修复工作中心绑定机床和胚料外协供应商外包未勾选问题

This commit is contained in:
jinling.yang
2023-01-13 16:47:12 +08:00
12 changed files with 97 additions and 113 deletions

View File

@@ -13,6 +13,24 @@ class ResWorkcenter(models.Model):
'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment",
check_company=True)
@api.onchange('machine_tool_id')
def update_machine_tool_is_binding(self):
machine_tool = self.env["sf.machine_tool"].search([('is_binding', '=', True)])
if machine_tool:
for item in machine_tool:
workcenter_machine_tool = self.env["mrp.workcenter"].search([('machine_tool_id', '=', item.id)])
if workcenter_machine_tool:
if self.machine_tool_id.id:
if workcenter_machine_tool.id != self.machine_tool_id.id:
self.machine_tool_id.is_binding = True
else:
self.machine_tool_id.is_binding = True
else:
self.machine_tool_id.is_binding = True
item.is_binding = False
else:
self.machine_tool_id.is_binding = True
def action_work_order(self):
if not self.env.context.get('desktop_list_view', False):
action = self.env["ir.actions.actions"]._for_xml_id("sf_manufacturing.mrp_workorder_action_tablet")

View File

@@ -107,7 +107,7 @@
</xpath>
<xpath expr="//field[@name='alternative_workcenter_ids']" position="after">
<field name="machine_tool_id"/>
<field name="machine_tool_id" domain="[('is_binding','=',False)]"/>
</xpath>
</field>
</record>

View File

@@ -12,7 +12,7 @@
<field name="name" position="after">
<field name="processing_panel"/>
</field>
<field name="state" position="after">
<field name="state" position="after">
<field name="work_state"/>
</field>
<xpath expr="//button[@name='button_start']" position="attributes">