bzr revid: fp@tinyerp.com-20101018143520-monr578ssid7l006
This commit is contained in:
Fabien Pinckaers
2010-10-18 16:35:20 +02:00
+3 -1
View File
@@ -457,7 +457,9 @@ class account_account(osv.osv):
if not ids:
ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit)
if not ids and len(name.split()) >= 2:
ids = self.search(cr, user, [('code', operator, name.split()[0]), ('name', operator, name.split()[1])]+ args, limit=limit)
#Separating code and name of account for searching
operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A.
ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2)]+ args, limit=limit)
else:
ids = self.search(cr, user, args, context=context, limit=limit)
return self.name_get(cr, user, ids, context=context)