summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/graph/graph_model.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-07-27 16:03:10 +0200
committerAaron Bohy <aab@odoo.com>2017-07-28 09:27:31 +0200
commit2ba72fb2248665a4b06d1ea99452edc5acadc344 (patch)
treee21e6db37e17f63e6d538ed5a0146e6845da8117 /addons/web/static/src/js/views/graph/graph_model.js
parent3b3f6f04af79d7dcc4461262e14e05096d76180b (diff)
[FIX] web: graph: reload with correct fields
A traceback occurred when trying to reload a graph view with no groupBy in the searchview, because the array of fields to read given to the read_group RPC didn't contain the default groupBy field (Error "Fields in 'groupby' must appear in the list of fields to read"), e.g. in Sales > My Pipeline.
Diffstat (limited to 'addons/web/static/src/js/views/graph/graph_model.js')
-rw-r--r--addons/web/static/src/js/views/graph/graph_model.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_model.js b/addons/web/static/src/js/views/graph/graph_model.js
index 8a7f5da6d5d..50e9f224697 100644
--- a/addons/web/static/src/js/views/graph/graph_model.js
+++ b/addons/web/static/src/js/views/graph/graph_model.js
@@ -114,13 +114,13 @@ return AbstractModel.extend({
* @returns {Deferred}
*/
_loadGraph: function () {
- var fields = _.map(this.chart.groupedBy, function (groupBy) {
+ var groupedBy = this.chart.groupedBy.length ? this.chart.groupedBy : this.initialGroupBys;
+ var fields = _.map(groupedBy, function (groupBy) {
return groupBy.split(':')[0];
});
if (this.chart.measure !== '__count__') {
fields = fields.concat(this.chart.measure);
}
- var groupedBy = this.chart.groupedBy.length ? this.chart.groupedBy : this.initialGroupBys;
return this._rpc({
model: this.modelName,
method: 'read_group',