From e6e55f51bce02e0989832f8cff686c7a3ea720d0 Mon Sep 17 00:00:00 2001 From: clesgow Date: Wed, 28 Sep 2022 11:52:18 +0000 Subject: [PATCH] [FIX] stock_picking_batch: Add_to_batch wizard When selecting the "Add to batch" wizard, if a user selected "Add to an existing batch transfer", the only batches appearing there would be only draft batches, while it could be added to in_progress batches as well. It also displayed waves transfers with the batches, so it now only shows batches. Also restricted the creation of a batch in the related field since there is an explicit option to create a new batch transfer. Somewhat the same for the "Add to wave" wizard as it would display cancelled waves as well. Part of task-2985735 closes odoo/odoo#102715 X-original-commit: a8db2c5fe4b2ea1f28c6ea788ac1976678da11aa Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Quentin Wolfs (quwo) --- addons/stock_picking_batch/wizard/stock_add_to_wave.py | 2 +- addons/stock_picking_batch/wizard/stock_add_to_wave_views.xml | 4 ++-- addons/stock_picking_batch/wizard/stock_picking_to_batch.py | 2 +- .../wizard/stock_picking_to_batch_views.xml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/stock_picking_batch/wizard/stock_add_to_wave.py b/addons/stock_picking_batch/wizard/stock_add_to_wave.py index 6d715d45136..c09755ab0ca 100644 --- a/addons/stock_picking_batch/wizard/stock_add_to_wave.py +++ b/addons/stock_picking_batch/wizard/stock_add_to_wave.py @@ -27,7 +27,7 @@ class StockPickingToWave(models.TransientModel): raise UserError(_("The selected transfers should belong to the same operation type")) return res - wave_id = fields.Many2one('stock.picking.batch', string='Wave Transfer', domain="[('is_wave', '=', True), ('state', '!=', 'done')]") + wave_id = fields.Many2one('stock.picking.batch', string='Wave Transfer', domain="[('is_wave', '=', True), ('state', 'in', ('draft', 'in_progress'))]") picking_ids = fields.Many2many('stock.picking') line_ids = fields.Many2many('stock.move.line') mode = fields.Selection([('existing', 'an existing wave transfer'), ('new', 'a new wave transfer')], default='existing') diff --git a/addons/stock_picking_batch/wizard/stock_add_to_wave_views.xml b/addons/stock_picking_batch/wizard/stock_add_to_wave_views.xml index cca65188886..9ad57fe21d5 100644 --- a/addons/stock_picking_batch/wizard/stock_add_to_wave_views.xml +++ b/addons/stock_picking_batch/wizard/stock_add_to_wave_views.xml @@ -10,8 +10,8 @@ diff --git a/addons/stock_picking_batch/wizard/stock_picking_to_batch.py b/addons/stock_picking_batch/wizard/stock_picking_to_batch.py index 37fb80f5759..9b261d73297 100644 --- a/addons/stock_picking_batch/wizard/stock_picking_to_batch.py +++ b/addons/stock_picking_batch/wizard/stock_picking_to_batch.py @@ -9,7 +9,7 @@ class StockPickingToBatch(models.TransientModel): _name = 'stock.picking.to.batch' _description = 'Batch Transfer Lines' - batch_id = fields.Many2one('stock.picking.batch', string='Batch Transfer', domain="[('state', '=', 'draft')]") + batch_id = fields.Many2one('stock.picking.batch', string='Batch Transfer', domain="[('is_wave', '=', False), ('state', 'in', ('draft', 'in_progress'))]") mode = fields.Selection([('existing', 'an existing batch transfer'), ('new', 'a new batch transfer')], default='new') user_id = fields.Many2one('res.users', string='Responsible') is_create_draft = fields.Boolean(string="Draft", help='When checked, create the batch in draft status') diff --git a/addons/stock_picking_batch/wizard/stock_picking_to_batch_views.xml b/addons/stock_picking_batch/wizard/stock_picking_to_batch_views.xml index 6aeb7ec3578..f4273e10949 100644 --- a/addons/stock_picking_batch/wizard/stock_picking_to_batch_views.xml +++ b/addons/stock_picking_batch/wizard/stock_picking_to_batch_views.xml @@ -11,8 +11,8 @@