summaryrefslogtreecommitdiff
path: root/addons/web/static/src/xml/base.xml
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-04-09 14:32:37 +0200
committerGéry Debongnie <ged@odoo.com>2018-04-10 17:41:12 +0200
commit8dbc1d95c36b18398c7284eddda2fe48842a8904 (patch)
tree35c0de6d39b5ecbcd1c77437c5408fa4f8b6a849 /addons/web/static/src/xml/base.xml
parent36b4468d15bf96de097cfc3d7e2d5f99febb984b (diff)
[IMP] web: many2one as measure in graph & pivot only when desirable
With this commit, the fields many2one are not always measures in pivot and graph views. By default, they are *not* measures. In order to have them as measures, we should pass `additionalMeasures` as a param to any of the views, which contains a list of fields to consider as measures. example: Suppose a model with the following fields: - `product_id` (many2one) - `categ_id` (many2one) - `sold` (float) By default, only the field `sold` is a measure in a graph or pivot view. In order to pass `product_id` as a measure of a graph view, you should instantiate this view as follow: `` var viewInfo = /* ... */; var params = { additionalMeasures = ['product_id'], }; var graph = new GraphView(viewInfo, params); `` An exception to the rule above is when the many2one field is of type `measure` in the arch: this field is set as the default measure of the view, therefore it is implicitly added as an additional measure.
Diffstat (limited to 'addons/web/static/src/xml/base.xml')
-rw-r--r--addons/web/static/src/xml/base.xml2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 96f80c96eb2..0cd931553f0 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -498,7 +498,7 @@
</button>
<ul class="dropdown-menu o_graph_measures_list">
<li t-foreach="measures" t-as="measure" t-att-data-field="measure[0]">
- <a href="#"><t t-esc="measure[1].string"/></a>
+ <a href="#"><t t-esc="measure[1].string"/><t t-if="measure[1].type === 'many2one'"> (count)</t></a>
</li>
<li class="divider"></li>
<li data-field="__count__"><a href="#">Count</a></li>