Skip to content

Commit

Permalink
[16.0][IMP] stock_barcodes: Change format string
Browse files Browse the repository at this point in the history
  • Loading branch information
edescalona committed Feb 6, 2025
1 parent 2bd5dcc commit a9fb278
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions stock_barcodes/models/stock_barcodes_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,20 @@ def _constrains_barcode(self):
if not re.match(REGEX.get("barcode", False), action.barcode):
raise ValidationError(

Check warning on line 50 in stock_barcodes/models/stock_barcodes_action.py

View check run for this annotation

Codecov / codecov/patch

stock_barcodes/models/stock_barcodes_action.py#L50

Added line #L50 was not covered by tests
_(
""" The barcode {} is not correct.
Use numbers, letters and dashes, without spaces.
E.g. 15753, BC-5789,er-56 """.format(
action.barcode
)
)
" The barcode {} is not correct."
"Use numbers, letters and dashes, without spaces."
"E.g. 15753, BC-5789,er-56 "
""
).format(action.barcode)
)
all_barcode = [bar for bar in action.mapped("barcode") if bar]
domain = [("barcode", "in", all_barcode)]
matched_actions = self.sudo().search(domain, order="id")

Check warning on line 60 in stock_barcodes/models/stock_barcodes_action.py

View check run for this annotation

Codecov / codecov/patch

stock_barcodes/models/stock_barcodes_action.py#L58-L60

Added lines #L58 - L60 were not covered by tests
if len(matched_actions) > len(all_barcode):
raise ValidationError(

Check warning on line 62 in stock_barcodes/models/stock_barcodes_action.py

View check run for this annotation

Codecov / codecov/patch

stock_barcodes/models/stock_barcodes_action.py#L62

Added line #L62 was not covered by tests
_(
""" Barcode has already been assigned to
the action(s): {}.
""".format(
", ".join(matched_actions.mapped("name"))
)
)
""" Barcode has already been assigned to the action(s): {}."""
).format(", ".join(matched_actions.mapped("name")))
)

def _generate_barcode(self):
Expand Down

0 comments on commit a9fb278

Please sign in to comment.