mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_move_auto_assign: Extract SQL locking logic into a dedicated method
This commit is contained in:
@@ -46,6 +46,10 @@ class ProductProduct(models.Model):
|
||||
pickings = moves.picking_id
|
||||
if not pickings:
|
||||
return
|
||||
self._lock_pickings_or_retry(pickings)
|
||||
moves._action_assign()
|
||||
|
||||
def _lock_pickings_or_retry(self, pickings):
|
||||
try:
|
||||
self.env.cr.execute(
|
||||
"SELECT id FROM stock_picking WHERE id IN %s FOR UPDATE NOWAIT",
|
||||
@@ -62,4 +66,3 @@ class ProductProduct(models.Model):
|
||||
"Could not obtain lock on transfers, will retry.", ignore_retry=True
|
||||
) from err
|
||||
raise
|
||||
moves._action_assign()
|
||||
|
||||
Reference in New Issue
Block a user