From a73cf4939e1a906aab14e9f0f77f9304c4e16c93 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Thu, 23 Feb 2023 11:11:41 +0100 Subject: [PATCH] [16.0][MIG] Migrate stock_picking_operation_quick_change to v16 --- stock_picking_operation_quick_change/__manifest__.py | 2 +- .../wizards/stock_picking_wizard.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/stock_picking_operation_quick_change/__manifest__.py b/stock_picking_operation_quick_change/__manifest__.py index c4817de3d0c2..196f7d4bf276 100644 --- a/stock_picking_operation_quick_change/__manifest__.py +++ b/stock_picking_operation_quick_change/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Picking Operation Quick Change", "summary": "Change location of all picking operations", - "version": "15.0.1.1.0", + "version": "16.0.1.0.0", "category": "Warehouse", "website": "https://github.com/OCA/stock-logistics-workflow", "author": "Tecnativa, " "Odoo Community Association (OCA)", diff --git a/stock_picking_operation_quick_change/wizards/stock_picking_wizard.py b/stock_picking_operation_quick_change/wizards/stock_picking_wizard.py index 437f6ae81d3b..4e6e1f58ec66 100644 --- a/stock_picking_operation_quick_change/wizards/stock_picking_wizard.py +++ b/stock_picking_operation_quick_change/wizards/stock_picking_wizard.py @@ -27,7 +27,7 @@ def default_get(self, fields): def _default_old_dest_location_id(self): stock_picking_obj = self.env["stock.picking"] pickings = stock_picking_obj.browse(self.env.context["active_ids"]) - first_move_line = pickings.mapped("move_line_ids")[:1] + first_move_line = pickings.move_line_ids[:1] return first_move_line.location_dest_id.id def _get_allowed_locations(self): @@ -74,9 +74,7 @@ def _get_allowed_picking_states(self): @api.depends("picking_id") def _compute_allowed_product_ids(self): for record in self: - record.allowed_product_ids = record.picking_id.move_lines.mapped( - "product_id" - ) + record.allowed_product_ids = record.picking_id.move_ids.product_id def check_allowed_pickings(self, pickings): forbidden_pickings = pickings.filtered( @@ -91,7 +89,7 @@ def check_allowed_pickings(self, pickings): % ",".join(self._get_allowed_picking_states()) ) pickings_with_chained_moves = pickings.filtered( - lambda x: x.move_lines.mapped("move_dest_ids") + lambda x: x.move_ids.move_dest_ids ) if pickings_with_chained_moves: raise UserError( @@ -105,7 +103,7 @@ def action_apply(self): stock_picking_obj = self.env["stock.picking"] pickings = stock_picking_obj.browse(self.env.context["active_ids"]) self.check_allowed_pickings(pickings) - move_lines = pickings.mapped("move_line_ids") + move_lines = pickings.move_line_ids vals = {"location_dest_id": self.new_location_dest_id.id} if self.change_all: