summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-10-11 12:05:32 +0200
committerXavier Morel <xmo@openerp.com>2012-10-11 12:05:32 +0200
commite6b77eb820a7670b416319f314808e4b90931a01 (patch)
treef9199c1ec49214e1e203652623325d66e7d46f00 /addons/web/static/src/js/data.js
parentb94e9c30a78e0047457977bf8ff5bd6bdda81372 (diff)
[IMP] shortcut call to eval_domain_and_context to be evaluated on the JS side, also add some offline-evaluation of contexts and domains in rpc call methods
bzr revid: xmo@openerp.com-20121011100532-5ihje0maslp37zpf
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 2b82e618203..af887a5152f 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -61,8 +61,10 @@ instance.web.Query = instance.web.Class.extend({
return instance.session.rpc('/web/dataset/search_read', {
model: this._model.name,
fields: this._fields || false,
- domain: this._model.domain(this._filter),
- context: this._model.context(this._context),
+ domain: instance.web.pyeval.eval('domains',
+ [this._model.domain(this._filter)]),
+ context: instance.web.pyeval.eval('contexts',
+ [this._model.context(this._context)]),
offset: this._offset,
limit: this._limit,
sort: instance.web.serialize_sort(this._order_by)
@@ -280,6 +282,7 @@ instance.web.Model = instance.web.Class.extend({
kwargs = args;
args = [];
}
+ instance.web.pyeval.ensure_evaluated(args, kwargs);
return instance.session.rpc('/web/dataset/call_kw', {
model: this.name,
method: method,
@@ -291,7 +294,7 @@ instance.web.Model = instance.web.Class.extend({
* Fetches a Query instance bound to this model, for searching
*
* @param {Array<String>} [fields] fields to ultimately fetch during the search
- * @returns {openerp.web.Query}
+ * @returns {instance.web.Query}
*/
query: function (fields) {
return new instance.web.Query(this, fields);
@@ -339,9 +342,11 @@ instance.web.Model = instance.web.Class.extend({
* FIXME: remove when evaluator integrated
*/
call_button: function (method, args) {
+ instance.web.pyeval.ensure_evaluated(args, {});
return instance.session.rpc('/web/dataset/call_button', {
model: this.name,
method: method,
+ // Should not be necessary anymore. Integrate remote in this?
domain_id: null,
context_id: args.length - 1,
args: args || []
@@ -599,9 +604,12 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @returns {$.Deferred}
*/
call_and_eval: function (method, args, domain_index, context_index) {
+ instance.web.pyeval.ensure_evaluated(args, {});
return instance.session.rpc('/web/dataset/call', {
model: this.model,
method: method,
+ // Should not be necessary anymore as ensure_evaluated traverses
+ // all of the args array
domain_id: domain_index == undefined ? null : domain_index,
context_id: context_index == undefined ? null : context_index,
args: args || []