diff --git a/static/src/css/lefilament_tdb.css b/static/src/css/lefilament_tdb.css index ea7f94a096942424d59e6c0fd3c1df5f4e6a002b..c25c834b1ba3f6611285a1adfdedbeccde29fa3d 100644 --- a/static/src/css/lefilament_tdb.css +++ b/static/src/css/lefilament_tdb.css @@ -21,14 +21,16 @@ } .card { - color: #73879c; margin: 10px 0; } +.card-body { + color: #73879c; +} .card a { color: inherit; } .card-number a { - color: inherit; + color: #73879c; } .card-half { float: left; @@ -75,6 +77,7 @@ p.card-maj { #pipe, #facture, #fournisseur, +#statement_lines, #releve { cursor: pointer; } diff --git a/static/src/js/dashboard_year.js b/static/src/js/dashboard_year.js index f7f099f117f4cad8ca9c812b6ca7c3e96bf9215f..aa491efb3abeebf1d5308ded1ae4e779dcbb2907 100644 --- a/static/src/js/dashboard_year.js +++ b/static/src/js/dashboard_year.js @@ -36,6 +36,9 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { "click #releve": function () { this.releve(); }, + "click #statement_lines": function () { + this.statement_lines(); + }, }, init: function () { @@ -52,11 +55,19 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { this._rpc({ model: "ir.model.data", method: "xmlid_to_res_id", - args: ["account.view_move_form"], + args: ["account.view_invoice_form"], }).then(function (results) { self.invoice_view_id = results; }); + this._rpc({ + model: "ir.model.data", + method: "xmlid_to_res_id", + args: ["lefilament_tdb.view_invoice_tree"], + }).then(function (results) { + self.invoice_tree_id = results; + }); + this._rpc({ model: "ir.model.data", method: "xmlid_to_res_id", @@ -96,16 +107,10 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { ).toFixed(0); self.ptarg = 100 - - self.pfact - - self.pcomm - - self.ppipe_win - - self.ppipe_to_win; + self.pfact; self.ptarg2 = self.values.target - - self.pfact2 - - self.pcomm2 - - self.ppipe2_to_win - - self.ppipe2_win; + self.pfact2; self.total = ( ((self.values.facture + self.values.commandes + @@ -125,7 +130,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { self.total2 = self.pfact2 + self.pcomm2 + self.ppipe2_win; - self.target = self.values.target; + self.yeartarget = self.values.target; deferred.resolve(); }); @@ -143,6 +148,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { this.ctx = this.$el.find("#target")[0].getContext("2d"); + var yeartarget = this.yeartarget var ptarg = this.ptarg; var max_xaxis = 100; @@ -153,10 +159,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { 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: [ptarg], backgroundColor: "#eee"}, + {label: "À facturer", data: [ptarg], backgroundColor: "#eee"}, ]; var label = "Année " + moment(Date.now()).format("YYYY"); @@ -210,10 +213,10 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { titleFontColor: "#999", bodyFontColor: "#777", callbacks: { - label: function (tooltipItems) { + label: function (tooltipItems, data) { return ( ( - (tooltipItems.xLabel * self.target) / + (tooltipItems.xLabel * yeartarget) / 100000 ).toLocaleString("fr", {maximumFractionDigits: 2}) + " K€" @@ -265,20 +268,24 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { facture: function (fiscalyear) { var self = this; - var context = {user_id: session.uid}; + var context = { + user_id: session.uid, + search_default_posted: 1, + }; + console.log(self.invoice_tree_id) + console.log(self.invoice_view_id) var action = { type: "ir.actions.act_window", res_model: "account.move", - view_mode: "tree,form", + view_mode: "tree,pivot,graph,form", views: [ - [false, "list"], + [self.invoice_tree_id, "list"], [false, "pivot"], [false, "graph"], [self.invoice_view_id, "form"], ], domain: [ - ["state", "=", "posted"], ["move_type", "in", ["out_invoice", "out_refund"]], ["invoice_date", ">=", fiscalyear], ], @@ -287,6 +294,8 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { context: context, }; + console.log(action) + this.do_action(action); }, commandes: function () { @@ -364,7 +373,7 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { res_model: "account.move", view_mode: "tree,form", views: [ - [false, "list"], + [self.invoice_tree_id, "list"], [false, "pivot"], [false, "graph"], [self.invoice_view_id, "form"], @@ -420,6 +429,26 @@ odoo.define("lefilament_tdb.dashboard_year", function (require) { context: context, }; + this.do_action(action); + }, + statement_lines: function () { + var context = {user_id: session.uid}; + + var action = { + type: "ir.actions.act_window", + res_model: "account.bank.statement.line", + view_mode: "tree,pivot,graph,form", + views: [ + [false, "list"], + [false, "pivot"], + [false, "graph"], + [false, "form"], + ], + target: "current", + name: "Lignes de banque", + context: context, + }; + this.do_action(action); }, }); diff --git a/static/src/xml/lefilament_tdb.xml b/static/src/xml/lefilament_tdb.xml index 658359d1c6560b8f5d3cc172577074a952fa867a..1e641f178eb9f7418160d5a56316adea5701be88 100644 --- a/static/src/xml/lefilament_tdb.xml +++ b/static/src/xml/lefilament_tdb.xml @@ -134,7 +134,7 @@ </tr> <tr> <td style="background-color: #eee; width: 20px;" /> - <td>To Do</td> + <td>À facturer</td> <td class="nb"><t t-esc="widget.render_percent(widget.ptarg)" /></td> @@ -218,7 +218,9 @@ <div class="tab-content card-tab" id="myTab2Content"> <div id="variation" class="tab-pane fade show active in"> <p class="card-number"> - <t t-raw="widget.render_monetary_color(widget.values.variation)" /> + <a id="statement_lines"> + <t t-raw="widget.render_monetary_color(widget.values.variation)" /> + </a> </p> </div> <div id="e_s" class="tab-pane fade"> @@ -238,24 +240,6 @@ </div> </div> </div> - <!-- <div class="col-xs-12"> - <div class="card card-cca"> - <div class="card-body"> - <div class="card-cca-half"> - <h5 class="card-title">CCA en cours</h5> - <p class="card-number"> - <t t-raw="widget.render_monetary(widget.values.cca)"></t> - </p> - </div> - <div class="card-cca-half"> - <h5 class="card-title">Capital Social</h5> - <p class="card-number"> - <t t-raw="widget.render_monetary(widget.values.capital)"></t> - </p> - </div> - </div> - </div> - </div> --> </div> </div> </div> diff --git a/views/views.xml b/views/views.xml index 60bc10b03d01fe1e4eb6a0797c6da9ef07cadeba..8bc5be2ebf0c9a9de753c0bab0e2b30a837e316f 100644 --- a/views/views.xml +++ b/views/views.xml @@ -102,6 +102,32 @@ sequence="10" /> + <record id="view_invoice_tree" model="ir.ui.view"> + <field name="name">account.invoice.tree</field> + <field name="model">account.move</field> + <field name="arch" type="xml"> + <tree string="Invoices"> + <field name="name" decoration-bf="1"/> + <field name="invoice_date" string="Date Facturation"/> + <field name="partner_id" string="Client"/> + <field name="invoice_date_due" /> + <field name="invoice_origin"/> + <field name="payment_reference" optional="hide"/> + <field name="ref" optional="hide"/> + <field name="invoice_user_id" widget="many2one_avatar_user"/> + <field name="amount_untaxed_signed" string="Montant HT" sum="Total" decoration-bf="1" /> + <field name="amount_tax_signed" sum="Total" optional="hide"/> + <field name="amount_total_signed" string="Total" sum="Total" optional="show"/> + <field name="amount_residual_signed" string="Montant Dû" sum="Amount Due" optional="show"/> + <field name="currency_id" invisible="1"/> + <field name="company_currency_id" invisible="1"/> + <field name="state" widget="badge" decoration-success="state == 'posted'" decoration-info="state == 'draft'" optional="show"/> + <field name="payment_state" widget="badge" decoration-danger="payment_state == 'not_paid'" decoration-warning="payment_state in ('partial', 'in_payment')" decoration-success="payment_state in ('paid', 'reversed')" attrs="{'invisible': [('payment_state', 'in', ('invoicing_legacy'))]}"/> + <field name="move_type" invisible="1"/> + </tree> + </field> + </record> + <record id="lefilament_dashboard_tree" model="ir.ui.view"> <field name="name">Le Filament Dashboard Treeview</field>