[FIX] project: use selected unit of measure in gantt display
Hack to use working time unit in gantt view. Similar to 533399f
for project.task
Fixes lp:1108913, opw 613979
This commit is contained in:
parent
316be12a3c
commit
6dcccae568
|
@ -1179,13 +1179,20 @@ class task(base_stage, osv.osv):
|
|||
context = context or {}
|
||||
result = ""
|
||||
ident = ' '*ident
|
||||
company = self.pool["res.users"].browse(cr, uid, uid, context=context).company_id
|
||||
duration_uom = {
|
||||
'day(s)': 'd', 'days': 'd', 'day': 'd', 'd': 'd',
|
||||
'month(s)': 'm', 'months': 'm', 'month': 'month', 'm': 'm',
|
||||
'week(s)': 'w', 'weeks': 'w', 'week': 'w', 'w': 'w',
|
||||
'hour(s)': 'h', 'hours': 'H', 'hour': 'H', 'h': 'H',
|
||||
}.get(company.project_time_mode_id.name.lower(), "hour(s)")
|
||||
for task in tasks:
|
||||
if task.state in ('done','cancelled'):
|
||||
continue
|
||||
result += '''
|
||||
%sdef Task_%s():
|
||||
%s todo = \"%.2fH\"
|
||||
%s effort = \"%.2fH\"''' % (ident,task.id, ident,task.remaining_hours, ident,task.total_hours)
|
||||
%s todo = \"%.2f%s\"
|
||||
%s effort = \"%.2f%s\"''' % (ident, task.id, ident, task.remaining_hours, duration_uom, ident, task.total_hours, duration_uom)
|
||||
start = []
|
||||
for t2 in task.parent_ids:
|
||||
start.append("up.Task_%s.end" % (t2.id,))
|
||||
|
|
Loading…
Reference in New Issue