Skip to content
Extraits de code Groupes Projets
Valider 4ca81893 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

Fix calculation of hours spent

parent 5e2d02d2
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -40,28 +40,26 @@ class FilamentProjet(models.Model): ...@@ -40,28 +40,26 @@ class FilamentProjet(models.Model):
@api.one @api.one
def _total_heures_prospection(self): def _total_heures_prospection(self):
res = 0.0
project = self.id project = self.id
self.lf_heures_prospection = 0.0
## Calcul heures ## 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] heures_prospection = self.env.cr.fetchone()[0]
if heures_prospection: if heures_prospection:
self.lf_heures_prospection = heures_prospection self.lf_heures_prospection = heures_prospection
else:
self.lf_heures_prospection = 0.0
@api.one @api.one
def _total_heures_passees(self): def _total_heures_passees(self):
res = 0.0
project = self.id project = self.id
self.lf_heures_passees = 0.0
## Calcul heures ## Calcul heures
self.env.cr.execute("select sum(unit_amount) from account_analytic_line where project_id=%s;", (project, ) ) self.env.cr.execute("select sum(unit_amount) from account_analytic_line where project_id=%s;", (project, ) )
heures_passees = self.env.cr.fetchone()[0] heures_passees = self.env.cr.fetchone()[0]
if heures_passees: if heures_passees:
self.lf_heures_passees = heures_passees self.lf_heures_passees = heures_passees
else: if self.use_prospection:
self.lf_heures_passees = 0.0 self.lf_heures_passees -= self.lf_heures_prospection
@api.one @api.one
def _total_heures_planifiees(self): def _total_heures_planifiees(self):
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter