From d7a0bc3702239d93272ae9008c70c3c2c7a76676 Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Tue, 17 Dec 2024 09:52:52 +0530 Subject: [PATCH] Dec 17: [FIX] Bug Fixed 'dynamic_accounts_report' --- dynamic_accounts_report/__manifest__.py | 5 +- dynamic_accounts_report/doc/RELEASE_NOTES.md | 12 ++--- .../static/src/js/aged_payable_report.js | 4 +- .../static/src/js/aged_receivable_report.js | 4 +- .../static/src/js/balance_sheet.js | 4 +- .../static/src/js/bank_flow.js | 8 +-- .../static/src/js/cash_flow.js | 8 +-- .../static/src/js/general_ledger.js | 13 ++--- .../static/src/js/partner_ledger.js | 13 ++--- .../static/src/js/profit_and_loss.js | 4 +- .../static/src/js/tax_report.js | 49 ++++++++++--------- .../static/src/js/trial_balance.js | 14 +++--- .../static/src/xml/partner_ledger_view.xml | 1 - 13 files changed, 72 insertions(+), 67 deletions(-) diff --git a/dynamic_accounts_report/__manifest__.py b/dynamic_accounts_report/__manifest__.py index 922988578..288e91f20 100644 --- a/dynamic_accounts_report/__manifest__.py +++ b/dynamic_accounts_report/__manifest__.py @@ -21,7 +21,7 @@ ################################################################################ { 'name': 'Odoo18 Dynamic Accounting Reports', - 'version': '18.0.1.0.2', + 'version': '18.0.1.1.1', 'category': 'Accounting', 'summary': "Odoo 18 Accounting Financial Reports,Dynamic Accounting Reports, Dynamic Financial Reports,Dynamic Report Odoo18, Odoo18,Financial Reports, Odoo18 Accounting,Accounting, Odoo Apps", 'description': "This module creates dynamic Accounting General Ledger, Trial" @@ -32,7 +32,7 @@ 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': "https://www.cybrosys.com", - 'depends': ['web', 'base_accounting_kit'], + 'depends': ['base_accounting_kit'], 'data': [ 'security/ir.model.access.csv', 'views/accounting_report_views.xml', @@ -49,7 +49,6 @@ ], 'assets': { 'web.assets_backend': [ - 'web/static/lib/jquery/jquery.js', #No conflict with web jquery 'dynamic_accounts_report/static/src/xml/general_ledger_view.xml', 'dynamic_accounts_report/static/src/xml/trial_balance_view.xml', 'dynamic_accounts_report/static/src/xml/cash_flow_templates.xml', diff --git a/dynamic_accounts_report/doc/RELEASE_NOTES.md b/dynamic_accounts_report/doc/RELEASE_NOTES.md index 9c873430e..e4c5be32c 100644 --- a/dynamic_accounts_report/doc/RELEASE_NOTES.md +++ b/dynamic_accounts_report/doc/RELEASE_NOTES.md @@ -1,11 +1,11 @@ ## Module -#### 18.10.2024 -#### Version 18.0.1.0.0 +#### 21.11.2024 +#### Version 18.0.1.0.1 #### ADD - Initial commit for Dynamic Accounts Reports -- -#### 04.12.2024 -#### Version 18.0.1.0.2 + +#### 13.12.2024 +#### Version 18.0.1.1.1 #### UPDT -- Updated the Jquery version issue +- Fixed the errors in the filters. \ No newline at end of file diff --git a/dynamic_accounts_report/static/src/js/aged_payable_report.js b/dynamic_accounts_report/static/src/js/aged_payable_report.js index 2aabb68cb..819001dcb 100644 --- a/dynamic_accounts_report/static/src/js/aged_payable_report.js +++ b/dynamic_accounts_report/static/src/js/aged_payable_report.js @@ -142,12 +142,12 @@ class AgedPayable extends owl.Component { */ if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/aged_receivable_report.js b/dynamic_accounts_report/static/src/js/aged_receivable_report.js index 07f8e7e7e..53f28a3bd 100644 --- a/dynamic_accounts_report/static/src/js/aged_receivable_report.js +++ b/dynamic_accounts_report/static/src/js/aged_receivable_report.js @@ -141,12 +141,12 @@ class AgedReceivable extends owl.Component { */ if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show'); } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/balance_sheet.js b/dynamic_accounts_report/static/src/js/balance_sheet.js index f9c715bde..a47a1d38c 100644 --- a/dynamic_accounts_report/static/src/js/balance_sheet.js +++ b/dynamic_accounts_report/static/src/js/balance_sheet.js @@ -202,12 +202,12 @@ class BalanceSheet extends owl.Component { */ if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/bank_flow.js b/dynamic_accounts_report/static/src/js/bank_flow.js index 342253f45..c7129e98d 100644 --- a/dynamic_accounts_report/static/src/js/bank_flow.js +++ b/dynamic_accounts_report/static/src/js/bank_flow.js @@ -318,8 +318,8 @@ class BankBook extends owl.Component { this.state.total = move_line_totals this.state.total_debit = totalDebitSum.toFixed(2) this.state.total_credit = totalCreditSum.toFixed(2) - if ($(this.unfoldButton.el.classList).find("selected-filter")) { - this.unfoldButton.el.classList.remove("selected-filter") + if (this.unfoldButton.el.classList.contains("selected-filter")) { + this.unfoldButton.el.classList.remove("selected-filter"); } } async unfoldAll(ev) { @@ -331,12 +331,12 @@ class BankBook extends owl.Component { */ if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/cash_flow.js b/dynamic_accounts_report/static/src/js/cash_flow.js index 5064af385..abdcf3913 100644 --- a/dynamic_accounts_report/static/src/js/cash_flow.js +++ b/dynamic_accounts_report/static/src/js/cash_flow.js @@ -308,8 +308,8 @@ class CashBook extends owl.Component { this.state.total = move_line_totals this.state.total_debit = totalDebitSum.toFixed(2) this.state.total_credit = totalCreditSum.toFixed(2) - if ($(this.unfoldButton.el.classList).find("selected-filter")) { - this.unfoldButton.el.classList.remove("selected-filter") + if (this.unfoldButton.el.classList.contains("selected-filter")) { + this.unfoldButton.el.classList.remove("selected-filter"); } } async unfoldAll(ev) { @@ -321,12 +321,12 @@ class CashBook extends owl.Component { */ if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/general_ledger.js b/dynamic_accounts_report/static/src/js/general_ledger.js index eabd63955..a61f22812 100644 --- a/dynamic_accounts_report/static/src/js/general_ledger.js +++ b/dynamic_accounts_report/static/src/js/general_ledger.js @@ -281,7 +281,8 @@ class GeneralLedger extends owl.Component { } } let filtered_data = await this.orm.call("account.general.ledger", "get_filter_values", [this.state.selected_journal_list, this.state.date_range, this.state.options, this.state.selected_analytic_list,this.state.method]); - $.each(filtered_data, function (index, value) { + for (let index in filtered_data) { + const value = filtered_data[index]; if (index !== 'account_totals' && index !== 'journal_ids' && index !== 'analytic_ids') { account_list.push(index) } @@ -292,25 +293,25 @@ class GeneralLedger extends owl.Component { totalCreditSum += account_list.total_credit || 0; }); } - }) + } this.state.account = account_list this.state.account_data = filtered_data this.state.account_total = account_totals this.state.total_debit = totalDebitSum.toFixed(2) this.state.total_credit = totalCreditSum.toFixed(2) - if ($(this.unfoldButton.el.classList).find("selected-filter")) { - this.unfoldButton.el.classList.remove("selected-filter") + if (this.unfoldButton.el.classList.contains("selected-filter")) { + this.unfoldButton.el.classList.remove("selected-filter"); } } async unfoldAll(ev) { if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/partner_ledger.js b/dynamic_accounts_report/static/src/js/partner_ledger.js index ae488db3b..112e98b0f 100644 --- a/dynamic_accounts_report/static/src/js/partner_ledger.js +++ b/dynamic_accounts_report/static/src/js/partner_ledger.js @@ -351,7 +351,8 @@ class PartnerLedger extends owl.Component { } } let filtered_data = await this.orm.call("account.partner.ledger", "get_filter_values", [this.state.selected_partner, this.state.date_range, this.state.account, this.state.options,]); - $.each(filtered_data, function (index, value) { + for (let index in filtered_data) { + const value = filtered_data[index]; if (index !== 'partner_totals') { partner_list.push(index) } @@ -362,14 +363,14 @@ class PartnerLedger extends owl.Component { totalCreditSum += partner_list.total_credit || 0; }); } - }) + } this.state.partners = partner_list this.state.data = filtered_data this.state.total = partner_totals this.state.total_debit = totalDebitSum this.state.total_credit = totalCreditSum - if ($(this.unfoldButton.el.classList).find("selected-filter")) { - this.unfoldButton.el.classList.remove("selected-filter") + if (this.unfoldButton.el.classList.contains("selected-filter")) { + this.unfoldButton.el.classList.remove("selected-filter"); } } getDomain() { @@ -384,12 +385,12 @@ class PartnerLedger extends owl.Component { */ if (!ev.target.classList.contains("selected-filter")) { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/profit_and_loss.js b/dynamic_accounts_report/static/src/js/profit_and_loss.js index a0a9618b6..830c51352 100644 --- a/dynamic_accounts_report/static/src/js/profit_and_loss.js +++ b/dynamic_accounts_report/static/src/js/profit_and_loss.js @@ -221,13 +221,13 @@ class ProfitAndLoss extends owl.Component { if (!ev.target.classList.contains("selected-filter")) { // Unfold all elements for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.add('show') + this.tbody.el.children[length].classList.add('show') } ev.target.classList.add("selected-filter"); } else { // Collapse all elements for (var length = 0; length < this.tbody.el.children.length; length++) { - $(this.tbody.el.children[length])[0].classList.remove('show') + this.tbody.el.children[length].classList.remove('show') } ev.target.classList.remove("selected-filter"); } diff --git a/dynamic_accounts_report/static/src/js/tax_report.js b/dynamic_accounts_report/static/src/js/tax_report.js index f587a00f7..bb1e03ad2 100644 --- a/dynamic_accounts_report/static/src/js/tax_report.js +++ b/dynamic_accounts_report/static/src/js/tax_report.js @@ -66,12 +66,12 @@ class TaxReport extends owl.Component { self.start_date.el.value = startOfMonth.getFullYear() + '-' + String(startOfMonth.getMonth() + 1).padStart(2, '0') + '-' + String(startOfMonth.getDate()).padStart(2, '0'); self.end_date.el.value = endOfMonth.getFullYear() + '-' + String(endOfMonth.getMonth() + 1).padStart(2, '0') + '-' + String(endOfMonth.getDate()).padStart(2, '0'); self.state.date_viewed.push(monthNamesShort[today.getMonth()] + ' ' + today.getFullYear()) - $.each(self.state.data.sale, function (index, value) { - self.state.sale_total += value.tax - }) - $.each(self.state.data.purchase, function (index, value) { - self.state.purchase_total += value.tax - }) + self.state.data.sale.forEach((value) => { + self.state.sale_total += value.tax; + }); + self.state.data.purchase.forEach((value) => { + self.state.purchase_total += value.tax + }); } catch (el) { window.location.href; @@ -184,10 +184,10 @@ class TaxReport extends owl.Component { 'account': true }; val.target.classList.add("selected-filter"); - if($(this.tax.el.classList.contains("selected-filter"))) { + if(this.tax.el.classList.contains("selected-filter")) { this.tax.el.classList.remove("selected-filter"); } - if($(this.global.el.classList.contains("selected-filter"))) { + if(this.global.el.classList.contains("selected-filter")) { this.global.el.classList.remove("selected-filter"); } } @@ -201,10 +201,10 @@ class TaxReport extends owl.Component { 'tax': true }; val.target.classList.add("selected-filter"); - if($(this.account.el.classList.contains("selected-filter"))) { + if(this.account.el.classList.contains("selected-filter")) { this.account.el.classList.remove("selected-filter"); } - if($(this.global.el.classList.contains("selected-filter"))) { + if(this.global.el.classList.contains("selected-filter")) { this.global.el.classList.remove("selected-filter"); } } @@ -216,10 +216,10 @@ class TaxReport extends owl.Component { } else { this.state.report_type = null val.target.classList.add("selected-filter"); - if($(this.account.el.classList.contains("selected-filter"))) { + if(this.account.el.classList.contains("selected-filter")) { this.account.el.classList.remove("selected-filter"); } - if($(this.tax.el.classList.contains("selected-filter"))) { + if(this.tax.el.classList.contains("selected-filter")) { this.tax.el.classList.remove("selected-filter"); } } @@ -251,18 +251,21 @@ class TaxReport extends owl.Component { var date_viewed = [] var sale_total = 0.0 var purchase_total = 0.0 - $.each(this.state.data.sale, function (index, value) { - sale_total += value.tax - }) - $.each(this.state.data.purchase, function (index, value) { - purchase_total += value.tax - }) + this.state.data.sale.forEach((value) => { + sale_total += value.tax; + }); + this.state.data.purchase.forEach((value) => { + purchase_total += value.tax; + }); var date_viewed = [] - $.each(this.state.data.dynamic_date_num, function (index, value) { - if (!date_viewed.includes(value)) { - date_viewed.push(value) - } - }) + let iterable = Array.isArray(this.state.data.dynamic_date_num) + ? this.state.data.dynamic_date_num + : Object.values(this.state.data.dynamic_date_num); + for (const date_num of iterable) { + if (!date_viewed.includes(date_num)) { + date_viewed.push(date_num); + } + } if (date_viewed.length !== 0) { this.state.date_viewed = date_viewed.reverse() } diff --git a/dynamic_accounts_report/static/src/js/trial_balance.js b/dynamic_accounts_report/static/src/js/trial_balance.js index 105ad0c35..543e869b6 100644 --- a/dynamic_accounts_report/static/src/js/trial_balance.js +++ b/dynamic_accounts_report/static/src/js/trial_balance.js @@ -241,16 +241,18 @@ class TrialBalance extends owl.Component { } this.state.data = await this.orm.call("account.trial.balance", "get_filter_values", [this.start_date.el.value, this.end_date.el.value, this.state.comparison_number, this.state.comparison_type, this.state.selected_journal_list, this.state.selected_analytic, this.state.options,this.state.method,]); var date_viewed = [] - $.each(this.state.data, function (index, value) { + this.state.data.forEach((value, index) => { if (index == 'journal_ids') { this.state.journals = value } if (value.dynamic_date_num) { - $.each(value.dynamic_date_num, function (index, value) { - if (!date_viewed.includes(value)) { - date_viewed.push(value) - } - }) + let iterable = Array.isArray(value.dynamic_date_num) ? value.dynamic_date_num + : Object.values(value.dynamic_date_num); + for (const date_num of iterable) { + if (!date_viewed.includes(date_num)) { + date_viewed.push(date_num); + } + } } }) if (date_viewed.length !== 0) { diff --git a/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml b/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml index 943ed8cfe..b404346e1 100644 --- a/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml +++ b/dynamic_accounts_report/static/src/xml/partner_ledger_view.xml @@ -350,7 +350,6 @@ -