From 5abaef146b1a1d9a868931add2c92120c63c5050 Mon Sep 17 00:00:00 2001
From: Benjamin <Benjamin@MBP-de-Benj.(none)>
Date: Thu, 13 Jul 2017 10:29:41 +0200
Subject: [PATCH] =?UTF-8?q?[modif]=20journ=C3=A9e=20=3D=208h?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lefilament_projets.py             |  39 +++++++++++++++++++++---------
 lefilament_projets.pyc            | Bin 3105 -> 0 bytes
 static/src/less/style.less        |   1 -
 views/lefilament_projets_view.xml |  15 ++++++++----
 4 files changed, 37 insertions(+), 18 deletions(-)
 delete mode 100644 lefilament_projets.pyc

diff --git a/lefilament_projets.py b/lefilament_projets.py
index 06793c4..cbdc39d 100644
--- a/lefilament_projets.py
+++ b/lefilament_projets.py
@@ -10,6 +10,7 @@ class SapovalPartners(models.Model):
 	_inherit = 'project.project'
 
 	lf_total_budget = fields.Float('Budget Projet',)
+	lf_heures_budget = fields.Float('Budget Heures', compute='_budget_heures')
 	lf_tarif_jour = fields.Float('Tarif Jour',)
 	lf_taux_horaire = fields.Float('Taux Horaire', compute='_taux_horaire')
 	lf_heures_projet = fields.Float('Allouées (h)', compute='_total_heures')
@@ -20,14 +21,7 @@ class SapovalPartners(models.Model):
 
 	@api.one
 	def _taux_horaire(self):
-		self.lf_taux_horaire = self.lf_tarif_jour / 7.5
-
-	@api.one
-	def _total_heures(self):
-		if (self.lf_tarif_jour != 0.0):
-			self.lf_heures_projet = (self.lf_total_budget / self.lf_tarif_jour) * 7.5
-		else:
-			self.lf_heures_projet = 0.0
+		self.lf_taux_horaire = self.lf_tarif_jour / 8
 
 	@api.one
 	def _total_heures_passees(self):
@@ -36,10 +30,6 @@ class SapovalPartners(models.Model):
 			res = res + record.effective_hours
 		self.lf_heures_passees = res
 
-	@api.one
-	def _total_heures_restantes(self):
-		self.lf_heures_restantes = self.lf_heures_projet - self.lf_heures_passees
-
 	@api.one
 	def _total_heures_planifiees(self):
 		res = 0.0
@@ -58,3 +48,28 @@ class SapovalPartners(models.Model):
 		else:
 			self.lf_couts_annexes = 0.0
 
+	@api.one
+	@api.depends('lf_total_budget','lf_couts_annexes')
+	def _budget_heures(self):
+		self.lf_heures_budget = self.lf_total_budget - self.lf_couts_annexes
+
+	@api.one
+	def _total_heures(self):
+		if (self.lf_tarif_jour != 0.0):
+			self.lf_heures_projet = (self.lf_heures_budget / self.lf_tarif_jour) * 7.5
+		else:
+			self.lf_heures_projet = 0.0
+
+	@api.one
+	def _total_heures_restantes(self):
+		self.lf_heures_restantes = self.lf_heures_projet - self.lf_heures_passees
+
+	def open_project(self):
+	    return {
+	        'type': 'ir.actions.act_window',
+	        'name': 'Projet' + self.name,
+	        'view_mode': 'kanban',
+	        'res_model': 'project.project',
+	        'res_id': self.id, 
+	        'views': [(False, 'kanban')],
+	    }
diff --git a/lefilament_projets.pyc b/lefilament_projets.pyc
deleted file mode 100644
index 686cbae0e815eb879d5d46c6c85e67a90a2c36cb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 3105
zcmZSn%*$2wH6=2c0ScHI7#JKF7#NBR85kH+7#LC*8FCmHav2z+7#MOH8KM{&7(t>;
z3^_~;QA}VJ%nUiq47n@}Q7jNS7BHWcA&QkDmyIEcjUktvA&Q+LmxCdSgMl%Hl_8at
zA&ZkCjgcXRjiH5sp_zdpGKz~Kg^3|pgPnnaA@l$L|Nk|Z7#J8zI6#g_EJ-cN%uOv}
zfpYvb7(sHZAR<3Mr&t3dQNqT+z>u4tlA2QtW~ODP=A;ytfV`7fkO`*qi_1#*85kIX
z6ASXo5_19)i%RlRi;Cf12N~l8^12Ko14AkU$ge33P)|lNGo-RGWU+$6qnQ!pDJYkT
z0mNm8$ucvfurQ>sGBh(XMsdId*}#JAU_nlpAO~2G6D-ID6XXI5a)SlAVS+qhL0+&R
z4@{5`EXWTQ<Yh?ZW60uXND%-BCnH0Y08B&>CL#zE5rT;b!9;{%BEm2c5txVwOhgnW
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GJ~K%;fl-%)C^E@{H7?R0W7a8v}*J
zycC7Z;&@OKqc|fqwZzuV(I?myEDY11nPRJ2Y@G=zMxkZVhy73n0|U6t0#1~0YY_TM
zK#3(Y1)S$n^UA>7<RWmbms*jU465}&;h2_MlAMvBmkKMwP$~>a`UmA|us*2a;KYHd
z4&*+n$2X_~GXjM%56E~X9wtdfF-A5<0VZ%O09+cy$LA&HrpCvYfC|I-_}u)I(i{*M
z6hUAqh^oxIjMSpck|0pER05K7%gIkH2@(QjY*3jV1S-FSK)E{zl+S}e#cGf=NLC3%
zfOLSvF+VRAT=@intP28_GC?4>1%Xm#5XiaUFhCI0O#Ptd3Mj&gK?NHdBO4<d6F(zA
zqbLG039$&V3$cSp4Y1ol!4?E6$iNL)P%;BYV}3zuUTRT65Ga8JfwB!aT!KKp3<8zR
p;1Kc!HE4rCmLj|ZW>L{k;K;FoM4BDQA;lmMiZSvq3NR`$0RTaow6p*K

diff --git a/static/src/less/style.less b/static/src/less/style.less
index 0d88dd6..a91c85a 100644
--- a/static/src/less/style.less
+++ b/static/src/less/style.less
@@ -1,6 +1,5 @@
 
 .o_project_kanban_main { width: 100%!important; }
-.o_project_kanban_main a { color: inherit!important; }
 
 .lf_cell { padding: 5px 0; border-top: 1px solid #999!important; }
 .budget_table { margin-top: 10px; margin-bottom: 20px; }
diff --git a/views/lefilament_projets_view.xml b/views/lefilament_projets_view.xml
index e4c25dd..cf6c3cb 100644
--- a/views/lefilament_projets_view.xml
+++ b/views/lefilament_projets_view.xml
@@ -42,6 +42,7 @@
 			<field name="arch" type="xml">
 				<xpath expr="//field[@name='state']" position="after">
 					<field name="lf_total_budget" />
+					<field name="lf_heures_budget" />
 					<field name="lf_heures_projet" />
 					<field name="lf_heures_planifiees" />
 					<field name="lf_heures_restantes" />
@@ -57,7 +58,6 @@
                 <field name="inherit_id" ref="project.view_project_kanban"/>
                 <field name="arch" type="xml">
                         <xpath expr="//div[@class='o_kanban_primary_left']" position="after">
-                        	<a t-if="record.use_tasks.raw_value" name="%(project.act_project_project_2_project_task_all)d" type="action">
 	                        	<table class="table table-condensed" style="margin-bottom: 0;">
 	                        		<thead style="background: transparent; border-bottom: 1px solid #555;">
 	                        			<tr>
@@ -75,14 +75,21 @@
 	                        		</tbody>
 	                        	</table>
 	                        	<table class="budget_table"><tbody><tr>
-	                        		<td><strong>Budget : </strong></td>
+	                        		<td><strong>Budget total : </strong></td>
 	                        		<td><field name="lf_total_budget"> €</field></td>
 	                        	</tr>
 	                        	<tr>
 	                        		<td><strong>Coûts Annexes : </strong></td>
 	                        		<td><field name="lf_couts_annexes"> €</field></td>
+	                        	</tr>
+	                        	<tr>
+	                        		<td><strong>Budget heures : </strong></td>
+	                        		<td><field name="lf_heures_budget"> €</field></td>
 	                        	</tr></tbody></table>
-                        	</a>
+	                        <table class="budget_table"><tbody><tr>
+	                        	<td><a t-if="record.use_tasks.raw_value" name="%(project.act_project_project_2_project_task_all)d" type="action">Voir les tâches</a></td>
+	                        	<!-- <td><a name="%(act_detail_project)d" type="action">Voir détail projet</a></td> -->
+	                        </tr></tbody></table>
                         </xpath>
                         <!-- HIDE TASK AND DOCS NUMBER -->
                         <xpath expr="//div[@class='o_project_kanban_boxes']" position="attributes">
@@ -91,7 +98,5 @@
                 </field>
         </record>
 
-
-
 	</data>
 </openerp>
\ No newline at end of file
-- 
GitLab