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 @@
+
+
+
+