|
@ -117,16 +117,22 @@ class GeneralView(models.TransientModel): |
|
|
item['name']['en_US'] |
|
|
item['name']['en_US'] |
|
|
else: |
|
|
else: |
|
|
item['new_name'] = item['name'] |
|
|
item['new_name'] = item['name'] |
|
|
# if user_language in item['name']: |
|
|
merged_data = {} |
|
|
# item['new_name'] = item['name'][user_language] |
|
|
for line in records['Accounts']: |
|
|
# else: |
|
|
account_id = line['account_id'] |
|
|
# item['new_name'] = item['name'][default_lg] |
|
|
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 { |
|
|
return { |
|
|
'name': title, |
|
|
'name': title, |
|
|
'type': 'ir.actions.client', |
|
|
'type': 'ir.actions.client', |
|
|
'tag': 'g_l', |
|
|
'tag': 'g_l', |
|
|
'filters': filters, |
|
|
'filters': filters, |
|
|
'report_lines': records['Accounts'], |
|
|
'report_lines': report_list, |
|
|
'debit_total': records['debit_total'], |
|
|
'debit_total': records['debit_total'], |
|
|
'credit_total': records['credit_total'], |
|
|
'credit_total': records['credit_total'], |
|
|
'debit_balance': records['debit_balance'], |
|
|
'debit_balance': records['debit_balance'], |
|
@ -256,7 +262,8 @@ class GeneralView(models.TransientModel): |
|
|
rec['name'] = localized_name |
|
|
rec['name'] = localized_name |
|
|
else: |
|
|
else: |
|
|
# If the translation for the current language is not available, use a default language or handle it as needed. |
|
|
# 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: |
|
|
else: |
|
|
# Handle the case where 'name' is not present in the dictionary. |
|
|
# Handle the case where 'name' is not present in the dictionary. |
|
|
rec['name'] = '' # You can use an |
|
|
rec['name'] = '' # You can use an |
|
@ -421,7 +428,8 @@ class GeneralView(models.TransientModel): |
|
|
WHERE += ' AND an.id IN %s' % str( |
|
|
WHERE += ' AND an.id IN %s' % str( |
|
|
tuple(data.get('analytics').ids) + tuple([0])) |
|
|
tuple(data.get('analytics').ids) + tuple([0])) |
|
|
if data.get('account_tags'): |
|
|
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 |
|
|
# Get move lines base on sql query and Calculate the total balance |
|
|
# of move lines |
|
|
# of move lines |
|
|