将生产线模型从设备模块搬移到了制造模块,新增工作日历设置修改休息日字段则工作日历创建新记录

This commit is contained in:
yuxianghui
2023-07-13 16:05:38 +08:00
parent 571e32925e
commit 81842dc5ec
12 changed files with 32 additions and 26 deletions

View File

@@ -0,0 +1,30 @@
from odoo import models,fields
class ProductionLine(models.Model):
_name = 'sf.production.line'
_description = '生产线'
def _get_code(self):
"""
自动生成编码
:return:
"""
fixture_material = self.env['sf.production.line'].sudo().search(
[('code', '!=', '')],
limit=1,
order="id desc")
if not fixture_material:
num = "%03d" % 1
else:
m = int(fixture_material.code) + 1
num = "%03d" % m
return num
name = fields.Char('生产线')
code = fields.Char('编码', default=_get_code, readonly=True)
remark = fields.Char('备注')