diff --git a/models/lefilament_tdb.py b/models/lefilament_tdb.py
index 23891ed3776cee75456d055eeb7b3d404e910555..70412f9a883abfa95493bcd93a4a6f183a91270d 100644
--- a/models/lefilament_tdb.py
+++ b/models/lefilament_tdb.py
@@ -154,16 +154,24 @@ class LeFilamentTdb(models.Model):
res['pipe_to_win'] =+ datas[0]['pipe_to_win']
if datas[0]['pipe_n1']:
res['pipe_n1'] =+ datas[0]['pipe_n1']
- res['tresorerie'] =+ datas[0]['tresorerie']
- res['date_maj'] = datas[0]['date_maj']
- res['entree'] =+ datas[0]['entree']
- res['sortie'] =+ datas[0]['sortie']
- res['variation'] =+ datas[0]['variation']
+ if datas[0]['tresorerie']:
+ res['tresorerie'] =+ datas[0]['tresorerie']
+ if datas[0]['date_maj']:
+ res['date_maj'] = datas[0]['date_maj']
+ if datas[0]['entree']:
+ res['entree'] =+ datas[0]['entree']
+ if datas[0]['sortie']:
+ res['sortie'] =+ datas[0]['sortie']
+ if datas[0]['variation']:
+ res['variation'] =+ datas[0]['variation']
if datas[0]['commandes']:
res['commandes'] =+ datas[0]['commandes']
- res['cca'] =+ datas[0]['cca']
- res['target'] =+ ca_target[0]['ca_target']
- res['capital'] =+ capital[0]['capital']
+ if datas[0]['cca']:
+ res['cca'] =+ datas[0]['cca']
+ if ca_target[0]['ca_target']:
+ res['target'] =+ ca_target[0]['ca_target']
+ if capital[0]['capital']:
+ res['capital'] =+ capital[0]['capital']
return res
diff --git a/static/src/css/lefilament_tdb.css b/static/src/css/lefilament_tdb.css
index 35e4c6c20e2a0c11323f38a33e35508254fa67ab..9f830eec8f1ea9277b089b6e53edf260df5c3a3f 100644
--- a/static/src/css/lefilament_tdb.css
+++ b/static/src/css/lefilament_tdb.css
@@ -51,11 +51,13 @@ p.card-maj { margin: 0px; font-size: 10px; font-style: italic; font-weight:
.btn-tdb { border: 1px solid #eee; border-radius: 0; font-size: 11px; padding: 6px 10px; text-transform: none; }
/*HIGHCHART*/
-#hchart .highcharts-container { max-width: 100%; }
+/*#hchart .highcharts-container { max-width: 100%; }
#hchart svg { max-width: 100%; }
.highcharts-title { font-family: "Helvetica Neue", Helvetica, "Open Sans"; }
.point { font-family: "Helvetica Neue", Helvetica, "Open Sans"; color: #73879C; text-align: center; }
-.point_percent { font-size: 16px; font-weight: 400; }
+.point_percent { font-size: 16px; font-weight: 400; }*/
+
+canvas { width: 100%; }
/*Legend*/
.table-legend { width: 100%; max-width: 100%; margin: 10px 0; border-collapse: separate; border-spacing: 8px; font-size: 11px; }
diff --git a/static/src/js/dashboard_year.js b/static/src/js/dashboard_year.js
index 5875e51d2595b8691cec8906db4a0acd0340bb41..5b65c900e28ea1227a8f1f1b6f1e114c73a7b1e2 100644
--- a/static/src/js/dashboard_year.js
+++ b/static/src/js/dashboard_year.js
@@ -16,9 +16,6 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
template: 'YearDashboard',
events: {
- // 'click .card': function() {
- // this.mychart.reflow();
- // },
'click #facture_non_encaisse': function() {
this.facture();
},
@@ -42,20 +39,24 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
dash_model.call('retrieve_datas_dashboard')
.then(function(results) {
self.values = results;
- self.progress = results.facture / results.target;
self.pfact = (self.values.facture / self.values.target * 100).toFixed(0);
self.pcomm = (self.values.commandes / self.values.target * 100).toFixed(0);
self.ppipe_win = (self.values.pipe_win / self.values.target * 100).toFixed(0);
self.ppipe_to_win = (self.values.pipe_to_win / self.values.target * 100).toFixed(0);
self.ptarg = 100-self.pfact-self.pcomm-self.ppipe_win-self.ppipe_to_win;
+
self.pfact2 = (self.values.facture);
self.pcomm2 = (self.values.commandes);
self.ppipe2_win = (self.values.pipe_win);
self.ppipe2_to_win = (self.values.pipe_to_win);
self.ptarg2 = self.values.target -self.pfact2-self.pcomm2-self.ppipe2_to_win-self.ppipe2_win;
- self.total2 = ((self.values.facture + self.values.commandes + self.values.pipe_win) / self.values.target * 100).toFixed(0);
- self.total = self.pfact + self.pcomm + self.ppipe_win
+
+ self.total = ((self.values.facture + self.values.commandes + self.values.pipe_win) / self.values.target * 100).toFixed(0);
+ self.total2 = self.pfact2 + self.pcomm2 + self.ppipe2_win
+
+ self.target = self.values.target
+
deferred.resolve();
});
return jQuery.when(this._super.apply(this, arguments),deferred);
@@ -133,11 +134,11 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
this.ctx = this.$el.find('#target')[0].getContext('2d');
var dataset_stacked = [
- { label: 'Facturé', data: [this.pfact2], backgroundColor: '#8ED8A2', },
- { label: 'Commandes', data: [this.pcomm2], backgroundColor: '#F6DCA2', },
- { label: 'Gagné', data: [this.ppipe2_win], backgroundColor: '#F6CCA2', },
- { label: 'Pipe', data: [this.ppipe2_to_win], backgroundColor: '#F6ACA2', },
- { label: 'To Do', data: [this.ptarg2], backgroundColor: '#eee', }];
+ { 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', }];
var label = 'Année ' + moment(Date.now()).format('YYYY');
@@ -149,8 +150,6 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
var options = {
legend: {
display: false,
- position: 'bottom',
- fullWidth: false,
},
layout: {
padding: { left:0, right: 0, bottom: 20, top: 20, },
@@ -174,7 +173,7 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
bodyFontColor: '#777',
callbacks: {
label: function(tooltipItems, data) {
- return (tooltipItems.xLabel / 1000).toLocaleString('fr', { maximumFractionDigits: 2 }) + ' K€';
+ return (tooltipItems.xLabel * self.target / 100000).toLocaleString('fr', { maximumFractionDigits: 2 }) + ' K€';
}
}
},
@@ -190,7 +189,7 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) {
return value;
},
render_keur: function(value) {
- value = (value / 1000).toLocaleString('fr', { maximumFractionDigits: 0 }) + ' K€';
+ value = (value/ 1000).toLocaleString('fr', { maximumFractionDigits: 0 }) + ' K€';
return value;
},
render_percent: function(value) {
diff --git a/static/src/xml/lefilament_tdb.xml b/static/src/xml/lefilament_tdb.xml
index aacdb085d50490c4b3ec7c09aa65d8298a01a1d1..f2b0e32eac2848a08d85126d3e0241a494fda558 100644
--- a/static/src/xml/lefilament_tdb.xml
+++ b/static/src/xml/lefilament_tdb.xml
@@ -130,7 +130,6 @@
<t t-esc="widget.render_monetary(widget.values.target)"></t>
</p>
<canvas id="target" width="auto" height="100"></canvas>
- <div id="chart" class="chart-container"></div>
<!-- <div id="hchart" ></div> -->
<table class="table-legend">
<tr>