diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 13a4f6e7..c299891e 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -474,6 +474,8 @@ class ProductionLot(models.Model): [('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', product.name.split('[')[0])], limit=1, order='name desc') + if not last_serial: + return "%s-%03d" % (product.name, 1) return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1] now = datetime.now().strftime("%Y%m%d") if product.cutting_tool_model_id: