diff --git a/dynamic_accounts_report/__manifest__.py b/dynamic_accounts_report/__manifest__.py
index a50ee53c1..54ffef272 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.11',
+ 'version': '16.0.1.0.12',
'category': 'Accounting',
'live_test_url': 'https://www.youtube.com/watch?v=gVQi9q9Rs-E&t=5s',
'summary': "Odoo 16 Accounting Financial Reports",
diff --git a/dynamic_accounts_report/doc/RELEASE_NOTES.md b/dynamic_accounts_report/doc/RELEASE_NOTES.md
index 29bca296e..0123a856b 100644
--- a/dynamic_accounts_report/doc/RELEASE_NOTES.md
+++ b/dynamic_accounts_report/doc/RELEASE_NOTES.md
@@ -45,3 +45,8 @@
### version 16.0.1.0.11,
### BUGFIX
- General Ledger: Fixed the Redundancy bug
+
+### 05.09.2024
+### version 16.0.1.0.12,
+### BUGFIX
+- Report Bug Fix: Problem with rounding issue.
diff --git a/dynamic_accounts_report/static/src/js/ageing.js b/dynamic_accounts_report/static/src/js/ageing.js
index 05b55f181..3ac429f03 100644
--- a/dynamic_accounts_report/static/src/js/ageing.js
+++ b/dynamic_accounts_report/static/src/js/ageing.js
@@ -127,6 +127,7 @@ odoo.define('dynamic_accounts_report.ageing', function(require) {
}
var child = [];
+ console.log(datas,'datas.....')
self.$('.table_view_tb').html(QWeb.render('Ageingtable', {
report_lines: datas['report_lines'],
diff --git a/dynamic_accounts_report/static/src/js/general_ledger.js b/dynamic_accounts_report/static/src/js/general_ledger.js
index b8dbdb242..b4960de65 100644
--- a/dynamic_accounts_report/static/src/js/general_ledger.js
+++ b/dynamic_accounts_report/static/src/js/general_ledger.js
@@ -88,6 +88,7 @@ odoo.define('dynamic_accounts_report.general_ledger', function(require) {
load_data: function(initial_render = true) {
var self = this;
self.$(".categ").empty();
+ console.log('load data.....')
try {
var self = this;
var action_title = self._title
@@ -127,6 +128,10 @@ odoo.define('dynamic_accounts_report.general_ledger', function(require) {
});
}
var child = [];
+ console.log(datas['debit_balance'],'debit balance....')
+ console.log(datas['debit_total'],'debit_total....')
+ console.log(datas['credit_total'],'credit_total....')
+ console.log(datas['currency'],'currency....')
self.$('.table_view_tb').html(QWeb.render('GLTable', {
report_lines: datas['report_lines'],
filter: datas['filters'],
diff --git a/dynamic_accounts_report/static/src/xml/ageing.xml b/dynamic_accounts_report/static/src/xml/ageing.xml
index 88eda8da3..0f1a0f1e6 100644
--- a/dynamic_accounts_report/static/src/xml/ageing.xml
+++ b/dynamic_accounts_report/static/src/xml/ageing.xml
@@ -40,7 +40,7 @@
-
+
-
+
+
+
+
+
+
+
+
@@ -74,7 +81,7 @@
-
+
@@ -84,7 +91,7 @@
-
+
|
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 7e135215c..de607fc7b 100644
--- a/dynamic_accounts_report/static/src/xml/general_ledger_view.xml
+++ b/dynamic_accounts_report/static/src/xml/general_ledger_view.xml
@@ -26,6 +26,7 @@
+
@@ -48,8 +49,10 @@
-
-
+
+
+
+
|
@@ -58,8 +61,10 @@
-
-
+
+
+
+
|
@@ -68,8 +73,10 @@
-
-
+
+
+
+
|
@@ -79,8 +86,9 @@
-
-
-
+
+
+
@@ -90,7 +98,8 @@
-
+
+
@@ -100,7 +109,8 @@
-
+
+
diff --git a/dynamic_accounts_report/static/src/xml/trial_balance_view.xml b/dynamic_accounts_report/static/src/xml/trial_balance_view.xml
index 867e6b6f8..43b3b4237 100644
--- a/dynamic_accounts_report/static/src/xml/trial_balance_view.xml
+++ b/dynamic_accounts_report/static/src/xml/trial_balance_view.xml
@@ -76,20 +76,24 @@
-
+
+
|
-
+
+
|
-
+
+
|
-
+
+
|
@@ -175,13 +179,13 @@
-
+
|
-
+
|
diff --git a/dynamic_accounts_report/wizard/ageing.py b/dynamic_accounts_report/wizard/ageing.py
index e5c22997d..5f9b1411a 100644
--- a/dynamic_accounts_report/wizard/ageing.py
+++ b/dynamic_accounts_report/wizard/ageing.py
@@ -529,8 +529,9 @@ class AgeingView(models.TransientModel):
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
+ decimal_places = self.env.company.currency_id.decimal_places
currency_array = [self.env.company.currency_id.symbol,
- self.env.company.currency_id.position, lang]
+ self.env.company.currency_id.position, lang,decimal_places]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):
diff --git a/dynamic_accounts_report/wizard/balance_sheet.py b/dynamic_accounts_report/wizard/balance_sheet.py
index 760b30606..11a2a2c83 100644
--- a/dynamic_accounts_report/wizard/balance_sheet.py
+++ b/dynamic_accounts_report/wizard/balance_sheet.py
@@ -201,13 +201,14 @@ class BalanceSheetView(models.TransientModel):
currency = company_id.currency_id
symbol = currency.symbol
rounding = currency.rounding
+ decimal_places = currency.decimal_places
position = currency.position
for rec in final_report_lines:
- rec['debit'] = round(rec['debit'], 2)
- rec['credit'] = round(rec['credit'], 2)
+ rec['debit'] = round(rec['debit'], decimal_places)
+ rec['credit'] = round(rec['credit'], decimal_places)
rec['balance'] = rec['debit'] - rec['credit']
- rec['balance'] = round(rec['balance'], 2)
+ rec['balance'] = round(rec['balance'], decimal_places)
if (rec['balance_cmp'] < 0 and rec['balance'] > 0) or (
rec['balance_cmp'] > 0 and rec['balance'] < 0):
rec['balance'] = rec['balance'] * -1
@@ -379,6 +380,7 @@ class BalanceSheetView(models.TransientModel):
def _get_report_values(self, data):
docs = data['model']
display_account = data['display_account']
+ decimal_places = self.env.company.currency_id.decimal_places
init_balance = True
journals = data['journals']
accounts = self.env['account.account'].search([])
@@ -405,7 +407,7 @@ class BalanceSheetView(models.TransientModel):
debit_total = 0
debit_total = sum(x['debit'] for x in account_res)
credit_total = sum(x['credit'] for x in account_res)
- debit_balance = round(debit_total, 2) - round(credit_total, 2)
+ debit_balance = round(debit_total, decimal_places) - round(credit_total, decimal_places)
return {
'doc_ids': self.ids,
'debit_total': debit_total,
@@ -454,6 +456,7 @@ class BalanceSheetView(models.TransientModel):
MoveLine = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
currency_id = self.env.company.currency_id
+ decimal_places = self.env.company.currency_id.decimal_places
# Prepare sql query base on selected parameters from wizard
tables, where_clause, where_params = MoveLine._query_get()
@@ -493,10 +496,10 @@ class BalanceSheetView(models.TransientModel):
# tuple(data.get('analytic_tags').ids) + tuple([0]))
# current_lang = self.env.user.lang
# Get move lines base on sql query and Calculate the total balance of move lines
- sql = ('''SELECT l.account_id AS account_id, a.code AS code,a.id AS id, a.name AS name,
- ROUND(COALESCE(SUM(l.debit),0),2) AS debit,
- ROUND(COALESCE(SUM(l.credit),0),2) AS credit,
- ROUND(COALESCE(SUM(l.balance),0),2) AS balance,
+ base_sql = ('''SELECT l.account_id AS account_id, a.code AS code,a.id AS id, a.name AS name,
+ ROUND(COALESCE(SUM(l.debit),0),{}) AS debit,
+ ROUND(COALESCE(SUM(l.credit),0),{}) AS credit,
+ ROUND(COALESCE(SUM(l.balance),0),{}) AS balance,
anl.keys, act.name as tag
FROM account_move_line l
JOIN account_move m ON (l.move_id=m.id)
@@ -512,9 +515,9 @@ class BalanceSheetView(models.TransientModel):
SELECT jsonb_object_keys(l.analytic_distribution)::INT
AS keys) anl ON true
LEFT JOIN account_analytic_account an
- ON (anl.keys = an.id)'''
- + WHERE + final_filters + ''' GROUP BY l.account_id,
- a.code,a.id,a.name,anl.keys, act.name''')
+ ON (anl.keys = an.id)''').format(decimal_places, decimal_places, decimal_places)
+ sql = base_sql + WHERE + final_filters + ''' GROUP BY l.account_id,
+ a.code,a.id,a.name,anl.keys, act.name'''
if data.get('accounts'):
params = tuple(where_params)
diff --git a/dynamic_accounts_report/wizard/balance_sheet_config.py b/dynamic_accounts_report/wizard/balance_sheet_config.py
index 054bd91cc..35df01b2d 100644
--- a/dynamic_accounts_report/wizard/balance_sheet_config.py
+++ b/dynamic_accounts_report/wizard/balance_sheet_config.py
@@ -30,6 +30,7 @@ class BalanceSheet(models.TransientModel):
data = dict()
report_lines = acc
data['form'] = form
+ decimal_places = self.env.company.currency_id.decimal_places
# find the journal items of these accounts
journal_items = self.find_journal_items(report_lines, data['form'])
@@ -49,7 +50,7 @@ class BalanceSheet(models.TransientModel):
# finding the root
for item in report_lines:
- item['balance'] = round(item['balance'], 2)
+ item['balance'] = round(item['balance'], decimal_places)
if not item['parent']:
item['level'] = 1
parent = item
diff --git a/dynamic_accounts_report/wizard/general_ledger.py b/dynamic_accounts_report/wizard/general_ledger.py
index ca082ab39..b1870e244 100644
--- a/dynamic_accounts_report/wizard/general_ledger.py
+++ b/dynamic_accounts_report/wizard/general_ledger.py
@@ -120,6 +120,7 @@ class GeneralView(models.TransientModel):
merged_data = {}
for line in records['Accounts']:
account_id = line['account_id']
+ print(line['balance'],'balance....')
if account_id not in merged_data:
merged_data[account_id] = line
else:
@@ -284,7 +285,8 @@ class GeneralView(models.TransientModel):
debit_total = 0
debit_total = sum(x['debit'] for x in account_res)
credit_total = sum(x['credit'] for x in account_res)
- debit_balance = round(debit_total, 2) - round(credit_total, 2)
+ decimal_places = self.env.company.currency_id.decimal_places
+ debit_balance = round(debit_total, decimal_places) - round(credit_total, decimal_places)
return {
'doc_ids': self.ids,
'debit_total': debit_total,
@@ -334,6 +336,7 @@ class GeneralView(models.TransientModel):
cr = self.env.cr
MoveLine = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
+ decimal_places = self.env.company.currency_id.decimal_places
# Prepare initial sql query and Get the initial move lines
if init_balance and data.get('date_from'):
init_tables, init_where_clause, init_where_params = MoveLine.with_context(
@@ -366,14 +369,14 @@ class GeneralView(models.TransientModel):
tuple(data.get('analytics').ids) + tuple([0]))
if data['account_tags']:
WHERE += ' AND tag IN %s' % str(data.get('account_tags'))
- sql = ('''SELECT
+ base_sql = ('''SELECT
l.account_id AS account_id,
a.code AS code,
a.id AS id,
a.name AS name,
- ROUND(COALESCE(SUM(l.debit),0),2) AS debit,
- ROUND(COALESCE(SUM(l.credit),0),2) AS credit,
- ROUND(COALESCE(SUM(l.balance),0),2) AS balance,
+ ROUND(COALESCE(SUM(l.debit),0),{}) AS debit,
+ ROUND(COALESCE(SUM(l.credit),0),{}) AS credit,
+ ROUND(COALESCE(SUM(l.balance),0),{}) AS balance,
anl.keys,
act.name AS tag
FROM
@@ -396,15 +399,17 @@ class GeneralView(models.TransientModel):
SELECT jsonb_array_elements_text(l.analytic_distribution->'ids')::INT AS keys
) anl ON true
LEFT JOIN
- account_analytic_account an ON (anl.keys = an.id) '''+ WHERE + new_filter + '''
+ account_analytic_account an ON (anl.keys = an.id) ''').format(decimal_places, decimal_places, decimal_places)
+ sql = base_sql + WHERE + new_filter + '''
GROUP BY
- l.account_id, a.code, a.id, a.name, anl.keys, act.name''')
+ l.account_id, a.code, a.id, a.name, anl.keys, act.name'''
if data.get('accounts'):
params = tuple(init_where_params)
else:
params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params)
+ print('1...............')
for row in cr.dictfetchall():
row['m_id'] = row['account_id']
move_lines[row.pop('account_id')].append(row)
@@ -443,11 +448,11 @@ class GeneralView(models.TransientModel):
# Get move lines base on sql query and Calculate the total balance
# of move lines
- sql = ('''SELECT l.account_id AS account_id, a.code AS code,
+ base_sql = ('''SELECT l.account_id AS account_id, a.code AS code,
a.id AS id, a.name AS name, l.id as line_id,
- ROUND(COALESCE(SUM(l.debit),0),2) AS debit,
- ROUND(COALESCE(SUM(l.credit),0),2) AS credit,
- ROUND(COALESCE(SUM(l.balance),0),2) AS balance,
+ ROUND(COALESCE(SUM(l.debit),0),{}) AS debit,
+ ROUND(COALESCE(SUM(l.credit),0),{}) AS credit,
+ ROUND(COALESCE(SUM(l.balance),0),{}) AS balance,
anl.keys, act.name as tag
FROM account_move_line l
LEFT JOIN account_move m ON (l.move_id = m.id)
@@ -463,15 +468,17 @@ class GeneralView(models.TransientModel):
SELECT jsonb_object_keys(l.analytic_distribution)::INT
AS keys) anl ON true
LEFT JOIN account_analytic_account an
- ON (anl.keys = an.id)'''
- + WHERE + new_final_filter + ''' GROUP BY l.account_id,
- a.code,a.id,a.name,anl.keys, act.name, l.id''')
+ ON (anl.keys = an.id)''').format(decimal_places, decimal_places, decimal_places)
+ sql = base_sql+ WHERE + new_final_filter + ''' GROUP BY l.account_id,
+ a.code,a.id,a.name,anl.keys, act.name, l.id'''
if data.get('accounts'):
params = tuple(where_params)
else:
params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params)
+ print('2.........')
account_res = cr.dictfetchall()
+ print(account_res,'account res....')
unique_line_ids = set()
filtered_records = []
for record in account_res:
@@ -492,7 +499,7 @@ class GeneralView(models.TransientModel):
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
- self.env.company.currency_id.position, lang]
+ self.env.company.currency_id.position, lang,self.env.company.currency_id.decimal_places]
return currency_array
def get_accounts_line(self, account_id, title):
diff --git a/dynamic_accounts_report/wizard/partner_leadger.py b/dynamic_accounts_report/wizard/partner_leadger.py
index 5208a4686..13f52f0ce 100644
--- a/dynamic_accounts_report/wizard/partner_leadger.py
+++ b/dynamic_accounts_report/wizard/partner_leadger.py
@@ -216,6 +216,7 @@ class PartnerView(models.TransientModel):
docs = data['model']
display_account = data['display_account']
init_balance = True
+ decimal_places = self.env.company.currency_id.decimal_places
company_id = self.env.companies.ids
accounts = self.env['account.account'].search(
[('account_type', 'in', ('asset_receivable', 'liability_payable')),
@@ -237,7 +238,7 @@ class PartnerView(models.TransientModel):
debit_total = 0
debit_total = sum(x['debit'] for x in partner_res)
credit_total = sum(x['credit'] for x in partner_res)
- debit_balance = round(debit_total, 2) - round(credit_total, 2)
+ debit_balance = round(debit_total, decimal_places) - round(credit_total, decimal_places)
return {
'doc_ids': self.ids,
'debit_total': debit_total,
@@ -294,6 +295,7 @@ class PartnerView(models.TransientModel):
move_line = self.env['account.move.line']
move_lines = {x: [] for x in partners.ids}
currency_id = self.env.company.currency_id
+ decimal_places = self.env.company.currency_id.decimal_places
tables, where_clause, where_params = move_line._query_get()
wheres = [""]
if where_clause.strip():
@@ -370,9 +372,9 @@ class PartnerView(models.TransientModel):
balance = 0
if row['partner_id'] in move_lines:
for line in move_lines.get(row['partner_id']):
- balance += round(line['debit'], 2) - round(line['credit'],
- 2)
- row['balance'] += (round(balance, 2))
+ balance += round(line['debit'], decimal_places) - round(line['credit'],
+ decimal_places)
+ row['balance'] += (round(balance, decimal_places))
row['m_id'] = row['account_id']
row['account_name'] = account_list[row['account_id']][
'name'] + "(" + \
@@ -389,9 +391,9 @@ class PartnerView(models.TransientModel):
res['id'] = partner.id
res['move_lines'] = move_lines[partner.id]
for line in res.get('move_lines'):
- res['debit'] += round(line['debit'], 2)
- res['credit'] += round(line['credit'], 2)
- res['balance'] = round(line['balance'], 2)
+ res['debit'] += round(line['debit'], decimal_places)
+ res['credit'] += round(line['credit'], decimal_places)
+ res['balance'] = round(line['balance'], decimal_places)
if display_account == 'all':
partner_res.append(res)
if display_account == 'movement' and res.get('move_lines'):
diff --git a/dynamic_accounts_report/wizard/trial_balance.py b/dynamic_accounts_report/wizard/trial_balance.py
index 4583ce8f3..16a6baccf 100644
--- a/dynamic_accounts_report/wizard/trial_balance.py
+++ b/dynamic_accounts_report/wizard/trial_balance.py
@@ -284,9 +284,10 @@ class TrialView(models.TransientModel):
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
+
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position,
- lang]
+ lang,self.env.company.currency_id.decimal_places]
return currency_array
def get_dynamic_xlsx_report(self, data, response ,report_data, dfr_data):
|