Simplified a little the Query class by removing a reference to a controller and using call_kw instead
bzr revid: nicolas.vanhoren@openerp.com-20130805130458-21w806v9wc456oq4
This commit is contained in:
parent
70e3af6312
commit
226b142ac6
|
@ -58,19 +58,18 @@ instance.web.Query = instance.web.Class.extend({
|
|||
},
|
||||
_execute: function () {
|
||||
var self = this;
|
||||
return instance.session.rpc('/web/dataset/search_read', {
|
||||
model: this._model.name,
|
||||
fields: this._fields || false,
|
||||
return this._model.call('search_read', {
|
||||
domain: instance.web.pyeval.eval('domains',
|
||||
[this._model.domain(this._filter)]),
|
||||
context: instance.web.pyeval.eval('contexts',
|
||||
[this._model.context(this._context)]),
|
||||
fields: this._fields || false,
|
||||
offset: this._offset,
|
||||
limit: this._limit,
|
||||
sort: instance.web.serialize_sort(this._order_by)
|
||||
order: instance.web.serialize_sort(this._order_by),
|
||||
context: instance.web.pyeval.eval('contexts',
|
||||
[this._model.context(this._context)]),
|
||||
}).then(function (results) {
|
||||
self._count = results.length;
|
||||
return results.records;
|
||||
return results;
|
||||
}, null);
|
||||
},
|
||||
/**
|
||||
|
|
|
@ -18,16 +18,16 @@ openerp.testing.section('data.model.group_by', {
|
|||
"should have single grouping field");
|
||||
return group_result;
|
||||
});
|
||||
mock('/web/dataset/search_read', function (args) {
|
||||
deepEqual(args.params.domain, [['bar', '=', 3]],
|
||||
mock('foo:search_read', function (args, kwargs) {
|
||||
deepEqual(kwargs.domain, [['bar', '=', 3]],
|
||||
"should have domain matching that of group_by result");
|
||||
return {records: [
|
||||
return [
|
||||
{bar: 3, id: 1},
|
||||
{bar: 3, id: 2},
|
||||
{bar: 3, id: 4},
|
||||
{bar: 3, id: 8},
|
||||
{bar: 3, id: 16}
|
||||
], length: 5};
|
||||
];
|
||||
});
|
||||
|
||||
return m.query().group_by('bar')
|
||||
|
|
Loading…
Reference in New Issue