开发测试制造模块权限,修改设备机床类别的布局以及编码规则

This commit is contained in:
qihao.gong@jikimo.com
2023-11-22 17:36:50 +08:00
parent e6bb5db0e1
commit b4b5207aea
5 changed files with 38 additions and 16 deletions

View File

@@ -63,7 +63,7 @@ class SfMaintenanceEquipment(models.Model):
else:
record.equipment_maintenance_standards_ids = False
MTcode = fields.Char("编码", default=get_no)
MTcode = fields.Char("机台编码", default=get_no)
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')]
, compute='_compute_category_id')
@@ -74,8 +74,8 @@ class SfMaintenanceEquipment(models.Model):
if record:
record.equipment_type = record.category_id.equipment_type
code = fields.Char('机台号')
name = fields.Char('名称')
code = fields.Char('行业编码')
name = fields.Char('机台号')
knife_type = fields.Selection(
[("BT40", "BT40"), ("BT30", "BT30"), ("BT50", "BT50")],
default="", string="刀把类型")
@@ -154,6 +154,20 @@ class SfMaintenanceEquipment(models.Model):
result.append((parameter.id, name))
return result
@api.model
def create(self, vals):
# 在创建设备之前执行一些自定义逻辑
vals.name = vals.MTcode + '#' + vals.type_id.name
equipment = super(SfMaintenanceEquipment, self).create(vals)
# 在创建设备之后执行一些自定义逻辑
# ...
return equipment
# @api.constrains('rotate_speed')
# def _check_rotate_speed(self):
# if self.rotate_speed <= 0:

View File

@@ -52,11 +52,13 @@
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"
attrs="{'invisible': [('equipment_type', '!=', '机床'), ('brand_id','!=',False),('type_id','!=',False),('control_system_id','!=',False)]}"/>
</div>
</xpath>
<xpath expr="//field[@name='category_id']" position="before">
<field name="MTcode"/>
</xpath>
<xpath expr="//field[@name='category_id']" position="after">
<field name="state_zc"/>
<field name="code"/>
<field name="code" readonly="1"/>
<field name="equipment_type" invisible="1"/>
<field name="brand_id" force_save="1"/>
<field name="type_id" attrs="{'required': [('equipment_type', '=', '机床')]}"