diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml index f4a256bd..95d19c39 100644 --- a/sf_dlm/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -1,5 +1,6 @@ + 坯料 坯料 diff --git a/sf_manufacturing/data/stock_data.xml b/sf_manufacturing/data/stock_data.xml index 74d02b4a..6bd0fe53 100644 --- a/sf_manufacturing/data/stock_data.xml +++ b/sf_manufacturing/data/stock_data.xml @@ -1,6 +1,13 @@ + + 工序编码规则 + mrp.routing.workcenter + 4 + + + YourCompany Sequence ocout WH/OCOUT/ diff --git a/sf_manufacturing/models/mrp_routing_workcenter.py b/sf_manufacturing/models/mrp_routing_workcenter.py index c8e7d8aa..95c70533 100644 --- a/sf_manufacturing/models/mrp_routing_workcenter.py +++ b/sf_manufacturing/models/mrp_routing_workcenter.py @@ -1,5 +1,6 @@ import logging -from odoo import fields, models +from odoo import fields, models, api +from odoo.exceptions import UserError class ResMrpRoutingWorkcenter(models.Model): @@ -21,13 +22,17 @@ class ResMrpRoutingWorkcenter(models.Model): bom_id = fields.Many2one('mrp.bom', required=False) surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺") + def generate_code(self): + return self.env['ir.sequence'].next_by_code('mrp.routing.workcenter') + + code = fields.Char('编码', default=generate_code) + # 获得当前登陆者公司 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) - # 排产的时候, 根据坯料的长宽高比对一下机床的最大加工尺寸.不符合就不要分配给这个加工中心(机床). # 工单对应的工作中心,根据工序中的工作中心去匹配, # 如果只配置了一个工作中心,则默认采用该工作中心; diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 7a341c36..42a392e2 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -6,8 +6,8 @@ import os from odoo import models, fields, api, _ from odoo.exceptions import ValidationError from odoo.modules import get_resource_path -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_manufacturing/views/mrp_routing_workcenter_view.xml b/sf_manufacturing/views/mrp_routing_workcenter_view.xml index d0db3a7b..5ab745db 100644 --- a/sf_manufacturing/views/mrp_routing_workcenter_view.xml +++ b/sf_manufacturing/views/mrp_routing_workcenter_view.xml @@ -6,6 +6,9 @@ mrp.routing.workcenter + + +