[IMP] Account : Fiscalyear and Period now have name_search

bzr revid: gpa@tinyerp.com-20100511054908-ot3sbwbyzpjd8s48
This commit is contained in:
gpa 2010-05-11 11:19:08 +05:30
parent cea2b3cf11
commit a238492db8
1 changed files with 25 additions and 0 deletions

View File

@ -631,6 +631,19 @@ class account_fiscalyear(osv.osv):
else:
return False
return ids[0]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
if context is None:
context = {}
ids = []
if name:
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
return self.name_get(cr, user, ids, context=context)
account_fiscalyear()
class account_period(osv.osv):
@ -706,6 +719,18 @@ class account_period(osv.osv):
cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
cr.execute('update account_period set state=%s where id=%s', (mode, id))
return True
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
if context is None:
context = {}
ids = []
if name:
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
return self.name_get(cr, user, ids, context=context)
account_period()