From 22801dbb62b759ce8fee3307ee9b02f83fa37f1a Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 12 Dec 2022 17:49:41 +0000 Subject: [PATCH] [FIX] account: cr.execute() without flush() in reconciliation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes odoo/odoo#109013 X-original-commit: 77e80ff62c0f7584857fbdb96aae5caea62aa504 Signed-off-by: William André (wan) --- addons/account/models/account_move.py | 5 +++++ addons/account/tests/test_account_move_reconcile.py | 1 + 2 files changed, 6 insertions(+) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 16bad96e441..e01033cbabb 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -3044,6 +3044,10 @@ class AccountMove(models.Model): if not reconciled_lines: return {} + self.env['account.partial.reconcile'].flush_model([ + 'credit_amount_currency', 'credit_move_id', 'debit_amount_currency', + 'debit_move_id', 'exchange_move_id', + ]) query = ''' SELECT part.id, @@ -3080,6 +3084,7 @@ class AccountMove(models.Model): exchange_move_ids.add(values['exchange_move_id']) if exchange_move_ids: + self.env['account.move.line'].flush_model(['move_id']) query = ''' SELECT part.id, diff --git a/addons/account/tests/test_account_move_reconcile.py b/addons/account/tests/test_account_move_reconcile.py index 244ff4eeadf..014e9974f2a 100644 --- a/addons/account/tests/test_account_move_reconcile.py +++ b/addons/account/tests/test_account_move_reconcile.py @@ -1901,6 +1901,7 @@ class TestAccountMoveReconcile(AccountTestInvoicingCommon): # 3th reconciliation inv1 + pay1 self.assert_invoice_outstanding_reconciled_widget(inv2, { refund1.id: 28.46, + res['partials'].exchange_move_id.id: 6.34, }) self.assert_invoice_outstanding_to_reconcile_widget(inv2, { pay1.move_id.id: 1907.17,