diff options
| author | Adrien Dieudonne <adr@odoo.com> | 2018-07-06 14:22:58 +0200 |
|---|---|---|
| committer | Adrien Dieudonne <adr@odoo.com> | 2018-07-06 14:22:58 +0200 |
| commit | 3ebff1f4721dd4a9057db4d26162c57c8506700a (patch) | |
| tree | e3b02fcc528dcc3a0ae50b55a5d3a1d4708ab992 /addons/web/static/src/js/_deprecated | |
| parent | f9a68d5e778da0ff4e1f1a0936b51b98a822a15a (diff) | |
| parent | 11b7857af63a35e81daa495bcb3522b3915f32ca (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/_deprecated')
| -rw-r--r-- | addons/web/static/src/js/_deprecated/data.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/addons/web/static/src/js/_deprecated/data.js b/addons/web/static/src/js/_deprecated/data.js index eb70f330076..fd19ff61af7 100644 --- a/addons/web/static/src/js/_deprecated/data.js +++ b/addons/web/static/src/js/_deprecated/data.js @@ -7,7 +7,7 @@ var concurrency = require('web.concurrency'); var mixins = require('web.mixins'); var session = require('web.session'); var translation = require('web.translation'); -var pyeval = require('web.pyeval'); +var pyUtils = require('web.py_utils'); var _t = translation._t; @@ -85,9 +85,9 @@ var Query = Class.extend({ return session.rpc('/web/dataset/search_read', { model: this._model.name, fields: this._fields || false, - domain: pyeval.eval('domains', + domain: pyUtils.eval('domains', [this._model.domain(this._filter)]), - context: pyeval.eval('contexts', + context: pyUtils.eval('contexts', [this._model.context(this._context)]), offset: this._offset, limit: this._limit, @@ -138,7 +138,7 @@ var Query = Class.extend({ * @returns {jQuery.Deferred<Array<openerp.web.QueryGroup>> | null} */ group_by: function (grouping) { - var ctx = pyeval.eval( + var ctx = pyUtils.eval( 'context', this._model.context(this._context)); // undefined passed in explicitly (!) @@ -609,7 +609,7 @@ var DataSet = Class.extend(mixins.PropertiesMixin, { return session.rpc('/web/dataset/resequence', { model: this.model, ids: ids, - context: pyeval.eval( + context: pyUtils.eval( 'context', this.get_context(options.context)), }).then(function (results) { return results; @@ -797,7 +797,7 @@ var Model = Class.extend({ * Call a method (over RPC) on the bound OpenERP model. * * @param {String} method name of the method to call - * @param {Array} [args] positional arguments + * @param {Array} [args] positipyEvalonal arguments * @param {Object} [kwargs] keyword arguments * @param {Object} [options] additional options for the rpc() method * @returns {jQuery.Deferred<>} call result @@ -810,7 +810,7 @@ var Model = Class.extend({ kwargs = args; args = []; } - pyeval.ensure_evaluated(args, kwargs); + pyUtils.ensure_evaluated(args, kwargs); var call_kw = '/web/dataset/call_kw/' + this.name + '/' + method; return session.rpc(call_kw, { model: this.name, @@ -820,7 +820,7 @@ var Model = Class.extend({ }, options); }, call_button: function (method, args) { - pyeval.ensure_evaluated(args, {}); + pyUtils.ensure_evaluated(args, {}); return session.rpc('/web/dataset/call_button', { model: this.name, method: method, |
