Fix the computation of all_participants of a task

This commit is contained in:
Shalabh Aggarwal 2012-09-15 11:29:18 +05:30
parent 3590fc6075
commit 2e57ae6b50
2 changed files with 11 additions and 11 deletions

View File

@ -134,11 +134,7 @@ class Project(ModelSQL, ModelView):
'History', readonly=True)
participants = fields.Many2Many(
'project.work-nereid.user', 'project', 'user',
'Participants', depends=['parent', 'type'],
states={
'invisible': Bool(Eval('parent')) or Eval('type') != 'project',
'readonly': Bool(Eval('parent')) or Eval('type') != 'project',
}
'Participants'
)
tags_for_projects = fields.One2Many('project.work.tag', 'project',
@ -225,12 +221,14 @@ class Project(ModelSQL, ModelView):
the admins
"""
vals = {}
for task in self.browse(ids):
vals[task.id] = []
if task.type != 'task':
continue
vals[task.id].extend([p.id for p in task.participants])
vals[task.id].extend([p.id for p in task.company.project_admins])
for work in self.browse(ids):
vals[work.id] = []
vals[work.id].extend([p.id for p in work.participants])
vals[work.id].extend([p.id for p in work.company.project_admins])
if work.parent:
vals[work.id].extend(
[p.id for p in work.parent.all_participants]
)
return vals
def create(self, values):

View File

@ -18,6 +18,8 @@ of this repository contains the full copyright notices and license terms. -->
<page string="Participants" id="project_participants">
<separator name="participants" colspan="4"/>
<field name="participants" colspan="4"/>
<separator name="all_participants" colspan="4"/>
<field name="all_participants" colspan="4"/>
</page>
<page string="Tags" id="project_tags">
<separator name="tags" colspan="4"/>