[FIX] stock_picking_batch: fix cancel in batch
As done with the "done" state, if a single picking in a batch is cancelled while the other pickings aren't, this picking is removed from the batch, as it would create inconsistencies between the states of the pickings in a single batch. closes odoo/odoo#90449 X-original-commit: 1f2813e59970cd2eb078b514cd7d563837f175a1 Signed-off-by: Arnold Moyaux <arm@odoo.com> Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
This commit is contained in:
@@ -127,6 +127,13 @@ class StockPicking(models.Model):
|
||||
|
||||
return res
|
||||
|
||||
def action_cancel(self):
|
||||
res = super().action_cancel()
|
||||
for picking in self:
|
||||
if picking.batch_id and any(picking.state != 'cancel' for picking in picking.batch_id.picking_ids):
|
||||
picking.batch_id = None
|
||||
return res
|
||||
|
||||
def _should_show_transfers(self):
|
||||
if len(self.batch_id) == 1 and self == self.batch_id.picking_ids:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user