From 47369ac18a6427cdc913b8e6e4cca4634c4c9a69 Mon Sep 17 00:00:00 2001
From: Benjamin <Benjamin@MBP-de-Benj.(none)>
Date: Wed, 18 Jul 2018 16:16:01 +0200
Subject: [PATCH] modif progressbar

---
 __manifest__.py                   |  2 +-
 static/src/js/dashboard_year.js   | 23 +++++++++++++++++++++--
 static/src/xml/lefilament_tdb.xml |  2 +-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/__manifest__.py b/__manifest__.py
index d9939ec..17d368c 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -20,7 +20,7 @@
     'website': "http://www.le-filament.com",
     'version': '10.0.1',
     'license': 'AGPL-3',
-    'depends': ['crm','account'],
+    'depends': ['crm','account','hr_expense'],
     'data': [
         'security/lefilament_dashboard_security.xml',
         'security/ir.model.access.csv',
diff --git a/static/src/js/dashboard_year.js b/static/src/js/dashboard_year.js
index 2d037a9..2ae6294 100644
--- a/static/src/js/dashboard_year.js
+++ b/static/src/js/dashboard_year.js
@@ -103,13 +103,22 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
             /////////////////////////////////////////
             
             this.ctx = this.$el.find('#target')[0].getContext('2d');
+
+            var ptarg = this.ptarg;
+            var max_xaxis = 100;
+
+            if (this.ptarg < 0 ) {
+            	ptarg = 0;
+            	max_xaxis = 100 - this.ptarg;
+            }
 	    		
    			var dataset_stacked = [
 		        { label: 'Facturé', data: [this.pfact], backgroundColor: '#8ED8A2', },
 		        { label: 'Commandes', data: [this.pcomm], backgroundColor: '#F6DCA2', },
 		        { label: 'Gagné', data: [this.ppipe_win], backgroundColor: '#F6CCA2', },
 		        { label: 'Pipe', data: [this.ppipe_to_win], backgroundColor: '#F6ACA2', },
-		        { label: 'To Do', data: [this.ptarg], backgroundColor: '#eee', }];
+		        { label: 'To Do', data: [ptarg], backgroundColor: '#eee', },
+		        ];
 
 		    var label = 'Année ' + moment(Date.now()).format('YYYY');
 
@@ -119,6 +128,7 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
 	        };
 
             var options = { 
+            	responsive: true,
             	legend: {
             		display: false,
             	},
@@ -129,7 +139,16 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
 		            xAxes: [{
 		                stacked: true,
 		                scaleShowLabels: false,
-                        display : false ,
+                        display : true ,
+                        ticks: {
+		                    max: max_xaxis,
+		                    stepSize: 50,
+		                    fontSize: 10,
+		                    fontColor: '#999',
+		                    callback: function(value, index, values) {
+		                        return value + '%';
+		                    },
+		                },
 		            }],
                     yAxes: [{
                             stacked: true,
diff --git a/static/src/xml/lefilament_tdb.xml b/static/src/xml/lefilament_tdb.xml
index 299c415..57b2bdb 100644
--- a/static/src/xml/lefilament_tdb.xml
+++ b/static/src/xml/lefilament_tdb.xml
@@ -135,7 +135,7 @@
 							<p class="card-number">
 								<t t-esc="widget.render_monetary(widget.values.target)"></t>
 							</p>
-							<canvas id="target" width="auto" height="100"></canvas>
+							<canvas id="target" width="auto" height="125"></canvas>
 							<!-- <div id="hchart" ></div> -->
 							<table class="table-legend">
 								<tr>
-- 
GitLab