修改设备oee自动生成,设备刀库编码规则

This commit is contained in:
qihao.gong@jikimo.com
2024-02-28 17:14:42 +08:00
parent d684dfe8d0
commit 75354c67db
4 changed files with 38 additions and 23 deletions

View File

@@ -22,10 +22,19 @@ class ResMrpRoutingWorkcenter(models.Model):
bom_id = fields.Many2one('mrp.bom', required=False)
surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺")
def generate_code(self):
return self.env['ir.sequence'].next_by_code('mrp.routing.workcenter')
def get_no(self):
international_standards = self.search(
[('code', '!=', ''), ('active', 'in', [True, False])],
limit=1,
order="id desc")
if not international_standards:
num = "%03d" % 1
else:
m = int(international_standards.code) + 1
num = "%03d" % m
return num
code = fields.Char('编码', default=generate_code)
code = fields.Char('编码', default=get_no)
# 获得当前登陆者公司
def get_company_id(self):

View File

@@ -859,7 +859,7 @@ class SfMaintenanceEquipmentAndProductTemplate(models.Model):
for i in range(1, number + 1):
self.env['maintenance.equipment.tool'].create({
'equipment_id': res.id,
'code': 'T' + str(i)
'code': "T%02d" % i
})
vals.append(res)
return vals[0]