Browse Source

[UPDT] Updated 'dynamic_accounts_report'

pull/175/head
Ajmal Cybro 4 years ago
parent
commit
8c45b8fe6d
  1. 2
      dynamic_accounts_report/__manifest__.py
  2. 6
      dynamic_accounts_report/doc/RELEASE_NOTES.md
  3. 35
      dynamic_accounts_report/static/src/js/ageing.js
  4. 52
      dynamic_accounts_report/static/src/js/cash_flow.js
  5. 27
      dynamic_accounts_report/static/src/js/daybook.js
  6. 11
      dynamic_accounts_report/static/src/js/financial_reports.js
  7. 30
      dynamic_accounts_report/static/src/js/general_ledger.js
  8. 34
      dynamic_accounts_report/static/src/js/partner_ledger.js
  9. 23
      dynamic_accounts_report/static/src/js/trial_balance.js
  10. 79
      dynamic_accounts_report/static/src/xml/ageing.xml
  11. 18
      dynamic_accounts_report/static/src/xml/daybook.xml
  12. 36
      dynamic_accounts_report/static/src/xml/general_ledger_view.xml
  13. 6
      dynamic_accounts_report/static/src/xml/trial_balance_view.xml
  14. 8
      dynamic_accounts_report/wizard/ageing.py
  15. 68
      dynamic_accounts_report/wizard/balance_sheet.py
  16. 7
      dynamic_accounts_report/wizard/balance_sheet_config.py
  17. 6
      dynamic_accounts_report/wizard/cash_flow.py
  18. 6
      dynamic_accounts_report/wizard/daybook.py
  19. 6
      dynamic_accounts_report/wizard/general_ledger.py
  20. 6
      dynamic_accounts_report/wizard/partner_leadger.py
  21. 7
      dynamic_accounts_report/wizard/trial_balance.py

2
dynamic_accounts_report/__manifest__.py

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

6
dynamic_accounts_report/doc/RELEASE_NOTES.md

@ -16,4 +16,10 @@
- Ageing Report.
#### 28.06.2021
#### Version 14.0.1.2.2
#### UPDT
- Updated

35
dynamic_accounts_report/static/src/js/ageing.js

@ -61,6 +61,17 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
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', {
@ -97,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();
@ -214,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',
@ -223,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',
@ -344,7 +366,6 @@ odoo.define('dynamic_accounts_report.ageing', function (require) {
var post_res = document.getElementById("post_res")
filter_data_selected.target_move = $(".target_move")[1].value
console.log($(".target_move"))
post_res.value = $(".target_move")[1].value
post_res.innerHTML=post_res.value;

52
dynamic_accounts_report/static/src/js/cash_flow.js

@ -58,6 +58,37 @@ odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
[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(
@ -100,6 +131,17 @@ odoo.define('dynamic_cash_flow_statements.cash_flow', function (require) {
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');

27
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'] ){

11
dynamic_accounts_report/static/src/js/financial_reports.js

@ -52,6 +52,7 @@ odoo.define('dynamic_accounts_report.financial_reports', function (require) {
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');

30
dynamic_accounts_report/static/src/js/general_ledger.js

@ -70,6 +70,15 @@ odoo.define('dynamic_cash_flow_statements.general_ledger', function (require) {
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', {
@ -205,6 +214,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();
@ -221,6 +239,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++) {
@ -390,7 +418,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;
}

34
dynamic_accounts_report/static/src/js/partner_ledger.js

@ -54,6 +54,18 @@ odoo.define('dynamic_accounts_report.partner_ledger', 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) {
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'] ){

23
dynamic_accounts_report/static/src/js/trial_balance.js

@ -55,6 +55,14 @@ odoo.define('dynamic_cash_flow_statements.trial', 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) {
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({

79
dynamic_accounts_report/static/src/xml/ageing.xml

@ -59,7 +59,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['direction']"/>
<!-- <t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
@ -69,7 +70,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['4'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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;">
@ -78,7 +80,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['3'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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;">
@ -87,7 +90,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['2'] * Math.pow(10, 2)) / Math.pow(10, 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;">
@ -96,7 +100,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['1'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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;">
@ -105,7 +110,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['0'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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;">
@ -114,7 +120,8 @@
</t>
<t t-else="">
<t t-esc="currency[0]"/>
<t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<t t-esc="account['total']"/>
<!-- <t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>-->
</t>
</td>
</t>
@ -124,7 +131,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['direction'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -133,7 +141,9 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['4'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -142,7 +152,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['3'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -151,7 +162,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['2'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -160,7 +172,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['1'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -169,7 +182,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['0'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -178,7 +192,8 @@
<span>-</span>
</t>
<t t-else="">
<t t-esc="Math.round(account['total'] * Math.pow(10, 2)) / Math.pow(10, 2)"/>
<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>
@ -379,7 +394,8 @@
</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>
@ -394,7 +410,8 @@
</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>
@ -409,7 +426,8 @@
</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>
@ -425,7 +443,8 @@
</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>
@ -441,7 +460,8 @@
</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>
@ -456,7 +476,8 @@
</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="">
@ -471,7 +492,8 @@
<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>
@ -483,7 +505,8 @@
<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>
@ -495,7 +518,8 @@
<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>
@ -507,7 +531,8 @@
<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>
@ -519,7 +544,8 @@
<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>
@ -531,7 +557,8 @@
<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>

18
dynamic_accounts_report/static/src/xml/daybook.xml

@ -273,7 +273,8 @@
</t>
<t t-else="">
<t t-esc="currency_symbol"/>
<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="text-right">
@ -282,7 +283,8 @@
</t>
<t t-else="">
<t t-esc="currency_symbol"/>
<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="text-right">
@ -291,7 +293,8 @@
</t>
<t t-else="">
<t t-esc="currency_symbol"/>
<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>
@ -301,7 +304,8 @@
<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="currency_symbol"/>
</t>
</td>
@ -310,7 +314,8 @@
<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="currency_symbol"/>
</t>
</td>
@ -319,7 +324,8 @@
<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="currency_symbol"/>
</t>
</td>

36
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>
@ -319,7 +325,8 @@
</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_right" class="amt">
@ -328,7 +335,8 @@
</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_right" class="amt">
@ -337,7 +345,8 @@
</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>
@ -347,7 +356,8 @@
<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>
@ -356,7 +366,8 @@
<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>
@ -365,7 +376,8 @@
<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>

6
dynamic_accounts_report/static/src/xml/trial_balance_view.xml

@ -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>

8
dynamic_accounts_report/wizard/ageing.py

@ -533,8 +533,6 @@ class AgeingView(models.TransientModel):
partner['partner_id']]):
res.append(values)
return res, total, lines
@api.model
@ -543,8 +541,12 @@ class AgeingView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
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]
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data ):

68
dynamic_accounts_report/wizard/balance_sheet.py

@ -5,7 +5,6 @@ import io
import json
from odoo.exceptions import AccessError, UserError, AccessDenied
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
@ -17,37 +16,30 @@ class BalanceSheetView(models.TransientModel):
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,
@ -57,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({
@ -77,14 +68,10 @@ 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)
if filters['account_tags'] != ['All']:
tag_accounts = list(map(lambda x: x.code, new_account_ids))
@ -98,7 +85,7 @@ class BalanceSheetView(models.TransientModel):
records['Accounts'] = new_records
account_report_id = self.env['account.financial.report'].search([
('name', 'ilike', tag)])
('name', 'ilike', tag)])
new_data = {'id': self.id, 'date_from': False,
'enable_filter': True,
@ -108,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,
@ -153,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:
@ -162,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:
@ -203,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']
@ -223,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,
@ -300,14 +288,13 @@ class BalanceSheetView(models.TransientModel):
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 = 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)
@ -326,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,
@ -520,7 +505,6 @@ class BalanceSheetView(models.TransientModel):
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
@ -624,4 +608,4 @@ class BalanceSheetView(models.TransientModel):
workbook.close()
output.seek(0)
response.stream.write(output.read())
output.close()
output.close()

7
dynamic_accounts_report/wizard/balance_sheet_config.py

@ -250,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):
@ -296,3 +297,9 @@ class BalanceSheet(models.TransientModel):
j['type'] = 'journal_item'
journal_items.append(j)
return journal_items

6
dynamic_accounts_report/wizard/cash_flow.py

@ -449,8 +449,12 @@ class AccountCasgFlow(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
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]
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):

6
dynamic_accounts_report/wizard/daybook.py

@ -229,8 +229,12 @@ class AgeingView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
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]
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):

6
dynamic_accounts_report/wizard/general_ledger.py

@ -371,8 +371,12 @@ class GeneralView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
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]
self.env.company.currency_id.position,lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response ,report_data, dfr_data):

6
dynamic_accounts_report/wizard/partner_leadger.py

@ -335,8 +335,12 @@ class PartnerView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
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]
self.env.company.currency_id.position, lang]
return currency_array
def get_dynamic_xlsx_report(self, data, response, report_data, dfr_data):

7
dynamic_accounts_report/wizard/trial_balance.py

@ -232,8 +232,13 @@ class TrialView(models.TransientModel):
self.env.context.get('default_journal_id', False))
if journal.currency_id:
return journal.currency_id.id
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]
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