summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/graph/graph_view.js12
-rw-r--r--addons/web/static/src/js/views/pivot/pivot_view.js8
2 files changed, 14 insertions, 6 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_view.js b/addons/web/static/src/js/views/graph/graph_view.js
index 8cfe2dc0272..54ff6642b15 100644
--- a/addons/web/static/src/js/views/graph/graph_view.js
+++ b/addons/web/static/src/js/views/graph/graph_view.js
@@ -36,12 +36,15 @@ var GraphView = AbstractView.extend({
/**
* @override
*/
- init: function () {
+ init: function (viewInfo, params) {
this._super.apply(this, arguments);
+ var self = this;
var measure;
var groupBys = [];
+ var measures = {__count__: {string: _t("Count"), type: "integer"}};
this.fields.__count__ = {string: _t("Count"), type: "integer"};
+
this.arch.children.forEach(function (field) {
var name = field.attrs.name;
if (field.attrs.interval) {
@@ -49,16 +52,17 @@ var GraphView = AbstractView.extend({
}
if (field.attrs.type === 'measure') {
measure = name;
+ measures[name] = self.fields[name];
} else {
groupBys.push(name);
}
});
- var measures = {__count__: {string: _t("Count"), type: "integer"}};
_.each(this.fields, function (field, name) {
if (name !== 'id' && field.store === true) {
- if (field.type === 'integer' || field.type === 'float' || field.type === 'monetary' || field.type === 'many2one') {
- measures[name] = field;
+ if (_.contains(['integer', 'float', 'monetary'], field.type) ||
+ _.contains(params.additionalMeasures, name)) {
+ measures[name] = field;
}
}
});
diff --git a/addons/web/static/src/js/views/pivot/pivot_view.js b/addons/web/static/src/js/views/pivot/pivot_view.js
index 199042ec12a..e0b232b6310 100644
--- a/addons/web/static/src/js/views/pivot/pivot_view.js
+++ b/addons/web/static/src/js/views/pivot/pivot_view.js
@@ -35,6 +35,8 @@ var PivotView = AbstractView.extend({
init: function (viewInfo, params) {
this._super.apply(this, arguments);
+ var self = this;
+
var activeMeasures = [];
var colGroupBys = [];
var rowGroupBys = [];
@@ -45,8 +47,9 @@ var PivotView = AbstractView.extend({
this.fields.__count = {string: _t("Count"), type: "integer"};
_.each(this.fields, function (field, name) {
if ((name !== 'id') && (field.store === true)) {
- if (_.contains(['integer', 'float', 'monetary', 'many2one'], field.type)) {
- measures[name] = field;
+ if (_.contains(['integer', 'float', 'monetary'], field.type) ||
+ _.contains(params.additionalMeasures, name)) {
+ measures[name] = field;
}
if (_.contains(GROUPABLE_TYPES, field.type)) {
groupableFields[name] = field;
@@ -73,6 +76,7 @@ var PivotView = AbstractView.extend({
}
if (field.attrs.type === 'measure' || 'operator' in field.attrs) {
activeMeasures.push(name);
+ measures[name] = self.fields[name];
}
if (field.attrs.type === 'col') {
colGroupBys.push(name);