[FIX] default search values set on m2o field contexts were not propagated to the m2o search dialog
on selecting 'search more' in autocompletion or 'search' from icon menu bzr revid: xmo@openerp.com-20111124104305-kfr33cqcq5uuvzye
This commit is contained in:
commit
6ae439dab0
|
@ -2553,18 +2553,30 @@ openerp.web.form.SelectCreatePopup = openerp.web.OldWidget.extend(/** @lends ope
|
|||
this.dataset.parent_view = this.options.parent_view;
|
||||
this.dataset.on_default_get.add(this.on_default_get);
|
||||
if (this.options.initial_view == "search") {
|
||||
this.setup_search_view();
|
||||
self.rpc('/web/session/eval_domain_and_context', {
|
||||
domains: [],
|
||||
contexts: [this.context]
|
||||
}, function (results) {
|
||||
var search_defaults = {};
|
||||
_.each(results.context, function (value, key) {
|
||||
var match = /^search_default_(.*)$/.exec(key);
|
||||
if (match) {
|
||||
search_defaults[match[1]] = value;
|
||||
}
|
||||
});
|
||||
self.setup_search_view(search_defaults);
|
||||
});
|
||||
} else { // "form"
|
||||
this.new_object();
|
||||
}
|
||||
},
|
||||
setup_search_view: function() {
|
||||
setup_search_view: function(search_defaults) {
|
||||
var self = this;
|
||||
if (this.searchview) {
|
||||
this.searchview.stop();
|
||||
}
|
||||
this.searchview = new openerp.web.SearchView(this,
|
||||
this.dataset, false, {});
|
||||
this.dataset, false, search_defaults);
|
||||
this.searchview.on_search.add(function(domains, contexts, groupbys) {
|
||||
if (self.initial_ids) {
|
||||
self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]),
|
||||
|
|
Loading…
Reference in New Issue