Lock the sale being processed for Shopify

Closes #14500
This commit is contained in:
Cédric Krier
2026-01-15 15:22:09 +01:00
parent e543e295cf
commit 2e6dc5f27c
+4
View File
@@ -556,6 +556,7 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
"""
pool = Pool()
Payment = pool.get('account.payment')
self.lock()
with self.web_shop.shopify_session():
for shipment in self.shipments:
fulfillment = shipment.get_shopify(self)
@@ -578,6 +579,9 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
shipment.set_shopify_identifier(
self, gid2id(fulfillment['id']))
Transaction().commit()
# Start a new transaction as commit release the lock
self.__class__.__queue__._process_shopify(self)
return
elif shipment.state == 'cancelled':
fulfillment_id = shipment.get_shopify_identifier(self)
if fulfillment_id: