From e34b07e1e3a52be4915d16c868442a26a278b736 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 29 Sep 2011 12:32:29 +0200 Subject: [PATCH] [IMP] Fixed list view in order to support new do_search bzr revid: fme@openerp.com-20110929103229-l9pfjqbezj28ihd9 --- addons/web/static/src/js/view_list.js | 29 ++++--------------- .../web/static/src/js/view_list_editable.js | 6 ++-- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 49fdf326253..d637802c08a 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -401,41 +401,22 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# self.compute_aggregates(); })); }, - /** - * Event handler for a search, asks for the computation/folding of domains - * and contexts (and group-by), then reloads the view's content. - * - * @param {Array} domains a sequence of literal and non-literal domains - * @param {Array} contexts a sequence of literal and non-literal contexts - * @param {Array} groupbys a sequence of literal and non-literal group-by contexts - * @returns {$.Deferred} fold request evaluation promise - */ - do_search: function (domains, contexts, groupbys) { - return this.rpc('/web/session/eval_domain_and_context', { - domains: _([this.dataset.get_domain()].concat(domains)).compact(), - contexts: _([this.dataset.get_context()].concat(contexts)).compact(), - group_by_seq: groupbys - }, $.proxy(this, 'do_actual_search')); - }, /** * Handler for the result of eval_domain_and_context, actually perform the * searching * * @param {Object} results results of evaluating domain and process for a search */ - do_actual_search: function (results) { + do_search: function (domain, context, group_by) { this.groups.datagroup = new openerp.web.DataGroup( - this, this.model, - results.domain, - results.context, - results.group_by); + this, this.model, domain, context, group_by); this.groups.datagroup.sort = this.dataset._sort; - if (_.isEmpty(results.group_by) && !results.context['group_by_no_leaf']) { - results.group_by = null; + if (_.isEmpty(group_by) && !context['group_by_no_leaf']) { + group_by = null; } - this.reload_view(!!results.group_by, results.context).then( + this.reload_view(!!group_by, context).then( $.proxy(this, 'reload_content')); }, /** diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index beb2c3ac0a9..0b361ae3a9c 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -56,11 +56,11 @@ openerp.web.list_editable = function (openerp) { || this.defaults.editable); }, /** - * Replace do_actual_search to handle editability process + * Replace do_search to handle editability process */ - do_actual_search: function (results) { + do_search: function() { this.set_editable(results.context['set_editable']); - this._super(results); + this._super.apply(this, arguments); }, /** * Replace do_add_record to handle editability (and adding new record