[IMP] crm: Redirect to activity view from systray

Purpose: Redirect to lead activity view when clicking
on activity systray for leads. The idea is to give the
user a quick overview of his "To Do List" activities.

Specification: The path from the systray (opportunity/leads)
should redirect to the view with the buttons instead of the
one from the pipeline.

On top of the existing filters/domain, it adds the time-based
filter : Today, Late, Future Activities, ...

Task ID-2281254
Community PR odoo#55383

closes odoo/odoo#55413

X-original-commit: 0cee7f48ce44cea6aa31fcace40206eaed5315ca
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Pierre Collinet (pic)
2020-08-04 15:09:20 +00:00
committed by Thibault Delavallée
parent 656e322be8
commit af7b23f4ae
2 changed files with 31 additions and 1 deletions
@@ -22,5 +22,35 @@ ActivityMenu.include({
}
return this._super(...arguments);
},
//-----------------------------------------
// Handlers
//-----------------------------------------
/**
* @private
* @override
*/
_onActivityFilterClick: function (event) {
// fetch the data from the button otherwise fetch the ones from the parent (.o_mail_preview).
var data = _.extend({}, $(event.currentTarget).data(), $(event.target).data());
var context = {};
if (data.res_model === "crm.lead") {
if (data.filter === 'my') {
context['search_default_activities_overdue'] = 1;
context['search_default_activities_today'] = 1;
} else {
context['search_default_activities_' + data.filter] = 1;
}
// Necessary because activity_ids of mail.activity.mixin has auto_join
// So, duplicates are faking the count and "Load more" doesn't show up
context['force_search_count'] = 1;
this.do_action('crm.crm_lead_action_my_activities', {
additional_context: context
});
} else {
this._super.apply(this, arguments);
}
},
});
});
+1 -1
View File
@@ -887,7 +887,7 @@ if record:
<field name="res_model">crm.lead</field>
<field name="view_mode">tree,kanban,graph,pivot,calendar,form,activity</field>
<field name="view_id" ref="crm_lead_view_list_activities"/>
<field name="domain">[('type','=','opportunity'), ('activity_ids','!=',False)]</field>
<field name="domain">[('activity_ids','!=',False)]</field>
<field name="search_view_id" ref="crm.view_crm_case_my_activities_filter"/>
<field name="context">{'default_type': 'opportunity',
'search_default_assigned_to_me': 1}