Browse Source

July 29: [FIX]Bug fixed 'dynamic_accounts_report'

18.0
Cybrosys Technologies 4 days ago
parent
commit
2dea00e826
  1. 2
      dynamic_accounts_report/__manifest__.py
  2. 8
      dynamic_accounts_report/doc/RELEASE_NOTES.md
  3. 12
      dynamic_accounts_report/models/account_trial_balance.py
  4. 3
      dynamic_accounts_report/models/cash_book_report.py
  5. 48
      dynamic_accounts_report/report/bank_book_templates.xml
  6. 2
      dynamic_accounts_report/static/src/js/bank_flow.js
  7. 22
      dynamic_accounts_report/static/src/js/trial_balance.js
  8. 240
      dynamic_accounts_report/static/src/xml/trial_balance_view.xml

2
dynamic_accounts_report/__manifest__.py

@ -21,7 +21,7 @@
################################################################################
{
'name': 'Odoo18 Dynamic Accounting Reports',
'version': '18.0.1.2.3',
'version': '18.0.1.2.4',
'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"

8
dynamic_accounts_report/doc/RELEASE_NOTES.md

@ -18,4 +18,10 @@
#### 16.05.2025
#### Version 18.0.1.2.3
#### UPDT
- Bug Fixing and added thousand seperators
- Bug Fixing and added thousand separators
#### 28.07.2025
#### Version 18.0.1.2.4
#### UPDT
- Bug Fixing in the accounting report (Trial Balance).
-

12
dynamic_accounts_report/models/account_trial_balance.py

@ -115,6 +115,7 @@ class AccountTrialBalance(models.TransientModel):
:return: List of dictionaries representing the financial report.
:rtype: list
"""
if options == {}:
options = None
if options is None:
@ -207,7 +208,7 @@ class AccountTrialBalance(models.TransientModel):
domain = [('date', '>=', com_start_date),
('account_id', '=', account_id.id),
('date', '<=', com_end_date),
('parent_state', 'in', option_domain), ]
('parent_state', 'in', option_domain)]
if journal_list:
domain.append(
('journal_id', 'in', journal_list), )
@ -243,15 +244,14 @@ class AccountTrialBalance(models.TransientModel):
('parent_state', 'in', option_domain), ]
if journal_list:
domain.append(
('journal_id', 'in', journal_list), )
('journal_id', 'in', journal_list))
if analytic:
domain.append(
('analytic_line_ids', 'in', analytic))
if method is not None and 'cash' in method:
domain.append(('journal_id', 'in',
self.env.company.tax_cash_basis_journal_id.ids))
move_lines = self.env['account.move.line'].search(
domain)
move_lines = self.env['account.move.line'].search(domain)
dynamic_date_num[
f"dynamic_date_num{i}"] = 'Q' + ' ' + str(
get_quarter_number(com_start_date)) + ' ' + str(
@ -265,7 +265,7 @@ class AccountTrialBalance(models.TransientModel):
domain = [('date', '>=', start_date),
('account_id', '=', account_id.id),
('date', '<=', end_date),
('parent_state', 'in', option_domain), ]
('parent_state', 'in', option_domain)]
if journal_list:
domain.append(
('journal_id', 'in', journal_list), )
@ -449,4 +449,4 @@ class AccountTrialBalance(models.TransientModel):
workbook.close()
output.seek(0)
response.stream.write(output.read())
output.close()
output.close()

3
dynamic_accounts_report/models/cash_book_report.py

@ -191,8 +191,7 @@ class CashBookReport(models.TransientModel):
lambda x: x.account_id.id == account['id'])
move_line_data = move_lines.read(
['date', 'journal_id', 'partner_id', 'move_name', 'debit',
'move_id',
'credit', 'name', 'ref'])
'move_id', 'credit', 'name', 'ref'])
data[move_lines.mapped('account_id').display_name] = move_line_data
currency_id = self.env.company.currency_id.symbol
move_lines_total[move_lines.mapped('account_id').display_name] = {

48
dynamic_accounts_report/report/bank_book_templates.xml

@ -117,9 +117,9 @@
<th style="width:10% border:0px solid transparent;">
<strong>
<span>
<t t-if="'total_debit' in total[move_line] and total[move_line]['total_debit']"
<t t-if="total[move_line]['total_debit']"
t-esc="total[move_line]['currency_id']"/>
<t t-if="'total_debit' in total[move_line] and total[move_line]['total_debit'] and 'total_debit_display' in total[move_line]"
<t t-if="total[move_line]['total_debit']"
t-esc="total[move_line]['total_debit_display']"/>
</span>
</strong>
@ -127,17 +127,10 @@
<th style="width:10% border:0px solid transparent;">
<strong>
<span>
<t t-if="'total_credit' in total[move_line] and total[move_line]['total_credit']">
<t t-esc="total[move_line]['currency_id']"/>
</t>
<t t-if="'total_credit' in total[move_line] and total[move_line]['total_credit'] ">
<t t-esc="total[move_line]['currency_id']"/>
</t>
<t t-if="'total_credit' in total[move_line] and total[move_line]['total_credit'] and 'total_credit_display' in total[move_line]">
<t t-esc="total[move_line]['total_credit_display']"/>
</t>
<t t-if="total[move_line]['total_credit']"
t-esc="total[move_line]['currency_id']"/>
<t t-if="total[move_line]['total_credit']"
t-esc="total[move_line]['total_credit_display']"/>
</span>
</strong>
</th>
@ -191,23 +184,18 @@
</th>
<th>
<span>
<t t-if="'debit' in valuelist and valuelist['debit']">
<t t-esc="total[move_line]['currency_id']"/>
</t>
<t t-if="'debit' in valuelist and valuelist['debit'] and 'debit_display' in valuelist">
<t t-esc="valuelist['debit_display']"/>
</t>
<t t-if="valuelist['debit']"
t-esc="total[move_line]['currency_id']"/>
<t t-if="valuelist['debit']"
t-esc="valuelist['debit_display']"/>
</span>
</th>
<th style="width:10%">
<span>
<t t-if="'credit' in valuelist and valuelist['credit']">
<t t-esc="total[move_line]['currency_id']"/>
</t>
<t t-if="'credit' in valuelist and valuelist['credit'] and 'credit_display' in valuelist">
<t t-esc="valuelist['credit_display']"/>
</t>
<t t-if="valuelist['credit']"
t-esc="total[move_line]['currency_id']"/>
<t t-if="valuelist['credit']"
t-esc="valuelist['credit_display']"/>
</span>
</th>
<th style="width:10%"/>
@ -223,15 +211,11 @@
<th style="width:60%;">Total</th>
<th style="width:10%">
<t t-out="grand_total['currency']"/>
<t t-if="'total_debit_display' in grand_total">
<t t-out="grand_total['total_debit_display']"/>
</t>
<t t-out="grand_total['total_debit_display']"/>
</th>
<th style="width:10%">
<t t-out="grand_total['currency']"/>
<t t-if="'total_credit_display' in grand_total">
<t t-out="grand_total['total_credit_display']"/>
</t>
<t t-out="grand_total['total_credit_display']"/>
</th>
<th style="width:10%">
<t t-out="grand_total['currency']"/>

2
dynamic_accounts_report/static/src/js/bank_flow.js

@ -140,7 +140,7 @@ class BankBook extends owl.Component {
var self = this;
let totals = {
'total_debit':this.state.total_debit,
'total_debit_display':this.state.total_debit_display ,
'total_debit_display':this.state.total_debit_display,
'total_credit':this.state.total_credit,
'total_credit_display':this.state.total_credit_display,
'currency':this.state.currency,

22
dynamic_accounts_report/static/src/js/trial_balance.js

@ -2,7 +2,7 @@
const { Component } = owl;
import { registry } from "@web/core/registry";
import { useService } from "@web/core/utils/hooks";
import { useRef, useState } from "@odoo/owl";
import { useRef, useState, useEffect } from "@odoo/owl";
import { BlockUI } from "@web/core/ui/block_ui";
import { download } from "@web/core/network/download";
const actionRegistry = registry.category("actions");
@ -23,6 +23,7 @@ class TrialBalance extends owl.Component {
this.unfoldButton = useRef('unfoldButton');
this.state = useState({
move_line: null,
default_report: true,
data: null,
total: null,
journals: null,
@ -43,6 +44,7 @@ class TrialBalance extends owl.Component {
},
});
this.load_data(self.initial_render = true);
}
async load_data() {
/**
@ -243,23 +245,8 @@ 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,]);
this.state.default_report = false
var date_viewed = []
// this.state.data.forEach((value, index) => {
// console.log(index)
// if (index == 'journal_ids') {
// this.state.journals = value
// console.log(this.state.journals)
// }
// if (value.dynamic_date_num) {
// 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) {
this.state.date_viewed = date_viewed.reverse()
}
@ -451,6 +438,7 @@ class TrialBalance extends owl.Component {
}
return filters
}
async print_xlsx() {
/**
* Asynchronously generates and downloads an XLSX report.

240
dynamic_accounts_report/static/src/xml/trial_balance_view.xml

@ -310,116 +310,190 @@
</tr>
</thead>
<tbody t-ref="tbody">
<t t-if="state.data">
<t t-set="i" t-value="0"/>
<t t-foreach="state.accounts"
t-as="move_line"
t-key="move_line_index">
<t t-set="i" t-value="i + 1"/>
<tr class="border-bottom"
style="border-spacing: 0 10px;">
<th colspan="6">
<span class="dropdown">
<a class="dropdown-toggle"
data-bs-toggle="dropdown"
style="color: black;">
<span>
<t t-esc="move_line['account']"/>
</span>
</a>
<span class="dropdown-menu">
<a role="menuitem"
t-on-click="show_gl"
class="show_gl">
General Ledger
<t t-set="show" t-value="True"/>
<t t-if="this.state.default_report == false">
<t t-if="state.data">
<t t-foreach="state.data" t-as="each" t-key="each.account_id">
<t t-set="show" t-value="False"/>
<tr class="border-bottom"
style="border-spacing: 0 10px;">
<th colspan="6">
<span class="dropdown">
<a class="dropdown-toggle"
data-bs-toggle="dropdown"
style="color: black;">
<span>
<t t-esc="each['account']"/>
</span>
</a>
<div role="separator"
class="dropdown-divider"/>
<a role="menuitem"
t-att-data-id="move_line['account_id']"
t-on-click="gotoJournalItem"
class="show_gl">
Journal Items
<span class="dropdown-menu">
<a role="menuitem"
t-on-click="show_gl"
class="show_gl">
General Ledger
</a>
<div role="separator"
class="dropdown-divider"/>
<a role="menuitem"
t-att-data-id="each['account_id']"
t-on-click="gotoJournalItem"
class="show_gl">
Journal Items
</a>
</span>
</span>
</th>
<th style="text-align:center;">
<t t-if="each['initial_total_credit']"
t-esc="each['initial_total_credit']"/>
</th>
<t t-if="state.apply_comparison == true">
<t t-set="number_of_periods"
t-value="comparison_number_range"/>
<t t-foreach="number_of_periods"
t-as="num" t-key="num">
<th style="text-align:center;">
<t t-if="each['dynamic_total_debit_' + num]"
t-esc="each['dynamic_total_debit_' + num]"/>
</th>
<th style="text-align:center;">
<t t-if="each['dynamic_total_credit_' + num]"
t-esc="each['dynamic_total_credit_' + num]"/>
</th>
</t>
</t>
<th style="text-align:center;">
<t t-if="each['total_debit']"
t-esc="each['total_debit']"/>
</th>
<th style="text-align:center;">
<t t-if="each['total_credit']"
t-esc="each['total_credit']"/>
</th>
<th style="text-align:center;">
<t t-if="each['end_total_debit']"
t-esc="each['end_total_debit']"/>
</th>
<th style="text-align:center;">
<t t-if="each['end_total_credit']"
t-esc="each['end_total_credit']"/>
</th>
</tr>
</t>
</t>
</t>
<t t-if="this.state.default_report == true">
<t t-if="state.data">
<t t-set="i" t-value="0"/>
<t t-foreach="state.accounts"
t-as="move_line"
t-key="move_line_index">
<t t-set="i" t-value="i + 1"/>
<tr class="border-bottom"
style="border-spacing: 0 10px;">
<th colspan="6">
<span class="dropdown">
<a class="dropdown-toggle"
data-bs-toggle="dropdown"
style="color: black;">
<span>
<t t-esc="move_line['account']"/>
</span>
</a>
<span class="dropdown-menu">
<a role="menuitem"
t-on-click="show_gl"
class="show_gl">
General Ledger
</a>
<div role="separator"
class="dropdown-divider"/>
<a role="menuitem"
t-att-data-id="move_line['account_id']"
t-on-click="gotoJournalItem"
class="show_gl">
Journal Items
</a>
</span>
</span>
</span>
</th>
</th>
<th style="text-align:center;">
<t t-if="move_line['initial_total_debit']"
t-esc="move_line['initial_total_debit']"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['initial_total_credit']"
t-esc="move_line['initial_total_credit']"/>
</th>
<t t-if="state.apply_comparison == true">
<t t-set="number_of_periods"
t-value="comparison_number_range"/>
<t t-foreach="number_of_periods"
t-as="num" t-key="num">
<th style="text-align:center;">
<t t-if="move_line['dynamic_total_debit_' + num]"
t-esc="move_line['dynamic_total_debit_' + num]"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['dynamic_total_credit_' + num]"
t-esc="move_line['dynamic_total_credit_' + num]"/>
</th>
</t>
</t>
<th style="text-align:center;">
<t t-if="move_line['total_debit']"
t-esc="move_line['total_debit']"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['total_credit']"
t-esc="move_line['total_credit']"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['end_total_debit']"
t-esc="move_line['end_total_debit']"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['end_total_credit']"
t-esc="move_line['end_total_credit']"/>
</th>
</tr>
</t>
<tr class="border-bottom"
style="border-spacing: 0 10px;color:#000">
<th colspan="6">Total</th>
<th style="text-align:center;">
<t t-if="move_line['initial_total_debit']"
t-esc="move_line['initial_total_debit']"/>
<t t-esc="sumByKey(state.accounts, 'initial_total_debit')"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['initial_total_credit']"
t-esc="move_line['initial_total_credit']"/>
<t t-esc="sumByKey(state.accounts, 'initial_total_credit')"/>
</th>
<t t-if="state.apply_comparison == true">
<t t-set="number_of_periods"
t-value="comparison_number_range"/>
<t t-foreach="number_of_periods"
t-as="num" t-key="num">
t-as="nb" t-key="nb">
<th style="text-align:center;">
<t t-if="move_line['dynamic_total_debit_' + num]"
t-esc="move_line['dynamic_total_debit_' + num]"/>
<t t-esc="sumByKey(state.accounts, 'dynamic_total_debit_' + nb)"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['dynamic_total_credit_' + num]"
t-esc="move_line['dynamic_total_credit_' + num]"/>
<t t-esc="sumByKey(state.accounts, 'dynamic_total_credit_' + nb)"/>
</th>
</t>
</t>
<th style="text-align:center;">
<t t-if="move_line['total_debit']"
t-esc="move_line['total_debit']"/>
<t t-esc="sumByKey(state.accounts, 'total_debit')"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['total_credit']"
t-esc="move_line['total_credit']"/>
<t t-esc="sumByKey(state.accounts, 'total_credit')"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['end_total_debit']"
t-esc="move_line['end_total_debit']"/>
<t t-esc="sumByKey(state.accounts, 'end_total_debit')"/>
</th>
<th style="text-align:center;">
<t t-if="move_line['end_total_credit']"
t-esc="move_line['end_total_credit']"/>
<t t-esc="sumByKey(state.accounts, 'end_total_credit')"/>
</th>
</tr>
</t>
<tr class="border-bottom"
style="border-spacing: 0 10px;color:#000">
<th colspan="6">Total</th>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'initial_total_debit')"/>
</th>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'initial_total_credit')"/>
</th>
<t t-if="state.apply_comparison == true">
<t t-set="number_of_periods"
t-value="comparison_number_range"/>
<t t-foreach="number_of_periods"
t-as="nb" t-key="nb">
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'dynamic_total_debit_' + nb)"/>
</th>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'dynamic_total_credit_' + nb)"/>
</th>
</t>
</t>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'total_debit')"/>
</th>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'total_credit')"/>
</th>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'end_total_debit')"/>
</th>
<th style="text-align:center;">
<t t-esc="sumByKey(state.accounts, 'end_total_credit')"/>
</th>
</tr>
</t>
</tbody>
</table>

Loading…
Cancel
Save