将生产线模型从设备模块搬移到了制造模块,新增工作日历设置修改休息日字段则工作日历创建新记录
This commit is contained in:
30
sf_manufacturing/models/production_line_base.py
Normal file
30
sf_manufacturing/models/production_line_base.py
Normal 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('备注')
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user