summaryrefslogtreecommitdiff
path: root/addons/project/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/project/project.py')
-rw-r--r--addons/project/project.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/project/project.py b/addons/project/project.py
index 7abab996c56..d57e91d007d 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -900,13 +900,20 @@ class task(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.stage_id and task.stage_id.fold:
continue
result += '''
%sdef Task_%s():
-%s todo = \"%.2fH\"
-%s effort = \"%.2fH\"''' % (ident,task.id, ident,task.remaining_hours, ident, task._get_total_hours())
+%s todo = \"%.2f%s\"
+%s effort = \"%.2f%s\"''' % (ident, task.id, ident, task.remaining_hours, duration_uom, ident, task._get_total_hours(), duration_uom)
start = []
for t2 in task.parent_ids:
start.append("up.Task_%s.end" % (t2.id,))