Fix search m2o field, default added
bzr revid: tta@openerp.com-20111122104145-ce1z32beh8ef6346
This commit is contained in:
parent
11bc9e1ad8
commit
733941e979
|
@ -2534,6 +2534,16 @@ openerp.web.form.SelectCreatePopup = openerp.web.OldWidget.extend(/** @lends ope
|
|||
start: function() {
|
||||
this._super();
|
||||
var self = this;
|
||||
search_defaults = {};
|
||||
if( "__contexts" in this.context.__contexts[0])
|
||||
{
|
||||
_.each(this.context.__contexts[0].__contexts[0], function (value, key) {
|
||||
var match = /^search_default_(.*)$/.exec(key);
|
||||
if (match) {
|
||||
search_defaults[match[1]] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.dataset = new openerp.web.ProxyDataSet(this, this.model,
|
||||
this.context);
|
||||
this.dataset.create_function = function() {
|
||||
|
@ -2548,18 +2558,18 @@ 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();
|
||||
this.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