[FIX] account : name_search() method fixed

lp bug: https://launchpad.net/bugs/613251 fixed

bzr revid: ach@tinyerp.com-20101018143353-w7x03fe0s9szkyz9
This commit is contained in:
Anup (OpenERP) 2010-10-18 20:03:53 +05:30
parent 06b12c0192
commit f2e519b591
1 changed files with 3 additions and 1 deletions

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)