mirror of
https://github.com/bringout/oca-ocb-security.git
synced 2026-04-23 02:32:07 +02:00
19.0 vanilla
This commit is contained in:
parent
20ddc1b4a3
commit
c0efcc53f5
1162 changed files with 125577 additions and 105287 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import main
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
from odoo.addons.google_calendar.utils.google_calendar import GoogleCalendarService
|
||||
from odoo.addons.calendar.controllers.main import CalendarController
|
||||
from odoo.addons.google_account.models.google_service import _get_client_secret
|
||||
|
||||
|
||||
class GoogleCalendarController(http.Controller):
|
||||
class GoogleCalendarController(CalendarController):
|
||||
|
||||
@http.route('/google_calendar/sync_data', type='json', auth='user')
|
||||
def sync_data(self, model, **kw):
|
||||
@http.route('/google_calendar/sync_data', type='jsonrpc', auth='user')
|
||||
def google_calendar_sync_data(self, model, **kw):
|
||||
""" This route/function is called when we want to synchronize Odoo
|
||||
calendar with Google Calendar.
|
||||
Function return a dictionary with the status : need_config_from_admin, need_auth,
|
||||
|
|
@ -44,10 +45,11 @@ class GoogleCalendarController(http.Controller):
|
|||
# If App authorized, and user access accepted, We launch the synchronization
|
||||
need_refresh = request.env.user.sudo()._sync_google_calendar(GoogleCal)
|
||||
|
||||
# If synchronization has been stopped
|
||||
if not need_refresh and request.env.user.google_synchronization_stopped:
|
||||
# If synchronization has been stopped or paused
|
||||
sync_status = request.env.user._get_google_sync_status()
|
||||
if not need_refresh and sync_status != "sync_active":
|
||||
return {
|
||||
"status": "sync_stopped",
|
||||
"status": sync_status,
|
||||
"url": ''
|
||||
}
|
||||
return {
|
||||
|
|
@ -56,3 +58,9 @@ class GoogleCalendarController(http.Controller):
|
|||
}
|
||||
|
||||
return {"status": "success"}
|
||||
|
||||
@http.route()
|
||||
def check_calendar_credentials(self):
|
||||
res = super().check_calendar_credentials()
|
||||
res['google_calendar'] = request.env['res.users']._has_setup_credentials()
|
||||
return res
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue