[ADD] @domains handling to searchview m2o field during completion
bzr revid: xmo@openerp.com-20130225164255-y3qkcjozr7rbtz1v
This commit is contained in:
parent
9f45e8970c
commit
ece114024f
|
@ -1477,6 +1477,8 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
|
|||
// FIXME: "concurrent" searches (multiple requests, mis-ordered responses)
|
||||
return this.model.call('name_search', [], {
|
||||
name: needle,
|
||||
args: instance.web.pyeval.eval(
|
||||
'domains', this.attrs.domain ? [this.attrs.domain] : []),
|
||||
limit: 8,
|
||||
context: {}
|
||||
}).then(function (results) {
|
||||
|
|
|
@ -594,6 +594,23 @@ openerp.testing.section('completions', {
|
|||
ok(!c, "no match should yield no completion");
|
||||
});
|
||||
});
|
||||
test("M2O filtered", {asserts: 2}, function (instance, $s, mock) {
|
||||
mock('dummy.model:name_search', function (args, kwargs) {
|
||||
deepEqual(args, [], "should have no positional arguments");
|
||||
deepEqual(kwargs, {
|
||||
name: 'bob',
|
||||
limit: 8,
|
||||
args: [['foo', '=', 'bar']],
|
||||
context: {},
|
||||
}, "should use filtering domain");
|
||||
return [[42, "Match"]];
|
||||
});
|
||||
var view = {inputs: []};
|
||||
var f = new instance.web.search.ManyToOneField(
|
||||
{attrs: {string: 'Dummy', domain: '[["foo", "=", "bar"]]'}},
|
||||
{relation: 'dummy.model'}, view);
|
||||
return f.complete("bob");
|
||||
});
|
||||
});
|
||||
openerp.testing.section('search-serialization', {
|
||||
dependencies: ['web.search'],
|
||||
|
|
Loading…
Reference in New Issue