diff options
| author | Xavier Morel <xmo@odoo.com> | 2019-10-31 08:44:14 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2019-11-29 12:02:57 +0000 |
| commit | 6c4ac28f332eb5c382512585641865ace3f563ea (patch) | |
| tree | 84cd4b054157c5847b7180004ce7249490b5cf60 /doc/reference/javascript_api.rst | |
| parent | 4411cedde8c5a9c1761cf441d0a46c3d3ec880d2 (diff) | |
[FIX] hr_timesheet: remove onchange domain
Fixes issues where static multi-company filtering would get squashed /
replaced by dynamic domains not having those filters.
The conditional could be replicated in two ways: one would be to use a
python-level conditional expression:
a if cond else b
this is easier for users to interpret, but harder to analyze: python
expressions are currently opaque to view analysis (and possibly
eventually to domain edition).
The alternative here is to leverage domain simplification:
(OR (= (not cond) 1) section)
if `cond` is true becomes
(OR (= 0 1) section)
and thus `section` itself, while if `cond` is false it becomes
(OR (= 1 1) section)
and thus `true` (so the section doesn't apply).
It works OK though the inversion of the condition itself is a bit
bizarre.
And in this specific case since we need both branches the negated
condition requires explicitly converting the condition to a boolean if
it might not be one: the expression compiler recognizes specifically
`(= 0 1)` and `(= 1 1)` (`(= False 1)` and `(= True 1)` also work for
Python reasons).
[REM] dynamic domain from hr_timesheet
closes odoo/odoo#40945
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'doc/reference/javascript_api.rst')
0 files changed, 0 insertions, 0 deletions
