Merge branch 'feature/修改产品等信息' into develop
# Conflicts: # sf_base/models/product_template.py # sf_route_workcenter/models/workcenter.py
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
'security/ir.model.access.csv',
|
||||
'views/mrs_base_view.xml',
|
||||
'views/mrs_common_view.xml',
|
||||
'views/mrp_routing_workcenter_view.xml',
|
||||
"views/menu_view.xml",
|
||||
'views/sale_order_view.xml',
|
||||
'views/product_template_view.xml',
|
||||
|
||||
@@ -6,6 +6,7 @@ class ModelType(models.Model):
|
||||
_description = '模型类型'
|
||||
|
||||
name = fields.Char('名称')
|
||||
embryo_tolerance = fields.Integer('胚料的容余量')
|
||||
routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from odoo import models, fields,api
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class ResProductTemplate(models.Model):
|
||||
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_volume = fields.Float('模型体积[mm³]', digits=(16, 3), compute='_compute_model_volume', store=True)
|
||||
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='模型材料型号')
|
||||
@@ -22,6 +22,7 @@ class ResProductTemplate(models.Model):
|
||||
# total_amount = fields.Float('金额', digits=(16, 3), compute='_compute_total_amount')
|
||||
# model_number =
|
||||
|
||||
|
||||
# 胚料的长,宽,高
|
||||
embryo_long = fields.Float('胚料长[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
embryo_width = fields.Float('胚料宽[mm]', digits=(16, 3), onchange='count_embryo_size')
|
||||
@@ -29,6 +30,12 @@ class ResProductTemplate(models.Model):
|
||||
embryo_materials_id = fields.Many2one('mrs.production.materials', string='胚料材料')
|
||||
embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='胚料材料型号')
|
||||
|
||||
long = fields.Float('长[mm]', digits=(16, 3), onchange='add_product_size')
|
||||
width = fields.Float('宽[mm]', digits=(16, 3), onchange='add_product_size')
|
||||
height = fields.Float('高[mm]', digits=(16, 3), onchange='add_product_size')
|
||||
materials_id = fields.Many2one('mrs.production.materials', string='材料')
|
||||
materials_type_id = fields.Many2one('mrs.materials.model', string='材料型号')
|
||||
|
||||
|
||||
volume = fields.Float(compute='_compute_volume', store=True)
|
||||
|
||||
@@ -36,6 +43,10 @@ class ResProductTemplate(models.Model):
|
||||
def _compute_volume(self):
|
||||
self.volume = self.embryo_long * self.embryo_width * self.embryo_height
|
||||
|
||||
@api.depends('model_long', 'model_width', 'model_height')
|
||||
def _compute_model_volume(self):
|
||||
self.model_volume = self.model_long * self.model_width * self.model_height
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
|
||||
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()
|
||||
@@ -63,6 +74,7 @@ class ResProductTemplate(models.Model):
|
||||
copy_product_id.sudo().write(vals)
|
||||
return copy_product_id
|
||||
|
||||
|
||||
# 在产品上增加模型类型和加工的面(例如:A、B) ,
|
||||
# 并根据模型类型计算出产品的胚料尺寸;
|
||||
@api.onchange('model_type_id')
|
||||
@@ -82,6 +94,25 @@ class ResProductTemplate(models.Model):
|
||||
|
||||
|
||||
|
||||
# 根据模型类型默认给模型的长高宽加配置的长度;
|
||||
@api.onchange('model_type_id')
|
||||
def add_product_size(self):
|
||||
if not self.model_type_id:
|
||||
return
|
||||
model_type = self.env['sf.model.type'].search(
|
||||
[('id', '=', self.model_type_id.id)])
|
||||
print(self.model_long)
|
||||
print(self.model_width)
|
||||
print(self.model_height)
|
||||
for item in self:
|
||||
print(item.model_long)
|
||||
print(item.model_width)
|
||||
print(item.model_height)
|
||||
item.model_long = item.model_long + model_type.embryo_tolerance
|
||||
item.model_width = item.model_width + model_type.embryo_tolerance
|
||||
item.model_height = item.model_width + model_type.embryo_tolerance
|
||||
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
_inherit = "product.category"
|
||||
@@ -124,14 +155,3 @@ class ResMrpBom(models.Model):
|
||||
'product_uom_id': 1
|
||||
}
|
||||
return self.env['mrp.bom.line'].create(vals)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -264,5 +264,5 @@ class CNCprocessing(models.Model):
|
||||
FJGSD = fields.Char(string="加工深度(Z)")
|
||||
FSCCD = fields.Char(string="刀具伸出长度")
|
||||
FDJSpec = fields.Char(string="刀柄型号")
|
||||
FJGDate = fields.Char(string="预计加工时间")
|
||||
FJGDate = fields.Datetime(string="预计加工时间")
|
||||
FComment = fields.Char(string="备注")
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?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="routing_type" required="1"/>
|
||||
<field name="is_repeat"/>
|
||||
</field>
|
||||
</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 model="ir.ui.view" id="view_mrp_production_workorder_tree_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.workorder.tree.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="workcenter_id" position="replace">-->
|
||||
<!-- <filter name="workcenter_ids" string="工作中心" />-->
|
||||
<!-- </field>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record model="ir.ui.view" id="view_mrp_production_workorder_filter_inherit_sf">-->
|
||||
<!-- <field name="name">mrp.production.workorder.filter.inherit.sf</field>-->
|
||||
<!-- <field name="model">mrp.workorder</field>-->
|
||||
<!-- <field name="inherit_id" ref="mrp.view_mrp_production_workorder_form_view_filter"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//filter[@name='work_center']" position="replace">-->
|
||||
<!-- <filter name="work_center" string="工作中心" context="{'group_by': 'workcenter_ids'}"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
#-----------------制造订单里的工单-------------------
|
||||
<record model="ir.ui.view" id="view_mrp_production_workorder_tree_editable_inherit_sf">
|
||||
<field name="name">mrp.production.workorder.tree.editable.inherit.sf</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_production_workorder_tree_editable_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="processing_panel"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -531,12 +531,16 @@
|
||||
<form string="模型类型">
|
||||
<group>
|
||||
<field name="name" required="1"/>
|
||||
<field name="embryo_tolerance" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name='routing_tmpl_ids'>
|
||||
<tree editable='bottom'>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="sequence" widget="handle" string="序号"/>
|
||||
<field name="route_workcenter_id" string="工序"/>
|
||||
<field name="routing_type" string="类型"/>
|
||||
<field name="is_repeat" string="重复"/>
|
||||
<field name="workcenter_ids" string="工作中心" widget="many2many_tags" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user