summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2015-06-30 15:42:24 +0200
committerGoffin Simon <sig@odoo.com>2015-07-01 08:55:10 +0200
commit60c94c7c423d8d4232b0f4e402a1a3723ad6253c (patch)
tree663c897f492fd8d595c7ed109b87fb3e9cf91fec /addons
parent01e4b76f656df1ef88b57af511ea28f3e9b6dc1d (diff)
[FIX] project: Working Time Progress
The precision of the field 'hours' in project.task.work and the precision of 'remaining_hours' are not the same. This is why the difference between them can generate some very small negative difference which implies an infinite percentage for the working progress time. opw:643649
Diffstat (limited to 'addons')
-rw-r--r--addons/project/project.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/project/project.py b/addons/project/project.py
index a6ca9bc17a1..05e68afbdd3 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -27,6 +27,7 @@ from openerp import SUPERUSER_ID
from openerp import tools
from openerp.addons.resource.faces import task as Task
from openerp.osv import fields, osv
+from openerp.tools import float_is_zero
from openerp.tools.translate import _
@@ -658,7 +659,7 @@ class task(osv.osv):
res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': (task.remaining_hours or 0.0) + hours.get(task.id, 0.0)}
res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours
res[task.id]['progress'] = 0.0
- if (task.remaining_hours + hours.get(task.id, 0.0)):
+ if not float_is_zero(res[task.id]['total_hours'], precision_digits=2):
res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2)
if task.stage_id and task.stage_id.fold:
res[task.id]['progress'] = 100.0