From a43b8c6805a9fe1f6eb8b0ce622bc01b53b230fc Mon Sep 17 00:00:00 2001 From: Renaud Thiry Date: Tue, 15 Nov 2022 15:39:03 +0000 Subject: [PATCH 1/3] [FIX] calendar: hide 'sync' options from users Issue When the google and outlook sync plugins are not installed the admin user should see an option to install them from the calendar but other users should not see anything. Fix This replaces the 'groups' attribute in the calendar controller template with a t-if and a dynamic check as OWL doesn't process 'groups'. task - 3056311 X-original-commit: 4d5b7d4b5347c958f37b8f40e9edfae7cd78c2ca Part-of: odoo/odoo#106517 --- .../views/attendee_calendar/attendee_calendar_controller.js | 3 ++- .../views/attendee_calendar/attendee_calendar_controller.xml | 4 ++-- addons/google_calendar/static/tests/google_calendar_tests.js | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.js b/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.js index ea97dee6e90..cd3652d08e8 100644 --- a/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.js +++ b/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.js @@ -4,11 +4,12 @@ import { CalendarController } from "@web/views/calendar/calendar_controller"; import { useService } from "@web/core/utils/hooks"; export class AttendeeCalendarController extends CalendarController { - setup() { + async setup() { super.setup(); this.actionService = useService("action"); this.user = useService("user"); this.orm = useService("orm"); + this.isSystemUser = await this.user.hasGroup('base.group_system'); } onClickAddButton() { diff --git a/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.xml b/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.xml index ce655e77a92..968e65fd26d 100644 --- a/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.xml +++ b/addons/calendar/static/src/views/attendee_calendar/attendee_calendar_controller.xml @@ -2,10 +2,10 @@ -
+
Synchronize with:
-
+
+
+
+ Synchronize with:
-
- +
+
+ +
+
+ +
diff --git a/addons/google_calendar/static/src/views/google_calendar/google_calendar_controller.xml b/addons/google_calendar/static/src/views/google_calendar/google_calendar_controller.xml index f97a9334d1d..d3bb0b13e28 100644 --- a/addons/google_calendar/static/src/views/google_calendar/google_calendar_controller.xml +++ b/addons/google_calendar/static/src/views/google_calendar/google_calendar_controller.xml @@ -1,6 +1,9 @@ + + true +