summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/utils.js
diff options
context:
space:
mode:
authorAdrien Dieudonne <adr@odoo.com>2018-07-06 14:22:58 +0200
committerAdrien Dieudonne <adr@odoo.com>2018-07-06 14:22:58 +0200
commit3ebff1f4721dd4a9057db4d26162c57c8506700a (patch)
treee3b02fcc528dcc3a0ae50b55a5d3a1d4708ab992 /addons/web/static/src/js/core/utils.js
parentf9a68d5e778da0ff4e1f1a0936b51b98a822a15a (diff)
parent11b7857af63a35e81daa495bcb3522b3915f32ca (diff)
[MERGE] *: Easy date filters
This commit allow to create easily a range of periods (related to a field of date or datetime type) to select in the filters menu. Two new attributes on elements with tag 'filter' are now usable in combination in a search view arch: - date: string. A valid field name with associated type date or datetime - default_period: string (optional). To choose in the following list: - 'today' - 'this_week' - 'this_month' (default) - 'this_quarter' - 'this_year' - 'yesterday' - 'last_week' - 'last_month' - 'last_quarter' - 'last_year' - 'last_7_days' - 'last_30_days' - 'last_365_days' Example: <filter string="Creation Date" name="period_generator" date="create_date" default_period="this_quarter"/> Note: the attribute 'domain' can not be used for such filters. The generated domains are dynamic and can be saved as such via the favorites menu. task-10532
Diffstat (limited to 'addons/web/static/src/js/core/utils.js')
-rw-r--r--addons/web/static/src/js/core/utils.js25
1 files changed, 0 insertions, 25 deletions
diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/js/core/utils.js
index ffeb4a1de87..3068a6528c9 100644
--- a/addons/web/static/src/js/core/utils.js
+++ b/addons/web/static/src/js/core/utils.js
@@ -52,20 +52,6 @@ var utils = {
return Math.max(min, Math.min(max, val));
},
/**
- * computes (Math.floor(a/b), a%b and passes that to the callback.
- *
- * returns the callback's result
- */
- divmod: function (a, b, fn) {
- var mod = a%b;
- // in python, sign(a % b) === sign(b). Not in JS. If wrong side, add a
- // round of b
- if (mod > 0 && b < 0 || mod < 0 && b > 0) {
- mod += b;
- }
- return fn(Math.floor(a/b), mod);
- },
- /**
* @param {number} value
* @param {integer} decimals
* @returns {boolean}
@@ -290,17 +276,6 @@ var utils = {
return new Array(size - str.length + 1).join('0') + str;
},
/**
- * Passes the fractional and integer parts of x to the callback, returns
- * the callback's result
- */
- modf: function (x, fn) {
- var mod = x%1;
- if (mod < 0) {
- mod += 1;
- }
- return fn(mod, Math.floor(x));
- },
- /**
* performs a half up rounding with a fixed amount of decimals, correcting for float loss of precision
* See the corresponding float_round() in server/tools/float_utils.py for more info
* @param {Number} value the value to be rounded