diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/microsoft_calendar/static/src/js/microsoft_calendar_popover.js | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/microsoft_calendar/static/src/js/microsoft_calendar_popover.js')
| -rw-r--r-- | addons/microsoft_calendar/static/src/js/microsoft_calendar_popover.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/microsoft_calendar/static/src/js/microsoft_calendar_popover.js b/addons/microsoft_calendar/static/src/js/microsoft_calendar_popover.js new file mode 100644 index 00000000..2699e0b3 --- /dev/null +++ b/addons/microsoft_calendar/static/src/js/microsoft_calendar_popover.js @@ -0,0 +1,34 @@ +odoo.define('microsoft_calendar.MicrosoftCalendarPopover', function(require) { + "use strict"; + + const CalendarPopover = require('web.CalendarPopover'); + + const MicrosoftCalendarPopover = CalendarPopover.include({ + events: _.extend({}, CalendarPopover.prototype.events, { + 'click .o_cw_popover_archive_m': '_onClickPopoverArchive', + }), + + /** + * We only want one 'Archive' button in the popover + * so if Google Sync is also active, it takes precedence + * over this popvoer. + */ + isMEventSyncedAndArchivable() { + if (this.event.extendedProps.record.google_id === undefined) { + return this.event.extendedProps.record.microsoft_id; + } + return !this.event.extendedProps.record.google_id && this.event.extendedProps.record.microsoft_id + }, + + isEventDeletable() { + return !this.isMEventSyncedAndArchivable() && this._super(); + }, + + _onClickPopoverArchive: function (ev) { + ev.preventDefault(); + this.trigger_up('archive_event', {id: this.event.id}); + }, + }); + + return MicrosoftCalendarPopover; +}); |
