I have inherited some model. I need also to override it's write method.
I've tried this:
@api.multi
def write(self, vals, context=None):
res = super(WebSiteSupportTicket, self).write(vals)
date = datetime.datetime.now()
if vals['state_id']:
if vals['state_id'] == 7 or vals['state_id'] == 8:
vals['closing_date'] = date
print(vals)
return res
Where closing_date is a Datetime field.
When I make the change of state_id to the state with id 7 or 8, closing_date is still being null. But I know the code is passing through the if statement because I can see closing_date on the print of vals
First time I run into a problem with write method. Why is happening and how can I get a solution?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…