Daily updates from Odoo
Friday, November 29, 2019
2 changes · master
Resolved issues and error corrections
Timesheet entry fields now keep the correct company-related filters instead of having them overwritten by automatic field changes. This helps users see and select the right projects or analytic accounts for their company, reducing incorrect entries.
Original PR description
Fixes a bug where `('company_id', '=', company_id)` would pretty much immediately get replaced by the domains from the onchange, so was essentially useless. The conditional could be replicated in two…
Fixes a bug where `('company_id', '=', company_id)` would pretty much immediately get replaced by the domains from the onchange, so was essentially useless.
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 probably the eventual 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).
Task 2115472
Also the fix on analytic_account_id is the sort of reasons why we'd want the ability to *edit* domans rather than just replace them.Calendar entries now keep their start and end times separate when events are edited, preventing incorrect end times from appearing. This also avoids related crashes in Planning, improving reliability for users who manage schedules.
Original PR description
Fixes the way record end hours are computed in calendar views. Before this commit: objects `record start` and `record end` properties being copied by reference and being incorrectly rewritten by other functions. This caused incorrect end hour computations (and a SQL crash in the Planning app). Now, objects are copied by value and don't interfere with each other. Task 2072961