[IMP] kpi_dashboard: Allow to set a context on the action

This commit is contained in:
Enric Tobella
2020-07-16 16:55:06 +02:00
parent 698138ca3f
commit 841f590edb
4 changed files with 14 additions and 7 deletions

View File

@@ -82,7 +82,10 @@ odoo.define('kpi_dashboard.AbstractWidget', function (require) {
_onClickDirectAction: function(event) {
event.preventDefault();
var $data = $(event.currentTarget).closest('a');
return this.do_action($($data).data('id'));
var action = this.actions[$($data).data('id')];
return this.do_action(action.id, {
additional_context: action.context
});
}
});

View File

@@ -19,9 +19,10 @@
</t>
<t t-name="kpi_dashboard.ManagePanel">
<t t-if="widget.actions" >
<t t-foreach="widget.actions" t-as="action">
<t t-foreach="widget.actions" t-as="action_id">
<t t-set="action" t-value="widget.actions[action_id]"/>
<div role="menuitem" class="">
<a role="menuitem" href="#" class="direct_action" t-att-data-id="action.id" t-att-data-type="action.type">Go to <t t-esc="action.name"/></a>
<a role="menuitem" href="#" class="direct_action" t-att-data-id="action_id" t-att-data-type="action.type">Go to <t t-esc="action.name"/></a>
</div>
</t>
</t>