Daily updates from Odoo
Saturday, April 25, 2026
1 change
Code cleanup and technical improvements
This update cleans up test code by removing redundant use of the 'tracking_disable' context key. This simplifies test readability and reduces potential performance issues, ensuring tests are more reliable and focused on core functionality. It's a housekeeping task improving test quality and maintainability.
Original PR description
When possible, avoid using context keys skipping the whole mail.thread stack. Since a few years various usage of those keys have been added through odoo addons quite often without clear purpose in…
When possible, avoid using context keys skipping the whole mail.thread stack. Since a few years various usage of those keys have been added through odoo addons quite often without clear purpose in mind when asked to authors or when reading commit messages. Partly because people tend to copy-paste code patterns without really understanding the purpose of those. See individual commits for more details. USAGE IN TESTS Lots of tests use the 'tracking_disable' or 'mail_notrack' context keys. However I bet most of those are there just because they were copy pasted, and without any thinking about the usage * it is used on non-thread models (which shows writer did not check what it was about); * it is copy-pasted in multiple unit tests creating one data each time (which shows performance are not the matter here as the writer could use a setupClass); * most usage is done when creating records, although there is no tracking at create time. And even if someday tracking at create comes back it would not be a performance issue on a test db compared to current test workload (too much tests, tours that are slow, ...). It also deactivates creation message log and initial follower (if not root) but those insert should be fast; * mail.thread is part of the real life stack and should be tested in functional addons. It notably has an impact on followers which means ACLs, partner_id field setup, field computation and invalidation, cache usage, ... Better remove most of them, and keep only relevant one (e.g. batch creation, simulating environment like Payroll, ...). Task-6094598 Followup of Task-3645865 Forward-Port-Of: odoo/enterprise#113258