[IMP] project: count the project tasks correctly

Also, we should be able to set a customer on a project, whatever the access rights,
for example, if we're managing services by using internal projects.
This commit is contained in:
Yannick Tivisse
2015-09-28 10:19:51 +02:00
parent c543e1be8b
commit 432c01c076
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -109,8 +109,7 @@ class project(osv.osv):
context = {}
res={}
for project in self.browse(cr, uid, ids, context=context):
tasks_undefined_stage = self.pool['project.task'].search_count(cr, uid, [('stage_id', '=', None), ('project_id', '=', project.id)], context=context)
res[project.id] = len(project.task_ids) + int(tasks_undefined_stage)
res[project.id] = len(project.task_ids)
return res
def _get_alias_models(self, cr, uid, context=None):
""" Overriden in project_issue to offer more options """
@@ -164,7 +163,7 @@ class project(osv.osv):
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'task_count': fields.function(_task_count, type='integer', string="Tasks",),
'task_ids': fields.one2many('project.task', 'project_id',
domain=[('stage_id.fold', '=', False)]),
domain=['|', ('stage_id.fold', '=', False), ('stage_id', '=', False)]),
'color': fields.integer('Color Index'),
'user_id': fields.many2one('res.users', 'Project Manager'),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
+1 -1
View File
@@ -112,7 +112,7 @@
<page string="Settings">
<group>
<field name="privacy_visibility" widget="radio"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" string="Customer" attrs="{'invisible': [('privacy_visibility', '!=', 'portal')]}"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" string="Customer"/>
<field name="user_id" string="Project Manager"
attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_manager']}"