diff options
| author | Hiral Bhavsar <hbh@odoo.com> | 2019-02-04 06:18:08 +0000 |
|---|---|---|
| committer | Martin Geubelle <mge@odoo.com> | 2019-05-03 10:19:40 +0000 |
| commit | b2de618f9ff9969ff0644f3be10752f23d9738dc (patch) | |
| tree | a7f54bb16273f3b626a96d363e0f54bf19bb4ba3 /addons/mail/static/src/js/views/activity/activity_controller.js | |
| parent | b29d4da037fbf73717cccdfcdf76d96e5b1b009b (diff) | |
[IMP] base,mail: allow to customize the activity view
The activity view has been greatly improved to allow to customize it
more easily. It works quite similarly to the kanban view, defining
`<field>` tags at the top and using these fields in the `<template>`
section. The template name used to define the activity cards is
`activity-box`.
Note that these activity cards are rendered using `KanbanRecord` widget
(this has implied that ActivityView inherits from `BasicView`).
Also note that the view validation has been moved in base to include the
common grammar.
Task 1894990
Diffstat (limited to 'addons/mail/static/src/js/views/activity/activity_controller.js')
| -rw-r--r-- | addons/mail/static/src/js/views/activity/activity_controller.js | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/addons/mail/static/src/js/views/activity/activity_controller.js b/addons/mail/static/src/js/views/activity/activity_controller.js index 6af4c310c01..4ed543dd3ec 100644 --- a/addons/mail/static/src/js/views/activity/activity_controller.js +++ b/addons/mail/static/src/js/views/activity/activity_controller.js @@ -1,34 +1,30 @@ odoo.define('mail.ActivityController', function (require) { "use strict"; -var AbstractController = require('web.AbstractController'); +var BasicController = require('web.BasicController'); -var ActivityController = AbstractController.extend({ - custom_events: _.extend({}, AbstractController.prototype.custom_events, { +var ActivityController = BasicController.extend({ + custom_events: _.extend({}, BasicController.prototype.custom_events, { send_mail_template: '_onSendMailTemplate', - open_view_form: '_onOpenViewForm', - reload: '_onReload', }), //-------------------------------------------------------------------------- - // Handlers + // Public //-------------------------------------------------------------------------- /** - * @private - * @param {OdooEvent} event - * @param {string} event.name - * @param {Object} event.data - * @param {boolean} [event.data.activity] - * @param {boolean} [event.data.followers] - * @param {boolean} [event.data.thread] + * Overridden to remove the pager as it makes no sense in this view. + * + * @override */ - _onReload: function (event) { - event.stopPropagation(); - var self = this; - this.model.reload().then(self.reload()); + renderPager: function () { + return Promise.resolve(); }, + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + /** * @private * @param {OdooEvent} ev @@ -36,8 +32,8 @@ var ActivityController = AbstractController.extend({ _onSendMailTemplate: function (ev) { var templateID = ev.data.templateID; var activityTypeID = ev.data.activityTypeID; - var state = this.model.get(); - var groupedActivities = state.data.grouped_activities; + var state = this.model.get(this.handle); + var groupedActivities = state.grouped_activities; var resIDS = []; Object.keys(groupedActivities).forEach(function (resID) { var activityByType = groupedActivities[resID]; @@ -52,21 +48,6 @@ var ActivityController = AbstractController.extend({ args: [resIDS, templateID], }); }, - /** - * @private - * @override - * @param {MouseEvent} ev - */ - _onOpenViewForm: function (ev) { - var resID = ev.data.resID; - this.do_action({ - type: 'ir.actions.act_window', - res_model: this.model.modelName, - res_id: resID, - views: [[false, 'form']], - target: 'current' - }); - }, }); return ActivityController; |
