Fix search on country code to not search with string greater than the code

bzr revid: ced-4bce2cc48e51e6ad75f25ada35a85ce13527c722
This commit is contained in:
ced 2007-10-31 14:14:25 +00:00
parent 0f66f8358f
commit 169e64cdcd
1 changed files with 5 additions and 3 deletions

View File

@ -52,10 +52,12 @@ class Country(osv.osv):
args=[]
if not context:
context={}
ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit,
context=context)
ids = False
if len(name) <= 2:
ids = self.search(cr, user, [('code', '=', name)] + args,
limit=limit, context=context)
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args,
ids = self.search(cr, user, [('name', operator, name)] + args,
limit=limit, context=context)
return self.name_get(cr, user, ids, context)
_order='code'