From 22bac48a98ea456f7957a74a1485b0db92b331e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 10 Jan 2025 09:57:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=BB=93=E6=9E=9C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=9B=E5=BB=BA=E4=BA=BA=EF=BC=8C=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E5=A4=84=E7=90=86=E4=BA=BA=EF=BC=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 9 +++++++++ .../views/mrp_production_addional_change.xml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 8a1c9072..f9e7c77b 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -1577,6 +1577,7 @@ class MrpProduction(models.Model): class sf_detection_result(models.Model): _name = 'sf.detection.result' _description = "检测结果" + _order = 'handle_result_date desc, id asc' production_id = fields.Many2one('mrp.production') processing_panel = fields.Char('加工面') @@ -1594,6 +1595,8 @@ class sf_detection_result(models.Model): test_report = fields.Binary('检测报告', readonly=True) handle_result = fields.Selection([("待处理", "待处理"), ("已处理", "已处理")], default='', string="处理结果", tracking=True) + handle_result_date = fields.Datetime('处理时间') + handle_result_user = fields.Many2one('res.users', '处理人') # 查看检测报告 def button_look_test_report(self): @@ -1604,6 +1607,12 @@ class sf_detection_result(models.Model): 'views': [(self.env.ref('sf_manufacturing.sf_test_report_form').id, 'form')], 'target': 'new' } + + def write(self, vals): + if vals.get('handle_result') and vals.get('handle_result') == '已处理': + vals['handle_result_date'] = fields.Datetime.now() + vals['handle_result_user'] = self.env.user.id + return super(sf_detection_result, self).write(vals) class sf_processing_panel(models.Model): diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 8a44b621..4c284fee 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -335,6 +335,10 @@ + + + +