[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>
This commit is contained in:
Sébastien Mottet (oms)
2020-04-30 11:34:36 +00:00
committed by Thibault Delavallée
parent 8b6b09fc26
commit debeec1201
3 changed files with 43 additions and 1 deletions
@@ -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);
},
});
});
+6
View File
@@ -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>
@@ -59,6 +59,16 @@ var ActivityMenu = Widget.extend({
method: 'get_activity_view_id'
});
},
/**
* 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,