修改胚料部分

This commit is contained in:
jinling.yang
2022-12-09 17:23:07 +08:00
parent a18d55850a
commit 5e2d75b23e
21 changed files with 306 additions and 117 deletions

View File

@@ -181,7 +181,7 @@ class StockRule(models.Model):
class ProductionLot(models.Model):
_inherit = 'stock.production.lot'
_inherit = 'stock.lot'
@api.model
def generate_lot_names1(self, display_name, first_lot, count):
@@ -217,10 +217,10 @@ class ProductionLot(models.Model):
def _get_next_serial(self, company, product):
"""Return the next serial number to be attributed to the product."""
if product.tracking == "serial":
last_serial = self.env['stock.production.lot'].search(
last_serial = self.env['stock.lot'].search(
[('company_id', '=', company.id), ('product_id', '=', product.id)],
limit=1, order='id DESC')
if last_serial:
return self.env['stock.production.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[
return self.env['stock.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[
1]
return "%s-%03d" % (product.display_name, 1)