From 169e64cdcd90288acba8bae889843871107889df Mon Sep 17 00:00:00 2001 From: ced <> Date: Wed, 31 Oct 2007 14:14:25 +0000 Subject: [PATCH] Fix search on country code to not search with string greater than the code bzr revid: ced-4bce2cc48e51e6ad75f25ada35a85ce13527c722 --- bin/addons/base/res/country.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/addons/base/res/country.py b/bin/addons/base/res/country.py index 6dbc0c7e39b..621d9c6601f 100644 --- a/bin/addons/base/res/country.py +++ b/bin/addons/base/res/country.py @@ -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'