Skip to content
Snippets Groups Projects
Commit 4ca81893 authored by Rémi - Le Filament's avatar Rémi - Le Filament
Browse files

Fix calculation of hours spent

parent 5e2d02d2
No related branches found
No related tags found
No related merge requests found
......@@ -40,28 +40,26 @@ class FilamentProjet(models.Model):
@api.one
def _total_heures_prospection(self):
res = 0.0
project = self.id
self.lf_heures_prospection = 0.0
## Calcul heures
self.env.cr.execute("select sum(aal.unit_amount) from account_analytic_line aal, project_task pt where aal.project_id=%s and pt.name='Prospection' and pt.id=aal.task_id;", (project, ) )
if self.use_prospection:
self.env.cr.execute("select sum(aal.unit_amount) from account_analytic_line aal, project_task pt where aal.project_id=%s and pt.name like 'Prospection' and pt.id=aal.task_id;", (project, ) )
heures_prospection = self.env.cr.fetchone()[0]
if heures_prospection:
self.lf_heures_prospection = heures_prospection
else:
self.lf_heures_prospection = 0.0
@api.one
def _total_heures_passees(self):
res = 0.0
project = self.id
self.lf_heures_passees = 0.0
## Calcul heures
self.env.cr.execute("select sum(unit_amount) from account_analytic_line where project_id=%s;", (project, ) )
heures_passees = self.env.cr.fetchone()[0]
if heures_passees:
self.lf_heures_passees = heures_passees
else:
self.lf_heures_passees = 0.0
if self.use_prospection:
self.lf_heures_passees -= self.lf_heures_prospection
@api.one
def _total_heures_planifiees(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment