from odoo import models, fields, api class SurveyUserInput(models.Model): _inherit = 'survey.user_input' date_start = fields.Datetime(string="Start date", readonly=True, help="This date is set when the user clicks on \"Start survey\" button for the first time.") date_done = fields.Datetime(string="Date done", readonly=True, help="This date is set when the user input is set ton \"Done\" status.") @api.multi def write(self, vals): if vals.get('state', False) == 'done': vals.update({ 'date_done': fields.Datetime.now(), }) return super(SurveyUserInput, self).write(vals)