From 730fcdb22f93edb6056463c595313da8345e12b2 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Tue, 25 Apr 2023 12:08:03 +0530 Subject: [PATCH] Apr 25 [UPDT] : Bug Fixed 'dynamic_accounts_report' --- dynamic_accounts_report/__manifest__.py | 2 +- dynamic_accounts_report/doc/RELEASE_NOTES.md | 5 +++ .../report/general_ledger.py | 1 + .../static/src/js/general_ledger.js | 1 + .../static/src/xml/general_ledger_view.xml | 2 +- .../wizard/general_ledger.py | 35 +++++++++++-------- 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/dynamic_accounts_report/__manifest__.py b/dynamic_accounts_report/__manifest__.py index d1fc86fc1..bd0923958 100644 --- a/dynamic_accounts_report/__manifest__.py +++ b/dynamic_accounts_report/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Dynamic Financial Reports V16', - 'version': '16.0.1.0.4', + 'version': '16.0.1.0.5', 'category': 'Accounting', 'live_test_url': 'https://www.youtube.com/watch?v=gVQi9q9Rs-E&t=5s', 'summary': """Dynamic Financial Reports with drill diff --git a/dynamic_accounts_report/doc/RELEASE_NOTES.md b/dynamic_accounts_report/doc/RELEASE_NOTES.md index 291406f72..d23d00c9a 100644 --- a/dynamic_accounts_report/doc/RELEASE_NOTES.md +++ b/dynamic_accounts_report/doc/RELEASE_NOTES.md @@ -14,3 +14,8 @@ #### Version 16.0.1.0.2 #### UPDT AND BUGFIX - Report Bug Fix: Correct the currency used in the General Ledger + +#### 21.04.2023 +#### Version 16.0.1.0.5 +#### BUGFIX +- Report Bug Fix: Journal filter is not visible for any languages other than english, entries of all journals are taken for bank book and cash book for other languages. diff --git a/dynamic_accounts_report/report/general_ledger.py b/dynamic_accounts_report/report/general_ledger.py index 912522d1c..e3a166eb6 100644 --- a/dynamic_accounts_report/report/general_ledger.py +++ b/dynamic_accounts_report/report/general_ledger.py @@ -13,6 +13,7 @@ class GeneralLedger(models.AbstractModel): 'debit_total': data.get('report_data')['debit_total'], 'credit_total': data.get('report_data')['credit_total'], 'title': data.get('report_data')['name'], + 'eng_title': data.get('report_data')['eng_title'], 'company': self.env.company, }) return data diff --git a/dynamic_accounts_report/static/src/js/general_ledger.js b/dynamic_accounts_report/static/src/js/general_ledger.js index 8f224f170..d0205679e 100644 --- a/dynamic_accounts_report/static/src/js/general_ledger.js +++ b/dynamic_accounts_report/static/src/js/general_ledger.js @@ -120,6 +120,7 @@ odoo.define('dynamic_accounts_report.general_ledger', function (require) { self.$('.filter_view_tb').html(QWeb.render('GLFilterView', { filter_data: datas['filters'], title : datas['name'], + eng_title : datas['eng_title'], })); self.$el.find('.journals').select2({ placeholder: ' Journals...', diff --git a/dynamic_accounts_report/static/src/xml/general_ledger_view.xml b/dynamic_accounts_report/static/src/xml/general_ledger_view.xml index b1dc547d6..b4d000404 100644 --- a/dynamic_accounts_report/static/src/xml/general_ledger_view.xml +++ b/dynamic_accounts_report/static/src/xml/general_ledger_view.xml @@ -205,7 +205,7 @@ - +
diff --git a/dynamic_accounts_report/wizard/general_ledger.py b/dynamic_accounts_report/wizard/general_ledger.py index af829d3b7..0f39533eb 100644 --- a/dynamic_accounts_report/wizard/general_ledger.py +++ b/dynamic_accounts_report/wizard/general_ledger.py @@ -50,32 +50,36 @@ class GeneralView(models.TransientModel): new_title = '' # todo: - # trans_title = self.env['ir.translation'].search([('value', '=', title), - # ('module', '=', - # 'dynamic_accounts_report')], - # limit=1).src + # to get the english translation of the title + record_id = self.env['ir.actions.client'].with_context(lang=self.env.user.lang). \ + search([('name', '=', title)]).id + trans_title = self.env['ir.actions.client'].with_context(lang='en_US').search([('id', '=', record_id)]).name company_id = self.env.companies.ids if r.journal_ids: journals = r.journal_ids else: journals = self.env['account.journal'].search( [('company_id', 'in', company_id)]) - if title == 'General Ledger': + if title == 'General Ledger' or trans_title == 'General Ledger': if r.journal_ids: journals = r.journal_ids else: journals = self.env['account.journal'].search( [('company_id', 'in', company_id)]) new_title = title - if title == 'Bank Book': + eng_title = 'General Ledger' + + if title == 'Bank Book' or trans_title == 'Bank Book': journals = self.env['account.journal'].search( [('type', '=', 'bank'), ('company_id', 'in', company_id)]) - new_title = title - if title == 'Cash Book': + eng_title = 'Bank Book' + + if title == 'Cash Book' or trans_title == 'Cash Book': journals = self.env['account.journal'].search( [('type', '=', 'cash'), ('company_id', 'in', company_id)]) new_title = title + eng_title = 'Cash Book' r.write({ 'titles': new_title, }) @@ -104,6 +108,7 @@ class GeneralView(models.TransientModel): currency = self._get_currency() return { 'name': new_title, + 'eng_title': eng_title, 'type': 'ir.actions.client', 'tag': 'g_l', 'filters': filters, @@ -431,10 +436,10 @@ class GeneralView(models.TransientModel): def get_accounts_line(self, account_id, title): - # trans_title = self.env['ir.translation'].search([('value', '=', title), - # ('module', '=', - # 'dynamic_accounts_report')], - # + # to get the english translation of the title + record_id = self.env['ir.actions.client'].with_context(lang=self.env.user.lang). \ + search([('name', '=', title)]).id + trans_title = self.env['ir.actions.client'].with_context(lang='en_US').search([('id', '=', record_id)]).name company_id = self.env.companies.ids if self.journal_ids: @@ -442,16 +447,16 @@ class GeneralView(models.TransientModel): else: journals = self.env['account.journal'].search( [('company_id', 'in', company_id)]) - if title == 'General Ledger': + if title == 'General Ledger' or trans_title == 'General Ledger': if self.journal_ids: journals = self.journal_ids else: journals = self.env['account.journal'].search( [('company_id', 'in', company_id)]) - if title == 'Bank Book': + if title == 'Bank Book' or trans_title == 'Bank Book': journals = self.env['account.journal'].search( [('type', '=', 'bank'), ('company_id', 'in', company_id)]) - if title == 'Cash Book': + if title == 'Cash Book' or trans_title == 'Cash Book': journals = self.env['account.journal'].search( [('type', '=', 'cash'), ('company_id', 'in', company_id)])