From 1da71e47b54a5cef69baac8d0dca087cce8a1dec Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Sun, 29 Sep 2024 18:50:14 +0200 Subject: [PATCH] [IMP] stock_barcodes: Performance and extra checks from 16.0 --- stock_barcodes/wizard/stock_barcodes_read.py | 4 +++- stock_barcodes/wizard/stock_barcodes_read_picking.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/stock_barcodes/wizard/stock_barcodes_read.py b/stock_barcodes/wizard/stock_barcodes_read.py index 0637783f038f..06f8fa52d066 100644 --- a/stock_barcodes/wizard/stock_barcodes_read.py +++ b/stock_barcodes/wizard/stock_barcodes_read.py @@ -647,7 +647,9 @@ def action_create_package(self): def action_clean_values(self): options = self.option_group_id.option_ids - options_to_clean = options.filtered("clean_after_done") + options_to_clean = options.filtered( + lambda op: op.clean_after_done and op.field_name in self + ) for option in options_to_clean: if option.field_name == "result_package_id" and self.keep_result_package: continue diff --git a/stock_barcodes/wizard/stock_barcodes_read_picking.py b/stock_barcodes/wizard/stock_barcodes_read_picking.py index 7504dd1012c3..e43b6dce9f08 100644 --- a/stock_barcodes/wizard/stock_barcodes_read_picking.py +++ b/stock_barcodes/wizard/stock_barcodes_read_picking.py @@ -478,6 +478,10 @@ def _process_stock_move_line(self): # noqa: C901 domain = self._prepare_stock_moves_domain() if self.option_group_id.barcode_guided_mode == "guided": moves_todo = self.todo_line_id.stock_move_ids + elif self.picking_id: + moves_todo = self.picking_id.move_lines.filtered( + lambda sm: sm.product_id == self.product_id + ) else: moves_todo = StockMove.search(domain) if not getattr(