summaryrefslogtreecommitdiff
path: root/addons/google_calendar/static/src/js/google_calendar_popover.js
blob: 89296d62113e0980691c08d68e535546c4a6db93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
});