[IMP] project_long_term: improve gantt view of resource allocation
bzr revid: hmo@tinyerp.com-20101015154701-6fw3rbkjfpilagji
This commit is contained in:
parent
5c1baa1f61
commit
3ce6888e42
|
@ -395,7 +395,18 @@ class project_resource_allocation(osv.osv):
|
|||
_name = 'project.resource.allocation'
|
||||
_description = 'Project Resource Allocation'
|
||||
_rec_name = 'resource_id'
|
||||
|
||||
def get_name(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = {}
|
||||
for allocation in self.browse(cr, uid, ids, context=context):
|
||||
name = allocation.resource_id.name
|
||||
if allocation.user_id:
|
||||
name = '%s' %(allocation.user_id.name)
|
||||
name += ' (%s%%)' %(allocation.useability)
|
||||
res[allocation.id] = name
|
||||
return res
|
||||
_columns = {
|
||||
'name': fields.function(get_name, method=True, type='char', size=256),
|
||||
'resource_id': fields.many2one('resource.resource', 'Resource', required=True),
|
||||
'phase_id': fields.many2one('project.phase', 'Project Phase', ondelete='cascade', required=True),
|
||||
'project_id': fields.related('phase_id', 'project_id', type='many2one', relation="project.project", string='Project', store=True),
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
<field name="model">project.resource.allocation</field>
|
||||
<field name="type">gantt</field>
|
||||
<field name="arch" type="xml">
|
||||
<gantt color="phase_id" date_start="date_start" date_stop="date_end" mode="year">
|
||||
<level object="project.project" link="project_id" domain="[]">
|
||||
<field name="phase_id"/>
|
||||
<gantt color="project_id" date_start="date_start" date_stop="date_end" mode="year">
|
||||
<level object="project.phase" link="phase_id" domain="[]">
|
||||
<field name="name"/>
|
||||
</level>
|
||||
</gantt>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue