Hello everybody,
I am on odoo 10, and I want to add a computed field that stores the difference between current date and other date. This is my code:
@api.multi@api.depends('maturity_date')
def _compute_remaining_days(self):
for record in self:
current_date = datetime.datetime.now().date()
date1 = datetime.datetime.strptime(record.maturity_date, "%Y-%m-%d")
date2 = datetime.datetime.strptime(str(current_date), "%Y-%m-%d")
timedelta = date1 - date2
date = int(timedelta._days)
record.update({'days_number': date})
But the field doesn't get the value.
Can you help me ?
Thanks