summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2020-02-17 16:41:00 +0000
committerNicolas Lempereur <nle@odoo.com>2020-02-24 12:46:46 +0000
commit78545ce0edf73dffc27a0923e12240bddfdcee64 (patch)
treee427d002cef4bbc4c8b745bf41b94ff1c6cf115b /addons/web/static/src/js
parentfd0937bdc786b47dfbb7b1785de750eecb2cc6ba (diff)
[FIX] web: digits option for aggregate is taken into account
If you have a currency with 3 decimals, when you show a list view grouped, you might have result like: [group partner 1 : amount : 4.4€] - amount : 1.11€ - amount : 3.33€ which is a little odd, it is not that odd since the groupings are an approximation (eg. you could have a line in EUR and a line in USD and the grouping value would be the sum of both line). But there is no way to specify another precision, and since this is a grouping it could be of line of different currencies so we can't use the lines currency to decide. With this changeset, having for example: <field name="amount" digits="[69,3]"/> with `digits` attribute is taken into account for the aggregate value and it would be displayed with 3 decimals. Without the fix, the added test fails with: aggregates monetary use digits attribute if available Expected: "2000.000", Result: "2000.00" opw-2195042 closes #45545 closes odoo/odoo#46094 X-original-commit: 4dd293c71851d0c6e9ffe09402cf54cfe889f402 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/list/list_renderer.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js
index c3581cb1564..cf47c997597 100644
--- a/addons/web/static/src/js/views/list/list_renderer.js
+++ b/addons/web/static/src/js/views/list/list_renderer.js
@@ -352,7 +352,10 @@ var ListRenderer = BasicRenderer.extend({
if (!formatFunc) {
formatFunc = field_utils.format[field.type];
}
- var formattedValue = formatFunc(value, field, { escape: true });
+ var formattedValue = formatFunc(value, field, {
+ escape: true,
+ digits: column.attrs.digits ? JSON.parse(column.attrs.digits) : undefined,
+ });
$cell.addClass('o_list_number').attr('title', help).html(formattedValue);
}
return $cell;