From e1fdc523c6e49828210d7962725d1348d6425317 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 30 Jun 2021 13:22:47 +0000 Subject: [PATCH] [FIX] mail: remove non-owl t-raw The Activity widget is apparently completely unused now that owl, so remove it, and its template --- addons/calendar/__manifest__.py | 1 - .../calendar/static/src/js/mail_activity.js | 60 ---------- addons/mail/static/src/js/activity.js | 105 ----------------- addons/mail/static/src/xml/activity.xml | 108 ------------------ 4 files changed, 274 deletions(-) delete mode 100644 addons/calendar/static/src/js/mail_activity.js diff --git a/addons/calendar/__manifest__.py b/addons/calendar/__manifest__.py index f44f1abeca5..a10644bcdca 100644 --- a/addons/calendar/__manifest__.py +++ b/addons/calendar/__manifest__.py @@ -45,7 +45,6 @@ If you need to manage your meetings, you should install the CRM module. 'calendar/static/src/js/calendar_controller.js', 'calendar/static/src/js/calendar_model.js', 'calendar/static/src/js/calendar_view.js', - 'calendar/static/src/js/mail_activity.js', 'calendar/static/src/js/systray_activity_menu.js', 'calendar/static/src/js/services/calendar_notification_service.js', ], diff --git a/addons/calendar/static/src/js/mail_activity.js b/addons/calendar/static/src/js/mail_activity.js deleted file mode 100644 index b25cc663204..00000000000 --- a/addons/calendar/static/src/js/mail_activity.js +++ /dev/null @@ -1,60 +0,0 @@ -odoo.define('calendar.Activity', function (require) { -"use strict"; - -var Activity = require('@mail/js/activity')[Symbol.for("default")]; -var Dialog = require('web.Dialog'); -var core = require('web.core'); -var _t = core._t; - -Activity.include({ - - /** - * Override behavior to redirect to calendar event instead of activity - * - * @override - */ - _onEditActivity: function (event, options) { - var self = this; - var activity_id = $(event.currentTarget).data('activity-id'); - var activity = _.find(this.activities, function (act) { return act.id === activity_id; }); - if (activity && activity.activity_category === 'meeting' && activity.calendar_event_id) { - return self._super(event, _.extend({ - res_model: 'calendar.event', - res_id: activity.calendar_event_id[0], - })); - } - return self._super(event, options); - }, - - /** - * Override behavior to warn that the calendar event is about to be removed as well - * - * @override - */ - _onUnlinkActivity: function (event, options) { - event.preventDefault(); - var self = this; - var activity_id = $(event.currentTarget).data('activity-id'); - var activity = _.find(this.activities, function (act) { return act.id === activity_id; }); - if (activity && activity.activity_category === 'meeting' && activity.calendar_event_id) { - Dialog.confirm( - self, - _t("The activity is linked to a meeting. Deleting it will remove the meeting as well. Do you want to proceed ?"), { - confirm_callback: function () { - return self._rpc({ - model: 'mail.activity', - method: 'unlink_w_meeting', - args: [[activity_id]], - }) - .then(self._reload.bind(self, {activity: true})); - }, - } - ); - } - else { - return self._super(event, options); - } - }, -}); - -}); diff --git a/addons/mail/static/src/js/activity.js b/addons/mail/static/src/js/activity.js index eb87a819ede..4bc4761fc62 100644 --- a/addons/mail/static/src/js/activity.js +++ b/addons/mail/static/src/js/activity.js @@ -539,109 +539,6 @@ var BasicActivity = AbstractField.extend({ }, }); -// ----------------------------------------------------------------------------- -// Activities Widget for Form views ('mail_activity' widget) -// ----------------------------------------------------------------------------- -// FIXME seems to still be needed in some cases like systray -var Activity = BasicActivity.extend({ - className: 'o_mail_activity', - events: _.extend({}, BasicActivity.prototype.events, { - 'click a': '_onClickRedirect', - }), - specialData: '_fetchSpecialActivity', - /** - * @override - */ - init: function () { - this._super.apply(this, arguments); - this._activities = this.record.specialData[this.name]; - }, - /** - * @override - */ - destroy: function () { - this._unbindOnUploadAction(); - return this._super.apply(this, arguments); - }, - - //------------------------------------------------------------ - // Private - //------------------------------------------------------------ - /** - * @private - * @param {Object} fieldsToReload - */ - _reload: function (fieldsToReload) { - this.trigger_up('reload_mail_fields', fieldsToReload); - }, - /** - * @override - * @private - */ - _render: function () { - _.each(this._activities, function (activity) { - var note = mailUtils.parseAndTransform(activity.note || '', mailUtils.inline); - var is_blank = (/^\s*$/).test(note); - if (!is_blank) { - activity.note = mailUtils.parseAndTransform(activity.note, mailUtils.addLink); - } else { - activity.note = ''; - } - }); - var activities = setFileUploadID(setDelayLabel(this._activities)); - if (activities.length) { - var nbActivities = _.countBy(activities, 'state'); - this.$el.html(QWeb.render('mail.activity_items', { - uid: session.uid, - activities: activities, - nbPlannedActivities: nbActivities.planned, - nbTodayActivities: nbActivities.today, - nbOverdueActivities: nbActivities.overdue, - dateFormat: time.getLangDateFormat(), - datetimeFormat: time.getLangDatetimeFormat(), - session: session, - widget: this, - })); - this._bindOnUploadAction(this._activities); - } else { - this._unbindOnUploadAction(this._activities); - this.$el.empty(); - } - }, - /** - * @override - * @private - * @param {Object} record - */ - _reset: function (record) { - this._super.apply(this, arguments); - this._activities = this.record.specialData[this.name]; - // the mail widgets being persistent, one need to update the res_id on reset - this.res_id = record.res_id; - }, - - //------------------------------------------------------------ - // Handlers - //------------------------------------------------------------ - - /** - * @private - * @param {MouseEvent} ev - */ - _onClickRedirect: function (ev) { - var id = $(ev.currentTarget).data('oe-id'); - if (id) { - ev.preventDefault(); - var model = $(ev.currentTarget).data('oe-model'); - this.trigger_up('redirect', { - res_id: id, - res_model: model, - }); - } - }, - -}); - // ----------------------------------------------------------------------------- // Activities Widget for Kanban views ('kanban_activity' widget) // ----------------------------------------------------------------------------- @@ -861,5 +758,3 @@ field_registry .add('kanban_activity', KanbanActivity) .add('list_activity', ListActivity) .add('activity_exception', ActivityException); - -export default Activity; diff --git a/addons/mail/static/src/xml/activity.xml b/addons/mail/static/src/xml/activity.xml index ec83191b4fe..74735cf214c 100644 --- a/addons/mail/static/src/xml/activity.xml +++ b/addons/mail/static/src/xml/activity.xml @@ -1,113 +1,5 @@ - - -
- -
-
-
- - -
-
-
-
- : - “” - - for - - -
-
-
Activity type
-
- -
-
Created on
-
- - by - - -
-
Assigned to
-
- - - , due on -
-
-
-
-
- -
- -
- -
- - : - Preview - or - Send Now -
-
-
-
-
- -
-
-
-
-
-
- -
- - - Mark Done - - - - Upload Document - - - - - /web/binary/upload_attachment - - - - - - Edit - - - Cancel - -
-