|
|
"""Check if this batch can plan batches"""
self.can_plan_batches = False
for record in self:
if record.state != "in_progress":
continue
origin_pickings = self.mapped(
"picking_ids.move_ids.move_orig_ids.picking_id"
).with_context(plan_batch=True)
# If no origin pickings, nothing can be planned
if not origin_pickings:
continue
for picking in origin_pickings:
if not picking.picking_type_id.plan_batch:
# Check first if picking type allows batch planning
continue
if picking._is_auto_batchable():
record.can_plan_batches = True
else:
for move_line in picking.move_line_ids:
if move_line._is_auto_waveable():
record.can_plan_batches = True
break
if record.can_plan_batches:
break
|
|