From f2e8d0175bc17af5ddd4c3cb267ffc110ae66bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 20 Dec 2024 12:51:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=B7=A5=E5=BA=8F=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=8E=92=E9=99=A4=E5=B7=B2=E7=BB=8F=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/model_type.py | 2 +- sf_manufacturing/models/mrp_routing_workcenter.py | 6 ++++++ sf_manufacturing/views/model_type_view.xml | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) 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..e09b0aa5 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_type'): + # 查询出已经选择的工序 + model_type = self.env[self._context.get('model_type')].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..d3f90fd7 100644 --- a/sf_manufacturing/views/model_type_view.xml +++ b/sf_manufacturing/views/model_type_view.xml @@ -37,7 +37,7 @@ - + @@ -48,7 +48,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -70,7 +70,7 @@ - +