summaryrefslogtreecommitdiff
path: root/addons/website/static/src/snippets
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-12-17 14:43:39 +0000
committerRaphael Collet <rco@odoo.com>2020-12-18 14:00:03 +0000
commit0734bf2b32e7e6843cd85d5e353259d92118470d (patch)
treec7022bf1578943d34f7f84a9eb334c6998f215da /addons/website/static/src/snippets
parentba4665ce8267b020f6dc81bb7d36875b60f64f66 (diff)
[FIX] account: flushing while recomputing fields is not a good idea
The Python constraint method `_check_unique_sequence_number` performs an SQL query, and therefore needs to `flush()` the some fields before doing so. However, it uses a generic call to `flush()`. In some situations, the call to `flush()` ends up into recursive flushing, and that's the beginning of a nightmare: - write on account.move.state, - which calls account.move._check_unique_sequence_number(), - which calls flush(), - which computes purchase.order.line.qty_invoiced, - which reads field purchase.order.line.invoice_lines, - which calls flush() for account.move.line.move_name, - which computes account.move.line.move_name, - which computes account.move.name, - which calls account.move._check_unique_sequence_number(), - which calls flush(), - which computes purchase.order.invoice_status, - which uses the not-yet-computed value of purchase.order.line.qty_invoiced, and computes an incorrect value. We fix it simply by making the call to `flush()` more specific: we only need to flush 4 fields. This avoids the nightmare above. closes odoo/odoo#63463 Related: odoo/enterprise#15421 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/website/static/src/snippets')
0 files changed, 0 insertions, 0 deletions