优化制造订单菜单
This commit is contained in:
@@ -220,21 +220,22 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
# workorder.write({'date_finished': datetime.now()})
|
# workorder.write({'date_finished': datetime.now()})
|
||||||
if ret['IsComplete'] is True:
|
if ret['IsComplete'] is True:
|
||||||
workorder.button_finish()
|
workorder.write({'date_finished': datetime.now()})
|
||||||
# workorder.process_state = '待解除装夹'
|
|
||||||
# workorder.sudo().production_id.process_state = '待解除装夹'
|
|
||||||
|
|
||||||
# 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态
|
# workorder.process_state = '待解除装夹'
|
||||||
# if workorder.date_finished:
|
# workorder.sudo().production_id.process_state = '待解除装夹'
|
||||||
# request.env['sf.production.plan'].sudo().search([('production_id', '=', production_id)]).write(
|
|
||||||
# {'actual_end_time': workorder.date_finished,
|
# 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态
|
||||||
# 'state': 'finished'})
|
# if workorder.date_finished:
|
||||||
# production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)])
|
# request.env['sf.production.plan'].sudo().search([('production_id', '=', production_id)]).write(
|
||||||
# if production_obj:
|
# {'actual_end_time': workorder.date_finished,
|
||||||
# production_obj.sudo().work_order_state = '已完成'
|
# 'state': 'finished'})
|
||||||
# production_obj.write({'state': 'done'})
|
# production_obj = request.env['mrp.production'].sudo().search([('name', '=', production_id)])
|
||||||
# request.env['sale.order'].sudo().search(
|
# if production_obj:
|
||||||
# [('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'})
|
# production_obj.sudo().work_order_state = '已完成'
|
||||||
|
# production_obj.write({'state': 'done'})
|
||||||
|
# request.env['sale.order'].sudo().search(
|
||||||
|
# [('name', '=', production_obj.origin)]).write({'schedule_status': 'to deliver'})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ class MrpProduction(models.Model):
|
|||||||
elif not production.workorder_ids and float_compare(production.qty_producing, production.product_qty,
|
elif not production.workorder_ids and float_compare(production.qty_producing, production.product_qty,
|
||||||
precision_rounding=production.product_uom_id.rounding) >= 0:
|
precision_rounding=production.product_uom_id.rounding) >= 0:
|
||||||
production.state = 'to_close'
|
production.state = 'to_close'
|
||||||
|
elif any(
|
||||||
|
wo.test_results == '返工' and wo.state == 'done' for wo in production.workorder_ids):
|
||||||
|
production.state = 'rework'
|
||||||
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
|
||||||
production.state = 'progress'
|
production.state = 'progress'
|
||||||
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
elif production.product_uom_id and not float_is_zero(production.qty_producing,
|
||||||
|
|||||||
@@ -957,7 +957,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# record.write({'process_state': '待加工'})
|
# record.write({'process_state': '待加工'})
|
||||||
record.production_id.process_state = '待解除装夹'
|
record.production_id.process_state = '待解除装夹'
|
||||||
if record.test_results in ['返工']:
|
if record.test_results in ['返工']:
|
||||||
record.production_id.state = 'rework'
|
|
||||||
record.production_id.write({'detection_result_ids': [(0, 0, {
|
record.production_id.write({'detection_result_ids': [(0, 0, {
|
||||||
'rework_reason': record.reason,
|
'rework_reason': record.reason,
|
||||||
'detailed_reason': record.detailed_reason,
|
'detailed_reason': record.detailed_reason,
|
||||||
|
|||||||
@@ -1,6 +1,58 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
<data>
|
||||||
|
<menuitem action="mrp.mrp_production_action"
|
||||||
|
id="mrp_production_action"
|
||||||
|
sequence="1" active="False"/>
|
||||||
|
|
||||||
|
<!-- <record id="mrp_production_action_sf" model="ir.actions.act_window">-->
|
||||||
|
<!-- <field name="name">Manufacturing Orders</field>-->
|
||||||
|
<!-- <field name="type">ir.actions.act_window</field>-->
|
||||||
|
<!-- <field name="res_model">mrp.production</field>-->
|
||||||
|
<!-- <field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>-->
|
||||||
|
<!-- <field name="search_view_id" ref="mrp.view_mrp_production_filter"/>-->
|
||||||
|
<!-- <!– <field name="context">{'search_default_todo': True, 'default_company_id': allowed_company_ids[0]}</field>–>-->
|
||||||
|
<!-- <field name="domain">[('picking_type_id.active', '=', True)]</field>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
<!-- <menuitem action="mrp_production_action_sf"-->
|
||||||
|
<!-- id="menu_mrp_production_action_sf"-->
|
||||||
|
<!-- parent="mrp.menu_mrp_manufacturing"-->
|
||||||
|
<!-- sequence="2"-->
|
||||||
|
<!-- string="制造订单"/>-->
|
||||||
|
<!-- <record id="mrp_production_action_sf" model="ir.actions.act_window">-->
|
||||||
|
<!-- <field name="name">Manufacturing Orders</field>-->
|
||||||
|
<!-- <field name="type">ir.actions.act_window</field>-->
|
||||||
|
<!-- <field name="res_model">mrp.production</field>-->
|
||||||
|
<!-- <field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>-->
|
||||||
|
<!-- <field name="view_id" eval="False"/>-->
|
||||||
|
<!-- <field name="search_view_id" ref="mrp.view_mrp_production_filter"/>-->
|
||||||
|
<!-- <field name="context">{'search_default_todo': True, 'default_company_id':-->
|
||||||
|
<!-- allowed_company_ids[0]}-->
|
||||||
|
<!-- </field>-->
|
||||||
|
<!-- <field name="domain">[('picking_type_id.active', '=', True)]</field>-->
|
||||||
|
<!--<!– <!– <field name="help" type="html">–>,'search_default_filter_rework': 1,–>-->
|
||||||
|
<!--<!– 'search_default_filter_programming': 1–>-->
|
||||||
|
<!-- <!– <p class="o_view_nocontent_smiling_face">–>-->
|
||||||
|
<!-- <!– No manufacturing order found. Let's create one.–>-->
|
||||||
|
<!-- <!– </p>–>-->
|
||||||
|
<!-- <!– <p>–>-->
|
||||||
|
<!-- <!– Consume <a name="%(product.product_template_action)d" type='action' tabindex="-1">components</a> and–>-->
|
||||||
|
<!-- <!– build finished products using–>-->
|
||||||
|
<!-- <!– <a name="%(mrp_bom_form_action)d" type='action' tabindex="-1">bills of materials</a>–>-->
|
||||||
|
<!-- <!– </p>–>-->
|
||||||
|
<!-- <!– </field>–>-->
|
||||||
|
<!-- </record>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <menuitem action="mrp_production_action_sf"-->
|
||||||
|
<!-- id="sf_manufacturing.menu_mrp_production_action_sf"-->
|
||||||
|
<!-- parent="mrp.menu_mrp_manufacturing"-->
|
||||||
|
<!-- sequence="3" string="制造订单"/>-->
|
||||||
|
|
||||||
|
<menuitem action="mrp.mrp_production_action"
|
||||||
|
id="mrp_production_action"
|
||||||
|
sequence="1" active="False"/>
|
||||||
|
|
||||||
<record id="custom_mrp_production_tree_view" model="ir.ui.view">
|
<record id="custom_mrp_production_tree_view" model="ir.ui.view">
|
||||||
<field name="name">custom.mrp.production.tree</field>
|
<field name="name">custom.mrp.production.tree</field>
|
||||||
<field name="model">mrp.production</field>
|
<field name="model">mrp.production</field>
|
||||||
@@ -429,6 +481,17 @@
|
|||||||
<field name="model">mrp.production</field>
|
<field name="model">mrp.production</field>
|
||||||
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/>
|
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<!-- <xpath expr="//filter[@name='filter_in_progress']" position="before">-->
|
||||||
|
<!-- <filter string="返工" name="filter_rework" domain="[('state', '=', 'rework')]"/>-->
|
||||||
|
<!-- </xpath>-->
|
||||||
|
<!-- <xpath expr="//filter[@name='planning_issues']" position="before">-->
|
||||||
|
<!-- <separator/>-->
|
||||||
|
<!-- <filter name="filter_programming" string="编程中"-->
|
||||||
|
<!-- domain="[('programming_state', 'in', ['编程中'])]"/>-->
|
||||||
|
<!-- <filter name="filter_programmed" string="已编程"-->
|
||||||
|
<!-- domain="[('programming_state', 'in', ['已编程'])]"/>-->
|
||||||
|
<!-- <separator/>-->
|
||||||
|
<!-- </xpath>-->
|
||||||
<xpath expr="//search" position="inside">
|
<xpath expr="//search" position="inside">
|
||||||
<searchpanel class="account_root">
|
<searchpanel class="account_root">
|
||||||
<field name="state" icon="fa-filter" enable_counters="1"/>
|
<field name="state" icon="fa-filter" enable_counters="1"/>
|
||||||
|
|||||||
@@ -184,7 +184,7 @@
|
|||||||
<xpath expr="//label[1]" position="before">
|
<xpath expr="//label[1]" position="before">
|
||||||
<field name='routing_type' readonly="1"/>
|
<field name='routing_type' readonly="1"/>
|
||||||
<field name='process_state' attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
<field name='process_state' attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||||
<field name="rfid_code" force_save="1" readonly="1" cache="True"
|
<field name="rfid_code" cache="True"
|
||||||
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
||||||
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
Reference in New Issue
Block a user