[FIX] website: use correct action domain on dashboard
Without this commit, when clicking on a metric on the website dashboard, it
would not load the correct data.
Indeed, the dashboard is loaded for a specific website only, but clicking on a
metric opens the data for every website together.
Step to reproduce:
- Make some orders on 2 differents website ecommerce
- OPTIONAL: Get through the payment on some orders, then just leave some
products in the cart afterward to have some unpaid orders
- Go to the website dashboard, you see some metrics
- Change the selected website on top right, you see the metrics adapts
correctly
- Click on a metric, it doesn't fit the number you clicked on. For instance,
if you had 1 Unpaid Orders for website 1 and 3 Unpaid Orders for website 2,
you see 4 orders in the tree view once you have clicked the metric.
This commit ensures the correct website is appended to every dashboard action
domain.
opw-2369420
Fixes #44926, fixes #51125
X-original-commit: 06f954787cf60e657768e365a15ea4513d459c0b
This commit is contained in:
@@ -6,6 +6,7 @@ var ajax = require('web.ajax');
|
||||
var core = require('web.core');
|
||||
var Dialog = require('web.Dialog');
|
||||
var field_utils = require('web.field_utils');
|
||||
var pyUtils = require('web.py_utils');
|
||||
var session = require('web.session');
|
||||
var time = require('web.time');
|
||||
var web_client = require('web.web_client');
|
||||
@@ -353,6 +354,7 @@ var Dashboard = AbstractAction.extend({
|
||||
|
||||
on_dashboard_action: function (ev) {
|
||||
ev.preventDefault();
|
||||
var self = this
|
||||
var $action = $(ev.currentTarget);
|
||||
var additional_context = {};
|
||||
if (this.date_range === 'week') {
|
||||
@@ -362,9 +364,18 @@ var Dashboard = AbstractAction.extend({
|
||||
} else if (this.date_range === 'year') {
|
||||
additional_context = {search_default_year: true};
|
||||
}
|
||||
this.do_action($action.attr('name'), {
|
||||
additional_context: additional_context,
|
||||
on_reverse_breadcrumb: this.on_reverse_breadcrumb
|
||||
this._rpc({
|
||||
route: '/web/action/load',
|
||||
params: {
|
||||
'action_id': $action.attr('name'),
|
||||
},
|
||||
})
|
||||
.then(function (action) {
|
||||
action.domain = pyUtils.assembleDomains([action.domain, `[('website_id', '=', ${self.website_id})]`]);
|
||||
return self.do_action(action, {
|
||||
'additional_context': additional_context,
|
||||
'on_reverse_breadcrumb': self.on_reverse_breadcrumb
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user