Skip to content

Commit

Permalink
[IMP] stock_barcodes: Reset lot fields if no lot found
Browse files Browse the repository at this point in the history
Better play sounds
  • Loading branch information
sergio-teruel authored and carlosdauden committed Jun 18, 2024
1 parent e3f472f commit 18ee526
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions stock_barcodes/wizard/stock_barcodes_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 262 in stock_barcodes/wizard/stock_barcodes_read.py

View check run for this annotation

Codecov / codecov/patch

stock_barcodes/wizard/stock_barcodes_read.py#L261-L262

Added lines #L261 - L262 were not covered by tests
return False
if quants:
self.set_info_from_quants(quants)
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -749,6 +753,7 @@ def onchange_package_id(self):

def action_confirm(self):
if not self.check_option_required():
self.play_sounds(False)

Check warning on line 756 in stock_barcodes/wizard/stock_barcodes_read.py

View check run for this annotation

Codecov / codecov/patch

stock_barcodes/wizard/stock_barcodes_read.py#L756

Added line #L756 was not covered by tests
return False
record = self.browse(self.ids)
record.write(self._convert_to_write(self._cache))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 18ee526

Please sign in to comment.