diff options
| author | Sébastien Mottet (oms) <oms@odoo.com> | 2020-04-23 08:31:30 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-30 11:34:36 +0000 |
| commit | debeec1201d447b24674449cfaf6ebd94b4e41ae (patch) | |
| tree | d92dacdbe64e9e1560defb27435d63055ca1e89d /addons | |
| parent | 8b6b09fc26dc35f57a68584a668940e1d8bde1ff (diff) | |
[IMP] mail, crm: add view types for crm.lead model when coming from activity menu
Purpose of this commit is to allow customization of view types available when
using the activity menu. By default only kanban, list and form are available
as before.
Calendar, pivot, graph and activity have been added for leads, allowing
better user experience in their use of activities.
Task ID: 2228451
Community PR odoo/odoo#50042
Enterprise PR odoo/enterprise#10145
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/crm/static/src/js/systray_activity_menu.js | 26 | ||||
| -rw-r--r-- | addons/crm/views/assets.xml | 6 | ||||
| -rw-r--r-- | addons/mail/static/src/js/systray/systray_activity_menu.js | 12 |
3 files changed, 43 insertions, 1 deletions
diff --git a/addons/crm/static/src/js/systray_activity_menu.js b/addons/crm/static/src/js/systray_activity_menu.js new file mode 100644 index 00000000000..fd3388b2335 --- /dev/null +++ b/addons/crm/static/src/js/systray_activity_menu.js @@ -0,0 +1,26 @@ +odoo.define('crm.systray.ActivityMenu', function (require) { +"use strict"; + +var ActivityMenu = require('mail.systray.ActivityMenu'); + +ActivityMenu.include({ + + //-------------------------------------------------- + // Private + //-------------------------------------------------- + + /** + * @override + */ + _getViewsList(model) { + if (model === "crm.lead") { + return [[false, 'kanban'], [false, 'list'], + [false, 'form'], [false, 'calendar'], + [false, 'pivot'], [false, 'graph'], + [false, 'activity'] + ]; + } + return this._super(...arguments); + }, +}); +}); diff --git a/addons/crm/views/assets.xml b/addons/crm/views/assets.xml index 5e601559a8e..a06748512c5 100644 --- a/addons/crm/views/assets.xml +++ b/addons/crm/views/assets.xml @@ -5,4 +5,10 @@ <script type="text/javascript" src="/crm/static/src/js/tours/crm.js"></script> </xpath> </template> + + <template id="assets_backend" name="CRM assets backend" inherit_id="web.assets_backend"> + <xpath expr="." position="inside"> + <script type="text/javascript" src="/crm/static/src/js/systray_activity_menu.js"/> + </xpath> + </template> </odoo> diff --git a/addons/mail/static/src/js/systray/systray_activity_menu.js b/addons/mail/static/src/js/systray/systray_activity_menu.js index aada48357b5..98fd27dbbe4 100644 --- a/addons/mail/static/src/js/systray/systray_activity_menu.js +++ b/addons/mail/static/src/js/systray/systray_activity_menu.js @@ -60,6 +60,16 @@ var ActivityMenu = Widget.extend({ }); }, /** + * Return views to display when coming from systray depending on the model. + * + * @private + * @param {string} model + * @returns {Array[]} output the list of views to display. + */ + _getViewsList(model) { + return [[false, 'kanban'], [false, 'list'], [false, 'form']]; + }, + /** * Update(render) activity system tray view on activity updation. * @private */ @@ -155,7 +165,7 @@ var ActivityMenu = Widget.extend({ type: 'ir.actions.act_window', name: data.model_name, res_model: data.res_model, - views: [[false, 'kanban'], [false, 'list'], [false, 'form']], + views: this._getViewsList(data.res_model), search_view_id: [false], domain: domain, context:context, |
