优化重新下发程序:装夹预调,cnc加工工单展示
This commit is contained in:
@@ -1090,8 +1090,15 @@ class ResMrpWorkOrder(models.Model):
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
self.write({'is_send_program_again': True})
|
||||
self.production_id.write({'work_state': '编程中', 'programming_state': '编程中'})
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')])
|
||||
if productions:
|
||||
workorder = productions.workorder_ids.filtered(
|
||||
lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel',
|
||||
'progress'])
|
||||
if workorder:
|
||||
workorder.write({'is_send_program_again': True})
|
||||
productions.write({'work_state': '编程中', 'programming_state': '编程中'})
|
||||
else:
|
||||
raise UserError(result['message'])
|
||||
except Exception as e:
|
||||
|
||||
@@ -62,16 +62,17 @@
|
||||
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='state']" position="attributes">
|
||||
<!-- <attribute name="statusbar_visible">draft,confirmed,progress,pending_processing,completed,done -->
|
||||
<!-- </attribute> -->
|
||||
<attribute name="statusbar_visible">progress,pending_cam,pending_processing,pending_era_cam,completed,done
|
||||
<!-- <attribute name="statusbar_visible">draft,confirmed,progress,pending_processing,completed,done -->
|
||||
<!-- </attribute> -->
|
||||
<attribute name="statusbar_visible">
|
||||
progress,pending_cam,pending_processing,pending_era_cam,completed,done
|
||||
</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//sheet//group//group[2]//label" position="before">
|
||||
<!-- <field name="process_state"/> -->
|
||||
<!-- <field name="process_state"/> -->
|
||||
<field name="state"/>
|
||||
<!-- <field name="process_state"/> -->
|
||||
<!-- <field name="process_state"/> -->
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//div[3]" position="after">
|
||||
@@ -281,7 +282,7 @@
|
||||
<field name="routing_type" invisible="True"/>
|
||||
<button name="button_start" type="object" string="开始" class="btn-success"
|
||||
attrs="{'invisible': ['|', '|', '|','|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False), ('routing_type', '=', 'CNC加工')]}"
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
groups="sf_base.group_sf_mrp_user" confirm="是否确认开始?"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree//button[@name='button_pending']" position="replace">
|
||||
<button name="button_pending" type="object" string="Pause" class="btn-warning"
|
||||
@@ -291,7 +292,8 @@
|
||||
<xpath expr="//tree//button[@name='button_finish']" position="replace">
|
||||
<button name="button_finish" type="object" string="Done" class="btn-success"
|
||||
attrs="{'invisible': ['|', '|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False), ('routing_type', '=', 'CNC加工')]}"
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
groups="sf_base.group_sf_mrp_user"
|
||||
confirm="是否确认完成?"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree//button[@name='%(mrp.act_mrp_block_workcenter_wo)d']" position="replace">
|
||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="Block"
|
||||
@@ -309,10 +311,10 @@
|
||||
<button name="action_open_wizard" type="object" icon="fa-external-link" class="oe_edit_only"
|
||||
title="Open Work Order"
|
||||
context="{'default_workcenter_id': workcenter_id}" groups="sf_base.group_sf_mrp_user"/>
|
||||
<!-- ======= -->
|
||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user"/> -->
|
||||
<!-- ======= -->
|
||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user"/> -->
|
||||
</xpath>
|
||||
<xpath expr="//tree//button[@name='button_pending']" position="replace">
|
||||
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
||||
@@ -322,7 +324,7 @@
|
||||
<xpath expr="//tree//button[@name='button_finish']" position="replace">
|
||||
<button name="button_finish" type="object" string="完成" class="btn-success"
|
||||
attrs="{'invisible': ['|', '|','|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False), ('routing_type', '=', 'CNC加工')]}"
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
groups="sf_base.group_sf_mrp_user" confirm="是否确认完成?"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree//button[@name='%(mrp.act_mrp_block_workcenter_wo)d']" position="replace">
|
||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="阻塞"
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done')]}"/>
|
||||
<button name="button_send_program_again" type="object" string="重新下发NC程序" class="btn-primary"
|
||||
confirm="是否确认重新下发NC程序?"
|
||||
attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','not in',['ready','progress']),('processing_drawing','=',False),('is_send_program_again','=',True)]}"/>
|
||||
attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','in',['done', 'cancel',
|
||||
'progress']),('cnc_worksheet','=',False),('is_send_program_again','=',True)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="开料要求" attrs='{"invisible": [("routing_type","!=","切割")]}'>
|
||||
@@ -521,7 +522,7 @@
|
||||
<field name="program_path"/>
|
||||
<field name="program_create_date"/>
|
||||
<field name="remark"/>
|
||||
<!-- <field name="button_state" invisible="1"/>-->
|
||||
<!-- <field name="button_state" invisible="1"/>-->
|
||||
</tree>
|
||||
</field>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user