Heads-upHighlight of Weekly #005

Domain condition warnings point to their caller

Warnings about unsupported domain values, such as NewId or records, and about upper-case operators now name the code that built the domain. Run your test suite and outdated patterns in custom modules are easy to find.

Versions19.020.0
AppFramework & technical

On the upgrade checklist: 18.0 → 19.0

Pull requests and commits

BranchPull requestCommit
19.0odoo/odoo#295414 ↗5e692143e6 ↗
20.0odoo/odoo#296980 ↗d0553bf2e2 ↗

Commit message

[IMP] orm: point the domain condition warnings to their caller

`DomainCondition.checked` only warns when it is given a value it does not
support, a NewId, a record or a Domain/Query/SQL with a simple operator:

    Domains don't support NewId, use .ids instead, for ('partner_id', '=', <NewId 0x7f...>)

The message names the condition but not the code that built the domain.
The call usually comes from a compute method run by an onchange, so
nothing in the log, or in an error reporting tool that collects the
warning, tells where the domain was written. The deprecation warning of
an upper-case operator has the same problem: it reports the line of
`domains.py` that emits it.

When the logger is enabled for DEBUG, add the stack to the three log
records and `stacklevel=3` to the deprecation warning, so it reports the
line that calls `Domain(field, operator, value)`. A plain log file does not
grow on every occurrence of a warning that can be frequent.

My stack

Pick the versions and apps you run. Weekly digests, this week's table and All changes then show only what concerns you. Saved in this browser.

Versions
Apps
Modules