diff --git a/account_move_name_sequence/models/account_move.py b/account_move_name_sequence/models/account_move.py index ea7478878..1514b6cb8 100644 --- a/account_move_name_sequence/models/account_move.py +++ b/account_move_name_sequence/models/account_move.py @@ -85,7 +85,7 @@ class AccountMove(models.Model): self._compute_name_by_sequence() def _post(self, soft=True): - self.flush() + self.flush_recordset() return super()._post(soft=soft) def _compute_name(self): diff --git a/account_move_name_sequence/tests/test_sequence_concurrency.py b/account_move_name_sequence/tests/test_sequence_concurrency.py index e59556335..482b1aa8e 100644 --- a/account_move_name_sequence/tests/test_sequence_concurrency.py +++ b/account_move_name_sequence/tests/test_sequence_concurrency.py @@ -161,7 +161,7 @@ class TestSequenceConcurrency(TransactionCase): with env0.cr.savepoint(), env1.cr.savepoint(): # Edit something in "last move" invoice.write({"write_uid": env0.uid}) - invoice.flush() + env0.flush_all() self._create_invoice_form(env1) def test_sequence_concurrency_30_editing_last_payment(self): @@ -182,7 +182,7 @@ class TestSequenceConcurrency(TransactionCase): with env0.cr.savepoint(), env1.cr.savepoint(): # Edit something in "last move" payment_move.write({"write_uid": env0.uid}) - payment_move.flush() + env0.flush_all() self._create_payment_form(env1) @tools.mute_logger("odoo.sql_db") @@ -205,7 +205,7 @@ class TestSequenceConcurrency(TransactionCase): lines2reconcile = ( (payment_move | invoice) .mapped("line_ids") - .filtered(lambda l: l.account_id.internal_type == "receivable") + .filtered(lambda l: l.account_id.account_type == "asset_receivable") ) with env0.cr.savepoint(), env1.cr.savepoint(): # Reconciling "last move" @@ -213,7 +213,7 @@ class TestSequenceConcurrency(TransactionCase): # lock records too many time lines2reconcile.reconcile() # Many pieces of code call flush directly - lines2reconcile.flush() + env0.flush_all() self._create_invoice_form(env1) def test_sequence_concurrency_50_reconciling_last_payment(self): @@ -235,7 +235,7 @@ class TestSequenceConcurrency(TransactionCase): lines2reconcile = ( (payment_move | invoice) .mapped("line_ids") - .filtered(lambda l: l.account_id.internal_type == "receivable") + .filtered(lambda l: l.account_id.account_type == "asset_receivable") ) with env0.cr.savepoint(), env1.cr.savepoint(): # Reconciling "last move" @@ -243,7 +243,7 @@ class TestSequenceConcurrency(TransactionCase): # lock records too many time lines2reconcile.reconcile() # Many pieces of code call flush directly - lines2reconcile.flush() + env0.flush_all() self._create_payment_form(env1) def test_sequence_concurrency_90_payments(self):