diff --git a/sf_base/views/common_view.xml b/sf_base/views/common_view.xml index 74b8f177..dbdfec49 100644 --- a/sf_base/views/common_view.xml +++ b/sf_base/views/common_view.xml @@ -5,7 +5,7 @@ sf.production.process.parameter - + @@ -15,7 +15,7 @@ sf.production.process.parameter -
+

@@ -104,7 +104,7 @@ sf.production.process.category - +

@@ -120,7 +120,7 @@ - + @@ -139,7 +139,7 @@ sf.production.process.category - + @@ -163,7 +163,7 @@ sf.production.process - + @@ -175,7 +175,7 @@ sf.production.process - +

@@ -395,7 +395,7 @@ tree,form - 表面工艺 + 工艺 ir.actions.act_window sf.production.process tree,form @@ -414,13 +414,13 @@ - 表面工艺类别 + 工艺类别 ir.actions.act_window sf.production.process.category tree,form - 表面工艺可选参数 + 工艺可选参数 ir.actions.act_window sf.production.process.parameter tree,form diff --git a/sf_base/views/menu_view.xml b/sf_base/views/menu_view.xml index cf7c7aaf..1ff47db8 100644 --- a/sf_base/views/menu_view.xml +++ b/sf_base/views/menu_view.xml @@ -78,7 +78,7 @@ 工艺可选参数编码序列 sf.production.process.parameter - WKSP - 9 + 3 + 1 \ No newline at end of file diff --git a/sf_dlm_management/models/sf_production_common.py b/sf_dlm_management/models/sf_production_common.py index cd19e938..0c937175 100644 --- a/sf_dlm_management/models/sf_production_common.py +++ b/sf_dlm_management/models/sf_production_common.py @@ -11,20 +11,23 @@ class SfProductionProcessParameter(models.Model): @api.model def create(self, vals): - if vals.get('code', '/') == '/' or vals.get('code', '/') is False: - vals['code'] = self.env['ir.sequence'].next_by_code('sf.production.process.parameter') or '/' + # if vals.get('code', '/') == '/' or vals.get('code', '/') is False: + # vals['code'] = '101'+self.routing_id.code +self.env['ir.sequence'].next_by_code('sf.production.process.parameter') if not vals.get('process_id') and vals.get('routing_id'): vals['gain_way'] = '外协' routing_id = self.env['mrp.routing.workcenter'].browse(vals.get('routing_id')) if routing_id.surface_technics_id: vals['process_id'] = routing_id.surface_technics_id.id + if vals.get('code', '/') == '/' or vals.get('code', '/') is False: + vals['code'] = '101' + routing_id.code + self.env['ir.sequence'].next_by_code( + 'sf.production.process.parameter') obj = super(SfProductionProcessParameter, self).create(vals) return obj def create_service_product(self): service_categ = self.env.ref( 'sf_dlm.product_category_surface_technics_sf').sudo() - product_name = f"{self.process_id.name}{self.name}" + product_name = f"{self.process_id.name}_{self.name}" product_id = self.env['product.template'].search( [("name", '=', product_name)]) if product_id: diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 1af6226a..2dd79adb 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -1067,7 +1067,8 @@ class ResProductMo(models.Model): raise UserError('产品名称【%s】已存在' % item.name) if item.categ_type == '表面工艺': if len(self.search([('server_product_process_parameters_id', '=', - item.server_product_process_parameters_id.id)])) > 1: + item.server_product_process_parameters_id.id),('server_product_process_parameters_id', '!=', + False)])) > 1: raise UserError('表面工艺参数为【%s】的产品已存在' % item.server_product_process_parameters_id.name) if "create_product_product" not in self._context: templates._create_variant_ids() diff --git a/sf_manufacturing/models/sf_production_common.py b/sf_manufacturing/models/sf_production_common.py index 708199bb..6285c133 100644 --- a/sf_manufacturing/models/sf_production_common.py +++ b/sf_manufacturing/models/sf_production_common.py @@ -21,6 +21,12 @@ class SfProductionProcessParameter(models.Model): for record in self: if len(record.outsourced_service_products) > 1: raise ValidationError("工艺参数不能与多个产品关联") + + @api.onchange('outsourced_service_products') + def _onchange_validate_partner_limit(self): + for record in self: + if len(record.outsourced_service_products) > 1: + raise ValidationError("工艺参数不能与多个产品关联") @api.depends('outsourced_service_products') def _compute_is_product_button(self): for record in self: diff --git a/sf_manufacturing/views/mrp_routing_workcenter_view.xml b/sf_manufacturing/views/mrp_routing_workcenter_view.xml index d1eb0618..3c3bb27a 100644 --- a/sf_manufacturing/views/mrp_routing_workcenter_view.xml +++ b/sf_manufacturing/views/mrp_routing_workcenter_view.xml @@ -30,7 +30,7 @@ - +