diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 4162ed68..b8cb237a 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -424,6 +424,8 @@ class ProductionLot(models.Model): """Generate `lot_names` from a string.""" if first_lot.__contains__(display_name): first_lot = first_lot[(len(display_name) + 1):] + else: + first_lot = first_lot[-3:] # We look if the first lot contains at least one digit. caught_initial_number = regex_findall(r"\d+", first_lot)