summaryrefslogtreecommitdiff
path: root/addons/google_calendar/static/src/js/google_calendar_popover.js
diff options
context:
space:
mode:
authorAurélien (avd) <avd@odoo.com>2021-02-04 13:22:15 +0000
committerAurélien (avd) <avd@odoo.com>2021-02-04 14:09:10 +0000
commit0564b4a6dacf449e2a87dfdd58bb48b4e79ebfab (patch)
treeca13cdd44b47a3f82d4acb079f98af378f327a67 /addons/google_calendar/static/src/js/google_calendar_popover.js
parent506755ef8ced187c0f5cd2fa600e7bb1e1fc0fe3 (diff)
[IMP] google_calendar: allow to archive from calendar view
Change Delete secondary button on calendar popover to Archive for synced calendar event. This makes it easier to delete synced calendar events.
Diffstat (limited to 'addons/google_calendar/static/src/js/google_calendar_popover.js')
-rw-r--r--addons/google_calendar/static/src/js/google_calendar_popover.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/google_calendar/static/src/js/google_calendar_popover.js b/addons/google_calendar/static/src/js/google_calendar_popover.js
new file mode 100644
index 00000000000..89296d62113
--- /dev/null
+++ b/addons/google_calendar/static/src/js/google_calendar_popover.js
@@ -0,0 +1,26 @@
+odoo.define('google_calendar.GoogleCalendarPopover', function(require) {
+ "use strict";
+
+ const CalendarPopover = require('web.CalendarPopover');
+
+ const GoogleCalendarPopover = CalendarPopover.include({
+ events: _.extend({}, CalendarPopover.prototype.events, {
+ 'click .o_cw_popover_archive_g': '_onClickPopoverGArchive',
+ }),
+
+ isGEventSyncedAndArchivable() {
+ return this.event.extendedProps.record.google_id;
+ },
+
+ isEventDeletable() {
+ return !this.isGEventSyncedAndArchivable() && this._super();
+ },
+
+ _onClickPopoverGArchive: function (ev) {
+ ev.preventDefault();
+ this.trigger_up('archive_event', {id: this.event.id});
+ },
+ })
+
+ return GoogleCalendarPopover;
+});