From 313855fa40d3f89f52fdad542de73829c03cff30 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Fri, 24 Nov 2023 15:46:21 +0530 Subject: [PATCH] Nov 24 : [FIX] Bug Fixed 'dynamic_accounts_report' --- dynamic_accounts_report/__manifest__.py | 2 +- dynamic_accounts_report/doc/RELEASE_NOTES.md | 7 ++++++- .../wizard/balance_sheet.py | 18 ++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dynamic_accounts_report/__manifest__.py b/dynamic_accounts_report/__manifest__.py index 96d5aba18..f731d2e23 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.8', + 'version': '16.0.1.0.9', '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 bb55e2f99..fdb0359d0 100644 --- a/dynamic_accounts_report/doc/RELEASE_NOTES.md +++ b/dynamic_accounts_report/doc/RELEASE_NOTES.md @@ -29,4 +29,9 @@ #### Version 16.0.1.0.7 #### BUGFIX - Report Bug Fix: Problem with language while printing profit and loss report fixed. -- Report Bug Fix: Problem with language while opening cash flow statement. \ No newline at end of file +- Report Bug Fix: Problem with language while opening cash flow statement. + +### 20.11.2023 +### version 16.0.1.0.9, +### BUGFIX +- Profit And Loss: multiple lines of the same account in the financial reports. \ No newline at end of file diff --git a/dynamic_accounts_report/wizard/balance_sheet.py b/dynamic_accounts_report/wizard/balance_sheet.py index a076d3ce4..d4bbf86cc 100644 --- a/dynamic_accounts_report/wizard/balance_sheet.py +++ b/dynamic_accounts_report/wizard/balance_sheet.py @@ -108,7 +108,6 @@ class BalanceSheetView(models.TransientModel): 'strict_range': False, 'company_id': self.company_id, 'lang': lang}} - account_lines = self.get_account_lines(new_data) report_lines = self.view_report_pdf(account_lines, new_data)[ 'report_lines'] @@ -136,7 +135,6 @@ class BalanceSheetView(models.TransientModel): report_lines_move.append(each) filter_movelines_parents(report_lines) - # for rec in report_lines_move: # if rec['report_type'] == 'accounts': # if rec['account'] in move_line_accounts: @@ -172,6 +170,7 @@ class BalanceSheetView(models.TransientModel): final_report_lines.append(rec) else: final_report_lines.append(rec) + def filter_sum(obj): sum_list = {} for pl in parent_list: @@ -234,12 +233,22 @@ class BalanceSheetView(models.TransientModel): item['name']['en_US'] else: item['new_name'] = item['name'] + merged_data = {} + for line in records['Accounts']: + account_id = line['account_id'] + if account_id not in merged_data: + merged_data[account_id] = line + else: + merged_data[account_id]['debit'] += line['debit'] + merged_data[account_id]['credit'] += line['credit'] + merged_data[account_id]['balance'] += line['balance'] + report_list = list(merged_data.values()) return { 'name': tag, 'type': 'ir.actions.client', 'tag': tag, 'filters': filters, - 'report_lines': records['Accounts'], + 'report_lines': report_list, 'debit_total': records['debit_total'], 'credit_total': records['credit_total'], 'debit_balance': records['debit_balance'], @@ -476,7 +485,8 @@ class BalanceSheetView(models.TransientModel): WHERE += ' AND an.id IN %s' % str( tuple(data.get('analytics').ids) + tuple([0])) if data.get('account_tags'): - WHERE += ' AND act.id IN %s' % str(tuple(data.get('account_tags').ids)+ tuple([0])) + WHERE += ' AND act.id IN %s' % str( + tuple(data.get('account_tags').ids) + tuple([0])) # if data['analytic_tags']: # WHERE += ' AND anltag.account_analytic_tag_id IN %s' % str(