检测结果增加创建人,时间,处理人,时间
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -335,6 +335,10 @@
|
||||
<field name="detailed_reason"/>
|
||||
<field name="test_results"/>
|
||||
<field name="handle_result"/>
|
||||
<field name="create_date" string="创建时间"/>
|
||||
<field name="create_uid" string="创建人"/>
|
||||
<field name="handle_result_date"/>
|
||||
<field name="handle_result_user"/>
|
||||
<field name="test_report" invisible="1"/>
|
||||
<button name="button_look_test_report" string="查看测试报告" type="object"
|
||||
attrs="{'invisible': [('test_report', '=', False)]}"
|
||||
|
||||
Reference in New Issue
Block a user