Browse Source

[UPDT] Updated 'dynamic_accounts_report'

pull/178/head
Ajmal Cybro 4 years ago
parent
commit
e58355742a
  1. 1
      dynamic_accounts_report/__init__.py
  2. 2
      dynamic_accounts_report/__manifest__.py
  3. 4
      dynamic_accounts_report/doc/RELEASE_NOTES.md
  4. 1
      dynamic_accounts_report/report/ageing.py
  5. 12
      dynamic_accounts_report/report/ageing.xml
  6. 2
      dynamic_accounts_report/report/cash_flow_report.py
  7. 20
      dynamic_accounts_report/report/cash_flow_report.xml
  8. 1
      dynamic_accounts_report/report/daybook.py
  9. 2
      dynamic_accounts_report/report/daybook.xml
  10. 15
      dynamic_accounts_report/report/financial_report_template.xml
  11. 1
      dynamic_accounts_report/report/financial_reports.py
  12. 1
      dynamic_accounts_report/report/general_ledger.py
  13. 39
      dynamic_accounts_report/report/general_ledger.xml
  14. 1
      dynamic_accounts_report/report/partner_ledger.py
  15. 2
      dynamic_accounts_report/report/partner_ledger.xml
  16. 1
      dynamic_accounts_report/report/trial_balance.py
  17. 2
      dynamic_accounts_report/report/trial_balance.xml
  18. 14
      dynamic_accounts_report/security/ir.model.access.csv
  19. 57
      dynamic_accounts_report/static/src/js/ageing.js
  20. 58
      dynamic_accounts_report/static/src/js/cash_flow.js
  21. 31
      dynamic_accounts_report/static/src/js/daybook.js
  22. 17
      dynamic_accounts_report/static/src/js/financial_reports.js
  23. 37
      dynamic_accounts_report/static/src/js/general_ledger.js
  24. 38
      dynamic_accounts_report/static/src/js/partner_ledger.js
  25. 27
      dynamic_accounts_report/static/src/js/trial_balance.js
  26. 213
      dynamic_accounts_report/static/src/xml/ageing.xml
  27. 14
      dynamic_accounts_report/static/src/xml/cash_flow_view.xml
  28. 107
      dynamic_accounts_report/static/src/xml/daybook.xml
  29. 7
      dynamic_accounts_report/static/src/xml/financial_reports_view.xml
  30. 63
      dynamic_accounts_report/static/src/xml/general_ledger_view.xml
  31. 29
      dynamic_accounts_report/static/src/xml/partner_ledger_view.xml
  32. 20
      dynamic_accounts_report/static/src/xml/trial_balance_view.xml
  33. 10
      dynamic_accounts_report/views/views.xml
  34. 42
      dynamic_accounts_report/wizard/ageing.py
  35. 119
      dynamic_accounts_report/wizard/balance_sheet.py
  36. 11
      dynamic_accounts_report/wizard/balance_sheet_config.py
  37. 18
      dynamic_accounts_report/wizard/cash_flow.py
  38. 23
      dynamic_accounts_report/wizard/daybook.py
  39. 44
      dynamic_accounts_report/wizard/general_ledger.py
  40. 30
      dynamic_accounts_report/wizard/partner_leadger.py
  41. 17
      dynamic_accounts_report/wizard/trial_balance.py

1
dynamic_accounts_report/__init__.py

@ -3,3 +3,4 @@
from . import controllers
from . import wizard
from . import report

2
dynamic_accounts_report/__manifest__.py

@ -22,7 +22,7 @@
{
'name': 'Dynamic Financial Reports',
'version': '13.0.1.0.0',
'version': '13.0.1.0.1',
'category': 'Accounting',
'summary': """Dynamic Financial Reports with drill
down and filters Community Edition""",

4
dynamic_accounts_report/doc/RELEASE_NOTES.md

@ -6,6 +6,10 @@
- Initial commit for Odoo 13 dynamic financial reports
#### 28.06.2021
#### Version 13.0.1.0.1
#### UPDT
- Updated

1
dynamic_accounts_report/report/ageing.py

@ -12,6 +12,7 @@ class PartnerAgeing(models.AbstractModel):
data.update(
{'account_data': data.get('report_data')['report_lines'][0],
'Filters': data.get('report_data')['filters'],
'company': self.env.company,
})

12
dynamic_accounts_report/report/ageing.xml

@ -7,7 +7,7 @@
<t t-call="web.internal_layout">
<div class="page">
<div class="oe_structure"/>
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Partner Ageing
<h3 style="text-align:centre;left:50%;"><span t-esc="Filters.get('company_name')"/>: Partner Ageing
</h3>
<strong> As On Date:</strong>
<t t-esc="Filters['date_from']"/>
@ -53,11 +53,11 @@
<th>JRNL</th>
<th>Account</th>
<th>Not Due</th>
<th>0 - 20</th>
<th>20 - 40</th>
<th>40 - 60</th>
<th>60 - 80</th>
<th>80 +</th>
<th>0 - 30</th>
<th>30 - 60</th>
<th>60 - 90</th>
<th>90 - 120</th>
<th>120 +</th>
<th> Total</th>
<th groups="base.group_multi_currency">Currency</th>
</tr>

2
dynamic_accounts_report/report/cash_flow_report.py

@ -8,9 +8,9 @@ class GeneralLedger(models.AbstractModel):
def _get_report_values(self, docids, data=None):
if self.env.context.get('trial_pdf_report'):
if data.get('report_data'):
data.update({'account_data': data.get('report_data')['report_lines'],
'Filters': data.get('report_data')['filters'],
'company': self.env.company,
})
return data

20
dynamic_accounts_report/report/cash_flow_report.xml

@ -18,20 +18,22 @@
<h4 style="padding-left:10px !important">Cash Flow statements</h4>
<div style="width:90%;margin:1px auto;font-size:12px" class="row mt32 mb32">
<div class="col-4">
<t t-if="Filters.get('target_moves')">
<p>
<strong>Target Moves:</strong>
<span t-esc="Filters['target_moves']"/>
<br/>
<div class="col-3">
<strong>Target move:</strong>
<li>
<t t-esc="Filters['target_move']"/>
</li>
</div>
<div class="col-3">
<t t-if="Filters.get('levels')">
<strong>Level :</strong>
<span t-esc="Filters['levels']"/>
<li>
<t t-esc="Filters['levels']"/>
</li>
</t>
</p>
</t>
</div>
<div class="col-4">

1
dynamic_accounts_report/report/daybook.py

@ -12,5 +12,6 @@ class DayBook(models.AbstractModel):
if data.get('report_data'):
data.update({'account_data': data.get('report_data')['report_lines'],
'Filters': data.get('report_data')['filters'],
'company': self.env.company,
})
return data

2
dynamic_accounts_report/report/daybook.xml

@ -7,7 +7,7 @@
<t t-call="web.internal_layout">
<div class="page">
<div class="oe_structure"/>
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Day Book
<h3 style="text-align:centre;left:50%;"><span t-esc="Filters.get('company_name')"/>: Day Book
</h3>
<span t-if="Filters.get('date_from')">

15
dynamic_accounts_report/report/financial_report_template.xml

@ -7,7 +7,7 @@
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<div class="page">
<h3><span t-esc="res_company.name"/>: <span t-esc="report_name"/>
<h3><span t-esc="Filters.get('company_name')"/>: <span t-esc="report_name"/>
</h3>
<div>
@ -71,12 +71,7 @@
<div class="col-3">
<strong>Target move:</strong>
<li>
<t t-if="Filters['target_move'] == 'all'">
<span>All</span>
</t>
<t t-if="Filters['target_move'] == 'posted'">
<span>Posted</span>
</t>
<t t-esc="Filters['target_move']"/>
</li>
</div>
</div>
@ -113,15 +108,15 @@
</td>
<td class="text-right">
<span t-esc="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
</tr>
</t>

1
dynamic_accounts_report/report/financial_reports.py

@ -15,5 +15,6 @@ class InsReportBalanceSheet(models.AbstractModel):
'report_lines': data.get('report_data')['bs_lines'],
'report_name': data.get('report_name'),
'title': data.get('report_data')['name'],
'company': self.env.company,
})
return data

1
dynamic_accounts_report/report/general_ledger.py

@ -15,5 +15,6 @@ class GeneralLedger(models.AbstractModel):
'debit_total': data.get('report_data')['debit_total'],
'credit_total': data.get('report_data')['credit_total'],
'title': data.get('report_data')['name'],
'company': self.env.company,
})
return data

39
dynamic_accounts_report/report/general_ledger.xml

@ -1,7 +1,5 @@
<odoo>
<template id="dynamic_accounts_report.general_ledger">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
@ -10,7 +8,7 @@
<t t-call="web.internal_layout">
<div class="page">
<div class="oe_structure"/>
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: <t t-esc="title"/>
<h3 style="text-align:centre;left:50%;"><span t-esc="Filters.get('company_name')"/>: <t t-esc="title"/>
</h3>
<span t-if="Filters.get('date_from')">
@ -27,9 +25,10 @@
<div>
<div style="text-align:centre;left:50%;" class="row">
<div style="width:100%;">
<div style="text-align:centre;" class="row">
<div class="col-3" style="">
<div class="col-2">
<strong>Journals:</strong>
<t t-foreach="Filters['journals']" t-as="ps">
<li>
@ -38,6 +37,33 @@
</t>
</div>
<div class="col-2">
<strong>Accounts:</strong>
<t t-foreach="Filters['accounts']" t-as="ps">
<li>
<t t-esc="ps"/>
</li>
</t>
</div>
<div class="col-2">
<strong>Analytic:</strong>
<t t-foreach="Filters['analytics']" t-as="ps">
<li>
<t t-esc="ps"/>
</li>
</t>
</div>
<div class="col-2">
<strong>Analytic Tag:</strong>
<t t-foreach="Filters['analytic_tags']" t-as="ps">
<li>
<t t-esc="ps"/>
</li>
</t>
</div>
<div class="col-3">
<strong>Target move:</strong>
<li>
@ -45,12 +71,13 @@
</li>
</div>
</div>
</div>
<br></br>
<table class="table table-sm table-reports">
<thead>
<tr class="text-center">
<tr class="text-right">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>

1
dynamic_accounts_report/report/partner_ledger.py

@ -11,5 +11,6 @@ class PartnerLedgerReport(models.AbstractModel):
if data.get('report_data'):
data.update({'account_data': data.get('report_data')['report_lines'],
'Filters': data.get('report_data')['filters'],
'company': self.env.company,
})
return data

2
dynamic_accounts_report/report/partner_ledger.xml

@ -8,7 +8,7 @@
<t t-call="web.internal_layout">
<div class="page">
<div class="oe_structure"/>
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Partner Ledger
<h3 style="text-align:centre;left:50%;"><span t-esc="Filters.get('company_name')"/>: Partner Ledger
</h3>
<span t-if="Filters.get('date_from')">

1
dynamic_accounts_report/report/trial_balance.py

@ -13,5 +13,6 @@ class TrialBalance(models.AbstractModel):
'Filters': data.get('report_data')['filters'],
'debit_total': data.get('report_data')['debit_total'],
'credit_total': data.get('report_data')['credit_total'],
'company': self.env.company,
})
return data

2
dynamic_accounts_report/report/trial_balance.xml

@ -7,7 +7,7 @@
<t t-call="web.internal_layout">
<div class="page">
<div class="oe_structure"/>
<h3 style="text-align:centre;left:50%;"><span t-esc="res_company.name"/>: Trial Balance
<h3 style="text-align:centre;left:50%;"><span t-esc="Filters.get('company_name')"/>: Trial Balance
</h3>
<span t-if="Filters.get('date_from')">

14
dynamic_accounts_report/security/ir.model.access.csv

@ -1,8 +1,8 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_general_ledger,access.account.general.ledger,model_account_general_ledger,base.group_user,1,1,1,1
access_account_trial_balance,access.account.trial.balance,model_account_trial_balance,base.group_user,1,1,1,1
access_account_cash_flow,access.account.cash.flow,model_account_cash_flow,base.group_user,1,1,1,1
access_dynamic_balance_sheet_report,access.dynamic.balance.sheet.report,model_dynamic_balance_sheet_report,base.group_user,1,1,1,1
access_account_partner_ledger,access.account.partner.ledger,model_account_partner_ledger,base.group_user,1,1,1,1
access_account_partner_ageing,account_partner_ageing.account_partner_ageing,model_account_partner_ageing,base.group_user,1,1,1,1
access_account_day_book,account_day_book.account_day_book,model_account_day_book,base.group_user,1,1,1,1
access_account_general_ledger,access.account.general.ledger,model_account_general_ledger,account.group_account_user,1,1,1,1
access_account_trial_balance,access.account.trial.balance,model_account_trial_balance,account.group_account_user,1,1,1,1
access_account_cash_flow,access.account.cash.flow,model_account_cash_flow,account.group_account_user,1,1,1,1
access_dynamic_balance_sheet_report,access.dynamic.balance.sheet.report,model_dynamic_balance_sheet_report,account.group_account_user,1,1,1,1
access_account_partner_ledger,access.account.partner.ledger,model_account_partner_ledger,account.group_account_user,1,1,1,1
access_account_partner_ageing,account_partner_ageing.account_partner_ageing,model_account_partner_ageing,account.group_account_user,1,1,1,1
access_account_day_book,account_day_book.account_day_book,model_account_day_book,account.group_account_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_general_ledger access.account.general.ledger model_account_general_ledger base.group_user account.group_account_user 1 1 1 1
3 access_account_trial_balance access.account.trial.balance model_account_trial_balance base.group_user account.group_account_user 1 1 1 1
4 access_account_cash_flow access.account.cash.flow model_account_cash_flow base.group_user account.group_account_user 1 1 1 1
5 access_dynamic_balance_sheet_report access.dynamic.balance.sheet.report model_dynamic_balance_sheet_report base.group_user account.group_account_user 1 1 1 1
6 access_account_partner_ledger access.account.partner.ledger model_account_partner_ledger base.group_user account.group_account_user 1 1 1 1
7 access_account_partner_ageing account_partner_ageing.account_partner_ageing model_account_partner_ageing base.group_user account.group_account_user 1 1 1 1
8 access_account_day_book account_day_book.account_day_book model_account_day_book base.group_user account.group_account_user 1 1 1 1

57
dynamic_accounts_report/static/src/js/ageing.js

@ -56,11 +56,22 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
self.$(".categ").empty();
try{
var self = this;
rpc.query({
self._rpc({
model: 'account.partner.ageing',
method: 'view_report',
args: [[this.wizard_id]],
}).then(function(datas) {
_.each(datas['report_lines'][0], function(rep_lines) {
rep_lines.total = self.format_currency(datas['currency'],rep_lines.total);
rep_lines[4] = self.format_currency(datas['currency'],rep_lines[4]);
rep_lines[3] = self.format_currency(datas['currency'],rep_lines[3]);
rep_lines[2] = self.format_currency(datas['currency'],rep_lines[2]);
rep_lines[1] = self.format_currency(datas['currency'],rep_lines[1]);
rep_lines[0] = self.format_currency(datas['currency'],rep_lines[0]);
rep_lines['direction'] = self.format_currency(datas['currency'],rep_lines['direction']);
});
if (initial_render) {
self.$('.filter_view_tb').html(QWeb.render('AgeingFilterView', {
@ -72,6 +83,12 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
self.$el.find('.category').select2({
placeholder: ' Partner Category...',
});
self.$el.find('.target_move').select2({
placeholder: ' Target Move...',
});
self.$el.find('.result_selection').select2({
placeholder: ' Account Type...',
});
}
var child=[];
@ -91,6 +108,15 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
window.location.href
}
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
print_pdf: function(e) {
e.preventDefault();
@ -208,8 +234,6 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
var td = $(event.currentTarget).next('tr').find('td');
if (td.length == 1) {
self._rpc({
model: 'account.partner.ageing',
method: 'view_report',
@ -217,19 +241,23 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
[self.wizard_id]
],
}).then(function(data) {
for (var i = 0; i < data['report_lines'][0].length; i++) {
if (account_id == data['report_lines'][0][i]['partner_id'] ){
_.each(data['report_lines'][0], function(rep_lines) {
_.each(rep_lines['child_lines'], function(child_line) {
child_line.amount = self.format_currency(data['currency'],child_line.amount);
});
});
for (var i = 0; i < data['report_lines'][0].length; i++) {
if (account_id == data['report_lines'][0][i]['partner_id'] ){
$(event.currentTarget).next('tr').find('td .gl-table-div').remove();
$(event.currentTarget).next('tr').find('td ul').after(
QWeb.render('SubSectional', {
account_data: data['report_lines'][0][i]['child_lines'],
}))
$(event.currentTarget).next('tr').find('td ul li:first a').css({
'background-color': '#00ede8',
'font-weight': 'bold',
@ -337,21 +365,22 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
if ($(".target_move").length) {
var post_res = document.getElementById("post_res")
filter_data_selected.target_move = $(".target_move")[0].value
post_res.value = $(".target_move")[0].value
filter_data_selected.target_move = $(".target_move")[1].value
post_res.value = $(".target_move")[1].value
post_res.innerHTML=post_res.value;
if ($(".target_move")[0].value == "") {
post_res.innerHTML="all";
if ($(".target_move")[1].value == "") {
post_res.innerHTML="posted";
}
}
if ($(".result_selection").length) {
var account_res = document.getElementById("account_res")
filter_data_selected.result_selection = $(".result_selection")[0].value
account_res.value = $(".result_selection")[0].value
filter_data_selected.result_selection = $(".result_selection")[1].value
account_res.value = $(".result_selection")[1].value
account_res.innerHTML=account_res.value;
if ($(".result_selection")[0].value == "") {
if ($(".result_selection")[1].value == "") {
account_res.innerHTML="customer";
}

58
dynamic_accounts_report/static/src/js/cash_flow.js

@ -51,13 +51,44 @@ odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
var offset = 0;
var td = $(event.currentTarget).next('tr').find('td');
if (td.length == 1) {
rpc.query({
self._rpc({
model: 'account.cash.flow',
method: 'view_report',
args: [
[self.wizard_id]
],
}).then(function(datas) {
_.each(datas['journal_res'], function(journal_lines) {
_.each(journal_lines['journal_lines'], function(rep_lines) {
rep_lines.total_debit = self.format_currency(datas['currency'],rep_lines.total_debit);
rep_lines.total_credit = self.format_currency(datas['currency'],rep_lines.total_credit);
rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
});
});
_.each(datas['account_res'], function(journal_lines) {
_.each(journal_lines['journal_lines'], function(rep_lines) {
rep_lines.total_debit = self.format_currency(datas['currency'],rep_lines.total_debit);
rep_lines.total_credit = self.format_currency(datas['currency'],rep_lines.total_credit);
rep_lines.total_balance = self.format_currency(datas['currency'],rep_lines.total_balance);
});
_.each(journal_lines['move_lines'], function(move_lines) {
move_lines.total_debit = self.format_currency(datas['currency'],move_lines.total_debit);
move_lines.total_credit = self.format_currency(datas['currency'],move_lines.total_credit);
move_lines.balance = self.format_currency(datas['currency'],move_lines.balance);
});
});
if(datas['levels']== 'detailed'){
$(event.currentTarget).next('tr').find('td ul').after(
@ -95,11 +126,22 @@ odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
self.$(".categ").empty();
try{
var self = this;
rpc.query({
self._rpc({
model: 'account.cash.flow',
method: 'view_report',
args: [[this.wizard_id]],
}).then(function(datas) {
_.each(datas['fetched_data'], function(rep_lines) {
rep_lines.total_debit = self.format_currency(datas['currency'],rep_lines.total_debit);
rep_lines.total_credit = self.format_currency(datas['currency'],rep_lines.total_credit);
rep_lines.total_balance = self.format_currency(datas['currency'],rep_lines.total_balance);
});
if (initial_render) {
self.$('.filter_view_tb').html(QWeb.render('CashFilterView', {
filter_data: datas['filters'],
@ -125,6 +167,16 @@ odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
}
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
show_gl: function(e) {
var self = this;
var account_id = $(e.target).attr('data-account-id');
@ -255,7 +307,7 @@ odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
post_res.value = $(".target_move")[0].value
post_res.innerHTML=post_res.value;
if ($(".target_move")[0].value == "") {
post_res.innerHTML="all";
post_res.innerHTML="posted";
}
}

31
dynamic_accounts_report/static/src/js/daybook.js

@ -56,6 +56,12 @@ odoo.define('dynamic_partner_daybook.daybook', function (require) {
method: 'view_report',
args: [[this.wizard_id]],
}).then(function(datas) {
_.each(datas['report_lines'], function(rep_lines) {
rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
});
if (initial_render) {
@ -88,6 +94,17 @@ odoo.define('dynamic_partner_daybook.daybook', function (require) {
}
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
print_pdf: function(e) {
e.preventDefault();
@ -196,6 +213,16 @@ odoo.define('dynamic_partner_daybook.daybook', function (require) {
[self.wizard_id]
],
}).then(function(data) {
_.each(data['report_lines'], function(rep_lines) {
_.each(rep_lines['child_lines'], function(move_line) {
move_line.debit = self.format_currency(data['currency'],move_line.debit);
move_line.credit = self.format_currency(data['currency'],move_line.credit);
move_line.balance = self.format_currency(data['currency'],move_line.balance);
});
});
for (var i = 0; i < data['report_lines'].length; i++) {
if (account_id == data['report_lines'][i]['id'] ){
@ -204,6 +231,8 @@ odoo.define('dynamic_partner_daybook.daybook', function (require) {
QWeb.render('SubSectiondb', {
account_data: data['report_lines'][i]['child_lines'],
currency_symbol : data.currency[0],
currency_position : data.currency[1],
}))
$(event.currentTarget).next('tr').find('td ul li:first a').css({
@ -332,7 +361,7 @@ odoo.define('dynamic_partner_daybook.daybook', function (require) {
post_res.value = $(".target_move")[0].value
post_res.innerHTML=post_res.value;
if ($(".target_move")[0].value == "") {
post_res.innerHTML="all";
post_res.innerHTML="posted";
}
}

17
dynamic_accounts_report/static/src/js/financial_reports.js

@ -47,11 +47,12 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
self.$(".categ").empty();
try{
var self = this;
rpc.query({
self._rpc({
model: 'dynamic.balance.sheet.report',
method: 'view_report',
args: [[this.wizard_id], action_title],
}).then(function(datas) {
if (initial_render) {
self.$('.filter_view_dfr').html(QWeb.render('DfrFilterView', {
filter_data: datas['filters'],
@ -92,6 +93,16 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
}
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
show_gl: function(e) {
var self = this;
var account_id = $(e.target).attr('data-account-id');
@ -311,7 +322,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
filter_data_selected.date_from = dateString;
}
if ($("#date_to").val()) {
var dateString = $("#date_from").val();
var dateString = $("#date_to").val();
filter_data_selected.date_to = dateString;
}
@ -321,7 +332,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
post_res.value = $(".target_move")[0].value
post_res.innerHTML=post_res.value;
if ($(".target_move")[0].value == "") {
post_res.innerHTML="all";
post_res.innerHTML="posted";
}
}

37
dynamic_accounts_report/static/src/js/general_ledger.js

@ -67,11 +67,20 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
try{
var self = this;
var action_title = self._title
rpc.query({
self._rpc({
model: 'account.general.ledger',
method: 'view_report',
args: [[this.wizard_id], action_title],
}).then(function(datas) {
_.each(datas['report_lines'], function(rep_lines) {
rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
});
if (initial_render) {
self.$('.filter_view_tb').html(QWeb.render('GLFilterView', {
@ -207,6 +216,15 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
});
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
show_drop_down: function(event) {
event.preventDefault();
@ -223,6 +241,16 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
[self.wizard_id], action_title
],
}).then(function(data) {
_.each(data['report_lines'], function(rep_lines) {
_.each(rep_lines['move_lines'], function(move_line) {
move_line.debit = self.format_currency(data['currency'],move_line.debit);
move_line.credit = self.format_currency(data['currency'],move_line.credit);
move_line.balance = self.format_currency(data['currency'],move_line.balance);
});
});
for (var i = 0; i < data['report_lines'].length; i++) {
@ -232,6 +260,9 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
$(event.currentTarget).next('tr').find('td ul').after(
QWeb.render('SubSection', {
account_data: data['report_lines'][i]['move_lines'],
currency_symbol : data.currency[0],
currency_position : data.currency[1],
}))
$(event.currentTarget).next('tr').find('td ul li:first a').css({
'background-color': '#00ede8',
@ -389,7 +420,7 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
filter_data_selected.date_from = dateString;
}
if ($("#date_to").val()) {
var dateString = $("#date_from").val();
var dateString = $("#date_to").val();
filter_data_selected.date_to = dateString;
}
@ -399,7 +430,7 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
post_res.value = $(".target_move")[0].value
post_res.innerHTML=post_res.value;
if ($(".target_move")[0].value == "") {
post_res.innerHTML="all";
post_res.innerHTML="posted";
}
}

38
dynamic_accounts_report/static/src/js/partner_ledger.js

@ -49,11 +49,23 @@ odoo.define('dynamic_accounts_report.partner_ledger', function (require) {
self.$(".categ").empty();
try{
var self = this;
rpc.query({
self._rpc({
model: 'account.partner.ledger',
method: 'view_report',
args: [[this.wizard_id]],
}).then(function(datas) {
_.each(datas['report_lines'], function(rep_lines) {
rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
});
if (initial_render) {
self.$('.filter_view_tb').html(QWeb.render('PLFilterView', {
filter_data: datas['filters'],
@ -99,6 +111,18 @@ odoo.define('dynamic_accounts_report.partner_ledger', function (require) {
}
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
print_pdf: function(e) {
e.preventDefault();
var self = this;
@ -185,6 +209,16 @@ odoo.define('dynamic_accounts_report.partner_ledger', function (require) {
[self.wizard_id]
],
}).then(function(data) {
_.each(data['report_lines'], function(rep_lines) {
_.each(rep_lines['move_lines'], function(move_line) {
move_line.debit = self.format_currency(data['currency'],move_line.debit);
move_line.credit = self.format_currency(data['currency'],move_line.credit);
move_line.balance = self.format_currency(data['currency'],move_line.balance);
});
});
for (var i = 0; i < data['report_lines'].length; i++) {
if (account_id == data['report_lines'][i]['id'] ){
@ -357,7 +391,7 @@ odoo.define('dynamic_accounts_report.partner_ledger', function (require) {
if ($(".reconciled").length){
var reconciled_res = document.getElementById("reconciled_res")
filter_data_selected.reconciled = $(".reconciled")[1].value
filter_data_selected.reconciled = $(".reconciled")[0].value
reconciled_res.value = $(".reconciled")[0].value
reconciled_res.innerHTML=reconciled_res.value;
if ($(".reconciled").value==""){

27
dynamic_accounts_report/static/src/js/trial_balance.js

@ -50,11 +50,19 @@ odoo.define('dynamic_cash_flow_statements.trial', function (require) {
self.$(".categ").empty();
try{
var self = this;
rpc.query({
self._rpc({
model: 'account.trial.balance',
method: 'view_report',
args: [[this.wizard_id]],
}).then(function(datas) {
_.each(datas['report_lines'], function(rep_lines) {
rep_lines.debit = self.format_currency(datas['currency'],rep_lines.debit);
rep_lines.credit = self.format_currency(datas['currency'],rep_lines.credit);
rep_lines.balance = self.format_currency(datas['currency'],rep_lines.balance);
});
if (initial_render) {
self.$('.filter_view_tb').html(QWeb.render('TrialFilterView', {
filter_data: datas['filters'],
@ -70,8 +78,8 @@ odoo.define('dynamic_cash_flow_statements.trial', function (require) {
report_lines : datas['report_lines'],
filter : datas['filters'],
currency : datas['currency'],
credit_total : datas['credit_total'],
debit_total : datas['debit_total'],
credit_total : self.format_currency(datas['currency'],datas['debit_total']),
debit_total : self.format_currency(datas['currency'],datas['debit_total']),
}));
});
@ -131,6 +139,17 @@ odoo.define('dynamic_cash_flow_statements.trial', function (require) {
});
},
format_currency: function(currency, amount) {
if (typeof(amount) != 'number') {
amount = parseFloat(amount);
}
var formatted_value = (parseInt(amount)).toLocaleString(currency[2],{
minimumFractionDigits: 2
})
return formatted_value
},
print_xlsx: function() {
var self = this;
self._rpc({
@ -219,7 +238,7 @@ odoo.define('dynamic_cash_flow_statements.trial', function (require) {
post_res.value = $(".target_move")[0].value
post_res.innerHTML=post_res.value;
if ($(".target_move")[0].value == "") {
post_res.innerHTML="all";
post_res.innerHTML="posted";
}
}

213
dynamic_accounts_report/static/src/xml/ageing.xml

@ -1,10 +1,9 @@
<templates>
<t t-name="AgeingTemp">
<div class="">
<div class="">
<h1>
PARTNER AGEING
<h1 style="padding:10px">
Partner Ageing
</h1>
</div>
@ -26,23 +25,20 @@
<tr>
<th colspan="6">Partner</th>
<th class="mon_fld">Not Due</th>
<th class="mon_fld">0-20</th>
<th class="mon_fld">20-40</th>
<th class="mon_fld">40-60</th>
<th class="mon_fld">60-80</th>
<th class="mon_fld">80+</th>
<th class="mon_fld">0-30</th>
<th class="mon_fld">30-60</th>
<th class="mon_fld">60-90</th>
<th class="mon_fld">90-120</th>
<th class="mon_fld">120+</th>
<th class="mon_fld">Total</th>
</tr>
</thead>
<tbody style="width:100%;">
</tbody>
<tbody>
<t t-set="none_value" t-value="_"/>
<t t-foreach="report_lines[0]" t-as="account">
<t t-set="common_id" t-value="0"/>
<tr style="border: 1.5px solid black;" class="gl-line"
@ -58,61 +54,151 @@
</span>
<t t-if="currency[1] == 'before'">
<td style="text-align:right;">
<t t-if="account['direction'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['direction']"/>
<t t-esc="account['direction']"/>
<!-- <t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td style="text-align:right;">
<t t-if="account['4'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['4']"/>
<t t-esc="account['4']"/>
<!-- <t t-esc="Math.round(account['4'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td style="text-align:right;">
<t t-if="account['3'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['3']"/>
<t t-esc="account['3']"/>
<!-- <t t-esc="Math.round(account['3'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td style="text-align:right;">
<t t-if="account['2'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['2']"/>
<t t-esc="account['2']"/>
<!-- <t t-esc="Math.round(account['2'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td style="text-align:right;">
<t t-if="account['1'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['1']"/>
<t t-esc="account['1']"/>
<!-- <t t-esc="Math.round(account['1'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td style="text-align:right;">
<t t-if="account['0'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['0']"/>
<t t-esc="account['0']"/>
<!-- <t t-esc="Math.round(account['0'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td style="text-align:right;">
<t t-if="account['total'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="account['total']"/>
<t t-esc="account['total']"/>
<!-- <t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
</t>
<t t-else="">
<td style="text-align:right;">
<t t-raw="account['direction']"/><t t-esc="currency[0]"/>
<t t-if="account['direction'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['direction']"/>
<!-- <t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
<td style="text-align:right;">
<t t-raw="account['4']"/><t t-esc="currency[0]"/>
<t t-if="account['4'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['4']"/>
<!-- <t t-esc="Math.round(account['4'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
<td style="text-align:right;">
<t t-raw="account['3']"/><t t-esc="currency[0]"/>
<t t-if="account['3'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['3']"/>
<!-- <t t-esc="Math.round(account['3'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
<td style="text-align:right;">
<t t-raw="account['2']"/><t t-esc="currency[0]"/>
<t t-if="account['2'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['2']"/>
<!-- <t t-esc="Math.round(account['2'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
<td style="text-align:right;">
<t t-raw="account['1']"/><t t-esc="currency[0]"/>
<t t-if="account['1'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['1']"/>
<!-- <t t-esc="Math.round(account['1'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
<td style="text-align:right;">
<t t-raw="account['0']"/><t t-esc="currency[0]"/>
<t t-if="account['0'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['0']"/>
<!-- <t t-esc="Math.round(account['0'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
<td style="text-align:right;">
<t t-raw="account['total']"/><t t-esc="currency[0]"/>
<t t-if="account['total'] == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account['total']"/>
<!-- <t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
</t>
<!--
< </div>-->
</td>
<tr t-attf-class="collapse a{{account['partner_id']}}">
<td colspan="14">
@ -132,14 +218,18 @@
</t>
<t t-name="AgeingFilterView">
<div class="" style="position: relative;">
<div class="sub_container_left">
<div class="report_print">
<button type="button" class="btn btn-primary" id="pdf" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Print (PDF)</button>
<button type="button" class="btn btn-primary" id="xlsx" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Export (XLSX)</button>
<button type="button" class="btn btn-primary" id="pdf"
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Print (PDF)
</button>
<button type="button" class="btn btn-primary" id="xlsx"
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Export (XLSX)
</button>
</div>
</div>
<br></br>
@ -147,7 +237,7 @@
<div class="" style="right:80x;">
<br></br>
<div class="row" style="right:80px;top:0px;position: absolute;width:50;">
<div class="row" style="right:100px;top:0px;position: absolute;width:50;">
<div class="time_range" style="">
<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="fa fa-calendar" title="Dates" role="img" aria-label="Dates"></span>
@ -171,9 +261,9 @@ Account Type:
</a>
<select id="selection" class="dropdown-menu result_selection" name="states[]">
<div role="separator" class="dropdown-divider"></div>
<option value="customer_supplier">Receivable and Payable Accounts</option>
<option value="customer">Receivable Accounts</option>
<option value="supplier">Payable Accounts</option>
<option value="customer_supplier">Receivable and Payable Accounts</option>
</select>
<span id="account_res"></span>
</div>
@ -218,8 +308,8 @@ Target Move:
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]">
<div role="separator" class="dropdown-divider"></div>
<option value="posted">Posted Entries</option>
<option value="all">All Entries </option>
<option value="Posted">Posted Entries</option>
<option value="All">All Entries</option>
</select>
<span id="post_res"></span>
@ -228,7 +318,10 @@ Target Move:
</div>
<div style="">
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button>
<button type="button" id="apply_filter" class="btn btn-primary"
style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
Apply
</button>
</div>
</div>
@ -246,11 +339,11 @@ Target Move:
<th>JRNL</th>
<th>Account</th>
<th>Not Due</th>
<th >0-20</th>
<th >21-40</th>
<th >41-60</th>
<th >61-80</th>
<th >80+</th>
<th>0-30</th>
<th>30-60</th>
<th>60-90</th>
<th>90-120</th>
<th>120+</th>
</tr>
</thead>
@ -301,7 +394,8 @@ Target Move:
</t>
<t t-else="">
<t t-esc="account_line.symbol"/>
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</t>
@ -316,7 +410,8 @@ Target Move:
</t>
<t t-else="">
<t t-esc="account_line.symbol"/>
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</t>
@ -331,7 +426,8 @@ Target Move:
</t>
<t t-else="">
<t t-esc="account_line.symbol"/>
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
@ -347,7 +443,8 @@ Target Move:
</t>
<t t-else="">
<t t-esc="account_line.symbol"/>
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
@ -363,7 +460,8 @@ Target Move:
</t>
<t t-else="">
<t t-esc="account_line.symbol"/>
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</t>
@ -378,7 +476,8 @@ Target Move:
</t>
<t t-else="">
<t t-esc="account_line.symbol"/>
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</t>
<t t-else="">
@ -393,7 +492,8 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.symbol"/>
</t>
</t>
@ -405,7 +505,8 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.symbol"/>
</t>
</t>
@ -417,7 +518,8 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.symbol"/>
</t>
</t>
@ -429,7 +531,8 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.symbol"/>
</t>
</t>
@ -441,7 +544,8 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.symbol"/>
</t>
</t>
@ -453,7 +557,8 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.amount"/>
<!-- <t t-esc="Math.round(account_line.amount * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="account_line.symbol"/>
</t>
</t>

14
dynamic_accounts_report/static/src/xml/cash_flow_view.xml

@ -3,8 +3,8 @@
<t t-name="CFTemp">
<div class="">
<div class="">
<h1>
CASH FLOW STATEMENTS
<h1 style="padding:10px">
Cash Flow Statement
</h1>
</div>
@ -142,8 +142,8 @@
<div class="" style="position: relative;">
<div class="sub_container_left">
<div class="report_print">
<button type="button" class="btn btn-primary" id="pdf" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Print (PDF)</button>
<button type="button" class="btn btn-primary" id="xlsx" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Export (XLSX)</button>
<button type="button" class="btn btn-primary" id="pdf" style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">Print (PDF)</button>
<button type="button" class="btn btn-primary" id="xlsx" style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">Export (XLSX)</button>
</div>
</div>
<br></br>
@ -183,8 +183,8 @@ Target Move:
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]" >
<div role="separator" class="dropdown-divider"></div>
<option value="all">All Entries </option>
<option value="posted">Posted Entries</option>
<option value="Posted">Posted Entries</option>
<option value="All">All Entries </option>
</select>
<span id="post_res"></span>
</div>
@ -208,7 +208,7 @@ Level:
</div>
<div style="">
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button>
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button>
</div>
</div>

107
dynamic_accounts_report/static/src/xml/daybook.xml

@ -1,9 +1,8 @@
<templates>
<t t-name="DaybookTemp">
<div class="">
<div class="">
<h1>
<h1 style="padding:10px">
Day Book
</h1>
@ -40,22 +39,62 @@
data-toggle="collapse"
t-att-data-account-id="account['id']"
t-attf-data-target=".a{{account['id']}}">
<t t-if="currency[1] == 'before'">
<td colspan="6" style="border: 0px solid black;">
<i class="fa fa-caret-down" role="img" aria-label="Unfolded"
title="Unfolded"></i>
<span>
<t t-esc="account['date']"/>
</span>
<td class="mon_fld">
<t t-esc="currency[0]"/>
<t t-raw="account['debit']"/>
</td>
<td class="mon_fld">
<t t-esc="currency[0]"/>
<t t-raw="account['credit']"/>
</td>
<td class="mon_fld">
<t t-esc="currency[0]"/>
<t t-raw="account['balance']"/>
</td>
<t t-set="common_id" t-value="'a'+account['id']"/>
</td>
</t>
<t t-else="">
<td colspan="6" style="border: 0px solid black;">
<i class="fa fa-caret-down" role="img" aria-label="Unfolded" title="Unfolded"></i>
<i class="fa fa-caret-down" role="img" aria-label="Unfolded"
title="Unfolded"></i>
<span>
<t t-esc="account['date']"/>
</span>
<td class="mon_fld">
<t t-raw="account['debit']"/><t t-esc="currency[0]"/>
<t t-raw="account['debit']"/>
<t t-esc="currency[0]"/>
</td>
<td class="mon_fld">
<t t-raw="account['credit']"/><t t-esc="currency[0]"/>
<t t-raw="account['credit']"/>
<t t-esc="currency[0]"/>
</td>
<td class="mon_fld">
<t t-raw="account['balance']"/><t t-esc="currency[0]"/>
<t t-raw="account['balance']"/>
<t t-esc="currency[0]"/>
</td>
<t t-set="common_id" t-value="'a'+account['id']"/>
</td>
</t>
<tr t-attf-class="collapse a{{account['id']}}">
<td colspan="10">
<ul>
@ -71,14 +110,18 @@
</t>
<t t-name="DayFilterView">
<div class="" style="position: relative;">
<div class="sub_container_left">
<div class="report_print">
<button type="button" class="btn btn-primary" id="pdf" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Print (PDF)</button>
<button type="button" class="btn btn-primary" id="xlsx" style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">Export (XLSX)</button>
<button type="button" class="btn btn-primary" id="pdf"
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Print (PDF)
</button>
<button type="button" class="btn btn-primary" id="xlsx"
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Export (XLSX)
</button>
</div>
</div>
<br></br>
@ -118,7 +161,8 @@ Journals:
<select class="dropdown-menu journals" name="states[]" multiple="multiple">
<div role="separator" class="dropdown-divider"></div>
<t t-foreach="filter_data.journals_list" t-as="journal">
<option t-attf-value="{{journal[0]}}"><t t-esc="journal[1]"/>
<option t-attf-value="{{journal[0]}}">
<t t-esc="journal[1]"/>
</option>
</t>
</select>
@ -147,8 +191,8 @@ Target Move:
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]">
<div role="separator" class="dropdown-divider"></div>
<option value="all">All Entries </option>
<option value="posted">Posted Entries</option>
<option value="Posted">Posted Entries</option>
<option value="All">All Entries</option>
</select>
<span id="post_res"></span>
</div>
@ -156,7 +200,10 @@ Target Move:
</div>
<div style="">
<button type="button" id="apply_filter" class="btn btn-primary" style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">Apply</button>
<button type="button" id="apply_filter" class="btn btn-primary"
style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
Apply
</button>
</div>
</div>
@ -219,14 +266,15 @@ Target Move:
<td t-att-style="style">
<t t-esc="account_line.lname"/>
</td>
<t t-if="account_line.currency_position == 'before'">
<t t-if="currency_position == 'before'">
<td t-att-style="style" class="text-right">
<t t-if="account_line.debit == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
</td>
<td t-att-style="style" class="text-right">
@ -234,8 +282,9 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
</td>
<td t-att-style="style" class="text-right">
@ -243,8 +292,9 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="currency_symbol"/>
<t t-esc="account_line.balance"/>
<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
</t>
@ -254,8 +304,9 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<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.debit"/>
<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency_symbol"/>
</t>
</td>
<td t-att-style="style" class="amt">
@ -263,8 +314,9 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<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.credit"/>
<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency_symbol"/>
</t>
</td>
<td t-att-style="style" class="amt">
@ -272,8 +324,9 @@ Target Move:
<span>-</span>
</t>
<t t-else="">
<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.balance"/>
<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency_symbol"/>
</t>
</td>

7
dynamic_accounts_report/static/src/xml/financial_reports_view.xml

@ -52,7 +52,7 @@
<div class="form-group ">
<div class="show-gl" aria-atomic="true" id="" data-target-input="">
<li role="presentation">
<a role="menuitem" style="background-color:grey;" t-att-data-account-id="account['id']" class="show-gl" >View General Ledger</a>
<a role="menuitem" style="background-color:aqua; font-weight:bold;" t-att-data-account-id="account['id']" class="show-gl" >View General Ledger</a>
</li>
</div>
</div>
@ -243,8 +243,9 @@ Target Move:
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]" >
<div role="separator" class="dropdown-divider"></div>
<option value="posted">Posted Entries</option>
<option value="all">All Entries </option>
<option value="Posted">Posted Entries</option>
<option value="All">All Entries</option>
</select>
<span id="post_res"></span>
</div>

63
dynamic_accounts_report/static/src/xml/general_ledger_view.xml

@ -46,7 +46,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['debit']"/>
<!-- <t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td class="mon_fld">
@ -55,7 +56,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['credit']"/>
<!-- <t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td class="mon_fld">
@ -64,7 +66,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['balance']"/>
<!-- <t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
@ -75,7 +78,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['debit']"/>
<!-- <t t-raw="Math.round(account['debit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
@ -84,7 +88,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['credit']"/>
<!-- <t t-raw="Math.round(account['credit'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
@ -93,7 +98,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['balance']"/>
<!-- <t t-raw="Math.round(account['balance'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="currency[0]"/>
</t>
</td>
@ -123,7 +129,7 @@
<t t-name="GLFilterView">
<div>
<h1>
<h1 style="padding:10px">
<t t-esc="title"/>
</h1>
@ -132,11 +138,11 @@
<div class="sub_container_left">
<div class="report_print">
<button type="button" class="btn btn-primary" id="pdf"
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Print (PDF)
</button>
<button type="button" class="btn btn-primary" id="xlsx"
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Export (XLSX)
</button>
</div>
@ -238,8 +244,8 @@
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]">
<div role="separator" class="dropdown-divider"></div>
<option value="all">All Entries</option>
<option value="posted">Posted Entries</option>
<option value="Posted">Posted Entries</option>
<option value="All">All Entries</option>
</select>
<span id="post_res"></span>
</div>
@ -248,7 +254,7 @@
</div>
<div style="">
<button type="button" id="apply_filter" class="btn btn-primary"
style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
Apply
</button>
@ -277,6 +283,7 @@
<tbody>
<t t-foreach="account_data" t-as="account_line">
<t t-set="style" t-value="''"/>
<t t-set="style_right" t-value="'text-align:right;'"/>
<tr>
<td>
<t t-if="account_line.ldate">
@ -311,60 +318,66 @@
<td t-att-style="style">
<t t-esc="account_line.lname"/>
</td>
<t t-if="account_line.currency_position == 'before'">
<td t-att-style="style" class="amt">
<t t-if="currency_position == 'before'">
<td t-att-style="style_right" class="amt">
<t t-if="account_line.debit == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.debit"/>
<!-- <t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td t-att-style="style" class="amt">
<td t-att-style="style_right" class="amt">
<t t-if="account_line.credit == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.credit"/>
<!-- <t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
<td t-att-style="style" class="amt">
<td t-att-style="style_right" class="amt">
<t t-if="account_line.balance == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="account_line.currency_code"/>
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account_line.balance"/>
<!-- <t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
</t>
<t t-else="">
<td t-att-style="style" class="amt">
<td t-att-style="style_right" class="amt">
<t t-if="account_line.debit == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.debit * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
</td>
<td t-att-style="style" class="amt">
<td t-att-style="style_right" class="amt">
<t t-if="account_line.credit == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.credit * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
</td>
<td t-att-style="style" class="amt">
<td t-att-style="style_right" class="amt">
<t t-if="account_line.balance == 0">
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account_line.balance * Math.pow(10, 2)) / Math.pow(10, 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>
</td>

29
dynamic_accounts_report/static/src/xml/partner_ledger_view.xml

@ -2,7 +2,7 @@
<t t-name="PartnerTemp">
<div class="">
<div class="">
<h1>
<h1 style="padding:10px">
Partner Ledger
</h1>
</div>
@ -95,11 +95,11 @@
<div class="sub_container_left">
<div class="report_print">
<button type="button" class="btn btn-primary" id="pdf"
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Print (PDF)
</button>
<button type="button" class="btn btn-primary" id="xlsx"
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Export (XLSX)
</button>
</div>
@ -147,17 +147,7 @@
<span id="partner_res"></span>
</div>
<div class="reconciliation_sts_filter">
<a type="button" class="dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-book"></span>
Reconciliation Status:
</a>
<select class="dropdown-menu reconciled" name="states[]" multiple="multiple">
<option value="unreconciled">Unreconciled</option>
</select>
<span id="reconciled_res"></span>
</div>
<div class="acccount_type_filter">
<a type="button" class="dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-book"></span>
@ -229,8 +219,8 @@
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]">
<div role="separator" class="dropdown-divider"></div>
<option value="posted">Posted Entries</option>
<option value="all">All Entries</option>
<option value="Posted">Posted Entries</option>
<option value="All">All Entries</option>
</select>
<span id="post_res"></span>
</div>
@ -239,7 +229,7 @@
</div>
<div style="">
<button type="button" id="apply_filter" class="btn btn-primary"
style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
Apply
</button>
@ -267,7 +257,8 @@
<tbody>
<t t-foreach="account_data" t-as="account_line">
<t t-set="style" t-value="''"/>
<t t-set="style" t-value="'text-align:right;'"/>
<t t-set="styleleft" t-value="'text-align:left;'"/>
<tr>
<td>
<t t-if="account_line.ldate">
@ -299,10 +290,10 @@
<t t-esc="account_line.account_name"/>
</span>
</td>
<td t-att-style="style">
<td t-att-style="styleleft">
<t t-esc="account_line.move_name"/>
</td>
<td t-att-style="style">
<td t-att-style="styleleft">
<t t-esc="account_line.lname"/>
</td>
<t t-if="account_line.currency_position == 'before'">

20
dynamic_accounts_report/static/src/xml/trial_balance_view.xml

@ -2,8 +2,8 @@
<t t-name="TrialTemp">
<div class="">
<div class="">
<h1>
TRIAL BALANCE
<h1 style="padding:10px">
Trial Balance
</h1>
</div>
@ -58,7 +58,7 @@
<div class="form-group ">
<div class="show-gl" aria-atomic="true" id="" data-target-input="">
<li role="presentation">
<a role="menuitem" style="background-color:grey;"
<a role="menuitem" style="background-color:aqua; font-weight:bold;"
t-att-data-account-id="account['id']" class="show-gl">
View General Ledger
</a>
@ -159,13 +159,15 @@
<td class="mon_fld" style="">
<strong>
<t t-esc="currency[0]"/>
<t t-raw="Math.round(debit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<!-- <t t-raw="Math.round(debit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="debit_total"/>
</strong>
</td>
<td class="mon_fld" style="">
<strong>
<t t-esc="currency[0]"/>
<t t-raw="Math.round(credit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<!-- <t t-raw="Math.round(credit_total * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
<t t-esc="credit_total"/>
</strong>
</td>
</t>
@ -199,11 +201,11 @@
<div class="sub_container_left">
<div class="report_print">
<button type="button" class="btn btn-primary" id="pdf"
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Print (PDF)
</button>
<button type="button" class="btn btn-primary" id="xlsx"
style="height:25px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="left:10px; height:30px;position: relative;color:white;background-color: #00A0AD;border-color: #00A0AD; padding:3px;">
Export (XLSX)
</button>
</div>
@ -259,8 +261,8 @@
</a>
<select id="entries" class="dropdown-menu target_move" name="states[]">
<div role="separator" class="dropdown-divider"></div>
<option value="all">All Entries</option>
<option value="posted">Posted Entries</option>
<option value="all">All Entries</option>
</select>
<span id="post_res"></span>
</div>
@ -269,7 +271,7 @@
</div>
<div style="">
<button type="button" id="apply_filter" class="btn btn-primary"
style="top:0px;height:25px;right:0px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
style="top:0px;height:30px;right:20px;position: absolute;color:white;background-color: #00A0AD;border-color: #00A0AD;">
Apply
</button>

10
dynamic_accounts_report/views/views.xml

@ -37,21 +37,21 @@
<field name="tag">d_b</field>
</record>
<menuitem id="menu_report_daybook" action="action_day_book"
name="Day Book" parent="dynamic_report_accounting"/>
name="Day Book" sequence="4" parent="dynamic_report_accounting"/>
<record id="action_bank_book" model="ir.actions.client">
<field name="name">Bank Book</field>
<field name="tag">g_l</field>
</record>
<menuitem id="menu_bank_book" action="action_bank_book"
name="Bank Book" parent="dynamic_report_accounting"/>
name="Bank Book" sequence="3" parent="dynamic_report_accounting"/>
<record id="action_cash_book" model="ir.actions.client">
<field name="name">Cash Book</field>
<field name="tag">g_l</field>
</record>
<menuitem id="menu_cash_book" action="action_cash_book"
name="Cash Book" parent="dynamic_report_accounting"/>
name="Cash Book" sequence="2" parent="dynamic_report_accounting"/>
<record id="action_dynamic_balance_sheet" model="ir.actions.client">
<field name="name">Balance Sheet</field>
@ -64,10 +64,10 @@
</record>
<menuitem id="menu_balance_sheet_report" action="action_dynamic_balance_sheet"
name="Balance Sheet" parent="dynamic_report_accounting"/>
name="Balance Sheet" sequence="1" parent="dynamic_report_accounting"/>
<menuitem id="menu_profit_and_loss_report" action="action_dynamic_profit_and_loss"
name="Profit and Loss" parent="dynamic_report_accounting"/>
name="Profit and Loss" sequence="0" parent="dynamic_report_accounting"/>
<record id="action_cash_flow" model="ir.actions.client">
<field name="name">Cash Flow Statements</field>

42
dynamic_accounts_report/wizard/ageing.py

@ -19,7 +19,7 @@ class AgeingView(models.TransientModel):
_name = 'account.partner.ageing'
period_length = fields.Integer(string='Period Length (days)',
required=True, default=20)
required=True, default=30)
date_from = fields.Date(default=lambda *a: time.strftime('%Y-%m-%d'))
result_selection = fields.Selection([('customer', 'Receivable Accounts'),
('supplier', 'Payable Accounts'),
@ -101,6 +101,7 @@ class AgeingView(models.TransientModel):
filters['partners_list'] = data.get('partners_list')
filters['category_list'] = data.get('category_list')
filters['company_name'] = data.get('company_name')
filters['target_move'] = data.get('target_move').capitalize()
return filters
@ -108,7 +109,7 @@ class AgeingView(models.TransientModel):
def get_filter_data(self, option):
r = self.env['account.partner.ageing'].search([('id', '=', option[0])])
default_filters = {}
company_id = r.env.user.company_id
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
partner = r.partner_ids if r.partner_ids else self.env[
'res.partner'].search([])
@ -160,11 +161,13 @@ class AgeingView(models.TransientModel):
@api.model
def create(self, vals):
vals['target_move'] = 'all'
vals['target_move'] = 'posted'
res = super(AgeingView, self).create(vals)
return res
def write(self, vals):
if vals.get('target_move'):
vals.update({'target_move': vals.get('target_move').lower()})
if vals.get('partner_ids'):
vals.update(
@ -530,8 +533,6 @@ class AgeingView(models.TransientModel):
partner['partner_id']]):
res.append(values)
return res, total, lines
@api.model
@ -540,9 +541,12 @@ class AgeingView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol,
self.env.user.company_id.currency_id.position]
lang = self.env.user.lang
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data ):
@ -570,7 +574,7 @@ class AgeingView(models.TransientModel):
txt_v = workbook.add_format(
{'align': 'right', 'font_size': '10px', 'border': 1})
sheet.merge_range('A2:H3',
self.env.user.company_id.name + ':' + ' Partner Ageing',
filters.get('company_name') + ':' + ' Partner Ageing',
head)
date_head = workbook.add_format({'align': 'center', 'bold': True,
'font_size': '10px'})
@ -597,11 +601,11 @@ class AgeingView(models.TransientModel):
sheet.merge_range('A7:C7', 'Partner', heading)
sheet.write('D7', 'Total', heading)
sheet.write('E7', 'Not Due', heading)
sheet.write('F7', '0-20', heading)
sheet.write('G7', '20-40', heading)
sheet.write('H7', '40-60', heading)
sheet.write('I7', '60-80', heading)
sheet.write('J7', '80+', heading)
sheet.write('F7', '0-30', heading)
sheet.write('G7', '30-60', heading)
sheet.write('H7', '60-90', heading)
sheet.write('I7', '90-120', heading)
sheet.write('J7', '120+', heading)
lst = []
for rec in report_data_main[0]:
@ -635,11 +639,11 @@ class AgeingView(models.TransientModel):
sheet.write(row, col + 2, 'Journal', sub_heading)
sheet.write(row, col + 3, 'Account', sub_heading)
sheet.write(row, col + 4, 'Not Due', sub_heading)
sheet.write(row, col + 5, '0 - 20', sub_heading)
sheet.write(row, col + 6, '21 - 40', sub_heading)
sheet.write(row, col + 7, '41 - 60', sub_heading)
sheet.write(row, col + 8, '61 - 80', sub_heading)
sheet.write(row, col + 9, '81 - 100', sub_heading)
sheet.write(row, col + 5, '0 - 30', sub_heading)
sheet.write(row, col + 6, '30 - 60', sub_heading)
sheet.write(row, col + 7, '60 - 90', sub_heading)
sheet.write(row, col + 8, '90 - 120', sub_heading)
sheet.write(row, col + 9, '120 +', sub_heading)
for line_data in rec_data['child_lines']:
row += 1

119
dynamic_accounts_report/wizard/balance_sheet.py

@ -1,8 +1,9 @@
import time
from odoo import fields, models, api
from odoo import fields, models, api, _
import io
import json
from odoo.exceptions import AccessError, UserError, AccessDenied
try:
from odoo.tools.misc import xlsxwriter
@ -12,36 +13,33 @@ except ImportError:
class BalanceSheetView(models.TransientModel):
_name = 'dynamic.balance.sheet.report'
_inherit = "account.common.report"
company_id = fields.Many2one('res.company', required=True,
default=lambda self: self.env.company)
journal_ids = fields.Many2many('account.journal',
string='Journals', required=True,
default=[])
account_ids = fields.Many2many(
"account.account",
string="Accounts",
)
account_ids = fields.Many2many("account.account", string="Accounts")
account_tag_ids = fields.Many2many("account.account.tag",
string="Account Tags")
analytic_ids = fields.Many2many(
"account.analytic.account", string="Analytic Accounts"
)
"account.analytic.account", string="Analytic Accounts")
analytic_tag_ids = fields.Many2many("account.analytic.tag",
string="Analytic Tags")
display_account = fields.Selection(
[('all', 'All'), ('movement', 'With movements'),
('not_zero', 'With balance is not equal to 0')],
string='Display Accounts', required=True, default='movement')
target_move = fields.Selection(
[('all', 'All'), ('posted', 'Posted')],
string='Target Move', required=True, default='posted')
date_from = fields.Date(string="Start date")
date_to = fields.Date(string="End date")
@api.model
def view_report(self, option, tag):
r = self.env['dynamic.balance.sheet.report'].search([('id', '=', option[0])])
r = self.env['dynamic.balance.sheet.report'].search(
[('id', '=', option[0])])
data = {
'display_account': r.display_account,
'model': self,
@ -51,7 +49,6 @@ class BalanceSheetView(models.TransientModel):
'account_tags': r.account_tag_ids,
'analytics': r.analytic_ids,
'analytic_tags': r.analytic_tag_ids,
}
if r.date_from:
data.update({
@ -62,7 +59,7 @@ class BalanceSheetView(models.TransientModel):
'date_to': r.date_to,
})
company_id = self.env.user.company_id
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
if r.account_tag_ids:
company_domain.append(
@ -71,10 +68,7 @@ class BalanceSheetView(models.TransientModel):
company_domain.append(('id', 'in', r.account_ids.ids))
new_account_ids = self.env['account.account'].search(company_domain)
data.update({
'accounts': new_account_ids,
})
data.update({'accounts': new_account_ids,})
filters = self.get_filter(option)
records = self._get_report_values(data)
@ -101,7 +95,7 @@ class BalanceSheetView(models.TransientModel):
'view_format': 'vertical',
'company_id': self.company_id,
'used_context': {'journal_ids': False,
'state': filters['target_move'],
'state': filters['target_move'].lower(),
'date_from': filters['date_from'],
'date_to': filters['date_to'],
'strict_range': False,
@ -146,7 +140,6 @@ class BalanceSheetView(models.TransientModel):
rec['balance'] = move_lines_dict[rec['code']]['balance']
parent_list = list(set(parent_list))
max_level = 0
for rep in report_lines_move:
if rep['level'] > max_level:
@ -155,21 +148,18 @@ class BalanceSheetView(models.TransientModel):
def get_parents(obj):
for item in report_lines_move:
for each in obj:
if item['report_type'] != 'account_type' and each in item[
'c_ids']:
if item['report_type'] != 'account_type' and \
each in item['c_ids']:
obj.append(item['r_id'])
if item['report_type'] == 'account_report':
obj.append(item['r_id'])
break
get_parents(parent_list)
for i in range(max_level):
get_parents(parent_list)
parent_list = list(set(parent_list))
final_report_lines = []
for rec in report_lines_move:
@ -196,8 +186,8 @@ class BalanceSheetView(models.TransientModel):
def assign_sum(obj):
for each in obj:
if each['r_id'] in parent_list and each[
'report_type'] != 'account_report':
if each['r_id'] in parent_list and \
each['report_type'] != 'account_report':
each['debit'] = sum_list_new[each['r_id']]['s_debit']
each['credit'] = sum_list_new[each['r_id']]['s_credit']
@ -205,7 +195,7 @@ class BalanceSheetView(models.TransientModel):
sum_list_new = filter_sum(final_report_lines)
assign_sum(final_report_lines)
company_id = self.env.user.company_id
company_id = self.env.company
currency = company_id.currency_id
symbol = currency.symbol
rounding = currency.rounding
@ -216,15 +206,20 @@ class BalanceSheetView(models.TransientModel):
rec['credit'] = round(rec['credit'], 2)
rec['balance'] = rec['debit'] - rec['credit']
rec['balance'] = round(rec['balance'], 2)
if position == "before":
rec['m_debit'] = symbol + " " + str(rec['debit'])
rec['m_credit'] = symbol + " " + str(rec['credit'])
rec['m_balance'] = symbol + " " + str(rec['balance'])
if (rec['balance_cmp'] < 0 and rec['balance'] > 0) or (
rec['balance_cmp'] > 0 and rec['balance'] < 0):
rec['balance'] = rec['balance'] * -1
if position == "before":
rec['m_debit'] = symbol + " " + "{:,.2f}".format(rec['debit'])
rec['m_credit'] = symbol + " " + "{:,.2f}".format(rec['credit'])
rec['m_balance'] = symbol + " " + "{:,.2f}".format(
rec['balance'])
else:
rec['m_debit'] = str(rec['debit']) + " " + symbol
rec['m_credit'] = str(rec['credit']) + " " + symbol
rec['m_balance'] = str(rec['balance']) + " " + symbol
rec['m_debit'] = "{:,.2f}".format(rec['debit']) + " " + symbol
rec['m_credit'] = "{:,.2f}".format(rec['credit']) + " " + symbol
rec['m_balance'] = "{:,.2f}".format(
rec['balance']) + " " + symbol
return {
'name': tag,
@ -289,19 +284,17 @@ class BalanceSheetView(models.TransientModel):
filters['account_tag_list'] = data.get('account_tag_list')
filters['analytic_tag_list'] = data.get('analytic_tag_list')
filters['company_name'] = data.get('company_name')
filters['target_move'] = data.get('target_move').capitalize()
return filters
def get_filter_data(self, option):
r = self.env['dynamic.balance.sheet.report'].search([('id', '=', option[0])])
r = self.env['dynamic.balance.sheet.report'].search(
[('id', '=', option[0])])
default_filters = {}
company_id = r.env.user.company_id
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
journals = r.journal_ids if r.journal_ids else self.env[
'account.journal'].search(company_domain)
analytics = self.analytic_ids if self.analytic_ids else self.env[
'account.analytic.account'].search(
company_domain)
@ -320,12 +313,10 @@ class BalanceSheetView(models.TransientModel):
accounts = self.account_ids if self.account_ids else self.env[
'account.account'].search(company_domain)
filter_dict = {
'journal_ids': r.journal_ids.ids,
'account_ids': r.account_ids.ids,
'analytic_ids': r.analytic_ids.ids,
'company_id': company_id.id,
'date_from': r.date_from,
'date_to': r.date_to,
@ -349,6 +340,8 @@ class BalanceSheetView(models.TransientModel):
init_balance = True
journals = data['journals']
accounts = self.env['account.account'].search([])
if not accounts:
raise UserError(_("No Accounts Found! Please Add One"))
account_res = self._get_accounts(accounts, init_balance,
display_account, data)
debit_total = 0
@ -367,49 +360,39 @@ class BalanceSheetView(models.TransientModel):
@api.model
def create(self, vals):
vals['target_move'] = 'all'
vals['target_move'] = 'posted'
res = super(BalanceSheetView, self).create(vals)
return res
def write(self, vals):
if vals.get('target_move'):
vals.update({'target_move': vals.get('target_move').lower()})
if vals.get('journal_ids'):
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]})
if vals.get('journal_ids') == []:
if not vals.get('journal_ids'):
vals.update({'journal_ids': [(5,)]})
if vals.get('account_ids'):
vals.update(
{'account_ids': [(4, j) for j in vals.get('account_ids')]})
if vals.get('account_ids') == []:
if not vals.get('account_ids'):
vals.update({'account_ids': [(5,)]})
if vals.get('analytic_ids'):
vals.update(
{'analytic_ids': [(4, j) for j in vals.get('analytic_ids')]})
if vals.get('analytic_ids') == []:
if not vals.get('analytic_ids'):
vals.update({'analytic_ids': [(5,)]})
if vals.get('analytic_tags'):
vals.update(
{'analytic_tags': [(4, j) for j in vals.get('analytic_tags')]})
if vals.get('analytic_tags') == []:
vals.update({'analytic_tags': [(5,)]})
if vals.get('account_tags'):
vals.update(
{'account_tags': [(4, j) for j in vals.get('account_tags')]})
if vals.get('account_tags') == []:
vals.update({'account_tags': [(5,)]})
if vals.get('account_tag_ids'):
vals.update({'account_tag_ids': [(4, j) for j in
vals.get('account_tag_ids')]})
if vals.get('account_tag_ids') == []:
if not vals.get('account_tag_ids'):
vals.update({'account_tag_ids': [(5,)]})
if vals.get('analytic_tag_ids'):
vals.update({'analytic_tag_ids': [(4, j) for j in
vals.get('analytic_tag_ids')]})
if vals.get('analytic_tag_ids') == []:
if not vals.get('analytic_tag_ids'):
vals.update({'analytic_tag_ids': [(5,)]})
res = super(BalanceSheetView, self).write(vals)
@ -436,6 +419,7 @@ class BalanceSheetView(models.TransientModel):
new_final_filter += " AND m.state = 'posted'"
else:
new_final_filter += " AND m.state in ('draft','posted')"
if data.get('date_from'):
new_final_filter += " AND l.date >= '%s'" % data.get('date_from')
if data.get('date_to'):
@ -516,12 +500,11 @@ class BalanceSheetView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol,
self.env.user.company_id.currency_id.position]
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position]
return currency_array
def get_dynamic_xlsx_report(self, options, response, report_data, dfr_data):
i_data = str(report_data)
filters = json.loads(options)
j_data = dfr_data
@ -557,7 +540,7 @@ class BalanceSheetView(models.TransientModel):
txt = workbook.add_format({'font_size': '10px', 'border': 1})
sheet.merge_range('A2:D3',
self.env.user.company_id.name + ' : ' + i_data,
filters.get('company_name') + ' : ' + i_data,
head)
date_head = workbook.add_format({'align': 'center', 'bold': True,
'font_size': '10px'})

11
dynamic_accounts_report/wizard/balance_sheet_config.py

@ -6,10 +6,6 @@ class BalanceSheet(models.TransientModel):
_inherit = "dynamic.balance.sheet.report"
def view_report_pdf(self, acc, form):
"""This function will be executed when we click the view button
from the wizard. Based on the values provided in the wizard, this
function will print pdf report"""
data = dict()
report_lines = acc
data['form'] = form
@ -254,6 +250,7 @@ class BalanceSheet(models.TransientModel):
sub_lines.append(vals)
lines += sorted(sub_lines,
key=lambda sub_line: sub_line['name'])
return lines
def find_journal_items(self, report_lines, form):
@ -300,3 +297,9 @@ class BalanceSheet(models.TransientModel):
j['type'] = 'journal_item'
journal_items.append(j)
return journal_items

18
dynamic_accounts_report/wizard/cash_flow.py

@ -100,13 +100,14 @@ class AccountCasgFlow(models.TransientModel):
filters['accounts_list'] = data.get('accounts_list')
filters['journals_list'] = data.get('journals_list')
filters['company_name'] = data.get('company_name')
filters['target_move'] = data.get('target_move').capitalize()
return filters
def get_filter_data(self, option):
r = self.env['account.cash.flow'].search([('id', '=', option[0])])
default_filters = {}
company_id = r.env.user.company_id
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
journals = r.journal_ids if r.journal_ids else self.env['account.journal'].search(company_domain)
accounts = self.account_ids if self.account_ids else self.env['account.account'].search(company_domain)
@ -129,7 +130,7 @@ class AccountCasgFlow(models.TransientModel):
def _get_report_values(self, data, option):
cr = self.env.cr
data = self.get_filter(option)
company_id = self.env.user.company_id
company_id = self.env.company
currency = company_id.currency_id
symbol = company_id.currency_id.symbol
rounding = company_id.currency_id.rounding
@ -423,11 +424,13 @@ class AccountCasgFlow(models.TransientModel):
@api.model
def create(self, vals):
vals['target_move'] = 'all'
vals['target_move'] = 'posted'
res = super(AccountCasgFlow, self).create(vals)
return res
def write(self, vals):
if vals.get('target_move'):
vals.update({'target_move': vals.get('target_move').lower()})
if vals.get('journal_ids'):
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]})
if vals.get('journal_ids') == []:
@ -446,7 +449,12 @@ class AccountCasgFlow(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol, self.env.user.company_id.currency_id.position]
lang = self.env.user.lang
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):
@ -460,7 +468,7 @@ class AccountCasgFlow(models.TransientModel):
journal_res = report_data.get('journal_res')
fetched = report_data.get('fetched')
account_type_id = self.env.ref('account.data_account_type_liquidity').id
currency_symbol = self.env.user.company_id.currency_id.symbol
currency_symbol = self.env.company.currency_id.symbol
logged_users = self.env['res.company']._company_default_get('account.account')

23
dynamic_accounts_report/wizard/daybook.py

@ -4,6 +4,7 @@ from datetime import timedelta, datetime
from odoo import fields, models, api, _
import io
import json
from odoo.exceptions import AccessError, UserError, AccessDenied
try:
from odoo.tools.misc import xlsxwriter
@ -81,13 +82,14 @@ class AgeingView(models.TransientModel):
filters['accounts_list'] = data.get('accounts_list')
filters['journals_list'] = data.get('journals_list')
filters['company_name'] = data.get('company_name')
filters['target_move'] = data.get('target_move').capitalize()
return filters
def get_filter_data(self, option):
r = self.env['account.day.book'].search([('id', '=', option[0])])
default_filters = {}
company_id = r.env.user.company_id
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
journals = self.journal_ids if self.journal_ids else self.env[
'account.journal'].search(company_domain)
@ -116,10 +118,14 @@ class AgeingView(models.TransientModel):
accounts = self.env['account.account'].search(
[('id', 'in', active_acc)]) if data['form']['account_ids'] else \
self.env['account.account'].search([])
if not accounts:
raise UserError(_("No Accounts Found! Please Add One"))
active_jrnl = data['form']['journal_ids']
journals = self.env['account.journal'].search(
[('id', 'in', active_jrnl)]) if data['form']['journal_ids'] else \
self.env['account.journal'].search([])
if not journals:
raise UserError(_("No journals Found!"))
date_start = datetime.strptime(str(form_data['date_from']),
@ -151,11 +157,13 @@ class AgeingView(models.TransientModel):
@api.model
def create(self, vals):
vals['target_move'] = 'all'
vals['target_move'] = 'posted'
res = super(AgeingView, self).create(vals)
return res
def write(self, vals):
if vals.get('target_move'):
vals.update({'target_move': vals.get('target_move').lower()})
if vals.get('journal_ids'):
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]})
if vals.get('journal_ids') == []:
@ -221,9 +229,12 @@ class AgeingView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol,
self.env.user.company_id.currency_id.position]
lang = self.env.user.lang
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):
@ -242,7 +253,7 @@ class AgeingView(models.TransientModel):
txt_l = workbook.add_format(
{'font_size': '10px', 'border': 1, 'bold': True})
sheet.merge_range('A2:D3',
self.env.user.company_id.name + ':' + ' Day Book',
filters.get('company_name') + ':' + ' Day Book',
head)
date_head = workbook.add_format({'align': 'center', 'bold': True,
'font_size': '10px'})

44
dynamic_accounts_report/wizard/general_ledger.py

@ -1,8 +1,9 @@
import time
from odoo import fields, models, api
from odoo import fields, models, api, _
import io
import json
from odoo.exceptions import AccessError, UserError, AccessDenied
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
@ -62,6 +63,9 @@ class GeneralView(models.TransientModel):
'journals': journals,
'target_move': r.target_move,
'accounts': r.account_ids,
'account_tags': r.account_tag_ids,
'analytics': r.analytic_ids,
'analytic_tags': r.analytic_tag_ids,
}
if r.date_from:
@ -110,11 +114,13 @@ class GeneralView(models.TransientModel):
if data.get('date_to'):
filters['date_to'] = data.get('date_to')
if data.get('analytic_ids', []):
filters['analytics'] = data.get('analytic_ids')
filters['analytics'] = self.env['account.analytic.account'].browse(
data.get('analytic_ids', [])).mapped('name')
else:
filters['analytics'] = ['All']
if data.get('analytic_tag_ids', []):
filters['analytic_tags'] = data.get('analytic_tag_ids')
filters['account_tags'] = self.env['account.account.tag'].browse(
data.get('account_tag_ids', [])).mapped('name')
else:
filters['analytic_tags'] = ['All']
@ -125,13 +131,14 @@ class GeneralView(models.TransientModel):
filters['analytic_list'] = data.get('analytic_list')
filters['analytic_tag_list'] = data.get('analytic_tag_list')
filters['company_name'] = data.get('company_name')
filters['target_move'] = data.get('target_move').capitalize()
return filters
def get_filter_data(self, option):
r = self.env['account.general.ledger'].search([('id', '=', option[0])])
default_filters = {}
company_id = r.env.user.company_id
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
journals = r.journal_ids if r.journal_ids else self.env['account.journal'].search(company_domain)
accounts = self.account_ids if self.account_ids else self.env['account.account'].search(company_domain)
@ -167,6 +174,8 @@ class GeneralView(models.TransientModel):
init_balance = True
journals = data['journals']
accounts = self.env['account.account'].search([])
if not accounts:
raise UserError(_("No Accounts Found! Please Add One"))
account_res = self._get_accounts(accounts, init_balance, display_account, data)
debit_total = 0
debit_total = sum(x['debit'] for x in account_res)
@ -184,11 +193,13 @@ class GeneralView(models.TransientModel):
@api.model
def create(self, vals):
vals['target_move'] = 'all'
vals['target_move'] = 'posted'
res = super(GeneralView, self).create(vals)
return res
def write(self, vals):
if vals.get('target_move'):
vals.update({'target_move': vals.get('target_move').lower()})
if vals.get('journal_ids'):
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]})
if vals.get('journal_ids') == []:
@ -360,7 +371,12 @@ class GeneralView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol, self.env.user.company_id.currency_id.position]
lang = self.env.user.lang
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position,lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response ,report_data, dfr_data):
@ -378,7 +394,7 @@ class GeneralView(models.TransientModel):
'border_color': 'black'})
txt = workbook.add_format({'font_size': '10px', 'border': 1})
txt_l = workbook.add_format({'font_size': '10px', 'border': 1, 'bold': True})
sheet.merge_range('A2:J3', self.env.user.company_id.name + ':' + name_data.get('name'), head)
sheet.merge_range('A2:J3', filters.get('company_name') + ':' + name_data.get('name'), head)
date_head = workbook.add_format({'align': 'center', 'bold': True,
'font_size': '10px'})
date_style = workbook.add_format({'align': 'center',
@ -387,8 +403,20 @@ class GeneralView(models.TransientModel):
sheet.merge_range('B4:C4', 'From: ' + filters.get('date_from'), date_head)
if filters.get('date_to'):
sheet.merge_range('H4:I4', 'To: ' + filters.get('date_to'), date_head)
# sheet.merge_range('A5:J6', 'Journals: ' + ', '.join(
# [lt or '' for lt in filters['journals']]) + ' Target Moves: ' + filters.get('target_move'), date_head)
sheet.merge_range('A5:J6', ' Journals: ' + ', '.join(
[lt or '' for lt in filters['journals']]) + ' Target Moves: ' + filters.get('target_move'), date_head)
[lt or '' for lt in
filters['journals']]) + ' Accounts: ' + ', '.join(
[lt or '' for lt in
filters['accounts']]) + ' Account Tags: ' + ', '.join(
[lt or '' for lt in
filters['analytic_tags']]) + ' Analytic: ' + ', '.join(
[at or '' for at in
filters['analytics']]) + ' Target Moves : ' + filters.get('target_move'),
date_head)
sheet.write('A8', 'Code', sub_heading)
sheet.write('B8', 'Amount', sub_heading)

30
dynamic_accounts_report/wizard/partner_leadger.py

@ -1,8 +1,10 @@
import time
from odoo import fields, models, api
from odoo import fields, models, api, _
import io
import json
from odoo.exceptions import AccessError, UserError, AccessDenied
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
@ -124,18 +126,16 @@ class PartnerView(models.TransientModel):
filters['partners_list'] = data.get('partners_list')
filters['category_list'] = data.get('category_list')
filters['account_type_list'] = data.get('account_type_list')
filters['target_move'] = data.get('target_move').capitalize()
return filters
def get_filter_data(self, option):
r = self.env['account.partner.ledger'].search([('id', '=', option[0])])
default_filters = {}
company_id = self.env.user.company_id
print(company_id)
account_domain = [('company_id', '=', company_id.id), (
'user_type_id.type', 'in', ('receivable', 'payable'))]
company_id = self.env.company
company_domain = [('company_id', '=', company_id.id)]
journals = r.journal_ids if r.journal_ids else self.env['account.journal'].search(company_domain)
accounts = self.account_ids if self.account_ids else self.env['account.account'].search(account_domain)
accounts = self.account_ids if self.account_ids else self.env['account.account'].search(company_domain)
partner = r.partner_ids if r.partner_ids else self.env[
'res.partner'].search([])
@ -181,7 +181,8 @@ class PartnerView(models.TransientModel):
if data['partner_tags']:
partners = self.env['res.partner'].search(
[('category_id', 'in', data['partner_tags'].ids)])
if not accounts:
raise UserError(_("No Accounts Found! Please Add One"))
partner_res = self._get_partners(partners,accounts, init_balance, display_account, data)
debit_total = 0
@ -200,11 +201,13 @@ class PartnerView(models.TransientModel):
@api.model
def create(self, vals):
vals['target_move'] = 'all'
vals['target_move'] = 'posted'
res = super(PartnerView, self).create(vals)
return res
def write(self, vals):
if vals.get('target_move'):
vals.update({'target_move': vals.get('target_move').lower()})
if vals.get('journal_ids'):
vals.update({'journal_ids': [(6, 0, vals.get('journal_ids'))]})
if not vals.get('journal_ids'):
@ -307,7 +310,7 @@ class PartnerView(models.TransientModel):
partner_res = []
for partner in partners:
company_id = self.env.user.company_id
company_id = self.env.company
currency = company_id.currency_id
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['name'] = partner.name
@ -332,7 +335,12 @@ class PartnerView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol, self.env.user.company_id.currency_id.position]
lang = self.env.user.lang
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):
@ -355,7 +363,7 @@ class PartnerView(models.TransientModel):
'border': 1,
'border_color': 'black'})
sheet.merge_range('A1:H2',
self.env.user.company_id.name + ':' + 'Partner Ledger',
filters.get('company_name') + ':' + 'Partner Ledger',
head)
date_head = workbook.add_format({'align': 'center', 'bold': True,
'font_size': '10px'})

17
dynamic_accounts_report/wizard/trial_balance.py

@ -22,6 +22,10 @@ class TrialView(models.TransientModel):
('not_zero', 'With balance is not equal to 0')],
string='Display Accounts', required=True, default='movement')
# target_move = fields.Selection([('posted', 'All Posted Entries'),
# ('all', 'All Entries')],
# string='Target Moves', required=True)
@api.model
def view_report(self, option):
r = self.env['account.trial.balance'].search([('id', '=', option[0])])
@ -199,10 +203,11 @@ class TrialView(models.TransientModel):
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
tables += ' JOIN account_move am ON (account_move_line.move_id=am.id)'
if data['target_move'] == 'posted':
filters += " AND account_move_line__move_id.state = 'posted'"
filters += " AND am.state = 'posted'"
else:
filters += " AND account_move_line__move_id.state in ('draft','posted')"
filters += " AND am.state in ('draft','posted')"
if data.get('date_from'):
filters += " AND account_move_line.date < '%s'" % data.get('date_from')
@ -225,7 +230,13 @@ class TrialView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
currency_array = [self.env.user.company_id.currency_id.symbol, self.env.user.company_id.currency_id.position]
lang = self.env.user.lang
if not lang:
lang = 'en_US'
lang = lang.replace("_", '-')
currency_array = [self.env.company.currency_id.symbol,
self.env.company.currency_id.position,
lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response ,report_data, dfr_data):

Loading…
Cancel
Save