[FIX] web: view form fieldselection, use name_search instead of cascading search and name_get

One rpc call won
Moreover, res_company in server overwrite name_search for company field in res users preferences, to display all allowed companies of the user, and not just the one allowed by record rules, so the user can change to the companies he is allowed to.

bzr revid: dle@openerp.com-20140304173838-c7uimmey8gvi3b64
This commit is contained in:
Denis Ledoux 2014-03-04 18:38:38 +01:00
parent de37ea15ac
commit 1761704af2
1 changed files with 1 additions and 3 deletions

View File

@ -2835,9 +2835,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan
var def;
if (this.field.type === "many2one") {
var model = new openerp.Model(openerp.session, this.field.relation);
def = model.call("search", [this.get("domain")], {"context": this.build_context()}).then(function(record_ids) {
return model.call("name_get", [record_ids] , {"context": self.build_context()});
});
def = model.call("name_search", ['', this.get("domain")], {"context": this.build_context()});
} else {
var values = _.reject(this.field.selection, function (v) { return v[0] === false && v[1] === ''; });
def = $.when(values);