|
|
@ -17,12 +17,15 @@ class NameSearchCase(TransactionCase): |
|
|
|
self.Partner = self.env['res.partner'] |
|
|
|
self.partner1 = self.Partner.create( |
|
|
|
{'name': 'Luigi Verconti', |
|
|
|
'customer': True, |
|
|
|
'phone': '+351 555 777 333'}) |
|
|
|
self.partner2 = self.Partner.create( |
|
|
|
{'name': 'Ken Shabby', |
|
|
|
'customer': True, |
|
|
|
'phone': '+351 555 333 777'}) |
|
|
|
self.partner3 = self.Partner.create( |
|
|
|
{'name': 'Johann Gambolputty of Ulm', |
|
|
|
'supplier': True, |
|
|
|
'phone': '+351 777 333 555'}) |
|
|
|
|
|
|
|
def test_RelevanceOrderedResults(self): |
|
|
@ -42,3 +45,10 @@ class NameSearchCase(TransactionCase): |
|
|
|
"""Must Match All Words""" |
|
|
|
res = self.Partner.name_search('ulm 555 777') |
|
|
|
self.assertFalse(res) |
|
|
|
|
|
|
|
def test_MustHonorDomain(self): |
|
|
|
"""Must also honor a provided Domain""" |
|
|
|
res = self.Partner.name_search('+351', args=[('supplier', '=', True)]) |
|
|
|
gambulputty = self.partner3.id |
|
|
|
self.assertEqual(len(res), 1) |
|
|
|
self.assertEqual(res[0][0], gambulputty) |