diff --git a/lefilament_projets.py b/lefilament_projets.py index 72202056b782613a2fc4ee294a316248e6c72418..f57e2d495da4b36b5c1727aae0581237d3f12234 100644 --- a/lefilament_projets.py +++ b/lefilament_projets.py @@ -26,9 +26,15 @@ class SapovalPartners(models.Model): @api.one def _total_heures_passees(self): res = 0.0 - for record in self.task_ids: - res = res + record.effective_hours - self.lf_heures_passees = res + account = self.analytic_account_id.id + ############## Calcul couts annexes ################ + self.env.cr.execute("select sum(unit_amount) from account_analytic_line where is_timesheet=TRUE and account_id=%s;", (account, ) ) + heures_passees = self.env.cr.fetchone()[0] + if heures_passees: + self.lf_heures_passees = heures_passees + else: + self.lf_heures_passees = 0.0 + @api.one def _total_heures_planifiees(self):