工序增加唯一编码,是否重复,排序;用xml代码生成CNC加工的标准工序;

产品增加模型类型对象和加工的面,包括胚料增加的尺寸
This commit is contained in:
jinling.yang
2022-10-25 17:30:13 +08:00
parent 9ee33ae0b9
commit c3a7a6c4d6
8 changed files with 162 additions and 41 deletions

View File

@@ -284,7 +284,6 @@
<search string="托盘">
<field name="name" string="名称" filter_domain="[('name','ilike',self)]"/>
<field name="code" string="编码" filter_domain="[('code','ilike',self)]"/>
<!-- <field name="state" string="状态" filter_domain="[('state','ilike',self)]"/>-->
</search>
<group string="分组">
<filter name="state" string="状态" domain="[]" context="{'group_by': 'state'}"/>

View File

@@ -10,9 +10,12 @@
""",
'category': 'sf',
'website': 'https://www.sf.cs.jikimo.com',
'depends': ['sale', 'sf_base'],
'depends': ['sale', 'sf_base', 'mrp'],
'data': [
'security/group_security.xml',
'security/ir.model.access.csv',
'data/product_data.xml',
'data/process_data.xml',
'views/product_template_view.xml',
'views/sale_order_view.xml'
],

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="mrp_workcenter_3" model="mrp.workcenter">
<field name="name">Assembly Line 1</field>
<field name="active">false</field>
</record>
<record id="mrp_bom_manufacture" model="mrp.bom">
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="product_uom_id" ref="uom.product_uom_unit"/>
<field name="sequence">1</field>
<field name="active">false</field>
</record>
<record id="mrp_routing_workcenter_template_automatic_coding_sf" model="mrp.routing.workcenter">
<field name="name">获取自动编码程序</field>
<field name="code">automatic coding</field>
<field name="time_mode">manual</field>
<field name="workcenter_id" ref="mrp_workcenter_3"/>
<field name="bom_id" ref="mrp_bom_manufacture"/>
<field name="time_cycle">60</field>
<field name="active">false</field>
</record>
<record id="mrp_routing_workcenter_template_clamping_sf" model="mrp.routing.workcenter">
<field name="name">装夹</field>
<field name="code">clamping</field>
<field name="time_mode">manual</field>
<field name="workcenter_id" ref="mrp_workcenter_3"/>
<field name="bom_id" ref="mrp_bom_manufacture"/>
<field name="time_cycle">60</field>
<field name="active">false</field>
</record>
<record id="mrp_routing_workcenter_template_pre_ternary_sf" model="mrp.routing.workcenter">
<field name="name">前置三元定位检测</field>
<field name="code">pre-ternary positioning detection</field>
<field name="time_mode">manual</field>
<field name="workcenter_id" ref="mrp_workcenter_3"/>
<field name="bom_id" ref="mrp_bom_manufacture"/>
<field name="time_cycle">60</field>
<field name="active">false</field>
</record>
<record id="mrp_routing_workcenter_template_cnc_sf" model="mrp.routing.workcenter">
<field name="name">CNC加工</field>
<field name="code">CNC machining</field>
<field name="time_mode">manual</field>
<field name="workcenter_id" ref="mrp_workcenter_3"/>
<field name="bom_id" ref="mrp_bom_manufacture"/>
<field name="time_cycle">60</field>
<field name="active">false</field>
</record>
<record id="mrp_routing_workcenter_template_post_ternary_sf" model="mrp.routing.workcenter">
<field name="name">后置三元质量检测</field>
<field name="code">post ternary quality inspection</field>
<field name="time_mode">manual</field>
<field name="workcenter_id" ref="mrp_workcenter_3"/>
<field name="bom_id" ref="mrp_bom_manufacture"/>
<field name="time_cycle">60</field>
<field name="active">false</field>
</record>
<record id="mrp_routing_workcenter_template_remove_clamping_sf" model="mrp.routing.workcenter">
<field name="name">解除装夹</field>
<field name="code">remove the clamping</field>
<field name="time_mode">manual</field>
<field name="workcenter_id" ref="mrp_workcenter_3"/>
<field name="bom_id" ref="mrp_bom_manufacture"/>
<field name="time_cycle">60</field>
<field name="active">false</field>
</record>
</data>
</odoo>

View File

@@ -2,5 +2,6 @@ from . import sale_order
from . import product_template
from . import http
from . import models
from . import process

View File

@@ -0,0 +1,11 @@
from odoo import fields, models, api
class ResMrpRoutingWorkcenter(models.Model):
_inherit = 'mrp.routing.workcenter'
code = fields.Char('唯一编码')
is_repeat = fields.Boolean('重复',default=False)
sort = fields.Integer('排序')

View File

@@ -13,6 +13,8 @@ class ResProductTemplate(models.Model):
model_precision = fields.Float('精度要求', digits=(16, 3))
model_materials_id = fields.Many2one('mrs.production.materials', string='材料')
model_materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
model_type_id = fields.Many2one('sf.model.type', string='类型')
processing_panel = fields.Char('加工面板')
# 胚料的长,宽,高
embryo_long = fields.Float('长[mm]', digits=(16, 3))
embryo_width = fields.Float('宽[mm]', digits=(16, 3))
@@ -20,6 +22,7 @@ class ResProductTemplate(models.Model):
embryo_materials_id = fields.Many2one('mrs.production.materials', string='材料')
embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
def product_create(self, product_id, item, order_id, order_number, i):
copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
@@ -84,3 +87,15 @@ class ResMrpBom(models.Model):
'product_uom_id': 1
}
return self.env['mrp.bom.line'].create(vals)
class ModelType(models.Model):
_name = 'sf.model.type'
_description = '模型类型'
name = fields.Char('名称')
code = fields.Char('编码')

View File

@@ -1,5 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sf_model_type sf_model_type model_sf_model_type base.group_user 1 1 1 1

View File

@@ -7,51 +7,67 @@
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[last()]" position="after">
<page string="CNC加工">
<group string="模型">
<group>
<page string="加工参数">
<group>
<group string="模型">
<field name="model_long"/>
<field name="model_width"/>
<field name="model_height"/>
<field name="model_volume"/>
</group>
<group>
<field name="model_type_id"/>
<field name="processing_panel" placeholder="例如A,B"/>
<field name="model_precision"/>
<field name="model_materials_id"/>
<field name="model_materials_type_id"/>
<field name="model_materials_type_id"
domain="[('materials_id', '=', model_materials_id)]"/>
</group>
<group string="胚料">
<field name="embryo_long"/>
<field name="embryo_width"/>
<field name="embryo_height"/>
<field name="volume" string="体积[mm³]"/>
<field name="embryo_materials_id"/>
<field name="embryo_materials_type_id"
domain="[('materials_id', '=',embryo_materials_id)]"/>
</group>
</group>
</page>
</xpath>
<xpath expr="//label[@for='volume']" position="before">
<label for="embryo_long" string="尺寸"
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
<div class="o_address_format"
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">
<label for="embryo_long" string="长"/>
<field name="embryo_long" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="embryo_width" string="宽"/>
<field name="embryo_width" class="o_address_zip"/>
<span>&amp;nbsp;</span>
<label for="embryo_height" string="高"/>
<field name="embryo_height" class="o_address_zip"/>
</div>
</xpath>
<xpath expr="//label[@for='produce_delay']" position="before">
<label for="embryo_materials_id"
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
<div class="o_row"
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">
<field name="embryo_materials_id"/>
</div>
<label for="embryo_materials_type_id"
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>
<div class="o_row"
attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">
<field name="embryo_materials_type_id" domain="[('materials_id', '=', embryo_materials_id)]"/>
</div>
</xpath>
<!-- <xpath expr="//label[@for='volume']" position="before">-->
<!-- <label for="embryo_long" string="尺寸"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <div class="o_address_format"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">-->
<!-- <label for="embryo_long" string="长"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <field name="embryo_long" class="o_address_zip"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <span>&amp;nbsp;</span>-->
<!-- <label for="embryo_width" string="宽"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <field name="embryo_width" class="o_address_zip"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <span>&amp;nbsp;</span>-->
<!-- <label for="embryo_height" string="高"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <field name="embryo_height" class="o_address_zip"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- </div>-->
<!-- </xpath>-->
<!-- <xpath expr="//label[@for='produce_delay']" position="before">-->
<!-- <label for="embryo_materials_id"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <div class="o_row"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">-->
<!-- <field name="embryo_materials_id"/>-->
<!-- </div>-->
<!-- <label for="embryo_materials_type_id"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}"/>-->
<!-- <div class="o_row"-->
<!-- attrs="{'invisible':[('product_variant_count', '>', 1), ('is_product_variant', '=', False)]}">-->
<!-- <field name="embryo_materials_type_id" domain="[('materials_id', '=', embryo_materials_id)]"/>-->
<!-- </div>-->
<!-- </xpath>-->
</field>
</record>