Browse Source

Feb 17 [UPDT] : Updated 'dynamic_accounts_report'

pull/254/head
AjmalCybro 2 years ago
parent
commit
0249332294
  1. 2
      dynamic_accounts_report/__manifest__.py
  2. 1
      dynamic_accounts_report/controllers/controllers.py
  3. 5
      dynamic_accounts_report/doc/RELEASE_NOTES.md
  4. 2
      dynamic_accounts_report/report/general_ledger.py
  5. 1
      dynamic_accounts_report/static/src/js/ageing.js
  6. 56
      dynamic_accounts_report/static/src/js/financial_reports.js
  7. 2
      dynamic_accounts_report/static/src/js/general_ledger.js
  8. 18
      dynamic_accounts_report/static/src/xml/general_ledger_view.xml
  9. 1
      dynamic_accounts_report/wizard/ageing.py
  10. 2
      dynamic_accounts_report/wizard/balance_sheet.py
  11. 4
      dynamic_accounts_report/wizard/balance_sheet_config.py
  12. 10
      dynamic_accounts_report/wizard/general_ledger.py
  13. 4
      dynamic_accounts_report/wizard/partner_leadger.py

2
dynamic_accounts_report/__manifest__.py

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

1
dynamic_accounts_report/controllers/controllers.py

@ -24,7 +24,6 @@ class TBXLSXReportController(http.Controller):
('Content-Disposition', content_disposition(report_name + '.xlsx'))
]
)
print('report data in controller: ', report_data)
report_obj.get_dynamic_xlsx_report(options, response, report_data, dfr_data)
response.set_cookie('fileToken', token)

5
dynamic_accounts_report/doc/RELEASE_NOTES.md

@ -31,3 +31,8 @@
#### Version 15.0.1.1.5
#### UPDT AND BUGFIX
- Report Bug Fix
#### 08.02.2023
#### Version 15.0.1.1.6
#### UPDT AND BUGFIX
- Report Bug Fix: Correct the currency used in the General Ledger

2
dynamic_accounts_report/report/general_ledger.py

@ -6,9 +6,7 @@ class GeneralLedger(models.AbstractModel):
@api.model
def _get_report_values(self, docids, data=None):
print('data frm repot', data)
if self.env.context.get('trial_pdf_report'):
print(data.get('report_data')['report_lines'], "data")
if data.get('report_data'):
data.update({'account_data': data.get('report_data')['report_lines'],
'Filters': data.get('report_data')['filters'],

1
dynamic_accounts_report/static/src/js/ageing.js

@ -125,7 +125,6 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
}
var child=[];
console.log(datas['report_lines'][0])
self.$('.table_view_tb').html(QWeb.render('Ageingtable', {
report_lines : datas['report_lines'],

56
dynamic_accounts_report/static/src/js/financial_reports.js

@ -85,35 +85,32 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
method: 'view_report',
args: [[this.wizard_id], action_title, self.searchModel.config.context.lang],
}).then(function(datas) {
console.log('Balance sheet values..........',datas)
if (initial_render) {
self.$('.filter_view_dfr').html(QWeb.render('DfrFilterView', {
filter_data: datas['filters'],
title : datas['name'],
}));
self.$el.find('.journals').select2({
placeholder: ' Journals...',
});
self.$el.find('.account').select2({
placeholder: ' Accounts...',
});
self.$el.find('.account-tag').select2({
placeholder: 'Account Tag...',
});
self.$el.find('.analytics').select2({
placeholder: 'Analytic Accounts...',
});
self.$el.find('.analytic-tag').select2({
placeholder: 'Analytic Tag...',
});
self.$el.find('.target_move').select2({
placeholder: 'Target Move...',
});
}
var child=[];
if (initial_render) {
self.$('.filter_view_dfr').html(QWeb.render('DfrFilterView', {
filter_data: datas['filters'],
title : datas['name'],
}));
self.$el.find('.journals').select2({
placeholder: ' Journals...',
});
self.$el.find('.account').select2({
placeholder: ' Accounts...',
});
self.$el.find('.account-tag').select2({
placeholder: 'Account Tag...',
});
self.$el.find('.analytics').select2({
placeholder: 'Analytic Accounts...',
});
self.$el.find('.analytic-tag').select2({
placeholder: 'Analytic Tag...',
});
self.$el.find('.target_move').select2({
placeholder: 'Target Move...',
});
}
var child=[];
self.$('.table_view_dfr').html(QWeb.render('dfr_table', {
report_lines : datas['report_lines'],
@ -242,7 +239,6 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
var account_ids = [];
var account_text = [];
var account_res = document.getElementById("acc_res")
console.log('account.value....',account_res.value)
var account_list = $(".account").select2('data')
for (var i = 0; i < account_list.length; i++) {
if(account_list[i].element[0].selected === true){

2
dynamic_accounts_report/static/src/js/general_ledger.js

@ -100,7 +100,6 @@ odoo.define('dynamic_accounts_report.general_ledger', function (require) {
try{
var self = this;
var action_title = self._title
console.log("action_title:",action_title)
self._rpc({
model: 'account.general.ledger',
method: 'view_report',
@ -279,7 +278,6 @@ odoo.define('dynamic_accounts_report.general_ledger', function (require) {
event.preventDefault();
var self = this;
var account_id = $(event.currentTarget).data('account-id');
console.log(account_id,'account_id')
var offset = 0;
var td = $(event.currentTarget).next('tr').find('td');
if (td.length == 1) {

18
dynamic_accounts_report/static/src/xml/general_ledger_view.xml

@ -370,7 +370,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<!-- <t t-esc="account_line.currency_code"/>-->
<t t-esc="currency_symbol"/>
<t t-esc="account_line.debit"/>
<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
@ -380,7 +381,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<!-- <t t-esc="account_line.currency_code"/>-->
<t t-esc="currency_symbol"/>
<t t-esc="account_line.credit"/>
<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
@ -391,7 +393,8 @@
</t>
<t t-else="">
<t t-set="t_balance" t-value="Math.round((t_balance+account_line.balance)* 100) / 100"/>
<t t-esc="account_line.currency_code"/>
<!-- <t t-esc="account_line.currency_code"/>-->
<t t-esc="currency_symbol"/>
<!-- <t t-esc="account_line.balance"/>-->
<t t-esc="t_balance" t-options='{"widget": "float", "precision": 2}'/>
<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
@ -406,7 +409,8 @@
<t t-else="">
<t t-esc="account_line.debit"/>
<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.currency_code"/>
<!-- <t t-esc="account_line.currency_code"/>-->
<t t-esc="currency_symbol"/>
</t>
</td>
<td t-att-style="style_right" class="amt">
@ -416,7 +420,8 @@
<t t-else="">
<t t-esc="account_line.credit"/>
<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.currency_code"/>
<!-- <t t-esc="account_line.currency_code"/>-->
<t t-esc="currency_symbol"/>
</t>
</td>
<td t-att-style="style_right" class="amt">
@ -428,7 +433,8 @@
<t t-esc="t_balance" t-options='{"widget": "float", "precision": 2}'/>
<!-- <t t-esc="account_line.balance"/>-->
<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.currency_code"/>
<!-- <t t-esc="account_line.currency_code"/>-->
<t t-esc="currency_symbol"/>
</t>
</td>
</t>

1
dynamic_accounts_report/wizard/ageing.py

@ -59,7 +59,6 @@ class AgeingView(models.TransientModel):
records = self._get_report_values(data)
currency = self._get_currency()
print(records['Partners'])
return {
'name': "Partner Ageing",
'type': 'ir.actions.client',

2
dynamic_accounts_report/wizard/balance_sheet.py

@ -111,10 +111,8 @@ class BalanceSheetView(models.TransientModel):
'lang': 'en_US'}}
account_lines = self.get_account_lines(new_data)
print("account_lines",account_lines)
report_lines = self.view_report_pdf(account_lines, new_data)[
'report_lines']
print("report_lines",report_lines)
move_line_accounts = []
move_lines_dict = {}

4
dynamic_accounts_report/wizard/balance_sheet_config.py

@ -94,7 +94,6 @@ class BalanceSheet(models.TransientModel):
res = {}
fields = ['credit', 'debit', 'balance']
print("reportssssssss",reports)
for report in reports:
if report.id in res:
continue
@ -128,7 +127,6 @@ class BalanceSheet(models.TransientModel):
elif report.type == 'sum':
# it's the sum of the children of this account.report
res2 = self._compute_report_balance(report.children_ids)
print(fields,"ffff")
for key, value in res2.items():
for field in fields:
res[report.id][field] += value[field]
@ -196,7 +194,6 @@ class BalanceSheet(models.TransientModel):
# used to display the details of the
# financial report, so it's not needed here.
continue
print("get_account:",res[report.id])
if res[report.id].get('account'):
sub_lines = []
for account_id, value \
@ -247,7 +244,6 @@ class BalanceSheet(models.TransientModel):
flag = True
if flag:
sub_lines.append(vals)
print("sub_lines",sub_lines)
lines += sorted(sub_lines,
key=lambda sub_line: sub_line['name'])
return lines

10
dynamic_accounts_report/wizard/general_ledger.py

@ -46,7 +46,6 @@ class GeneralView(models.TransientModel):
@api.model
def view_report(self, option, title):
print("view_report")
r = self.env['account.general.ledger'].search([('id', '=', option[0])])
self = r
new_title = ''
@ -102,7 +101,6 @@ class GeneralView(models.TransientModel):
filters = self.get_filter(option)
records = self._get_report_values(data)
currency = self._get_currency()
print('last return')
return {
'name': new_title,
'type': 'ir.actions.client',
@ -286,14 +284,12 @@ class GeneralView(models.TransientModel):
return res
def _get_accounts(self, accounts, init_balance, display_account, data):
print("function called..........")
cr = self.env.cr
MoveLine = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines
if init_balance and data.get('date_from'):
print("function called..2")
init_tables, init_where_clause, init_where_params = MoveLine.with_context(
date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get()
@ -345,7 +341,6 @@ class GeneralView(models.TransientModel):
params = tuple(init_where_params)
else:
params = (tuple(accounts.ids),) + tuple(init_where_params)
# print("aaaaaaaaaaaaaaaaaaaaaaa", params)
cr.execute(sql, params)
for row in cr.dictfetchall():
row['m_id'] = row['account_id']
@ -402,8 +397,6 @@ class GeneralView(models.TransientModel):
params = tuple(where_params)
else:
params = (tuple(accounts.ids),) + tuple(where_params)
# print("sql", sql)
# print("params", params)
cr.execute(sql, params)
account_res = cr.dictfetchall()
@ -626,7 +619,6 @@ class GeneralView(models.TransientModel):
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):
report_data_main = json.loads(report_data)
print('report data: ', report_data_main)
output = io.BytesIO()
name_data = json.loads(dfr_data)
filters = json.loads(data)
@ -721,8 +713,6 @@ class GeneralView(models.TransientModel):
sheet.write(row + 1, col + 7, line_data.get('debit'), txt)
sheet.write(row + 1, col + 8, line_data.get('credit'), txt)
sheet.write(row + 1, col + 9, line_data.get('balance'), txt)
else:
print('///////////',rec_data)
workbook.close()
output.seek(0)

4
dynamic_accounts_report/wizard/partner_leadger.py

@ -127,7 +127,6 @@ class PartnerView(models.TransientModel):
filters['category_list'] = data.get('category_list')
filters['account_type_list'] = data.get('account_type_list')
filters['target_move'] = data.get('target_move').capitalize()
print(filters, "filters")
return filters
def get_filter_data(self, option):
@ -163,8 +162,6 @@ class PartnerView(models.TransientModel):
o_company = j.company_id
accounts.append((j.id, j.name))
print(r.reconciled, "rec")
filter_dict = {
'journal_ids': r.journal_ids.ids,
'account_ids': r.account_ids.ids,
@ -294,7 +291,6 @@ class PartnerView(models.TransientModel):
if data.get('partners'):
WHERE += ' AND p.id IN %s' % str(
tuple(data.get('partners').ids) + tuple([0]))
print(data, "data")
if data.get('reconciled') == 'unreconciled':
WHERE += ' AND l.full_reconcile_id is null AND' \
' l.balance != 0 AND a.reconcile is true'

Loading…
Cancel
Save