[FIX] calendar: show calendar sync when installed

## Issue

Regular users were not able to see the sync button
used to sync with external calendar services even after
these services were configured

## Fix

Conditionally display the whole sync section until one of the
services is configured.

Override the display conditions when one of the relevant modules are
installed.

task - 3056311

X-original-commit: 29f820cfd421859a2b480725ba2a81a515509b88
Part-of: odoo/odoo#106517
This commit is contained in:
Renaud Thiry
2022-11-25 17:56:31 +01:00
parent a43b8c6805
commit 13db30cba5
3 changed files with 20 additions and 12 deletions
@@ -2,19 +2,21 @@
<templates>
<t t-name="calendar.AttendeeCalendarController" t-inherit="web.CalendarController" t-inherit-mode="primary" owl="1">
<DatePicker position="after">
<div id="calendar_sync_title" class="o_calendar_sync text-center" t-if="isSystemUser">
<span class="text-primary fs-6">Synchronize with:</span>
</div>
<div id="calendar_sync" class="container inline btn-group justify-content-evenly align-items-center" t-if="isSystemUser">
<div id="google_calendar_sync" class="o_calendar_sync">
<button type="button" id="google_sync_activate" class="btn btn-muted" t-on-click="() => this.configureCalendarProviderSync('google')">
<b><i class='fa fa-plug'/> Google</b>
</button>
<div id="calendar_sync_wrapper" t-if="isSystemUser">
<div id="calendar_sync_title" class="o_calendar_sync text-center">
<span class="text-primary fs-6">Synchronize with:</span>
</div>
<div id="microsoft_calendar_sync" class="o_calendar_sync">
<button type="button" id="microsoft_sync_activate" class="btn btn-muted" t-on-click="() => this.configureCalendarProviderSync('microsoft')">
<b><i class='fa fa-plug'/> Outlook</b>
</button>
<div id="calendar_sync" class="container inline btn-group justify-content-evenly align-items-center">
<div id="google_calendar_sync" class="o_calendar_sync" t-if="isSystemUser">
<button type="button" id="google_sync_activate" class="btn btn-muted" t-on-click="() => this.configureCalendarProviderSync('google')">
<b><i class='fa fa-plug'/> Google</b>
</button>
</div>
<div id="microsoft_calendar_sync" class="o_calendar_sync" t-if="isSystemUser">
<button type="button" id="microsoft_sync_activate" class="btn btn-muted" t-on-click="() => this.configureCalendarProviderSync('microsoft')">
<b><i class='fa fa-plug'/> Outlook</b>
</button>
</div>
</div>
</div>
</DatePicker>
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="google_calendar.GoogleCalendarController" t-inherit="calendar.AttendeeCalendarController" t-inherit-mode="extension" owl="1">
<xpath expr="//div[@id='calendar_sync_wrapper']" position="attributes">
<attribute name="t-if">true</attribute>
</xpath>
<xpath expr="//div[@id='google_calendar_sync']" position="replace">
<div id="google_calendar_sync" class="o_calendar_sync">
<button t-if="!model.googleIsSync" type="button" id="google_sync_pending" class="o_google_sync_button o_google_sync_pending btn btn-secondary btn" t-on-click="onGoogleSyncCalendar">
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="microsoft_calendar.MicrosoftCalendarController" t-inherit="calendar.AttendeeCalendarController" t-inherit-mode="extension" owl="1">
<xpath expr="//div[@id='calendar_sync_wrapper']" position="attributes">
<attribute name="t-if">true</attribute>
</xpath>
<xpath expr="//div[@id='microsoft_calendar_sync']" position="replace">
<div id="microsoft_calendar_sync" class="o_calendar_sync">
<button t-if="!model.microsoftIsSync" type="button" id="microsoft_sync_pending" class="o_microsoft_sync_button o_microsoft_sync_pending btn btn-secondary btn" t-on-click="onMicrosoftSyncCalendar">