优化装夹工单,新增工件装夹page,名字为组件的page名称改为物料,去掉单独的工件装夹功能

This commit is contained in:
jinling.yang
2023-07-13 16:57:48 +08:00
parent 7743c9658c
commit 5beb7b3417
12 changed files with 91 additions and 276 deletions

View File

@@ -6,6 +6,7 @@ from odoo import api, fields, models, _
class MrpProduction(models.Model):
_inherit = 'mrp.production'
_description = "制造订单"
_order = 'create_date desc'
tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘")
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")

View File

@@ -16,7 +16,7 @@ from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
class ResMrpWorkOrder(models.Model):
_inherit = 'mrp.workorder'
_order = 'sequence'
_order = 'sequence asc,create_date desc'
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True,
check_company=True, string="坯料长度(mm)")
@@ -108,6 +108,33 @@ class ResMrpWorkOrder(models.Model):
supplier_id = fields.Many2one('res.partner', string='外协供应商')
equipment_id = fields.Many2one('maintenance.equipment', string='加工设备')
schedule_state = fields.Selection(related='production_id.schedule_state', store=True)
# 工件装夹信息
functional_fixture_code = fields.Char(string="功能夹具编码", readonly=True)
functional_fixture_serial_number = fields.Char(string="功能夹具序列号", readonly=True)
functional_fixture_id = fields.Many2one('sf.functional.fixture', string="功能夹具")
functional_fixture_type_id = fields.Many2one('sf.functional.fixture.type', string="功能夹具类型", readonly=True)
chuck_serial_number = fields.Char(string="卡盘序列号")
chuck_name = fields.Char(string="卡盘名称")
chuck_brand_id = fields.Many2one('sf.machine.brand', string="卡盘品牌")
chuck_type_id = fields.Char(string="卡盘类型")
chuck_model_id = fields.Char(string="卡盘型号")
tray_serial_number = fields.Char(string="卡盘序列号")
tray_name = fields.Char(string="托盘名称")
tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌")
tray_type_id = fields.Char(string="托盘类型")
tray_model_id = fields.Char(string="托盘型号")
total_wight = fields.Float(string="总重量")
maximum_carrying_weight = fields.Char(string="最大承载重量[kg]")
maximum_clamping_force = fields.Char(string="最大夹持力[n]")
production_line = fields.Char(string="生产线")
preset_program_information = fields.Char(string="预调程序信息")
@api.onchange('functional_fixture_id')
def _onchange_functional_fixture_id(self):
if self.functional_fixture_id:
self.functional_fixture_code = self.functional_fixture_id.code
self.functional_fixture_type_id = self.functional_fixture_id.type_id.id
def get_no_data(self, production_id):
process_parameter_workorder = self.search(
@@ -524,18 +551,6 @@ class ResMrpWorkOrder(models.Model):
})
super().button_finish()
def action_view_schedule_tree(self):
# 执行打开树视图的操作(已排程的工单)
return {
'name': 'Schedule Work Order Tree',
'type': 'ir.actions.act_window',
'res_model': 'mrp.workorder',
'target': 'current',
'view_mode': 'tree',
'views': [[self.env.ref('mrp.mrp_production_workorder_tree_editable_view').id], 'tree'],
'domain': [('schedule_state', '=', '已排')],
}
class CNCprocessing(models.Model):
_name = 'sf.cnc.processing'

View File

@@ -95,39 +95,6 @@
</field>
</record>
<!-- <record model="ir.actions.act_window" id="mrp_workorder_action_scheduled">-->
<!-- <field name="name">工单</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">mrp.workorder</field>-->
<!-- <field name="view_mode">tree,kanban,form</field>-->
<!-- <field name="view_id" ref="view_mrp_production_workorder_tree_editable_inherit_sf"/>-->
<!-- &lt;!&ndash; <field name="view_ids" eval="[(5, 0, 0),&ndash;&gt;-->
<!-- &lt;!&ndash; (0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_view')}),&ndash;&gt;-->
<!-- &lt;!&ndash; (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')}) ]"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="target">fullscreen</field>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="search_view_id" ref="mrp.view_mrp_production_workorder_form_view_filter"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="context">{'search_default_workcenter_id': active_id}</field>&ndash;&gt;-->
<!-- <field name="help" type="html">-->
<!-- <p class="o_view_nocontent_workorder">-->
<!-- 没有已排程的工单!-->
<!-- </p>-->
<!-- </field>-->
<!-- </record>-->
<!-- <record model="ir.ui.view" id="view_mrp_production_workorder_form_inherit_sf">-->
<!-- <field name="name">mrp.production.workorder.form.inherit.sf</field>-->
<!-- <field name="model">mrp.workorder</field>-->
<!-- <field name="inherit_id" ref="mrp.mrp_production_workorder_form_view_inherit"/>-->
<!-- <field name="arch" type="xml">-->
<!-- <field name="production_id" position="after">-->
<!-- <field name="processing_panel" readonly="1"/>-->
<!-- </field>-->
<!-- </field>-->
<!-- </record>-->
<record id="view_mrp_production_workorder_tray_form_inherit_sf" model="ir.ui.view">
<field name="name">mrp.production.workorder.tray.form.inherit.sf</field>
<field name="model">mrp.workorder</field>
@@ -137,6 +104,7 @@
<field name='user_permissions' invisible="1"/>
<field name='name' invisible="1"/>
<field name='routing_type' invisible="1"/>
<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')),
@@ -156,7 +124,9 @@
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- 隐藏物料清单-->
<xpath expr="//page[@name='components']" position="attributes">
<attribute name="string">物料</attribute>
</xpath>
<field name="production_id" position="after" invisible="0">
<group>
<field name="date_planned_start" invisible="1"/>
@@ -169,7 +139,12 @@
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="equipment_id"
attrs='{"invisible": [("routing_type","in",("获取CNC加工程序","切割"))]}'/>
<field name="functional_fixture_id"
attrs='{"invisible": [("routing_type","!=","装夹")]}'/>
<field name="functional_fixture_code" force_save="1"
attrs='{"invisible": [("routing_type","!=","装夹")]}'/>
<field name="functional_fixture_type_id" force_save="1"
attrs='{"invisible": [("routing_type","!=","装夹")]}'/>
</group>
<group attrs='{"invisible": [("routing_type","=","获取CNC加工程序")]}'>
<div>
@@ -197,33 +172,52 @@
/>
</div>
</group>
</page>
</xpath>
<!-- <page string="Components" name="components">-->
<xpath expr="//page[1]" position="before">
<page string="装夹托盘" attrs='{"invisible": [("routing_type","!=","装夹")]}'>
<group>
<field name="routing_type" invisible="1"/>
<field name="tray_code"/>
<field name="tray_id" readonly="1"/>
</group>
<group>
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","=",False)]}'
style="color:green"/>
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","!=",False)]}'/>
<div>
<field name="pro_code_ok" invisible="1"/>
</div>
<!-- <page string="装夹托盘" attrs='{"invisible": [("routing_type","!=","装夹")]}'>-->
<!-- <group>-->
<!-- <field name="routing_type" invisible="1"/>-->
<!-- <field name="tray_code"/>-->
<!-- <field name="tray_id" readonly="1"/>-->
<!-- </group>-->
<!-- <group>-->
<!-- <field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","=",False)]}'-->
<!-- style="color:green"/>-->
<!-- <field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","!=",False)]}'/>-->
<!-- <div>-->
<!-- <field name="pro_code_ok" invisible="1"/>-->
<!-- </div>-->
</group>
<div class="col-12 col-lg-6 o_setting_box">
<button type="object" class="oe_highlight" name="gettray" string="绑定托盘"
attrs='{"invisible": ["|","|",("tray_id","!=",False),("state","!=","progress"),("production_id","=",False)]}'/>
<!-- </group>-->
<!-- <div class="col-12 col-lg-6 o_setting_box">-->
<!-- <button type="object" class="oe_highlight" name="gettray" string="绑定托盘"-->
<!-- attrs='{"invisible": ["|","|",("tray_id","!=",False),("state","!=","progress"),("production_id","=",False)]}'/>-->
</div>
<!-- </div>-->
<!-- </page>-->
<page string="工件装夹" attrs='{"invisible": [("routing_type","!=","装夹")]}'>
<group>
<group string="卡盘">
<field name="chuck_serial_number"/>
<field name="chuck_name"/>
<field name="chuck_brand_id"/>
<field name="chuck_type_id"/>
<field name="chuck_model_id"/>
</group>
<group string="托盘">
<field name="tray_serial_number"/>
<field name="tray_name"/>
<field name="tray_brand_id"/>
<field name="tray_type_id"/>
<field name="tray_model_id"/>
</group>
</group>
<group string="预调程序信息">
<field name="preset_program_information" colspan="2" nolabel="1"
placeholder="如有预调程序信息请在此处输入....."/>
</group>
</page>
</xpath>
@@ -440,34 +434,24 @@
</field>
</record>
<record id="mrp_workorder_action_schedule" model="ir.actions.act_window">
<field name="name">工单</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.workorder</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_id" eval="mrp.mrp_production_workorder_tree_editable_view"/>
<field name="view_id" ref="mrp.mrp_production_workorder_tree_editable_view"/>
<field name="search_view_id" ref="mrp.view_mrp_production_work_order_search"/>
<field name="domain">[('schedule_state', '=', '已排')]</field>
</record>
<menuitem id="menu_mrp_workorder_schedule_todo"
name="工单1"
name="工单"
action="mrp_workorder_action_schedule"
parent="mrp.menu_mrp_manufacturing"
sequence="15"/>
<!-- <record id="action_schedule_workorder_tree" model="ir.actions.server">-->
<!-- <field name="name">View Schedule Work Order Tree</field>-->
<!-- <field name="model_id" ref="model_mrp_workorder"/>-->
<!-- <field name="state">code</field>-->
<!-- <field name="code">model.action_view_schedule_tree()</field>-->
<!-- </record>-->
<!-- <record id="menu_schedule_workorder_tree" model="ir.ui.menu">-->
<!-- <field name="name">schedule Work Order Tree</field>-->
<!-- <field name="action" ref="action_schedule_workorder_tree"/>-->
<!-- <field name="sequence" eval="16"/>-->
<!-- </record>-->
<record id="mrp.menu_mrp_workorder_todo" model="ir.ui.menu">
<field name="active" eval="False"/>
</record>
</odoo>