From d1448b666b2ed61052f0e70d2e2c0dd060b58e04 Mon Sep 17 00:00:00 2001 From: yhu-odoo Date: Tue, 23 Feb 2021 10:52:22 +0000 Subject: [PATCH] [IMP] stock_picking_batch: allow create batch with picking in other batch We already allowed the stock.picking.to.batch wizard to create batch with pickings already in other batches. This commit will also allow you select pickings that are already in other batches on the batch form. Task-2464457 PR #66600 --- .../stock_picking_batch/models/stock_picking_batch.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/addons/stock_picking_batch/models/stock_picking_batch.py b/addons/stock_picking_batch/models/stock_picking_batch.py index 7bf363cf86a..fffd863a2af 100644 --- a/addons/stock_picking_batch/models/stock_picking_batch.py +++ b/addons/stock_picking_batch/models/stock_picking_batch.py @@ -61,10 +61,6 @@ class StockPickingBatch(models.Model): @api.depends('company_id', 'picking_type_id', 'state') def _compute_allowed_picking_ids(self): allowed_picking_states = ['waiting', 'confirmed', 'assigned'] - cancelled_batchs = self.env['stock.picking.batch'].search_read( - [('state', '=', 'cancel')], ['id'] - ) - cancelled_batch_ids = [batch['id'] for batch in cancelled_batchs] for batch in self: domain_states = list(allowed_picking_states) @@ -75,11 +71,6 @@ class StockPickingBatch(models.Model): ('company_id', '=', batch.company_id.id), ('immediate_transfer', '=', False), ('state', 'in', domain_states), - '|', - '|', - ('batch_id', '=', False), - ('batch_id', '=', batch.id), - ('batch_id', 'in', cancelled_batch_ids), ] if batch.picking_type_id: domain += [('picking_type_id', '=', batch.picking_type_id.id)] @@ -244,7 +235,7 @@ class StockPickingBatch(models.Model): raise UserError(_( "The following transfers cannot be added to batch transfer %s. " "Please check their states and operation types, if they aren't immediate " - "transfers or if they're not already part of another batch transfer.\n\n" + "transfers.\n\n" "Incompatibilities: %s", batch.name, ', '.join(erroneous_pickings.mapped('name')))) def _track_subtype(self, init_values):