summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_view.js
diff options
context:
space:
mode:
authorOlivier Dony <odo@odoo.com>2018-10-31 11:52:43 +0000
committerRaphael Collet <rco@odoo.com>2018-11-05 11:11:26 +0000
commitb9ec95a8cbcc0fafb15fc99506c492ba1dfb0311 (patch)
tree8d4c3732648fea5ab19c908ae25e4fc2b585a217 /addons/web/static/src/js/views/basic/basic_view.js
parentfc3088d90cf2684baa311b9380e4a85e9bdc5e5f (diff)
[FIX] fields: delete o2m lines before creating new ones
After 12744bc81ebdaa1671a953c14ba54c637d6a9255, x2m operations are fully batched, and deletions are processed last when the operations are flushed, regardless of the order in which they were specified by the write() or create() call. This carries a risk of violating (non-deferred) unique SQL constraints, when the operations for deleting previous lines and re-creating new ones are processed in the same batch. This patch executes the deletions before other operations during a flush, which should be safer with regard to SQL constraints. An extra constraint is added in test_performance.line to simulate this corner case, then covered by an extra unit test. Another unrelated test had to be altered to avoid violating the new constraint. This can be reproduced easily by upgrading the `project` module in master, due to the unique constraint[1] on `ir.actions.act_window.view`, that gets violated when processing the batch write on this o2m[2]. [1] https://github.com/odoo/odoo/blob/ccc42f16/odoo/addons/base/models/ir_actions.py#L288-L289 [2] https://github.com/odoo/odoo/blob/ccc42f16/addons/project/views/project_views.xml#L394-L396 closes odoo/odoo#28314
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_view.js')
0 files changed, 0 insertions, 0 deletions