Skip to Content
Menu
This question has been flagged
2 Replies
2621 Views
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
Discard
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
Discard
Author

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
Discard

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

Related Posts Replies Views Activity
2
Jan 24
939
2
Jun 18
4699
2
Nov 16
11675
2
Feb 24
10969
0
Oct 23
1377