Hi,
I have a model with a date field as follow :
class myModel(osv.osv)
date_start : fields.date(...)
month_nb = fields.integer(...)
date_end = fields.date(...)
I made an onchange method to calculate the date_end field on when month_nb and date_start change :
@api.onchange('date_start','month_nb')
def _compute_date_end(self):
from datetime import date
from dateutil.relativedelta import relativedelta
self.date_end = self.date_start + relativedelta(months=self.month_nb)
But with this code, I get an error :
self.date_end = self.date_start + relativedelta(months=self.month_nb)
File "/usr/lib/python2.7/dist-packages/dateutil/relativedelta.py", line 247, in __radd__
raise TypeError, "unsupported type for add operation"
TypeError: unsupported type for add operation
I don't understant what I am doing wrong in my code. Do you see something wrong in my code ?
Thank you for your help