summaryrefslogtreecommitdiff
path: root/doc/reference/javascript_cheatsheet.rst
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2019-11-04 18:22:50 +0000
committerfw-bot <otis@odoo.com>2019-11-04 20:53:34 +0000
commit8c59f5d345d763fed2f8616e63488db271dcb50c (patch)
tree7ba67916087a37832780254dcd074f7d8da96ee3 /doc/reference/javascript_cheatsheet.rst
parent13ee8a03733ed12e0fdb6a96f88c6448cc658b65 (diff)
[FIX] sale(_timesheet): faulty computation
The 'delivered quantity' field sometime needs to trigger a search on related objects (e.g. analytic lines) to know how much has been delivered. For performance reasons, this search is done using a read_group where the results are grouped by SO line. Unfortunately, this computation is sometimes launched during recomputes/onchanges where the line in question has a NewId instead of a regular id. This means that the mapping will return something like {240: 50.0} indicating that (e.g.) there are 50 timesheet hours for the SO line with id 240; unfortunately by doing mapping.get(line.id, 0.0) the NewId (240) is used - therefore returning a delivered quantity of 0.0 for a line which has actual timesheets. This commit ensures that if the line has a NewId and an original underlying record, the id of the latter is used as the key to fetch the value from the dict that contains the read_group result. Note that the problem was quite tricky to reproduce as it depended on the order of operations launched by triggers - the order of operations was important since triggering the compute with the 'real' record put things in order before any other piece of code could have spotted the issue. closes odoo/odoo#39781 X-original-commit: cf54606edb9130f2c5b351150f0e37b75f10ae66 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Diffstat (limited to 'doc/reference/javascript_cheatsheet.rst')
0 files changed, 0 insertions, 0 deletions