Skip to content
Snippets Groups Projects
Commit 82580b0b authored by Ahmed Khalaf (ahkh)'s avatar Ahmed Khalaf (ahkh)
Browse files

[FIX] stock_picking_batch: add picks to batch


When adding list of transfers to batch from transfer tree view,
if transfers belong to two or more batches an error traceback pops.

To reproduce:

1-Create Transfer 1, go to Transfer list view and add it to batch under Action, choose
add to a new batch transfer and confirm.
2-Create Transfer 2 and do the same.
3-Now that we have two transfer belonging to two different batches,
Under Inventory->Operations->Transfers, select the two transfers
in the tree view and choose add to batch under Action, choose add to new batch
and confirm, error popsup

Bug originated from: #89815
Discovered while working on TaskId:2871679

closes odoo/odoo#97401

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent cf6013ff
Branches
Tags
No related merge requests found
......@@ -150,8 +150,8 @@ class StockPickingBatch(models.Model):
def write(self, vals):
res = super().write(vals)
if not self.picking_ids and self.state == 'in_progress':
self.action_cancel()
if not self.picking_ids:
self.filtered(lambda b: b.state == 'in_progress').action_cancel()
if vals.get('picking_type_id'):
self._sanity_check()
if vals.get('picking_ids'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment