Lock the sale being processed for Shopify

Closes #14500
(grafted from 0d96a4b8d2ad4a7fd7ea8be06202afeee3d6df19)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2026-01-15 15:22:09 +01:00
parent 2eedae597e
commit 44badd4f28
+4
View File
@@ -222,6 +222,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)
@@ -234,6 +235,9 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
fulfillment.errors.full_messages())))
shipment.set_shopify_identifier(self, fulfillment.id)
Transaction().commit()
# Start a new transaction as commit release the lock
self.__class__.__queue__._process_shopify(self)
return
# TODO: manage drop shipment