[FIX] calendar: show dialog when sync unconfigured
## Issue Currently if an administrator installs one of the sync modules but does not set any credentials. If the user tries to sync their calendar they are met with an error. ## Fix Make sure they get a clear dialog explaining why they cannot sync. task - 3056311 X-original-commit: 6ec6a3764c5e5460aa8a1cdfa228740606fdfe13 Part-of: odoo/odoo#106517
This commit is contained in:
+11
-9
@@ -19,15 +19,17 @@ patch(AttendeeCalendarController.prototype, "google_calendar_google_calendar_con
|
||||
[[this.user.userId]],
|
||||
);
|
||||
const syncResult = await this.model.syncGoogleCalendar();
|
||||
if (syncResult.status === "need_auth") {
|
||||
this.configureCalendarProviderSync("google");
|
||||
} else if (syncResult.status === "need_config_from_admin") {
|
||||
if (Number.isInteger(syncResult.action)) {
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
title: this.env._t("Configuration"),
|
||||
body: this.env._t("The Google Synchronization needs to be configured before you can use it, do you want to do it now?"),
|
||||
confirm: this.actionService.doAction.bind(this.actionService, syncResult.action),
|
||||
});
|
||||
if (["need_auth", "need_config_from_admin"].includes(syncResult.status)) {
|
||||
if (this.isSystemUser) {
|
||||
if (syncResult.status === "need_auth") {
|
||||
this.configureCalendarProviderSync("google");
|
||||
} else if (syncResult.status === "need_config_from_admin") {
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
title: this.env._t("Configuration"),
|
||||
body: this.env._t("The Google Synchronization needs to be configured before you can use it, do you want to do it now?"),
|
||||
confirm: this.actionService.doAction.bind(this.actionService, syncResult.action),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.dialog.add(AlertDialog, {
|
||||
title: this.env._t("Configuration"),
|
||||
|
||||
+11
-9
@@ -19,15 +19,17 @@ patch(AttendeeCalendarController.prototype, "microsoft_calendar_microsoft_calend
|
||||
[[this.user.userId]],
|
||||
);
|
||||
const syncResult = await this.model.syncMicrosoftCalendar();
|
||||
if (syncResult.status === "need_auth") {
|
||||
this.configureCalendarProviderSync("microsoft");
|
||||
} else if (syncResult.status === "need_config_from_admin") {
|
||||
if (Number.isInteger(syncResult.action)) {
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
title: this.env._t("Configuration"),
|
||||
body: this.env._t("The Outlook Synchronization needs to be configured before you can use it, do you want to do it now?"),
|
||||
confirm: this.actionService.doAction.bind(this.actionService, syncResult.action),
|
||||
});
|
||||
if (["need_auth", "need_config_from_admin"].includes(syncResult.status)) {
|
||||
if (this.isSystemUser) {
|
||||
if (syncResult.status === "need_auth") {
|
||||
this.configureCalendarProviderSync("microsoft");
|
||||
} else if (syncResult.status === "need_config_from_admin") {
|
||||
this.dialog.add(ConfirmationDialog, {
|
||||
title: this.env._t("Configuration"),
|
||||
body: this.env._t("The Outlook Synchronization needs to be configured before you can use it, do you want to do it now?"),
|
||||
confirm: this.actionService.doAction.bind(this.actionService, syncResult.action),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.dialog.add(AlertDialog, {
|
||||
title: this.env._t("Configuration"),
|
||||
|
||||
Reference in New Issue
Block a user