From 7b07820c7eed396c5d45f4c5e6439004737f399d Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Mon, 5 Aug 2024 13:06:03 +0200 Subject: [PATCH] [FIX] stock_barcodes: Keep values don't work after force refresh changes. TT50421 --- stock_barcodes/wizard/stock_barcodes_read_picking.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/stock_barcodes/wizard/stock_barcodes_read_picking.py b/stock_barcodes/wizard/stock_barcodes_read_picking.py index e4e0fc84ce89..83c02370adcd 100644 --- a/stock_barcodes/wizard/stock_barcodes_read_picking.py +++ b/stock_barcodes/wizard/stock_barcodes_read_picking.py @@ -272,9 +272,14 @@ def action_done(self): if not self.keep_screen_values or self.todo_line_id.state != "pending": if not self.env.context.get("skip_clean_values", False): self.action_clean_values() + keep_vals = {} + else: + keep_vals = self._convert_to_write(self._cache) self.fill_todo_records() self.determine_todo_action() self.action_show_step() + if keep_vals: + self.update_keep_values(keep_vals) # Force refresh candidate pickings to show green if not pending moves if not self.pending_move_ids: self._set_candidate_pickings(self.picking_id) @@ -287,6 +292,13 @@ def action_done(self): self._add_read_log() return res + def update_keep_values(self, keep_vals): + options = self.option_group_id.option_ids + fields_to_keep = options.filtered(lambda op: not op.clean_after_done).mapped( + "field_name" + ) + self.update({f_name: keep_vals[f_name] for f_name in fields_to_keep}) + def action_manual_entry(self): result = super().action_manual_entry() if result: