Browse Source

Dec 8 : [FIX] Bug Fixed 'dynamic_accounts_report'

pull/295/head
AjmalCybro 2 years ago
parent
commit
400659caf8
  1. 2
      dynamic_accounts_report/__manifest__.py
  2. 5
      dynamic_accounts_report/doc/RELEASE_NOTES.md
  3. 22
      dynamic_accounts_report/wizard/general_ledger.py

2
dynamic_accounts_report/__manifest__.py

@ -22,7 +22,7 @@
{
'name': 'Dynamic Financial Reports V16',
'version': '16.0.1.0.9',
'version': '16.0.1.0.10',
'category': 'Accounting',
'live_test_url': 'https://www.youtube.com/watch?v=gVQi9q9Rs-E&t=5s',
'summary': """Dynamic Financial Reports with drill

5
dynamic_accounts_report/doc/RELEASE_NOTES.md

@ -35,3 +35,8 @@
### version 16.0.1.0.9,
### BUGFIX
- Profit And Loss: multiple lines of the same account in the financial reports.
### 11.12.2023
### version 16.0.1.0.10,
### BUGFIX
- Profit And Loss: multiple lines of the same account in the financial reports.

22
dynamic_accounts_report/wizard/general_ledger.py

@ -117,16 +117,22 @@ class GeneralView(models.TransientModel):
item['name']['en_US']
else:
item['new_name'] = item['name']
# if user_language in item['name']:
# item['new_name'] = item['name'][user_language]
# else:
# item['new_name'] = item['name'][default_lg]
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': title,
'type': 'ir.actions.client',
'tag': 'g_l',
'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'],
@ -256,7 +262,8 @@ class GeneralView(models.TransientModel):
rec['name'] = localized_name
else:
# If the translation for the current language is not available, use a default language or handle it as needed.
rec['name'] = rec['name'].get(default_lg, '') # Replace 'en_US' with your desired default language.
rec['name'] = rec['name'].get(default_lg,
'') # Replace 'en_US' with your desired default language.
else:
# Handle the case where 'name' is not present in the dictionary.
rec['name'] = '' # You can use an
@ -421,7 +428,8 @@ class GeneralView(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]))
# Get move lines base on sql query and Calculate the total balance
# of move lines

Loading…
Cancel
Save