summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/project/project.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/project/project.py b/addons/project/project.py
index b36f066cc2b..17bafe9aa30 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -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):