I have a time difference field
time_diff = fields.Char(string="Time Difference", required=False, )
and a sla field in odoo
sla_state = fields.Selection(string="SLA", selection=[('past sla', 'Past SLA'), ('within sla', 'Within SLA'), ], required=False, )
i want to set a condition where if time difference is greater than 1 the sla state automatically populates to Past SLA Below is my function
@api.onchange('time_diff')
def get_sla(self):
if self.time_diff >= 1:
self.sla_state == 'past sla'
else:
self.sla_state == 'within sla'
But its not working what might be the issue Please help.