diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-09-04 16:15:28 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-09-04 16:15:28 +0200 |
| commit | 99426b95b5a332626f0fcd7f2e19c1f917159de6 (patch) | |
| tree | 55261b6159a6bc36676e903c8c46daa023ddf1f1 /addons/web/static/src/js/framework | |
| parent | 583fcf0a67969b7463572310604e06c52a750812 (diff) | |
| parent | c5df78f38bd476bc225778d1c30ff3061e9b23bc (diff) | |
[MERGE] forward port branch 10.0 up to c5df78f38bd
Diffstat (limited to 'addons/web/static/src/js/framework')
| -rw-r--r-- | addons/web/static/src/js/framework/utils.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js index e19246823c5..0dc66c6817f 100644 --- a/addons/web/static/src/js/framework/utils.js +++ b/addons/web/static/src/js/framework/utils.js @@ -350,6 +350,15 @@ function round_decimals (value, decimals) { return round_precision(value, Math.pow(10,-decimals)); } +/* Rounds a value according to a currency's digits + * @param {dict} The dict containing the currency's info, usually retrieved with session.get_currency + * @param {Number} The value to be rounded + */ +function round_currency(currency_dict, value) { + var digits = currency_dict && currency_dict.digits[1] || 4; + return round_decimals(value, digits); +} + function float_is_zero (value, decimals) { var epsilon = Math.pow(10, -decimals); return Math.abs(round_precision(value, epsilon)) < epsilon; @@ -516,6 +525,7 @@ return { human_number: human_number, round_precision: round_precision, round_decimals: round_decimals, + round_currency: round_currency, float_is_zero: float_is_zero, confine: confine, assert: assert, |
