Skip to content

Commit

Permalink
sequence_check_digit: handle multiple records in a single call
Browse files Browse the repository at this point in the history
was causing a ValueError: Expected singleton
  • Loading branch information
Ricardoalso committed Jan 31, 2025
1 parent d9b16ca commit ec984b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sequence_check_digit/models/ir_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ class IrSequence(models.Model):

@api.constrains("check_digit_formula", "prefix", "suffix")
def check_check_digit_formula(self):
try:
self.get_next_char(0)
except Exception as err:
raise ValidationError(self.env._("Format is not accepted")) from err
for record in self:
try:
record.get_next_char(0)
except Exception as err:
raise ValidationError(self.env._("Format is not accepted")) from err

def get_check_digit(self, code):
try:
Expand Down

0 comments on commit ec984b8

Please sign in to comment.