Lock records instead of the entire table

issue11152
review366581003
This commit is contained in:
Sergi Almacellas Abellana committed 2022-01-26 10:36:40 +01:00
1 parent 6a2e57fe23
commit 4beac5fea6
1 file changed
+2 -1
+2 -1
View File
@@ -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)