From c55dd32ca12b44acb9e88ea3cec7feed5dad8184 Mon Sep 17 00:00:00 2001
From: remi_filament <remi@le-filament.com>
Date: Mon, 31 Jul 2017 15:08:01 +0200
Subject: [PATCH] Fix for v10 as is_timesheet does not exist anymore, may not
 work for expenses though

---
 lefilament_projets.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lefilament_projets.py b/lefilament_projets.py
index bd1ecbd..45469a3 100644
--- a/lefilament_projets.py
+++ b/lefilament_projets.py
@@ -5,7 +5,7 @@ import time
 from odoo import tools
 from odoo import models, fields, api, osv
 
-class SapovalPartners(models.Model):
+class FilamentProjet(models.Model):
 	_name = 'project.project'
 	_inherit = 'project.project'
 
@@ -30,7 +30,7 @@ class SapovalPartners(models.Model):
 		res = 0.0
 		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, ) )
+		self.env.cr.execute("select sum(unit_amount) from account_analytic_line where account_id=%s;", (account, ) )
 		heures_passees = self.env.cr.fetchone()[0]
 		if heures_passees:
 			self.lf_heures_passees = heures_passees
@@ -49,7 +49,8 @@ class SapovalPartners(models.Model):
 	def _couts_annexes(self):
 		account = self.analytic_account_id.id		
 		##############    Calcul couts annexes   ################
-		self.env.cr.execute("select sum(amount) from account_analytic_line where amount<0 and is_timesheet=FALSE and account_id=%s;", (account, ) )
+		## self.env.cr.execute("select sum(amount) from account_analytic_line where amount<0 and is_timesheet=FALSE and account_id=%s;", (account, ) )
+		self.env.cr.execute("select sum(amount) from account_analytic_line where amount<0 and account_id=%s;", (account, ) )
 		couts_annexes = self.env.cr.fetchone()[0]
 		if couts_annexes:
 			self.lf_couts_annexes = couts_annexes * (-1.0)
-- 
GitLab