From 7489c0c1d58027aab97b03d0c295c63c982cc0a2 Mon Sep 17 00:00:00 2001 From: Ajmal Cybro Date: Fri, 28 May 2021 18:30:25 +0530 Subject: [PATCH] [UPDT] 2 * Dashboard issue fixed --- base_accounting_kit/__manifest__.py | 2 +- .../data/account_financial_report_data.xml | 54 +- base_accounting_kit/doc/changelog.md | 6 + .../static/src/js/account_dashboard.js | 1125 +++++++++-------- 4 files changed, 676 insertions(+), 511 deletions(-) diff --git a/base_accounting_kit/__manifest__.py b/base_accounting_kit/__manifest__.py index f0d7f2e4e..21d77b0db 100644 --- a/base_accounting_kit/__manifest__.py +++ b/base_accounting_kit/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Odoo 14 Full Accounting Kit', - 'version': '14.0.3.10.8', + 'version': '14.0.3.11.9', 'category': 'Accounting', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'summary': """ Asset and Budget Management, diff --git a/base_accounting_kit/data/account_financial_report_data.xml b/base_accounting_kit/data/account_financial_report_data.xml index 6272289d8..018f242f9 100644 --- a/base_accounting_kit/data/account_financial_report_data.xml +++ b/base_accounting_kit/data/account_financial_report_data.xml @@ -1,6 +1,6 @@ - + @@ -13,20 +13,66 @@ model="account.financial.report"> Income - 0 + 1 + detail_with_hierarchy + sum + + + Other Income + 10 + + + detail_with_hierarchy account_type + eval="[(4,ref('account.data_account_type_other_income'))]"/> + + + + Gross Profit + + detail_with_hierarchy + sum + 3 + + + + + Cost of Revenue + 10 + + detail_with_hierarchy + account_type + + + + + Operating Income + 1 + + detail_with_hierarchy + account_type + Expense - 1 + 2 detail_with_hierarchy diff --git a/base_accounting_kit/doc/changelog.md b/base_accounting_kit/doc/changelog.md index 8da84a570..abaf93cb3 100644 --- a/base_accounting_kit/doc/changelog.md +++ b/base_accounting_kit/doc/changelog.md @@ -70,3 +70,9 @@ #### UPDT - Report Configuration Sequence +#### 28.05.2021 +#### Version 14.0.3.11.9 +#### UPDT +- 2 * Dashboard Issue +- Report Configuration Sequence + diff --git a/base_accounting_kit/static/src/js/account_dashboard.js b/base_accounting_kit/static/src/js/account_dashboard.js index 95db74605..79f7b1a34 100644 --- a/base_accounting_kit/static/src/js/account_dashboard.js +++ b/base_accounting_kit/static/src/js/account_dashboard.js @@ -1,4 +1,4 @@ -odoo.define('AccountingDashboard.AccountingDashboard', function (require) { +odoo.define('AccountingDashboard.AccountingDashboard', function(require) { 'use strict'; var AbstractAction = require('web.AbstractAction'); var ajax = require('web.ajax'); @@ -37,26 +37,26 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { 'click #in_ex_hide': 'onclick_in_ex_hide', 'click #aged_payable_hide': 'onclick_aged_payable_hide', 'change #aged_receivable_values': function(e) { - e.stopPropagation(); - var $target = $(e.target); - var value = $target.val(); -// this.$('.aged_receivable_this_month').empty(); - this.onclick_aged_payable(this.$('#aged_receivable_values').val()); - }, + e.stopPropagation(); + var $target = $(e.target); + var value = $target.val(); + // this.$('.aged_receivable_this_month').empty(); + this.onclick_aged_payable(this.$('#aged_receivable_values').val()); + }, 'change #aged_payable_value': function(e) { - e.stopPropagation(); - var $target = $(e.target); - var value = $target.val(); - this.$('.aged_receivable_this_month').empty(); - this.onclick_aged_receivable(this.$('#aged_payable_value').val()); - }, + e.stopPropagation(); + var $target = $(e.target); + var value = $target.val(); + this.$('.aged_receivable_this_month').empty(); + this.onclick_aged_receivable(this.$('#aged_payable_value').val()); + }, 'change #top_10_customer_value': function(e) { - e.stopPropagation(); - var $target = $(e.target); - var value = $target.val(); - this.$('.top_10_customers_this_month').empty(); - this.onclick_top_10_month(this.$('#top_10_customer_value').val()); - }, + e.stopPropagation(); + var $target = $(e.target); + var value = $target.val(); + this.$('.top_10_customers_this_month').empty(); + this.onclick_top_10_month(this.$('#top_10_customer_value').val()); + }, 'change #toggle-two': 'onclick_toggle_two', 'click #unreconciled_counts_this_year': 'unreconciled_year', 'click #unreconciled_items_': 'unreconciled_month', @@ -75,143 +75,183 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { 'click #total_expense_this_year': 'expense_year', 'click #total_expenses_': 'expense_month', }, - profit_income_year: function (ev){ + profit_income_year: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_profit_income_year", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Net Profit or Loss'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - profit_income_month: function (ev){ + profit_income_month: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_profit_income_month", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Net Profit or Loss'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - total_income_year: function (ev){ + total_income_year: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_total_income_year", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Total Income'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - total_income_month: function (ev){ + total_income_month: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_total_income_month", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Total Income'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - expense_year: function (ev){ + expense_year: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_expense_year", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Total Expenses'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - expense_month: function (ev){ + expense_month: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_expense_month", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Total Expenses'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - unreconciled_year: function (ev) { + unreconciled_year: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_unreconcile_year", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Unreconciled'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - unreconciled_month: function (ev) { + unreconciled_month: function(ev) { var posted = false; var self = this; rpc.query({ model: "account.move", method: "click_unreconcile_month", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move.line', name: _t('Unreconciled'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - invoice_month_paid: function (ev) { + invoice_month_paid: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -221,17 +261,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_invoice_month_paid", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Paid'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - invoice_month: function (ev) { + invoice_month: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -241,17 +286,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_invoice_month", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Invoice'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - bill_month_paid: function (ev) { + bill_month_paid: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -261,17 +311,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_bill_month_paid", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Paid'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - bill_month: function (ev) { + bill_month: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -281,17 +336,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_bill_month", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Invoice'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - bill_year: function (ev) { + bill_year: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -301,17 +361,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_bill_year", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Invoice'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - bill_year_paid: function (ev) { + bill_year_paid: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -321,17 +386,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_bill_year_paid", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Paid'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - invoice_year: function (ev) { + invoice_year: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -341,17 +411,22 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_invoice_year", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Invoice'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - invoice_year_paid: function (ev) { + invoice_year_paid: function(ev) { var posted = false; if ($('#toggle-two')[0].checked == true) { posted = "posted" @@ -361,18 +436,23 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "click_invoice_year_paid", args: [posted], - }).then(function (result) { - self.do_action({ + }).then(function(result) { + self.do_action({ res_model: 'account.move', name: _t('Paid'), - views: [[false, 'list'], [false, 'form']], + views: [ + [false, 'list'], + [false, 'form'] + ], type: 'ir.actions.act_window', - domain: [['id', 'in', result]], - }); - }) + domain: [ + ['id', 'in', result] + ], + }); + }) }, - onclick_toggle_two: function (ev) { + onclick_toggle_two: function(ev) { this.onclick_aged_payable(this.$('#aged_receivable_values').val()); @@ -386,7 +466,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { this.onclick_income_this_year(ev); }, - onclick_top_10_month: function (f) { + onclick_top_10_month: function(f) { var selected = $('.btn.btn-tool.income'); var data = $(selected[0]).data(); var posted = false; @@ -398,31 +478,32 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { rpc.query({ model: "account.move", method: "get_currency", - }).then(function (result) { + }).then(function(result) { currency = result; }) rpc.query({ - model: "account.move", - method: "get_top_10_customers_month", - args: [posted,f] - - }) - .then(function (result) { + model: "account.move", + method: "get_top_10_customers_month", + args: [posted, f] + }) + .then(function(result) { $('#top_10_customers').hide(); $('#top_10_customers_last_month').hide(); $('#top_10_customers_this_month').show(); $('#top_10_customers_this_month').empty(); var due_count = 0; - _.forEach(result, function (x) { + _.forEach(result, function(x) { due_count++; var amount = self.format_currency(currency, x.amount); $('#top_10_customers_this_month').append('
  • ' + x.customers + '
    ' + '
    ' + amount + '
    ' + '
  • '); - $('#line_'+ x.parent).on("click", function () { + $('#line_' + x.parent).on("click", function() { self.do_action({ res_model: 'res.partner', name: _t('Partner'), - views: [[false, 'form']], + views: [ + [false, 'form'] + ], type: 'ir.actions.act_window', res_id: x.parent, }); @@ -433,7 +514,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - onclick_income_last_year: function (ev) { + onclick_income_last_year: function(ev) { ev.preventDefault(); var selected = $('.btn.btn-tool.income'); var data = $(selected[0]).data(); @@ -442,13 +523,13 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { posted = "posted" } rpc.query({ - model: 'account.move', - method: 'get_income_last_year', - args: [posted], - }) - .then(function (result) { + model: 'account.move', + method: 'get_income_last_year', + args: [posted], + }) + .then(function(result) { - $('#net_profit_this_months').hide(); + $('#net_profit_current_months').hide(); $('#net_profit_last_month').hide(); $('#net_profit_last_year').show(); $('#net_profit_this_year').hide(); @@ -472,15 +553,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { data: { labels: labels, datasets: [{ - label: 'Income', // Name the series - data: income, // Specify the data values array - backgroundColor: '#66aecf', - borderColor: '#66aecf', - - borderWidth: 1, // Specify bar border width - type: 'bar', // Set this data to a line chart - fill: false - }, + label: 'Income', // Name the series + data: income, // Specify the data values array + backgroundColor: '#66aecf', + borderColor: '#66aecf', + + borderWidth: 1, // Specify bar border width + type: 'bar', // Set this data to a line chart + fill: false + }, { label: 'Expense', // Name the series data: expense, // Specify the data values array @@ -512,7 +593,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - onclick_income_last_month: function (ev) { + onclick_income_last_month: function(ev) { ev.preventDefault(); var selected = $('.btn.btn-tool.income'); var data = $(selected[0]).data(); @@ -521,12 +602,12 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { posted = "posted" } rpc.query({ - model: 'account.move', - method: 'get_income_last_month', - args: [posted], - }) - .then(function (result) { - $('#net_profit_this_months').hide(); + model: 'account.move', + method: 'get_income_last_month', + args: [posted], + }) + .then(function(result) { + $('#net_profit_current_months').hide(); $('#net_profit_last_month').show(); $('#net_profit_this_year').hide(); $('#net_profit_last_year').hide(); @@ -550,15 +631,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { data: { labels: labels, datasets: [{ - label: 'Income', // Name the series - data: income, // Specify the data values array - backgroundColor: '#66aecf', - borderColor: '#66aecf', - - borderWidth: 1, // Specify bar border width - type: 'bar', // Set this data to a line chart - fill: false - }, + label: 'Income', // Name the series + data: income, // Specify the data values array + backgroundColor: '#66aecf', + borderColor: '#66aecf', + + borderWidth: 1, // Specify bar border width + type: 'bar', // Set this data to a line chart + fill: false + }, { label: 'Expense', // Name the series data: expense, // Specify the data values array @@ -589,7 +670,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - onclick_income_this_year: function (ev) { + onclick_income_this_year: function(ev) { ev.preventDefault(); var selected = $('.btn.btn-tool.income'); var data = $(selected[0]).data(); @@ -600,15 +681,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { rpc.query({ - model: 'account.move', - method: 'get_income_this_year', - args: [posted], + model: 'account.move', + method: 'get_income_this_year', + args: [posted], - }) - .then(function (result) { + }) + .then(function(result) { - $('#net_profit_this_months').hide(); + $('#net_profit_current_months').hide(); $('#net_profit_last_month').hide(); $('#net_profit_last_year').hide(); $('#net_profit_this_year').show(); @@ -631,15 +712,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { data: { labels: labels, datasets: [{ - label: 'Income', // Name the series - data: income, // Specify the data values array - backgroundColor: '#66aecf', - borderColor: '#66aecf', - - borderWidth: 1, // Specify bar border width - type: 'bar', // Set this data to a line chart - fill: false - }, + label: 'Income', // Name the series + data: income, // Specify the data values array + backgroundColor: '#66aecf', + borderColor: '#66aecf', + + borderWidth: 1, // Specify bar border width + type: 'bar', // Set this data to a line chart + fill: false + }, { label: 'Expense', // Name the series data: expense, // Specify the data values array @@ -672,7 +753,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }, - onclick_invoice_this_year: function (ev) { + onclick_invoice_this_year: function(ev) { ev.preventDefault(); var selected = $('.btn.btn-tool.selected'); var data = $(selected[0]).data(); @@ -685,16 +766,16 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { rpc.query({ model: "account.move", method: "get_currency", - }).then(function (result) { + }).then(function(result) { currency = result; }) rpc.query({ - model: "account.move", - method: "get_total_invoice_current_year", - args: [posted], - }) - .then(function (result) { + model: "account.move", + method: "get_total_invoice_current_year", + args: [posted], + }) + .then(function(result) { $('#total_supplier_invoice_paid').hide(); $('#total_supplier_invoice').hide(); @@ -758,7 +839,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - onclick_invoice_this_month: function (ev) { + onclick_invoice_this_month: function(ev) { ev.preventDefault(); var selected = $('.btn.btn-tool.selected'); var data = $(selected[0]).data(); @@ -770,15 +851,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { rpc.query({ model: "account.move", method: "get_currency", - }).then(function (result) { + }).then(function(result) { currency = result; }) rpc.query({ - model: "account.move", - method: "get_total_invoice_current_month", - args: [posted], - }) - .then(function (result) { + model: "account.move", + method: "get_total_invoice_current_month", + args: [posted], + }) + .then(function(result) { $('#total_supplier_invoice_paid').hide(); $('#total_supplier_invoice').hide(); $('#total_customer_invoice_paid').hide(); @@ -839,7 +920,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - onclick_income_this_month: function (ev) { + onclick_income_this_month: function(ev) { ev.preventDefault(); var selected = $('.btn.btn-tool.income'); var data = $(selected[0]).data(); @@ -848,12 +929,12 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { posted = "posted" } rpc.query({ - model: 'account.move', - method: 'get_income_this_month', - args: [posted], + model: 'account.move', + method: 'get_income_this_month', + args: [posted], - }) - .then(function (result) { + }) + .then(function(result) { var ctx = document.getElementById("canvas").getContext('2d'); @@ -875,15 +956,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { data: { labels: labels, datasets: [{ - label: 'Income', // Name the series - data: income, // Specify the data values array - backgroundColor: '#66aecf', - borderColor: '#66aecf', - - borderWidth: 1, // Specify bar border width - type: 'bar', // Set this data to a line chart - fill: false - }, + label: 'Income', // Name the series + data: income, // Specify the data values array + backgroundColor: '#66aecf', + borderColor: '#66aecf', + + borderWidth: 1, // Specify bar border width + type: 'bar', // Set this data to a line chart + fill: false + }, { label: 'Expense', // Name the series data: expense, // Specify the data values array @@ -915,9 +996,9 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - onclick_aged_payable: function (f) { + onclick_aged_payable: function(f) { -// ev.preventDefault(); + // ev.preventDefault(); var arg = f; var selected = $('.btn.btn-tool.expense'); var data = $(selected[0]).data(); @@ -926,13 +1007,13 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { posted = "posted" } rpc.query({ - model: 'account.move', - method: 'get_overdues_this_month_and_year', - args: [posted,f], - }) - .then(function (result) { + model: 'account.move', + method: 'get_overdues_this_month_and_year', + args: [posted, f], + }) + .then(function(result) { // Doughnut Chart - $(document).ready(function () { + $(document).ready(function() { var options = { // legend: false, responsive: false @@ -985,7 +1066,7 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }, - onclick_aged_receivable: function (f) { + onclick_aged_receivable: function(f) { var selected = $('.btn.btn-tool.expense'); var data = $(selected[0]).data(); var posted = false; @@ -994,18 +1075,18 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { posted = "posted" } rpc.query({ - model: 'account.move', - method: 'get_latebillss', - args: [posted, f], + model: 'account.move', + method: 'get_latebillss', + args: [posted, f], - }) - .then(function (result) { + }) + .then(function(result) { function myFunction() { document.getElementByClass("btn btn-tool dropdown-toggle").text document.getElementById("aged_receivable_this_month").text } - $(document).ready(function () { + $(document).ready(function() { var options = { // legend: false, responsive: true, @@ -1062,10 +1143,10 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { }) }, - renderElement: function (ev) { + renderElement: function(ev) { var self = this; $.when(this._super()) - .then(function (ev) { + .then(function(ev) { $('#toggle-two').bootstrapToggle({ @@ -1081,21 +1162,21 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { rpc.query({ - model: "account.move", - method: "get_currency", - }) - .then(function (result) { + model: "account.move", + method: "get_currency", + }) + .then(function(result) { currency = result; }) rpc.query({ - model: "account.move", - method: "get_income_this_month", - args: [posted], - }) - .then(function (result) { + model: "account.move", + method: "get_income_this_month", + args: [posted], + }) + .then(function(result) { var ctx = document.getElementById("canvas").getContext('2d'); @@ -1117,15 +1198,15 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { data: { labels: labels, datasets: [{ - label: 'Income', // Name the series - data: income, // Specify the data values array - backgroundColor: '#66aecf', - borderColor: '#66aecf', - - borderWidth: 1, // Specify bar border width - type: 'bar', // Set this data to a line chart - fill: false - }, + label: 'Income', // Name the series + data: income, // Specify the data values array + backgroundColor: '#66aecf', + borderColor: '#66aecf', + + borderWidth: 1, // Specify bar border width + type: 'bar', // Set this data to a line chart + fill: false + }, { label: 'Expense', // Name the series data: expense, // Specify the data values array @@ -1159,20 +1240,20 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { rpc.query({ model: 'account.move', method: 'get_overdues_this_month_and_year', - args: [posted,arg], - }).then(function (result) { + args: [posted, arg], + }).then(function(result) { - // - }) + // + }) var arg = 'this_month'; rpc.query({ - model: 'account.move', - method: 'get_overdues_this_month_and_year', - args: [posted,arg], - }) - .then(function (result) { + model: 'account.move', + method: 'get_overdues_this_month_and_year', + args: [posted, arg], + }) + .then(function(result) { // Doughnut Chart - $(document).ready(function () { + $(document).ready(function() { var options = { // legend: false, responsive: true, @@ -1225,80 +1306,80 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { model: "account.move", method: "get_total_invoice_current_month", args: [posted], - }).then(function (result) { - - $('#total_supplier_invoice_paid').hide(); - $('#total_supplier_invoice').hide(); - $('#total_customer_invoice_paid').hide(); - $('#total_customer_invoice').hide(); - $('#tot_invoice').hide(); - $('#tot_supplier_inv').hide(); - - $('#total_supplier_invoice_paid_current_month').empty(); - $('#total_supplier_invoice_current_month').empty(); - $('#total_customer_invoice_paid_current_month').empty(); - $('#total_customer_invoice_current_month').empty(); - $('#tot_invoice_current_month').empty(); - $('#tot_supplier_inv_current_month').empty(); - - $('#total_supplier_invoice_paid_current_year').hide(); - $('#total_supplier_invoice_current_year').hide(); - $('#total_customer_invoice_paid_current_year').hide(); - $('#total_customer_invoice_current_year').hide(); - $('#tot_invoice_current_year').hide(); - $('#tot_supplier_inv_current_year').hide(); - - - $('#total_supplier_invoice_paid_current_month').show(); - $('#total_supplier_invoice_current_month').show(); - $('#total_customer_invoice_paid_current_month').show(); - $('#total_customer_invoice_current_month').show(); - $('#tot_invoice_current_month').show(); - $('#tot_supplier_inv_current_month').show(); - - - var tot_invoice_current_month = result[0][0] - var tot_credit_current_month = result[1][0] - var tot_supplier_inv_current_month = result[2][0] - var tot_supplier_refund_current_month = result[3][0] - var tot_customer_invoice_paid_current_month = result[4][0] - var tot_supplier_invoice_paid_current_month = result[5][0] - var tot_customer_credit_paid_current_month = result[6][0] - var tot_supplier_refund_paid_current_month = result[7][0] - var customer_invoice_total_current_month = (tot_invoice_current_month - tot_credit_current_month).toFixed(2) - var customer_invoice_paid_current_month = (tot_customer_invoice_paid_current_month - tot_customer_credit_paid_current_month).toFixed(2) - var invoice_percentage_current_month = ((customer_invoice_total_current_month / customer_invoice_paid_current_month) * 100).toFixed(2) - var supplier_invoice_total_current_month = (tot_supplier_inv_current_month - tot_supplier_refund_current_month).toFixed(2) - var supplier_invoice_paid_current_month = (tot_supplier_invoice_paid_current_month - tot_supplier_refund_paid_current_month).toFixed(2) - var supplier_percentage_current_month = ((supplier_invoice_total_current_month / supplier_invoice_paid_current_month) * 100).toFixed(2) - - $('#tot_supplier_inv_current_month').attr("value", supplier_invoice_paid_current_month); - $('#tot_supplier_inv_current_month').attr("max", supplier_invoice_total_current_month); - - $('#tot_invoice_current_month').attr("value", customer_invoice_paid_current_month); - $('#tot_invoice_current_month').attr("max", customer_invoice_total_current_month); - currency = result[8] - customer_invoice_paid_current_month = self.format_currency(currency, customer_invoice_paid_current_month); - customer_invoice_total_current_month = self.format_currency(currency, customer_invoice_total_current_month); - supplier_invoice_paid_current_month = self.format_currency(currency, supplier_invoice_paid_current_month); - supplier_invoice_total_current_month = self.format_currency(currency, supplier_invoice_total_current_month); - - $('#total_customer_invoice_paid_current_month').append(''); - $('#total_customer_invoice_current_month').append('