From 523d80ff6e2097efab29127200538f5530ac0ba3 Mon Sep 17 00:00:00 2001
From: Benjamin <Benjamin@MBP-de-Benj.(none)>
Date: Tue, 11 Jul 2017 18:02:12 +0200
Subject: [PATCH] [add] couts annexes + modif affichage kanban

---
 .gitignore                        |   3 ++
 lefilament_projets.py             |  15 +++++++++-
 lefilament_projets.pyc            | Bin 2514 -> 3105 bytes
 static/src/css/style.css          |   6 ++++
 views/lefilament_projets_view.xml |  48 +++++++++++++++++-------------
 5 files changed, 51 insertions(+), 21 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 static/src/css/style.css

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..75bb204
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.*
+*.pyc
+!.gitignore
diff --git a/lefilament_projets.py b/lefilament_projets.py
index 654182c..06793c4 100644
--- a/lefilament_projets.py
+++ b/lefilament_projets.py
@@ -16,6 +16,7 @@ class SapovalPartners(models.Model):
 	lf_heures_passees = fields.Float('Heures passées', compute='_total_heures_passees')
 	lf_heures_restantes = fields.Float('Restant (h)', compute='_total_heures_restantes')
 	lf_heures_planifiees = fields.Float('Planifiées (h)', compute='_total_heures_planifiees')
+	lf_couts_annexes =  fields.Float('Coûts Annexes', compute='_couts_annexes')
 
 	@api.one
 	def _taux_horaire(self):
@@ -44,4 +45,16 @@ class SapovalPartners(models.Model):
 		res = 0.0
 		for record in self.task_ids:
 			res = res + record.planned_hours
-		self.lf_heures_planifiees = res
\ No newline at end of file
+		self.lf_heures_planifiees = res
+
+	@api.one
+	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, ) )
+		couts_annexes = self.env.cr.fetchone()[0]
+		if couts_annexes:
+			self.lf_couts_annexes = couts_annexes * (-1.0)
+		else:
+			self.lf_couts_annexes = 0.0
+
diff --git a/lefilament_projets.pyc b/lefil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l2Kst2i5{c`N@fFo@_!43=Bb{lQ*y_LX@!u@h~tjs7*Ft&tw#yJd53g
zTL7d&3`B^7%#jG<Wnf^?Vqjn>=3ro8U|?cn6krr&)DW3$%jG672vWxfBKScB#B>l#
z0z^nnUe2XCc_nw$WPNTf1sMhg1~x`EMm8pXMt(+77-SM+5n>l&7h;(l%Y6g@^Sn4h

diff --git a/static/src/css/style.css b/static/src/css/style.css
new file mode 100644
index 0000000..0c70eb7
--- /dev/null
+++ b/static/src/css/style.css
@@ -0,0 +1,6 @@
+
+.o_project_kanban_main { width: 100%!important; }
+
+.lf_cell { padding: 5px 0;border-top: 1px solid #555; }
+.budget_table { margin-top: 10px; }
+.budget_table td { padding: 0 5px; }
\ No newline at end of file
diff --git a/views/lefilament_projets_view.xml b/views/lefilament_projets_view.xml
index f7fa703..f4b15e3 100644
--- a/views/lefilament_projets_view.xml
+++ b/views/lefilament_projets_view.xml
@@ -2,7 +2,14 @@
 
 <openerp>
 	<data>
-	
+
+		<!-- Assets -->	
+		<template id="assets_backend" name="project assets le filament" inherit_id="web.assets_backend">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/lefilament_projets/static/src/css/style.css"/>
+            </xpath>
+        </template>
+
 		<!-- Project Form -->
 		<record id="view_form_lefilament_project_form_inherited" model="ir.ui.view">
 			<field name="name">Le Filament Projets</field>
@@ -38,6 +45,7 @@
 					<field name="lf_heures_projet" />
 					<field name="lf_heures_planifiees" />
 					<field name="lf_heures_restantes" />
+					<field name="lf_couts_annexes" />
 				</xpath>
 			</field>
 		</record>
@@ -49,35 +57,35 @@
                 <field name="inherit_id" ref="project.view_project_kanban"/>
                 <field name="arch" type="xml">
                         <xpath expr="//div[@class='o_kanban_primary_left']" position="after">
-                        	<field name="lf_total_budget"> euros</field>
                         	<table class="table table-condensed" style="margin-bottom: 0;">
                         		<thead style="background: transparent; border-bottom: 1px solid #555;">
                         			<tr>
-                        				<td style="padding: 5px 0;">potentiel</td>
-                        				<td style="padding: 5px 0;">planifié</td>
+                        				<td>vendues</td>
+                        				<td>passées</td>
+                        				<td>restantes</td>
                         			</tr>
                         		</thead>
                         		<tbody>
                         			<tr>
-                        				<td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_projet" >h</field></td>
-                        				<td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_planifiees" >h</field></td>
+                        				<td class="lf_cell"><field name="lf_heures_projet" >h</field></td>
+                        				<td class="lf_cell"><field name="lf_heures_passees" >h</field></td>
+                        				<td class="lf_cell"><field name="lf_heures_restantes" >h</field></td>
                         			</tr>
                         		</tbody>
                         	</table>
-                        	<table class="table table-condensed">
-                        		<thead style="background: transparent; border-bottom: 1px solid #555;">
-                        			<tr>
-                        				<td style="padding: 5px 0;">en cours</td>
-                        				<td style="padding: 5px 0;">reste</td>
-                        			</tr>
-                        		</thead>
-                        		<tbody>
-                        			<tr>
-                        				<td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_passees" >h</field></td>
-                        				<td style="padding: 5px 0;border-top: 1px solid #555;"><field name="lf_heures_restantes" >h</field></td>
-                        			</tr>
-                        		</tbody>
-                        	</table>                              
+                        	<table class="budget_table"><tbody><tr>
+                        		<td><strong>Budget : </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></tbody></table>
+                        	       
+                        </xpath>
+                        <!-- HIDE TASK AND DOCS NUMBER -->
+                        <xpath expr="//div[@class='o_project_kanban_boxes']" position="attributes">
+							<attribute name="invisible">1</attribute>
                         </xpath>
                 </field>
         </record>
-- 
GitLab