From 3d2e3833309b5c2584b4c5f375fed14b57940edf Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 17 Feb 2025 15:17:54 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A4=84=E7=90=86=20sf-=E5=88=B6?= =?UTF-8?q?=E9=80=A0=E8=AE=A2=E5=8D=95-=E9=80=9A=E8=BF=87=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E6=A3=80=E6=9F=A5=E5=AF=B9=E8=A3=85=E5=A4=B9=E9=A2=84?= =?UTF-8?q?=E8=B0=83=E8=BF=9B=E8=A1=8C=E8=BF=94=E5=B7=A5-=E5=88=B6?= =?UTF-8?q?=E9=80=A0=E8=AE=A2=E5=8D=95=E6=9C=AA=E8=AE=B0=E5=BD=95=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E7=BB=93=E6=9E=9C=20=E9=97=AE=E9=A2=98=EF=BC=9B2?= =?UTF-8?q?=E3=80=81=E5=A4=84=E7=90=86=20=E6=89=8B=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=B0=83=E6=8B=A8=E5=8D=95=E5=8F=B3=E4=B8=8A=E8=A7=92?= =?UTF-8?q?=E4=BC=9A=E5=85=B3=E8=81=94=E5=9D=AF=E6=96=99=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=8D=95=E5=92=8C=E5=9D=AF=E6=96=99=E5=A7=94=E5=A4=96=E5=8D=95?= =?UTF-8?q?=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_quality/models/quality.py | 12 ++++++++++++ sf_stock/models/stock_picking.py | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sf_quality/models/quality.py b/sf_quality/models/quality.py index 201103f1..80fe2f46 100644 --- a/sf_quality/models/quality.py +++ b/sf_quality/models/quality.py @@ -84,6 +84,18 @@ class QualityCheck(models.Model): raise ValidationError('请填写【判定结果】里的信息') if self.test_results == '合格': raise ValidationError('请重新选择【判定结果】-【检测结果】') + if self.workorder_id.routing_type != 'CNC加工' and self.workorder_id.individuation_page_PTD is False: + self.workorder_id.production_id.write({'detection_result_ids': [(0, 0, { + 'rework_reason': self.workorder_id.reason, + 'detailed_reason': self.workorder_id.detailed_reason, + 'processing_panel': self.workorder_id.processing_panel, + 'routing_type': self.workorder_id.routing_type, + 'handle_result': '待处理' if (self.workorder_id.test_results in ['返工', '报废'] + or self.workorder_id.is_rework is True) else '', + 'test_results': self.workorder_id.test_results, + 'test_report': self.workorder_id.detection_report})], + 'is_scrap': True if self.workorder_id.test_results == '报废' else False + }) if self.workorder_id.state not in ['done']: self.workorder_id.write( {'test_results': self.test_results, 'reason': self.reason, 'detailed_reason': self.detailed_reason}) diff --git a/sf_stock/models/stock_picking.py b/sf_stock/models/stock_picking.py index f8105097..7b73485b 100644 --- a/sf_stock/models/stock_picking.py +++ b/sf_stock/models/stock_picking.py @@ -18,7 +18,7 @@ class StockPicking(models.Model): @api.depends('name') def _compute_pro_purchase_count(self): for sp in self: - if sp: + if sp.name and sp.name != '/': po_ids = self.env['purchase.order'].sudo().search([ ('origin', 'like', sp.name), ('purchase_type', '=', 'standard')]) if po_ids: @@ -52,7 +52,7 @@ class StockPicking(models.Model): @api.depends('name') def _compute_pro_out_purchase_count(self): for sp in self: - if sp: + if sp.name and sp.name != '/': po_ids = self.env['purchase.order'].sudo().search([ ('origin', 'like', sp.name), ('purchase_type', '=', 'outsourcing')]) if po_ids: