diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py index 1fe36b90..601c34e8 100644 --- a/sf_manufacturing/models/model_type.py +++ b/sf_manufacturing/models/model_type.py @@ -75,7 +75,7 @@ class ManualProductModelTypeRoutingSort(models.Model): _description = '成品工序排序(人工线下加工)' sequence = fields.Integer('Sequence') - route_workcenter_id = fields.Many2one('mrp.routing.workcenter') + route_workcenter_id = fields.Many2one('mrp.routing.workcenter', domain=[('routing_type', 'in', ['人工线下加工'])]) is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat') routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type') workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids') diff --git a/sf_manufacturing/models/mrp_routing_workcenter.py b/sf_manufacturing/models/mrp_routing_workcenter.py index e28bd091..27c8e9d2 100644 --- a/sf_manufacturing/models/mrp_routing_workcenter.py +++ b/sf_manufacturing/models/mrp_routing_workcenter.py @@ -94,4 +94,10 @@ class ResMrpRoutingWorkcenter(models.Model): route_ids.append(t.route_id.surface_technics_id.id) domain = [('id', 'not in', route_ids), ('routing_tag', '=', 'special')] return self._search(domain, limit=limit, access_rights_uid=name_get_uid) + if self._context.get('is_duplicate') and self._context.get('model_name'): + # 查询出已经选择的工序 + model_type = self.env[self._context.get('model_name')].search_read([],['route_workcenter_id']) + route_workcenter_ids = [item['route_workcenter_id'][0] if item['route_workcenter_id'] else False for item in model_type] + domain = args + [('id', 'not in', route_workcenter_ids)] + return self._search(domain, limit=limit, access_rights_uid=name_get_uid) return super()._name_search(name, args, operator, limit, name_get_uid) diff --git a/sf_manufacturing/views/model_type_view.xml b/sf_manufacturing/views/model_type_view.xml index 0f8b3085..f4c1f994 100644 --- a/sf_manufacturing/views/model_type_view.xml +++ b/sf_manufacturing/views/model_type_view.xml @@ -3,7 +3,7 @@ #------------------模型类型------------------ - + search.sf.model.type sf.model.type @@ -14,7 +14,7 @@ - + tree.sf.model.type sf.model.type @@ -24,7 +24,7 @@ - + form.sf.model.type sf.model.type @@ -37,7 +37,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -81,7 +81,7 @@ - + 模型类型 ir.actions.act_window sf.model.type @@ -96,11 +96,11 @@ \ No newline at end of file