[IMP] project search method for user prefrence
bzr revid: mra@tinyerp.com-20100209140616-cn7jhsxgv348h1gb
This commit is contained in:
parent
7568981fe1
commit
340c361b99
|
@ -46,6 +46,21 @@ class project(osv.osv):
|
|||
_name = "project.project"
|
||||
_description = "Project"
|
||||
_inherits = {'account.analytic.account':"category_id"}
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None,
|
||||
context=None, count=False):
|
||||
if user==1:
|
||||
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order,
|
||||
context=context, count=count)
|
||||
if context and context.has_key('user_prefence') and context['user_prefence']:
|
||||
cr.execute("""SELECT project.id FROM project_project project
|
||||
LEFT JOIN account_analytic_account account ON account.id = project.category_id
|
||||
WHERE (account.user_id = %s)"""%(user))
|
||||
res = cr.fetchall()
|
||||
return [(r[0]) for r in res]
|
||||
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order,
|
||||
context=context, count=count)
|
||||
|
||||
def _complete_name(self, cr, uid, ids, name, args, context):
|
||||
res = {}
|
||||
for m in self.browse(cr, uid, ids, context=context):
|
||||
|
|
Loading…
Reference in New Issue