diff --git a/addons/google_calendar/controllers/main.py b/addons/google_calendar/controllers/main.py index 40c8b736ab9..adc6bb90e64 100644 --- a/addons/google_calendar/controllers/main.py +++ b/addons/google_calendar/controllers/main.py @@ -18,7 +18,8 @@ class GoogleCalendarController(http.Controller): this URL for authorization for example """ if model == 'calendar.event': - GoogleCal = GoogleCalendarService(request.env['google.service']) + base_url = request.httprequest.url_root.strip('/') + GoogleCal = GoogleCalendarService(request.env['google.service'].with_context(base_url=base_url)) # Checking that admin have already configured Google API for google synchronization ! client_id = request.env['google.service']._get_client_id('calendar') diff --git a/addons/google_calendar/utils/google_calendar.py b/addons/google_calendar/utils/google_calendar.py index 3da73fc1b9a..a2bf89bd32d 100644 --- a/addons/google_calendar/utils/google_calendar.py +++ b/addons/google_calendar/utils/google_calendar.py @@ -112,10 +112,11 @@ class GoogleCalendarService(): 's': 'calendar', 'f': from_url } + base_url = self.google_service._context.get('base_url') or self.google_service.get_base_url() return self.google_service._get_authorize_uri( 'calendar', self._get_calendar_scope(), - self.google_service.get_base_url() + '/google_account/authentication', + base_url + '/google_account/authentication', state=json.dumps(state), approval_prompt='force', access_type='offline'