[REVERT] 4164 revid:dle@openerp.com-20140326113036-g9yv3jj6yetwxvg8: this fix actually works in saas-3, but not in 7.0, as search_read method is not part of the orm

bzr revid: dle@openerp.com-20140326123513-jkful2m1n2zjgdmv
This commit is contained in:
Denis Ledoux 2014-03-26 13:35:13 +01:00
parent 76aa47b133
commit 649ef3ed21
2 changed files with 6 additions and 13 deletions

View File

@ -951,20 +951,14 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
} else { } else {
var fields = _.keys(self.fields_view.fields); var fields = _.keys(self.fields_view.fields);
fields.push('display_name'); fields.push('display_name');
// Use of search_read instead of read to check if we can still read the record (security rules) return self.dataset.read_index(fields,
return self.dataset.call('search_read', [[['id', '=', self.dataset.ids[self.dataset.index]]], fields],
{ {
context: { context: {
'bin_size': true, 'bin_size': true,
'future_display_name': true 'future_display_name': true
} }
}).then(function(r) { }).then(function(r) {
if (_.isEmpty(r)){ self.trigger('load_record', r);
self.do_action('history_back');
}
else{
self.trigger('load_record', r[0]);
}
}); });
} }
}); });

View File

@ -528,14 +528,13 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}, },
reload_record: function (record) { reload_record: function (record) {
var self = this; var self = this;
// Use of search_read instead of read to check if we can still read the record (security rules) return this.dataset.read_ids(
return this.dataset.call('search_read', [ [record.get('id')],
[['id', '=', record.get('id')]],
_.pluck(_(this.columns).filter(function (r) { _.pluck(_(this.columns).filter(function (r) {
return r.tag === 'field'; return r.tag === 'field';
}), 'name')] }), 'name')
).done(function (records) { ).done(function (records) {
var values = _.isEmpty(records) ? undefined : records[0]; var values = records[0];
if (!values) { if (!values) {
self.records.remove(record); self.records.remove(record);
return; return;