i am trying to add a new compute field that add a mounth from an existing date field
the code is working on odoo13 but i don't know why it isn't on the odoo 8
from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta from openerp.osv import expression
class contract(models.Model):
_inherit = 'res.contract'
mounth = fields.Datetime(string="Date plus mois", compute='_add_mth')
def _add_mth(self):
for order in self:
d = 1
if self.date_start:
date_st = fields.Datetime.from_string(self.date_start)
dt = date_start_dt + relativedelta(months=d)
mounth = fields.Datetime.to_string(dt)
order.update({'mounth': mounth})
i have this error message Expected singleton: res.contract(137, 138)