Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
4445 Prikazi
I was trying to add 90 days to a date field:

for record in self:
record['x_studio_90_days'] = record.x_studio_det_days + datetime.timedelta(days=90)

however I am getting an error. Please help

Avatar
Opusti
Best Answer

Hi Neil,

Check this forum post: https://www.odoo.com/forum/help-1/how-to-add-42-days-to-an-date-field-108946

Thank you

Avatar
Opusti
Avtor

I have tried that one but it gives me a lot of errors

Hi,
Try this:
if record.x_studio_det_days:

record['x_studio_90_days'] = record.x_studio_det_days + datetime.timedelta(days=90)

Thank you

Best Answer

Hi  Neil Matan,

Try,

from dateutil.relativedelta import relativedelta

self.event_start = fields.Date.today() + relativedelta(days=7)


Avatar
Opusti

record['x_studio_90_days'] = record.x_studio_det_days + relativedelta(days=90)

Related Posts Odgovori Prikazi Aktivnost
2
jan. 24
2504
2
jun. 18
6008
2
nov. 16
13598
2
feb. 24
12500
0
okt. 23
2845