'records': [{'id': id} for id in ids]
}
- records = Model.read(ids, fields or False, req.context)
+ records = Model.read(ids, fields or False, request.context)
- records.sort(key=lambda obj: ids.index(obj['id']))
+
+ index = dict((r['id'], r) for r in records)
+ records = [index[x] for x in ids if x in index]
+
return {
'length': length,
'records': records
if length == 2:
# subfields is a seq of $base/*rest, and not loaded yet
info.update(self.graft_subfields(
- req, fields[base]['relation'], base, fields[base]['string'],
+ fields[base]['relation'], base, fields[base]['string'],
subfields
))
- else:
+ elif base in fields:
info[base] = fields[base]['string']
return info
context: this.dataset.get_context(),
});
- $.when(load_view).then(function (r) {
+ this.alive($.when(load_view)).then(function (r) {
- return self.search_view_loaded(r)
+ return self.search_view_loaded(r);
}).fail(function () {
self.ready.reject.apply(null, arguments);
});
this.selection.on("change:value", this, this.on_selection_changed);
this.selection.appendTo(this.$(".oe_form_view_reference_selection"));
this.selection
- .on('focused', null, function () {self.trigger('focused')})
- .on('blurred', null, function () {self.trigger('blurred')});
+ .on('focused', null, function () {self.trigger('focused');})
+ .on('blurred', null, function () {self.trigger('blurred');});
this.m2o = new instance.web.form.FieldMany2One(fm, { attrs: {
- name: 'm2o',
+ name: 'Referenced Document',
modifiers: JSON.stringify({readonly: this.get('effective_readonly')}),
}});
this.m2o.on("change:value", this, this.data_changed);
});
this.get_selection();
if (this.options.clickable) {
- this.$el.on('click','li',this.on_click_stage);
+ this.$el.on('click','li[data-id]',this.on_click_stage);
}
- if (this.$el.parent().is('header')) {
- this.$el.after('<div class="oe_clear"/>');
- }
this._super();
},
set_value: function(value_) {
def test_regular_find(self):
self.search.return_value = [1, 2, 3]
+ self.read.return_value = [
+ {'id': 1, 'name': 'foo'},
+ {'id': 2, 'name': 'bar'},
+ {'id': 3, 'name': 'qux'}
+ ]
- self.dataset.do_search_read(self.request, 'fake.model')
+ self.dataset.do_search_read('fake.model')
self.read.assert_called_once_with(
- [1, 2, 3], False,self.request.context)
+ [1, 2, 3], False, req.context)
def test_ids_shortcut(self):
self.search.return_value = [1, 2, 3]