From 4beac5fea68f635d810bb5df60edff6877601a27 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Wed, 26 Jan 2022 10:36:40 +0100 Subject: [PATCH] Lock records instead of the entire table issue11152 review366581003 --- account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account.py b/account.py index db55001721..f9173f5f76 100644 --- a/account.py +++ b/account.py @@ -190,7 +190,6 @@ class InvoiceChorus(ModelSQL, ModelView, _SyntaxMixin, metaclass=PoolMeta): pool = Pool() Credential = pool.get('account.credential.chorus') transaction = Transaction() - cls.lock() if not records: records = cls.search(['OR', @@ -200,9 +199,11 @@ class InvoiceChorus(ModelSQL, ModelView, _SyntaxMixin, metaclass=PoolMeta): transaction.context.get('company')), ]) + cls.lock(records) for record in records: # Use clear cache after a commit record = cls(record.id) + record.lock() with Transaction().set_context(**record._send_context()): payload = record.get_payload() resp = Credential.post('factures/deposer/flux', payload)