def create(self, vals):
status_history_obj = self.env['hc.payment.notice.status.history']
res = super(PaymentNotice, self).create(vals)
if vals and vals.get('status_id'):
status_history_vals = {
'payment_notice_id': res.id,
'status': res.status_id.name,
'start_date': datetime.today()
}
if vals.get('status_id') == 'entered-in-error':
status_history_vals.update({'end_date': datetime.today()})
status_history_obj.create(status_history_vals)
return res
评论列表
文章目录