[FIX] Account: Other user can also open invoices and entiries

bzr revid: mra@mra-laptop-20100814122400-82hsjioqugm0jlkz
This commit is contained in:
PSI(OpenERP) 2010-08-14 17:54:00 +05:30 committed by Mustufa Rangwala
parent d9b17562a5
commit 3b9c2c2e6d
1 changed files with 5 additions and 3 deletions

View File

@ -731,17 +731,19 @@ class account_journal(osv.osv):
# })
return journal_id
def name_search(self, cr, user, name, args=None, operator='ilike', context={}, limit=100):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
if context is None:
context = {}
ids = []
if context.get('journal_type', False):
args += [('type','=',context.get('journal_type'))]
if name:
ids = self.search(cr, user, [('code', 'ilike', name)]+ args, limit=limit, context=context)
if not ids:
ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit, context=context)
# ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit, context=context)
ids = self.search(cr, user, [('name', 'ilike', name)]+ args, limit=limit, context=context)#fix it ilike should be replace with operator
return self.name_get(cr, user, ids, context=context)