Do not try to assign shipments that do not need to be assigned

Closes #12311
This commit is contained in:
Cédric Krier
2023-06-07 16:53:24 +02:00
parent 9f11b9fbfc
commit c1d4a667bd
+5
View File
@@ -961,6 +961,7 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
def assign_try(cls, shipments, with_childs=None):
pool = Pool()
Move = pool.get('stock.move')
shipments = [s for s in shipments if s.state == 'waiting']
to_assign = defaultdict(list)
for shipment in shipments:
location_type = shipment.from_location.type
@@ -1704,6 +1705,10 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
@ModelView.button
def assign_try(cls, shipments):
Move = Pool().get('stock.move')
shipments = [
s for s in shipments
if s.state == 'waiting'
and s.warehouse_storage != s.warehouse_output]
to_assign = [
m for s in shipments for m in s.assign_moves
if m.assignation_required]