Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
# Conflicts: # sf_base/security/ir.model.access.csv # sf_base/views/mrs_common_view.xml
This commit is contained in:
@@ -10,13 +10,18 @@
|
||||
""",
|
||||
'category': 'YZ',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['account', 'base', 'mrp'],
|
||||
'depends': ['account', 'base', 'mrp', 'sale'],
|
||||
'data': [
|
||||
'security/group_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'data/product_data.xml',
|
||||
# 'data/process_data.xml',
|
||||
'views/mrs_base_view.xml',
|
||||
'views/mrs_common_view.xml',
|
||||
"views/menu_view.xml"
|
||||
'views/menu_view.xml',
|
||||
'views/mrp_routing_workcenter_view.xml',
|
||||
'views/sale_order_view.xml',
|
||||
'views/product_template_view.xml',
|
||||
|
||||
],
|
||||
'demo': [
|
||||
|
||||
52
sf_base/data/process_data.xml
Normal file
52
sf_base/data/process_data.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<!--<?xml version="1.0" encoding="UTF-8" ?>-->
|
||||
<!--<odoo>-->
|
||||
<!-- <data noupdate="0">-->
|
||||
<!-- <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="time_cycle">60</field>-->
|
||||
<!-- <field name="active">True</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="time_cycle">60</field>-->
|
||||
<!-- <field name="active">True</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record id="mrp_routing_workcenter_template_pre_ternary_sf" model="mrp.routing.workcenter">-->
|
||||
<!-- <field name="name">前置三元定位检测</field>-->
|
||||
<!-- <field name="code">pre-ternary</field>-->
|
||||
<!-- <field name="time_mode">manual</field>-->
|
||||
<!-- <field name="time_cycle">60</field>-->
|
||||
<!-- <field name="active">True</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="time_cycle">60</field>-->
|
||||
<!-- <field name="active">True</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record id="mrp_routing_workcenter_template_post_ternary_sf" model="mrp.routing.workcenter">-->
|
||||
<!-- <field name="name">后置三元质量检测</field>-->
|
||||
<!-- <field name="code">post ternary</field>-->
|
||||
<!-- <field name="time_mode">manual</field>-->
|
||||
<!-- <field name="time_cycle">60</field>-->
|
||||
<!-- <field name="active">True</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="time_cycle">60</field>-->
|
||||
<!-- <field name="active">True</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- </data>-->
|
||||
<!--</odoo>-->
|
||||
@@ -1,2 +1,5 @@
|
||||
from. import sf_base
|
||||
from. import sf_common
|
||||
from . import sf_base
|
||||
from . import sf_common
|
||||
from . import product_template
|
||||
from . import sale_order
|
||||
from . import process
|
||||
|
||||
39
sf_base/models/process.py
Normal file
39
sf_base/models/process.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class ModelType(models.Model):
|
||||
_name = 'sf.model.type'
|
||||
_description = '模型类型'
|
||||
|
||||
name = fields.Char('名称')
|
||||
routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')
|
||||
|
||||
|
||||
class ResMrpRoutingWorkcenter(models.Model):
|
||||
_inherit = 'mrp.routing.workcenter'
|
||||
|
||||
is_repeat = fields.Boolean('重复', default=False)
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
||||
workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_route', required=True)
|
||||
bom_id = fields.Many2one('mrp.bom', required=False)
|
||||
|
||||
# 获得当前登陆者公司
|
||||
def get_company_id(self):
|
||||
self.company_id = self.env.user.company_id.id
|
||||
|
||||
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
|
||||
|
||||
|
||||
class ModelTypeRoutingSort(models.Model):
|
||||
_name = 'sf.model.type.routing.sort'
|
||||
_description = '工序排序'
|
||||
|
||||
sequence = fields.Integer('Sequence')
|
||||
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
|
||||
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
|
||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||
model_type_id = fields.Many2one('sf.model.type')
|
||||
|
||||
_sql_constraints = [
|
||||
('route_model_type_uniq', 'unique (route_workcenter_id,model_type_id)', '工序不能重复!')
|
||||
]
|
||||
@@ -1,4 +1,4 @@
|
||||
from odoo import models, fields
|
||||
from odoo import models, fields,api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
@@ -6,19 +6,27 @@ class ResProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
# 模型的长,宽,高,体积,精度,材料
|
||||
model_long = fields.Float('长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('宽[mm]', digits=(16, 3))
|
||||
model_height = fields.Float('高[mm]', digits=(16, 3))
|
||||
model_volume = fields.Float('体积[mm³]', digits=(16, 3))
|
||||
model_long = fields.Float('模型长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('模型宽[mm]', digits=(16, 3))
|
||||
model_height = fields.Float('模型高[mm]', digits=(16, 3))
|
||||
model_volume = fields.Float('模型体积[mm³]', digits=(16, 3))
|
||||
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_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))
|
||||
embryo_height = fields.Float('高[mm]', digits=(16, 3))
|
||||
embryo_materials_id = fields.Many2one('mrs.production.materials', string='材料')
|
||||
embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
|
||||
embryo_long = fields.Float('胚料长[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
embryo_width = fields.Float('胚料宽[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
embryo_height = fields.Float('胚料高[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
embryo_materials_id = fields.Many2one('mrs.production.materials', string='胚料材料')
|
||||
embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='胚料材料型号')
|
||||
|
||||
volume = fields.Float(compute='_compute_volume', store=True)
|
||||
|
||||
@api.depends('embryo_long', 'embryo_width', 'embryo_height')
|
||||
def _compute_volume(self):
|
||||
self.volume = self.embryo_long * self.embryo_width * self.embryo_height
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
|
||||
def product_create(self, product_id, item, order_id, order_number, i):
|
||||
@@ -42,6 +50,25 @@ class ResProductTemplate(models.Model):
|
||||
copy_product_id.sudo().write(vals)
|
||||
return copy_product_id
|
||||
|
||||
# 在产品上增加模型类型和加工的面(例如:A、B) ,
|
||||
# 并根据模型类型计算出产品的胚料尺寸;
|
||||
@api.onchange('model_type_id')
|
||||
def count_embryo_size(self):
|
||||
if not self.model_type_id:
|
||||
return
|
||||
bom = self.env['product.product'].search(
|
||||
[('categ_id.is_embryo', '=', True), ('product_tmpl_id', '=', self.id)],
|
||||
limit=1,
|
||||
order='volume desc'
|
||||
)
|
||||
for item in self:
|
||||
item.embryo_long = bom.embryo_long + 1
|
||||
item.embryo_width = bom.embryo_width + 1
|
||||
item.embryo_height = bom.embryo_height + 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
_inherit = "product.category"
|
||||
@@ -84,3 +111,14 @@ class ResMrpBom(models.Model):
|
||||
'product_uom_id': 1
|
||||
}
|
||||
return self.env['mrp.bom.line'].create(vals)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,12 @@ access_mrs_production_materials,mrs_production_materials,model_mrs_production_ma
|
||||
access_mrs_materials_model,mrs_materials_model,model_mrs_materials_model,base.group_user,1,1,1,1
|
||||
access_mrs_processing_technology,mrs_processing_technology,model_mrs_processing_technology,base.group_user,1,1,1,1
|
||||
access_sf_tray,sf_tray,model_sf_tray,base.group_user,1,1,1,1
|
||||
<<<<<<< HEAD
|
||||
access_cnc_processing,cnc_processing,model_cnc_processing,base.group_user,1,1,1,1
|
||||
=======
|
||||
access_sf_model_type,sf_model_type,model_sf_model_type,base.group_user,1,1,1,1
|
||||
access_sf_model_type_routing_sort,sf_model_type_routing_sort,model_sf_model_type_routing_sort,base.group_user,1,1,1,1
|
||||
>>>>>>> 8e337dda97a98a9a8d0a892a2c39bc076640f6ac
|
||||
|
||||
|
||||
|
||||
|
||||
|
Can't render this file because it has a wrong number of fields in line 16.
|
@@ -142,13 +142,13 @@
|
||||
action="action_mrs_machine_control_system"/>
|
||||
|
||||
|
||||
<!-- <menuitem-->
|
||||
<!-- id="menu_sf_partner_views"-->
|
||||
<!-- name="工厂token"-->
|
||||
<!-- parent="menu_mrs_base"-->
|
||||
<!-- sequence="1"-->
|
||||
<!-- action="token_factory_view"-->
|
||||
<!-- />-->
|
||||
<menuitem
|
||||
id="menu_sf_model_type"
|
||||
name="模型类型"
|
||||
parent="mrp.menu_mrp_configuration"
|
||||
sequence="10"
|
||||
action="action_sf_model_type"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
43
sf_base/views/mrp_routing_workcenter_view.xml
Normal file
43
sf_base/views/mrp_routing_workcenter_view.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
#-----------------作业-------------------
|
||||
<record model="ir.ui.view" id="view_mrp_routing_workcenter_form_inherit_sf">
|
||||
<field name="name">mrp.routing.workcenter.form.inherit.sf</field>
|
||||
<field name="model">mrp.routing.workcenter</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="workcenter_id" position="replace">
|
||||
<field name="workcenter_ids" widget="many2many_tags" string="工作中心" required="0"/>
|
||||
</field>
|
||||
<field name="bom_product_template_attribute_value_ids" position="after">
|
||||
<field name="is_repeat"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#-----------------工单-------------------
|
||||
<record model="ir.ui.view" id="view_mrp_workorder_form_inherit_sf">
|
||||
<field name="name">mrp.workorder.form.inherit.sf</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="processing_panel"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#-----------------制造订单-------------------
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_form_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.form.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.production</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <field name="workorder_ids" position="after">-->
|
||||
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -355,11 +355,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="机床">
|
||||
<header>
|
||||
<button type="object" class="oe_highlight" name ='enroll_machine_tool' string="机床注册" />
|
||||
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>
|
||||
</header>
|
||||
<group string="基本信息">
|
||||
<group>
|
||||
<field name="MTcode" string="编码" />
|
||||
<field name="MTcode" string="编码"/>
|
||||
|
||||
<field name="brand_id"
|
||||
required="1"
|
||||
@@ -368,7 +368,8 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="type_id" required="1" options="{'no_create': True}" domain="[('brand_id', '=', brand_id)]" attrs="{'invisible': [('brand_id','=',False)]}"/>
|
||||
<field name="type_id" required="1" options="{'no_create': True}"
|
||||
domain="[('brand_id', '=', brand_id)]" attrs="{'invisible': [('brand_id','=',False)]}"/>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
@@ -406,7 +407,7 @@
|
||||
<field name="rotate_speed" required="1" string="转速(min)" options="{'format': false}"/>
|
||||
<field name="precision" required="1" string="加工精度(mm)"/>
|
||||
<field name="control_system_id" required="1" options="{'no_create': True}"/>
|
||||
<field name="state" widget="selection"/>
|
||||
<field name="state" widget="selection"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="其它">
|
||||
@@ -489,4 +490,61 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
#------------------模型类型------------------
|
||||
|
||||
<record model="ir.ui.view" id="search_sf_model_type_view">
|
||||
<field name="name">search.sf.model.type</field>
|
||||
<field name="model">sf.model.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="模型类型">
|
||||
<field name="name" string="模糊搜索"
|
||||
filter_domain="[('name', 'ilike', self)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="tree_sf_model_type_view">
|
||||
<field name="name">tree.sf.model.type</field>
|
||||
<field name="model">sf.model.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="模型类型">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="form_sf_model_type">
|
||||
<field name="name">form.sf.model.type</field>
|
||||
<field name="model">sf.model.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="模型类型">
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name='routing_tmpl_ids'>
|
||||
<tree editable='bottom'>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="route_workcenter_id" string="工序"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sf_model_type" model="ir.actions.act_window">
|
||||
<field name="name">模型类型</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.model.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
[模型类型] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -277,10 +277,23 @@
|
||||
</record>
|
||||
|
||||
#------------------托盘------------------
|
||||
<record id="action_sf_tray" model="ir.actions.act_window">
|
||||
<field name="name">托盘</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.tray</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
创建托盘吧
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_sf_tray_search" model="ir.ui.view">
|
||||
<field name="name">sf.tray.search</field>
|
||||
<field name="model">sf.tray</field>
|
||||
<field name="arch" type="xml">
|
||||
<<<<<<< HEAD
|
||||
<!-- <group>-->
|
||||
|
||||
|
||||
@@ -292,6 +305,14 @@
|
||||
<group string="分组">
|
||||
<filter name="state" string="状态" domain="[]" context="{'group_by': 'state'}"/>
|
||||
</group>
|
||||
=======
|
||||
<search string="托盘">
|
||||
<field name="name" string="名称" filter_domain="[('name','ilike',self)]"/>
|
||||
<field name="code" string="编码" filter_domain="[('code','ilike',self)]"/>
|
||||
</search>
|
||||
<!-- <group string="分组">-->
|
||||
<!-- <filter name="state" string="状态" domain="[]" context="{'group_by': 'state'}"/>-->
|
||||
>>>>>>> 8e337dda97a98a9a8d0a892a2c39bc076640f6ac
|
||||
<!-- </group>-->
|
||||
</field>
|
||||
</record>
|
||||
@@ -326,17 +347,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sf_tray" model="ir.actions.act_window">
|
||||
<field name="name">托盘</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.tray</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
创建托盘吧
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
50
sf_base/views/product_template_view.xml
Normal file
50
sf_base/views/product_template_view.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_product_template_form_inherit_sf">
|
||||
<field name="name">product.template.form.inherit.sf</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="加工参数">
|
||||
<group>
|
||||
<group string="模型">
|
||||
<field name="model_long" string="长[mm]"/>
|
||||
<field name="model_width" string="宽[mm]"/>
|
||||
<field name="model_height" string="高[mm]"/>
|
||||
<field name="model_volume" string="体积[mm]"/>
|
||||
<field name="model_type_id" string="模板类型"/>
|
||||
<field name="processing_panel" placeholder="例如A,B" string="加工面板"/>
|
||||
<field name="model_precision" string="精度要求"/>
|
||||
<field name="model_materials_id" string="材料"/>
|
||||
<field name="model_materials_type_id" string="型号"
|
||||
domain="[('materials_id', '=', model_materials_id)]"/>
|
||||
</group>
|
||||
<group string="胚料">
|
||||
<field name="embryo_long" string="长[mm]"/>
|
||||
<field name="embryo_width" string="宽[mm]"/>
|
||||
<field name="embryo_height" string="高[mm]"/>
|
||||
<field name="volume" string="体积[mm³]"/>
|
||||
<field name="embryo_materials_id" string="材料"/>
|
||||
<field name="embryo_materials_type_id" string="型号"
|
||||
domain="[('materials_id', '=',embryo_materials_id)]"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_category_form_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">product.category.form.inherit.sf</field>
|
||||
<field name="model">product.category</field>
|
||||
<field name="inherit_id" ref="product.product_category_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="parent_id" position="before">
|
||||
<field name="is_embryo"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,18 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_sf_form_inherit">
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='Customer Signature']" position="before">
|
||||
<page string="Bfm Line">
|
||||
<group>
|
||||
<field name="bfm_process_order_ids"/>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
<!-- <data>-->
|
||||
<!-- <record model="ir.ui.view" id="view_sf_form_inherit">-->
|
||||
<!-- <field name="model">sale.order</field>-->
|
||||
<!-- <field name="inherit_id" ref="sale.view_order_form"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//page[@name='Customer Signature']" position="before">-->
|
||||
<!-- <page string="Bfm Line">-->
|
||||
<!-- <group>-->
|
||||
<!-- <field name="bfm_process_order_ids"/>-->
|
||||
<!-- </group>-->
|
||||
<!-- </page>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
<!-- </data>-->
|
||||
</odoo>
|
||||
@@ -10,11 +10,10 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.cs.jikimo.com',
|
||||
'depends': ['sale', 'sf_base'],
|
||||
'depends': ['sale', 'sf_base', 'mrp'],
|
||||
'data': [
|
||||
'data/product_data.xml',
|
||||
'views/product_template_view.xml',
|
||||
'views/sale_order_view.xml'
|
||||
'security/group_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'demo': [
|
||||
],
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from . import sale_order
|
||||
from . import product_template
|
||||
from . import http
|
||||
from . import models
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_product_template_form_inherit_sf">
|
||||
<field name="name">product.template.form.inherit.sf</field>
|
||||
<field name="model">product.template</field>
|
||||
<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>
|
||||
<field name="model_long"/>
|
||||
<field name="model_width"/>
|
||||
<field name="model_height"/>
|
||||
<field name="model_volume"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="model_precision"/>
|
||||
<field name="model_materials_id"/>
|
||||
<field name="model_materials_type_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>&nbsp;</span>
|
||||
<label for="embryo_width" string="宽"/>
|
||||
<field name="embryo_width" class="o_address_zip"/>
|
||||
<span>&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>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_category_form_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">product.category.form.inherit.sf</field>
|
||||
<field name="model">product.category</field>
|
||||
<field name="inherit_id" ref="product.product_category_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="parent_id" position="before">
|
||||
<field name="is_embryo"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1 +1,2 @@
|
||||
from. import sf_production
|
||||
from . import sf_production
|
||||
from . import mrp_workorder
|
||||
|
||||
13
sf_manufacturing_orders/models/mrp_workorder.py
Normal file
13
sf_manufacturing_orders/models/mrp_workorder.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
|
||||
|
||||
class ResWorkcenterProductivity(models.Model):
|
||||
_inherit = 'mrp.workcenter.productivity'
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
||||
|
||||
|
||||
class ResMrpWorkOrder(models.Model):
|
||||
_inherit = 'mrp.workorder'
|
||||
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
|
||||
processing_panel = fields.Char('加工面')
|
||||
@@ -29,10 +29,70 @@ class MrpProduction(models.Model):
|
||||
_inherit = 'mrp.production'
|
||||
_description = "制造订单"
|
||||
|
||||
# 重载根据工序生成工单的程序:如果产品BOM中没有工序时,
|
||||
# 根据产品对应的模板类型中工序,去生成工单;
|
||||
# 工单对应的工作中心,根据工序中的工作中心去匹配,
|
||||
# 如果只配置了一个工作中心,则默认采用该工作中心;
|
||||
# 如果有多个工作中心,
|
||||
# 则根据该工作中心的工单个数进行分配(优先分配给工单个数最少的);
|
||||
# CNC加工工序的选取规则:
|
||||
# 如果自动报价有带过来预分配的机床,
|
||||
# 则根据设备找到工作中心;否则采用前面描述的工作中心分配机制;
|
||||
# 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心;
|
||||
|
||||
def _create_workorder(self):
|
||||
for production in self:
|
||||
if not production.bom_id or not production.product_id:
|
||||
continue
|
||||
workorders_values = []
|
||||
|
||||
product_qty = production.product_uom_id._compute_quantity(production.product_qty,
|
||||
production.bom_id.product_uom_id)
|
||||
exploded_boms, dummy = production.bom_id.explode(production.product_id,
|
||||
product_qty / production.bom_id.product_qty,
|
||||
picking_type=production.bom_id.picking_type_id)
|
||||
|
||||
for bom, bom_data in exploded_boms:
|
||||
# If the operations of the parent BoM and phantom BoM are the same, don't recreate work orders.
|
||||
if not (bom.operation_ids and (not bom_data['parent_line'] or bom_data[
|
||||
'parent_line'].bom_id.operation_ids != bom.operation_ids)):
|
||||
continue
|
||||
for operation in bom.operation_ids:
|
||||
if operation._skip_operation_line(bom_data['product']):
|
||||
continue
|
||||
workorders_values += [{
|
||||
'name': operation.name,
|
||||
'production_id': production.id,
|
||||
'workcenter_id': operation.workcenter_id.id,
|
||||
'product_uom_id': production.product_uom_id.id,
|
||||
'operation_id': operation.id,
|
||||
'state': 'pending',
|
||||
}]
|
||||
# 根据加工面板的面数及对应的工序模板生成工序
|
||||
for k in (production.product_id.processing_panel.split(',')):
|
||||
for route in production.product_id.model_type_id.routing_tmpl_ids:
|
||||
if route.route_workcenter_id:
|
||||
workorders_values_str = [0, '', {
|
||||
'product_uom_id': production.product_uom_id.id,
|
||||
'qty_producing': 0,
|
||||
'operation_id': False,
|
||||
'name': route.route_workcenter_id.name,
|
||||
'processing_panel': k,
|
||||
'workcenter_id': False,
|
||||
'date_planned_start': False,
|
||||
'date_planned_finished': False,
|
||||
'duration_expected': 60,
|
||||
'duration': 0
|
||||
}]
|
||||
workorders_values.append(workorders_values_str)
|
||||
production.workorder_ids = workorders_values
|
||||
for workorder in production.workorder_ids:
|
||||
workorder.duration_expected = workorder._get_duration_expected()
|
||||
|
||||
|
||||
class StockRule(models.Model):
|
||||
_inherit = 'stock.rule'
|
||||
|
||||
|
||||
@api.model
|
||||
def _run_pull(self, procurements):
|
||||
moves_values_by_company = defaultdict(list)
|
||||
@@ -142,6 +202,7 @@ class StockRule(models.Model):
|
||||
moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(moves_values)
|
||||
# Since action_confirm launch following procurement_group we should activate it.
|
||||
moves._action_confirm()
|
||||
|
||||
return True
|
||||
|
||||
# @api.model
|
||||
@@ -256,5 +317,3 @@ class StockRule(models.Model):
|
||||
# mo_lists.append(vals)
|
||||
#
|
||||
# return mo_lists
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user