diff --git a/static/src/css/lefilament_tdb.css b/static/src/css/lefilament_tdb.css index 09a8f5e420b224ac8897076614a41684d81cc1d6..d2b195f5c213666b654ad0578651c43ec4404a04 100644 --- a/static/src/css/lefilament_tdb.css +++ b/static/src/css/lefilament_tdb.css @@ -44,8 +44,7 @@ p.card-maj { margin: 0px; font-size: 10px; font-style: italic; font-weight: .dashboard-tab .nav-tabs { margin-top: 10px; border-bottom: none; } .dashboard-tab .nav-tabs > li > a { border: none!important; color: #aaa;} -#commandes { cursor: pointer; } -#facture_non_encaisse { cursor: pointer; } +#commandes, #facture_non_encaisse, #pipe, #facture, #fournisseur, #releve { cursor: pointer; } .ca_target { font-size: 18px; } diff --git a/static/src/js/dashboard_year.js b/static/src/js/dashboard_year.js index e7e6d259c07946551970e681d446189224c652a9..381357c46a40f4268cdb294762c6cb99099b99bf 100644 --- a/static/src/js/dashboard_year.js +++ b/static/src/js/dashboard_year.js @@ -20,12 +20,27 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) { template: 'YearDashboard', events: { - 'click #facture_non_encaisse': function() { + 'click #facture': function() { this.facture(); }, + 'click #facture_non_encaisse': function() { + this.facture_non_encaisse(); + }, 'click #commandes': function() { this.commandes(); }, + 'click #pipe_link': function() { + this.pipe(); + }, + 'click #pipe_n1_link': function() { + this.pipe_n1(); + }, + 'click #fournisseur_link': function() { + this.fournisseur(); + }, + 'click #releve': function() { + this.releve(); + }, }, init: function() { @@ -73,64 +88,6 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) { render_chart: function(chart) { self = this; - ///////////////////////////////////////// - // Etat d'avancement -> HighChart // - ///////////////////////////////////////// - - // var hchart = this.$el.find('#hchart')[0]; - - // Highcharts.setOptions({ colors: ['#8ED8A2', '#F6DCA2', '#F6CCA2', '#F6ACA2', '#eee'], }); - - // this.mychart = new Highcharts.chart({ - // chart: { - // renderTo: hchart, - // type: 'pie', - // margin: 0 - // }, - // title: { - // text: '<span class="ca_target">'+ - // self.values.target.toLocaleString('fr', { maximumFractionDigits: 0 }) + ' € </span>', - // align: 'center', - // verticalAlign: 'middle', - // style: { 'color': '#73879C', 'font-size': '11px' }, - // y: -20, - // }, - // plotOptions: { - // pie: { - // slicedOffset: 0, - // size: '100%', - // dataLabels: { - // enabled: false - // } - // }, - // series: { - // states: { - // hover: { - // enabled: false - // } - // } - // } - // }, - // tooltip: { - // pointFormat: '<p class="point"><span class="point_percent">{point.percentage:.0f}% </span><br/> {point.y} €</p>', - // backgroundColor: "rgba(255,255,255,0.85)", - // borderColor: null, - // borderRadius: 0, - // borderWidth: 0, - // useHTML: true, - // shadow: false, - // }, - // series: [{ - // type: 'pie', - // innerSize: '85%', - // data: [ ['Facturé', this.pfact2], ['Commandes', this.pcomm2], ['Gagné', this.ppipe2_win], ['Pipe', this.ppipe2_to_win], ['To Do', this.ptarg2], ], - // slicedOffset: 0, - - // }], - // }); - - // this.mychart.reflow(); - ///////////////////////////////////////// // Etat d'avancement -> Bar Chart // ///////////////////////////////////////// @@ -216,6 +173,8 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) { facture: function() { var self = this; + var date = moment().startOf('year').format('YYYY-MM-DD'); + console.log(date); var context = { 'user_id': this.session.uid, } var action = ({ @@ -224,9 +183,9 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) { view_type: 'form', view_mode: 'tree,form', views: [[false, 'list'], [false, 'form']], - domain: [['state','=','open'],['type','=','out_invoice']], + domain: [['state','in',['open','paid']],['type','=','out_invoice'],['date_invoice','>=',date]], target:'current', - name: 'Factures en cours', + name: 'Facturé', context: context }) @@ -248,6 +207,98 @@ odoo.define('lefilament_tdb.dashboard_year', function (require) { context: context }) + this.do_action(action); + }, + pipe: function() { + var self = this; + var deadline = moment().endOf('year').format('YYYY-MM-DD'); + var context = { 'user_id': this.session.uid, } + + var action = ({ + type: 'ir.actions.act_window', + res_model: 'crm.lead', + view_type: 'form', + view_mode: 'tree,form', + views: [[false, 'kanban'], [false, 'list'], [326, 'form']], + domain: [['type','=','opportunity'],['date_deadline','<=', deadline]], + target:'current', + name: 'Pipe', + context: context + }) + + this.do_action(action); + }, + pipe_n1: function() { + var self = this; + var deadline = moment().endOf('year').format('YYYY-MM-DD'); + var context = { 'user_id': this.session.uid, } + + var action = ({ + type: 'ir.actions.act_window', + res_model: 'crm.lead', + view_type: 'form', + view_mode: 'kanban,tree,form', + views: [[false, 'kanban'], [false, 'list'], [326, 'form']], + domain: [['type','=','opportunity'],['date_deadline','>', deadline]], + target:'current', + name: 'Pipe', + context: context + }) + + this.do_action(action); + }, + facture_non_encaisse: function() { + var self = this; + var context = { 'user_id': this.session.uid, } + + var action = ({ + type: 'ir.actions.act_window', + res_model: 'account.invoice', + view_type: 'form', + view_mode: 'kanban,tree,form', + views: [[false, 'list'], [false, 'form']], + domain: [['state','=','open'],['type','=','out_invoice']], + target:'current', + name: 'Factures en cours', + context: context + }) + + this.do_action(action); + }, + fournisseur: function() { + var self = this; + var context = { 'user_id': this.session.uid, } + + var action = ({ + type: 'ir.actions.act_window', + res_model: 'account.invoice', + view_type: 'form', + view_mode: 'tree,form', + views: [[false, 'list'], [false, 'form']], + domain: [['state','=','open'],['type','=','in_invoice']], + target:'current', + name: 'Factures fournisseurs en cours', + context: context + }) + + this.do_action(action); + }, + releve: function() { + var self = this; + var context = { 'user_id': this.session.uid, } + + var action = ({ + type: 'ir.actions.act_window', + res_model: 'account.bank.statement', + view_type: 'form', + view_mode: 'tree,form', + views: [[false, 'list'], [false, 'form']], + // domain: [['state','=','open'],['type','=','in_invoice']], + target:'current', + name: 'Relevés en cours', + context: context + }) + this.do_action(action); }, }); diff --git a/static/src/xml/lefilament_tdb.xml b/static/src/xml/lefilament_tdb.xml index b3b6976b55b2ce8a56bf3fdf71dff1555571671a..299c415d01043dc6f512ab697cb2fcda6f08ddb3 100644 --- a/static/src/xml/lefilament_tdb.xml +++ b/static/src/xml/lefilament_tdb.xml @@ -87,7 +87,9 @@ <div class="card"> <p class="card-header">Facturé</p> <p class="card-number"> - <t t-esc="widget.render_monetary(widget.values.facture)"></t> + <a id="facture"> + <t t-esc="widget.render_monetary(widget.values.facture)"></t> + </a> </p> </div> </div> @@ -109,12 +111,16 @@ <div class="tab-content card-tab" id="myTab1Content"> <div id="pipe" class="tab-pane fade active in"> <p class="card-number"> - <t t-esc="widget.render_monetary(widget.values.pipe)"></t> + <a id="pipe_link"> + <t t-esc="widget.render_monetary(widget.values.pipe)"></t> + </a> </p> </div> <div id="pipe_n1" class="tab-pane fade"> <p class="card-number"> - <t t-esc="widget.render_monetary(widget.values.pipe_n1)"></t> + <a id="pipe_n1_link"> + <t t-esc="widget.render_monetary(widget.values.pipe_n1)"></t> + </a> </p> </div> </div> @@ -186,7 +192,9 @@ <p class="card-header">Trésorerie</p> <p class="card-maj">Denière mise à jour le <t t-esc="widget.render_date(widget.values.date_maj)"></t></p> <p class="card-number"> - <strong><t t-esc="widget.render_monetary(widget.values.tresorerie)"></t></strong> + <a id="releve"> + <strong><t t-esc="widget.render_monetary(widget.values.tresorerie)"></t></strong> + </a> </p> </div> </div> @@ -205,7 +213,9 @@ </div> <div id="fournisseur" class="tab-pane fade"> <p class="card-number"> - <t t-esc="widget.render_monetary(widget.values.a_payer)"></t> + <a id="fournisseur_link"> + <t t-esc="widget.render_monetary(widget.values.a_payer)"></t> + </a> </p> </div> </div>