summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/pivot/pivot_view.js
diff options
context:
space:
mode:
authorMathieu Duckerts-Antoine <dam@odoo.com>2018-04-05 17:08:26 +0200
committerGéry Debongnie <ged@odoo.com>2018-04-10 17:41:12 +0200
commit47395c6e51ec82283d3cd46e386befc256d8a657 (patch)
treeba8f89cdd2e46ccbe16635939ba3afe318922139 /addons/web/static/src/js/views/pivot/pivot_view.js
parent742476fb20e8183f96c42836552381fff259712c (diff)
[IMP] web: allow using many2one as measure in pivot view
With this commit, we add the possibility of using many2ones as measure. The way a many2one is aggregated is by using the count distinct operator. Some care had to be done to gracefully support the situation when a pivot view is grouped by a m2o field F, and the same field F is used as a measure.
Diffstat (limited to 'addons/web/static/src/js/views/pivot/pivot_view.js')
-rw-r--r--addons/web/static/src/js/views/pivot/pivot_view.js2
1 files changed, 1 insertions, 1 deletions
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 0d42fc7bd46..199042ec12a 100644
--- a/addons/web/static/src/js/views/pivot/pivot_view.js
+++ b/addons/web/static/src/js/views/pivot/pivot_view.js
@@ -45,7 +45,7 @@ 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'], field.type)) {
+ if (_.contains(['integer', 'float', 'monetary', 'many2one'], field.type)) {
measures[name] = field;
}
if (_.contains(GROUPABLE_TYPES, field.type)) {