diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 27ce925a..76c51cff 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -440,7 +440,7 @@ class ProductionLot(models.Model): if product.tracking == "serial": last_serial = self.env['stock.lot'].search( [('company_id', '=', company.id), ('product_id', '=', product.id)], - limit=1, order='id DESC') + limit=1, order='name desc') if last_serial: if product.categ_id.name == '刀具': return self.env['stock.lot'].get_tool_generate_lot_names1(company, product)