def _google_insert(self, google_service: GoogleCalendarService, values, timeout=TIMEOUT): if not values: return with google_calendar_token(self.env.user.sudo()) as token: if token: google_id = google_service.insert(values, token=token, timeout=timeout) self.write({ 'google_id': google_id, 'need_sync': False, })
def _google_insert(self, google_service: GoogleCalendarService, values, timeout=TIMEOUT): if not values: return with google_calendar_token(self.env.user.sudo()) as token: if token: try: google_id = google_service.insert(values, token=token, timeout=timeout) # Everything went smoothly self.with_context(dont_notify=True).write({ 'google_id': google_id, 'need_sync': False, }) except HTTPError as e: if e.response.status_code in (400, 403): self._google_error_handling(e) self.need_sync = False