[FIX] microsoft_calendar: fix the DateTime range

Before this commit, the DateTime range for getting events was six years,
while the Microsoft range limit is five years.

opw-2819858

closes odoo/odoo#93657

X-original-commit: 56f9b7646269d953c3068a12f20436d3afc970b1
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
pedrambiria
2022-06-15 10:00:16 +02:00
parent 0c555b6b5a
commit d3f3f44f7a
@@ -7,6 +7,7 @@ import logging
from werkzeug import urls
from odoo import fields
from odoo.addons.microsoft_calendar.utils.microsoft_event import MicrosoftEvent
from odoo.addons.microsoft_account.models.microsoft_service import TIMEOUT
@@ -36,8 +37,8 @@ class MicrosoftCalendarService():
if sync_token:
params['$deltatoken'] = sync_token
else:
params['startDateTime'] = '2016-12-01T00:00:00Z'
params['endDateTime'] = '2030-1-01T00:00:00Z'
params['startDateTime'] = fields.Datetime.subtract(fields.Datetime.now(), years=2).strftime("%Y-%m-%dT00:00:00Z")
params['endDateTime'] = fields.Datetime.add(fields.Datetime.now(), years=2).strftime("%Y-%m-%dT00:00:00Z")
try:
status, data, time = self.microsoft_service._do_request(url, params, headers, method='GET', timeout=timeout)
except requests.HTTPError as e: