修复模板类型工序
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
'security/group_security.xml',
|
'security/group_security.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/product_data.xml',
|
'data/product_data.xml',
|
||||||
'data/process_data.xml',
|
# 'data/process_data.xml',
|
||||||
'views/mrs_base_view.xml',
|
'views/mrs_base_view.xml',
|
||||||
'views/mrs_common_view.xml',
|
'views/mrs_common_view.xml',
|
||||||
'views/menu_view.xml',
|
'views/menu_view.xml',
|
||||||
|
|||||||
@@ -1,52 +1,52 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<!--<?xml version="1.0" encoding="UTF-8" ?>-->
|
||||||
<odoo>
|
<!--<odoo>-->
|
||||||
<data noupdate="0">
|
<!-- <data noupdate="0">-->
|
||||||
<record id="mrp_routing_workcenter_template_automatic_coding_sf" model="mrp.routing.workcenter">
|
<!-- <record id="mrp_routing_workcenter_template_automatic_coding_sf" model="mrp.routing.workcenter">-->
|
||||||
<field name="name">获取自动编码程序</field>
|
<!-- <field name="name">获取自动编码程序</field>-->
|
||||||
<field name="code">automatic coding</field>
|
<!-- <field name="code">automatic coding</field>-->
|
||||||
<field name="time_mode">manual</field>
|
<!-- <field name="time_mode">manual</field>-->
|
||||||
<field name="time_cycle">60</field>
|
<!-- <field name="time_cycle">60</field>-->
|
||||||
<field name="active">True</field>
|
<!-- <field name="active">True</field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="mrp_routing_workcenter_template_clamping_sf" model="mrp.routing.workcenter">
|
<!-- <record id="mrp_routing_workcenter_template_clamping_sf" model="mrp.routing.workcenter">-->
|
||||||
<field name="name">装夹</field>
|
<!-- <field name="name">装夹</field>-->
|
||||||
<field name="code">clamping</field>
|
<!-- <field name="code">clamping</field>-->
|
||||||
<field name="time_mode">manual</field>
|
<!-- <field name="time_mode">manual</field>-->
|
||||||
<field name="time_cycle">60</field>
|
<!-- <field name="time_cycle">60</field>-->
|
||||||
<field name="active">True</field>
|
<!-- <field name="active">True</field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="mrp_routing_workcenter_template_pre_ternary_sf" model="mrp.routing.workcenter">
|
<!-- <record id="mrp_routing_workcenter_template_pre_ternary_sf" model="mrp.routing.workcenter">-->
|
||||||
<field name="name">前置三元定位检测</field>
|
<!-- <field name="name">前置三元定位检测</field>-->
|
||||||
<field name="code">pre-ternary</field>
|
<!-- <field name="code">pre-ternary</field>-->
|
||||||
<field name="time_mode">manual</field>
|
<!-- <field name="time_mode">manual</field>-->
|
||||||
<field name="time_cycle">60</field>
|
<!-- <field name="time_cycle">60</field>-->
|
||||||
<field name="active">True</field>
|
<!-- <field name="active">True</field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="mrp_routing_workcenter_template_cnc_sf" model="mrp.routing.workcenter">
|
<!-- <record id="mrp_routing_workcenter_template_cnc_sf" model="mrp.routing.workcenter">-->
|
||||||
<field name="name">CNC加工</field>
|
<!-- <field name="name">CNC加工</field>-->
|
||||||
<field name="code">CNC machining</field>
|
<!-- <field name="code">CNC machining</field>-->
|
||||||
<field name="time_mode">manual</field>
|
<!-- <field name="time_mode">manual</field>-->
|
||||||
<field name="time_cycle">60</field>
|
<!-- <field name="time_cycle">60</field>-->
|
||||||
<field name="active">True</field>
|
<!-- <field name="active">True</field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="mrp_routing_workcenter_template_post_ternary_sf" model="mrp.routing.workcenter">
|
<!-- <record id="mrp_routing_workcenter_template_post_ternary_sf" model="mrp.routing.workcenter">-->
|
||||||
<field name="name">后置三元质量检测</field>
|
<!-- <field name="name">后置三元质量检测</field>-->
|
||||||
<field name="code">post ternary</field>
|
<!-- <field name="code">post ternary</field>-->
|
||||||
<field name="time_mode">manual</field>
|
<!-- <field name="time_mode">manual</field>-->
|
||||||
<field name="time_cycle">60</field>
|
<!-- <field name="time_cycle">60</field>-->
|
||||||
<field name="active">True</field>
|
<!-- <field name="active">True</field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
|
|
||||||
<record id="mrp_routing_workcenter_template_remove_clamping_sf" model="mrp.routing.workcenter">
|
<!-- <record id="mrp_routing_workcenter_template_remove_clamping_sf" model="mrp.routing.workcenter">-->
|
||||||
<field name="name">解除装夹</field>
|
<!-- <field name="name">解除装夹</field>-->
|
||||||
<field name="code">remove the clamping</field>
|
<!-- <field name="code">remove the clamping</field>-->
|
||||||
<field name="time_mode">manual</field>
|
<!-- <field name="time_mode">manual</field>-->
|
||||||
<field name="time_cycle">60</field>
|
<!-- <field name="time_cycle">60</field>-->
|
||||||
<field name="active">True</field>
|
<!-- <field name="active">True</field>-->
|
||||||
</record>
|
<!-- </record>-->
|
||||||
</data>
|
<!-- </data>-->
|
||||||
</odoo>
|
<!--</odoo>-->
|
||||||
@@ -6,7 +6,7 @@ class ModelType(models.Model):
|
|||||||
_description = '模型类型'
|
_description = '模型类型'
|
||||||
|
|
||||||
name = fields.Char('名称')
|
name = fields.Char('名称')
|
||||||
routing_tmpl_id = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')
|
routing_tmpl_ids = fields.One2many('sf.model.type.routing.sort', 'model_type_id', '工序模板')
|
||||||
|
|
||||||
|
|
||||||
class ResMrpRoutingWorkcenter(models.Model):
|
class ResMrpRoutingWorkcenter(models.Model):
|
||||||
@@ -14,9 +14,16 @@ class ResMrpRoutingWorkcenter(models.Model):
|
|||||||
|
|
||||||
code = fields.Char('唯一编码')
|
code = fields.Char('唯一编码')
|
||||||
is_repeat = fields.Boolean('重复', default=False)
|
is_repeat = fields.Boolean('重复', default=False)
|
||||||
workcenter_id = fields.Many2many('mrp.workcenter', required=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)
|
bom_id = fields.Many2one('mrp.bom', required=False)
|
||||||
route_workcenter_sort_id = fields.Many2many('sf.model.type.routing.sort')
|
|
||||||
|
# 获得当前登陆者公司
|
||||||
|
def get_company_id(self):
|
||||||
|
company = self.env.ref('base.main_company')
|
||||||
|
return company.id
|
||||||
|
|
||||||
|
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
|
||||||
|
|
||||||
|
|
||||||
class ModelTypeRoutingSort(models.Model):
|
class ModelTypeRoutingSort(models.Model):
|
||||||
@@ -24,8 +31,11 @@ class ModelTypeRoutingSort(models.Model):
|
|||||||
_description = '工序排序'
|
_description = '工序排序'
|
||||||
|
|
||||||
sequence = fields.Integer('Sequence')
|
sequence = fields.Integer('Sequence')
|
||||||
|
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
|
||||||
route_workcenter_id = fields.Many2many('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')
|
model_type_id = fields.Many2one('sf.model.type')
|
||||||
|
|
||||||
|
_sql_constraints = [
|
||||||
|
('route_model_type_uniq', 'unique (route_workcenter_id,model_type_id)', '工序不能重复!')
|
||||||
|
]
|
||||||
|
|||||||
@@ -49,15 +49,16 @@ class ResProductTemplate(models.Model):
|
|||||||
# 并根据模型类型计算出产品的胚料尺寸;
|
# 并根据模型类型计算出产品的胚料尺寸;
|
||||||
@api.onchange('model_type_id')
|
@api.onchange('model_type_id')
|
||||||
def count_embryo_size(self):
|
def count_embryo_size(self):
|
||||||
bom = self.env['mrp.bom.line'].search(
|
bom = self.env['product.product'].search(
|
||||||
[('product_tmpl_id', '=', self.id)])
|
[('categ_id.is_embryo', '=', True), ('product_tmpl_id', '=', self.id)],
|
||||||
|
limit=1,
|
||||||
|
order='volume desc'
|
||||||
|
)
|
||||||
for item in self:
|
for item in self:
|
||||||
print(bom.product_tmpl_id)
|
item.model_long = bom.embryo_long + 1
|
||||||
print(bom.model_long)
|
|
||||||
item.model_long = bom.model_long + 1
|
|
||||||
print(item.model_long)
|
|
||||||
item.embryo_width = bom.embryo_width + 1
|
item.embryo_width = bom.embryo_width + 1
|
||||||
item.embryo_height = bom.embryo_height + 1
|
item.embryo_height = bom.embryo_height + 1
|
||||||
|
item.volume = item.model_long * item.embryo_width * item.embryo_height
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,3 +19,4 @@ access_sf_model_type_routing_sort,sf_model_type_routing_sort,model_sf_model_type
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/>
|
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_form_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="workcenter_id" position="replace">
|
<field name="workcenter_id" position="replace">
|
||||||
<field name="workcenter_id" widget="many2many_tags"/>
|
<field name="workcenter_ids" widget="many2many_tags" string="工作中心" required="0"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -523,13 +523,12 @@
|
|||||||
<field name="name" required="1"/>
|
<field name="name" required="1"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<!-- <field name='routing_tmpl_id' options="{'no_create':True}" widget="one2many">-->
|
<field name='routing_tmpl_ids'>
|
||||||
<!-- <tree editable='bottom'>-->
|
<tree editable='bottom'>
|
||||||
<!-- <field name="sequence" widget="handle"/>-->
|
<field name="sequence" widget="handle"/>
|
||||||
<!-- <field name="route_workcenter_id" widget="many2many_tags">-->
|
<field name="route_workcenter_id" string="工序"/>
|
||||||
<!-- <field name="model_type_id" widget="many2many_tags">-->
|
</tree>
|
||||||
<!-- </tree>-->
|
</field>
|
||||||
<!-- </field>-->
|
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class ReStockRule(models.Model):
|
|||||||
print(productions.product_id.processing_panel)
|
print(productions.product_id.processing_panel)
|
||||||
# 查出产品的加工面板并对根据面板的数量循环生成工序
|
# 查出产品的加工面板并对根据面板的数量循环生成工序
|
||||||
for k in (productions.product_id.processing_panel.split(',')):
|
for k in (productions.product_id.processing_panel.split(',')):
|
||||||
print(productions.product_id.model_type_id.routing_tmpl_id)
|
print(productions.product_id.model_type_id.routing_tmpl_ids)
|
||||||
for j in productions.product_id.model_type_id.routing_tmpl_id:
|
for j in productions.product_id.model_type_id.routing_tmpl_ids:
|
||||||
productions._create_workorder()
|
productions._create_workorder()
|
||||||
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
|
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ class MrpProduction(models.Model):
|
|||||||
'operation_id': operation.id,
|
'operation_id': operation.id,
|
||||||
'state': 'pending',
|
'state': 'pending',
|
||||||
}]
|
}]
|
||||||
|
print('1111111')
|
||||||
production.workorder_ids = [(5, 0)] + [(0, 0, value) for value in workorders_values]
|
production.workorder_ids = [(5, 0)] + [(0, 0, value) for value in workorders_values]
|
||||||
|
print('22222')
|
||||||
for workorder in production.workorder_ids:
|
for workorder in production.workorder_ids:
|
||||||
workorder.duration_expected = workorder._get_duration_expected()
|
workorder.duration_expected = workorder._get_duration_expected()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user