From 18ee526d55b2c37d8e0020a048ca420efce23b80 Mon Sep 17 00:00:00 2001 From: sergio-teruel Date: Mon, 17 Jun 2024 15:24:07 +0200 Subject: [PATCH] [IMP] stock_barcodes: Reset lot fields if no lot found Better play sounds --- stock_barcodes/wizard/stock_barcodes_read.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/stock_barcodes/wizard/stock_barcodes_read.py b/stock_barcodes/wizard/stock_barcodes_read.py index 1d4bc83d552..9ee31290699 100644 --- a/stock_barcodes/wizard/stock_barcodes_read.py +++ b/stock_barcodes/wizard/stock_barcodes_read.py @@ -258,6 +258,8 @@ def process_barcode_lot_id(self): "more_match", _("No stock available for this lot with screen values"), ) + self.lot_id = False + self.lot_name = False return False if quants: self.set_info_from_quants(quants) @@ -377,6 +379,7 @@ def process_barcode_packaging_id(self): self._set_messagge_info( "more_match", _("More than one package found") ) + self.packaging_id = False return False self.action_packaging_scaned_post(packaging) return True @@ -399,14 +402,15 @@ def process_barcode(self, barcode): option_func = getattr(self, "process_barcode_%s" % option.field_name, False) if option_func: res = option_func() - if option.required: - self.play_sounds(res) if res: barcode_found = True + self.play_sounds(barcode_found) break elif self.message_type != "success": + self.play_sounds(False) return False if not barcode_found: + self.play_sounds(barcode_found) if self.option_group_id.ignore_filled_fields: self._set_messagge_info( "info", _("Barcode not found or field already filled") @@ -749,6 +753,7 @@ def onchange_package_id(self): def action_confirm(self): if not self.check_option_required(): + self.play_sounds(False) return False record = self.browse(self.ids) record.write(self._convert_to_write(self._cache)) @@ -839,7 +844,9 @@ def display_notification( options. sticky: Permanent notification until user removes it """ - if self.option_group_id.display_notification: + if self.option_group_id.display_notification and not self.env.context.get( + "skip_display_notification", False + ): message = {"message": message, "type": message_type, "sticky": sticky} if title: message["title"] = title