summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-09-04 17:12:40 +0200
committerChristophe Simonis <chs@odoo.com>2017-09-04 17:12:40 +0200
commitfc2a39cc7d083727af00e920aa0f66fb8785a8a5 (patch)
treef082ea4afc81346c535a192b569439308bbb7ec1 /addons/web/static/src/js
parent39dafce595187e22c9628098940b8b901a58f61a (diff)
parent99426b95b5a332626f0fcd7f2e19c1f917159de6 (diff)
[MERGE] forward port branch saas-14 up to 99426b95b5a
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/framework/utils.js10
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 6b0a2ddbcc0..dd35364a12f 100644
--- a/addons/web/static/src/js/framework/utils.js
+++ b/addons/web/static/src/js/framework/utils.js
@@ -383,6 +383,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;
@@ -550,6 +559,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,