Skip to content
Snippets Groups Projects
Commit b786adf2 authored by Tiffany Chang (tic)'s avatar Tiffany Chang (tic)
Browse files

[IMP] Mail: Add optional activity domain for systray

Addition of this optional 'domain' value for systray activity related
lines allows the restriction of which activities will be included in
the view opened when the line is clicked on.

One use case is when a model is split between 2 systray activity lines.
In this case we most likely do not want the same activities of the
model to show up when we click on either line. For example, say we
have 2 modules using the same model, but the module instances of that
model are distingushed by a field.Selection value. Then we would only
want to show the activities related to each module when we click on
their appropriate systray activity lines based on that field.Selection
value.

Task: 2169498
parent abaae1e4
No related branches found
No related tags found
No related merge requests found
......@@ -111,13 +111,18 @@ var ActivityMenu = Widget.extend({
if (actionXmlid) {
this.do_action(actionXmlid);
} else {
var domain = [['activity_ids.user_id', '=', session.uid]]
if (targetAction.data('domain')) {
domain = domain.concat(targetAction.data('domain'))
}
this.do_action({
type: 'ir.actions.act_window',
name: targetAction.data('model_name'),
views: [[false, 'activity'], [false, 'kanban'], [false, 'list']],
view_mode: 'activity',
res_model: targetAction.data('res_model'),
domain: [['activity_ids.user_id', '=', session.uid]],
domain: domain,
});
}
},
......@@ -140,13 +145,19 @@ var ActivityMenu = Widget.extend({
// 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;
var domain = [['activity_ids.user_id', '=', session.uid]]
if (data.domain) {
domain = domain.concat(data.domain)
}
this.do_action({
type: 'ir.actions.act_window',
name: data.model_name,
res_model: data.res_model,
views: [[false, 'kanban'], [false, 'list'], [false, 'form']],
search_view_id: [false],
domain: [['activity_user_id', '=', session.uid]],
domain: domain,
context:context,
});
},
......
......@@ -71,7 +71,7 @@
</div>
</t>
<t t-foreach="activities" t-as="activity">
<div class="o_mail_preview o_systray_activity" t-att-data-res_model="activity.model" t-att-data-model_name="activity.name" data-filter='my'>
<div class="o_mail_preview o_systray_activity" t-att-data-res_model="activity.model" t-att-data-model_name="activity.name" t-att-data-domain="activity.domain" data-filter='my'>
<div t-if="activity.icon" class="o_mail_preview_image o_mail_preview_app">
<img t-att-src="activity.icon" alt="Activity"/>
</div>
......@@ -87,7 +87,8 @@
t-att-class="'o_mail_activity_action btn btn-link fa ' + action.icon"
t-att-data-action_xmlid="action.action_xmlid"
t-att-data-res_model="activity.model"
t-att-data-model_name="activity.name">
t-att-data-model_name="activity.name"
t-att-data-domain="activity.domain">
</button>
</t>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment