summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2015-05-12 13:26:53 +0200
committerMartin Geubelle <mge@odoo.com>2015-05-12 17:16:19 +0200
commitcc6a6076dea4971259693cd27404a392164d34bd (patch)
tree691d804034788601292d66c2adda6ce0a88ede0f /addons/web/static/src/js/framework
parenta86d6a7df980d55dd0af007f77c6bb039771525a (diff)
[ADD] web : progress bar widget + method for human readable big numbers
Diffstat (limited to 'addons/web/static/src/js/framework')
-rw-r--r--addons/web/static/src/js/framework/utils.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js
index 393f3766bed..a7852ce4442 100644
--- a/addons/web/static/src/js/framework/utils.js
+++ b/addons/web/static/src/js/framework/utils.js
@@ -292,6 +292,22 @@ function human_size (size) {
}
/**
+ * Returns a human readable number
+ *
+ * @param {Number} number
+ */
+function human_number (number) {
+ var units = _t(",k,M").split(',');
+ var i = 0;
+ while (number >= 1000) {
+ number /= 1000;
+ ++i;
+ }
+ // return number.toFixed(2) + ' ' + units[i];
+ return parseInt(number) + ' ' + units[i];
+}
+
+/**
* performs a half up rounding with arbitrary precision, correcting for float loss of precision
* See the corresponding float_round() in server/tools/float_utils.py for more info
* @param {Number} the value to be rounded
@@ -394,6 +410,7 @@ return {
is_bin_size: is_bin_size,
binary_to_binsize: binary_to_binsize,
human_size: human_size,
+ human_number: human_number,
round_precision: round_precision,
round_decimals: round_decimals,
float_is_zero: float_is_zero,