Browse Source

[ADD] Responsive reports

pull/559/head
rgarnau 7 years ago
committed by Pedro M. Baeza
parent
commit
05477ee3a7
  1. 1
      account_financial_report/__manifest__.py
  2. 156
      account_financial_report/report/templates/aged_partner_balance.xml
  3. 65
      account_financial_report/report/templates/general_ledger.xml
  4. 57
      account_financial_report/report/templates/open_items.xml
  5. 40
      account_financial_report/report/templates/trial_balance.xml
  6. 3
      account_financial_report/static/src/css/report.css
  7. 289
      account_financial_report/tests/abstract_test.py
  8. 4
      account_financial_report/tests/test_aged_partner_balance.py
  9. 10
      account_financial_report/tests/test_general_ledger.py
  10. 4
      account_financial_report/tests/test_open_items.py
  11. 4
      account_financial_report/tests/test_trial_balance.py
  12. 2
      account_financial_report/view/report_aged_partner_balance.xml
  13. 2
      account_financial_report/view/report_general_ledger.xml
  14. 2
      account_financial_report/view/report_open_items.xml
  15. 2
      account_financial_report/view/report_trial_balance.xml

1
account_financial_report/__manifest__.py

@ -15,6 +15,7 @@
"website": "https://odoo-community.org/", "website": "https://odoo-community.org/",
'depends': [ 'depends': [
'account', 'account',
'account_invoicing',
'date_range', 'date_range',
'report_xlsx', 'report_xlsx',
], ],

156
account_financial_report/report/templates/aged_partner_balance.xml

@ -27,7 +27,8 @@
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<div class="act_as_caption account_title"
style="width: 100%;">
<span t-field="account.code"/> <span t-field="account.code"/>
- -
<span t-field="account.name"/> <span t-field="account.name"/>
@ -35,7 +36,8 @@
<!-- Display account lines --> <!-- Display account lines -->
<t t-if="not show_move_line_details"> <t t-if="not show_move_line_details">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table"
style="width: 100%;">
<!-- Display account header --> <!-- Display account header -->
<t t-call="account_financial_report.report_aged_partner_balance_lines_header"/> <t t-call="account_financial_report.report_aged_partner_balance_lines_header"/>
@ -80,7 +82,7 @@
</template> </template>
<template id="account_financial_report.report_aged_partner_balance_filters"> <template id="account_financial_report.report_aged_partner_balance_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div> <div class="act_as_cell">Date at filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -102,21 +104,21 @@
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 370px;">Partner</div>
<div class="act_as_cell" style="width: 32.52%;">Partner</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 110px;">Residual</div>
<div class="act_as_cell" style="width: 9.64%;">Residual</div>
<!--## current--> <!--## current-->
<div class="act_as_cell" style="width: 110px;">Not due</div>
<div class="act_as_cell" style="width: 9.64%;">Not due</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell" style="width: 110px;">1 - 30 d.</div>
<div class="act_as_cell" style="width: 9.64%;">1 - 30 d.</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell" style="width: 110px;">31 - 60 d.</div>
<div class="act_as_cell" style="width: 9.64%;">31 - 60 d.</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell" style="width: 110px;">61 - 90 d.</div>
<div class="act_as_cell" style="width: 9.64%;">61 - 90 d.</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell" style="width: 110px;">91 - 120 d.</div>
<div class="act_as_cell" style="width: 9.64%;">91 - 120 d.</div>
<!--## older--> <!--## older-->
<div class="act_as_cell" style="width: 110px;"> > 120 d.</div>
<div class="act_as_cell" style="width: 9.64%;"> > 120 d.</div>
</div> </div>
</div> </div>
</template> </template>
@ -163,38 +165,47 @@
</template> </template>
<template id="account_financial_report.report_aged_partner_balance_move_lines"> <template id="account_financial_report.report_aged_partner_balance_move_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for move lines --> <!-- Display table headers for move lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## date--> <!--## date-->
<div class="act_as_cell first_column" style="width: 60px;">Date</div>
<div class="act_as_cell first_column" style="width: 5.26%;">
Date</div>
<!--## move--> <!--## move-->
<div class="act_as_cell" style="width: 100px;">Entry</div>
<div class="act_as_cell" style="width: 8.77%;">Entry</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell" style="width: 40px;">Journal</div>
<div class="act_as_cell" style="width: 5.01%;">Journal</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<div class="act_as_cell" style="width: 6.88%;">Account</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 120px;">Partner</div>
<div class="act_as_cell" style="width: 10.52%;">Partner
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 220px;">Ref - Label</div>
<div class="act_as_cell" style="width: 19.23%;">Ref -
Label</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;">Due date</div>
<div class="act_as_cell" style="width: 6.26%;">Due
date</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 70px;">Residual</div>
<div class="act_as_cell" style="width: 6.19%;">Residual
</div>
<!--## current--> <!--## current-->
<div class="act_as_cell" style="width: 70px;">Current</div>
<div class="act_as_cell" style="width: 6.19%;">Current</div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 30 d.</div>
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 30
d.</div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 60 d.</div>
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 60
d.</div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 90 d.</div>
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 90
d.</div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell" style="width: 70px;">Age ≤ 120 d.</div>
<div class="act_as_cell" style="width: 6.19%;">Age ≤ 120
d.</div>
<!--## older--> <!--## older-->
<div class="act_as_cell" style="width: 70px;">Older</div>
<div class="act_as_cell" style="width: 6.19%;">Older</div>
</div> </div>
</div> </div>
<!-- Display each move lines --> <!-- Display each move lines -->
@ -264,38 +275,39 @@
<template id="account_financial_report.report_aged_partner_balance_partner_ending_cumul"> <template id="account_financial_report.report_aged_partner_balance_partner_ending_cumul">
<!-- Display ending balance line for partner --> <!-- Display ending balance line for partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## date--> <!--## date-->
<div class="act_as_cell right" style="width: 590px;">Partner cumul aged balance</div>
<div class="act_as_cell right" style="width: 51.41%;">Partner
cumul aged balance</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 5.26%;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.amount_residual"/> <span t-field="partner_cumul_line.amount_residual"/>
</div> </div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.current"/> <span t-field="partner_cumul_line.current"/>
</div> </div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_30_days"/> <span t-field="partner_cumul_line.age_30_days"/>
</div> </div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_60_days"/> <span t-field="partner_cumul_line.age_60_days"/>
</div> </div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_90_days"/> <span t-field="partner_cumul_line.age_90_days"/>
</div> </div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.age_120_days"/> <span t-field="partner_cumul_line.age_120_days"/>
</div> </div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%;">
<span t-field="partner_cumul_line.older"/> <span t-field="partner_cumul_line.older"/>
</div> </div>
</div> </div>
@ -304,71 +316,71 @@
<template id="account_financial_report.report_aged_partner_balance_account_ending_cumul"> <template id="account_financial_report.report_aged_partner_balance_account_ending_cumul">
<!-- Display ending balance line for account --> <!-- Display ending balance line for account -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<t t-if="not show_move_line_details"> <t t-if="not show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 370px;">Total</div>
<div class="act_as_cell right" style="width: 32.52%;">Total</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_amount_residual"/> <span t-field="account.cumul_amount_residual"/>
</div> </div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_current"/> <span t-field="account.cumul_current"/>
</div> </div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_30_days"/> <span t-field="account.cumul_age_30_days"/>
</div> </div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_60_days"/> <span t-field="account.cumul_age_60_days"/>
</div> </div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_90_days"/> <span t-field="account.cumul_age_90_days"/>
</div> </div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_age_120_days"/> <span t-field="account.cumul_age_120_days"/>
</div> </div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 110px;">
<div class="act_as_cell amount" style="width: 9.64%;">
<span t-field="account.cumul_older"/> <span t-field="account.cumul_older"/>
</div> </div>
</t> </t>
<t t-if="show_move_line_details"> <t t-if="show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 590px;">Total</div>
<div class="act_as_cell right" style="width: 51.41%;">Total</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 5.26%;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_amount_residual"/> <span t-field="account.cumul_amount_residual"/>
</div> </div>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_current"/> <span t-field="account.cumul_current"/>
</div> </div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_30_days"/> <span t-field="account.cumul_age_30_days"/>
</div> </div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_60_days"/> <span t-field="account.cumul_age_60_days"/>
</div> </div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_90_days"/> <span t-field="account.cumul_age_90_days"/>
</div> </div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_age_120_days"/> <span t-field="account.cumul_age_120_days"/>
</div> </div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 70px;">
<div class="act_as_cell amount" style="width: 6.19%">
<span t-field="account.cumul_older"/> <span t-field="account.cumul_older"/>
</div> </div>
</t> </t>
@ -376,53 +388,55 @@
<div class="act_as_row" style="font-weight: bold; font-style: italic;"> <div class="act_as_row" style="font-weight: bold; font-style: italic;">
<t t-if="not show_move_line_details"> <t t-if="not show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 370px;">Percents</div>
<div class="act_as_cell right" style="width: 32.52%;">
Percents</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 110px;"/>
<div class="act_as_cell amount" style="width: 9.64%;"/>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_current"/>%
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_current"/>%
</div> </div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_30_days"/>%
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_30_days"/>%
</div> </div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_60_days"/>%
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_60_days"/>%
</div> </div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_90_days"/>%
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_90_days"/>%
</div> </div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_age_120_days"/>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_age_120_days"/>
% %
</div> </div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.percent_older"/>%
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.percent_older"/>%
</div> </div>
</t> </t>
<t t-if="show_move_line_details"> <t t-if="show_move_line_details">
<!--## total--> <!--## total-->
<div class="act_as_cell right" style="width: 590px;">Percents</div>
<div class="act_as_cell right" style="width: 51.41%;">
Percents</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 5.26%;"/>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell amount" style="width: 70px;"/>
<div class="act_as_cell amount" style="width: 6.19%"/>
<!--## current--> <!--## current-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_current"/>%
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_current"/>%
</div> </div>
<!--## age_30_days--> <!--## age_30_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_30_days"/>%
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_30_days"/>%
</div> </div>
<!--## age_60_days--> <!--## age_60_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_60_days"/>%
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_60_days"/>%
</div> </div>
<!--## age_90_days--> <!--## age_90_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_90_days"/>%
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_90_days"/>%
</div> </div>
<!--## age_120_days--> <!--## age_120_days-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_age_120_days"/>%
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_age_120_days"/>%
</div> </div>
<!--## older--> <!--## older-->
<div class="act_as_cell amount" style="width: 70px;"><span t-field="account.percent_older"/>%
<div class="act_as_cell amount" style="width: 6.19%"><span t-field="account.percent_older"/>%
</div> </div>
</t> </t>
</div> </div>

65
account_financial_report/report/templates/general_ledger.xml

@ -27,7 +27,8 @@
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<div class="act_as_caption account_title"
style="width: 100%">
<span t-field="account.code"/> - <span t-field="account.name"/> <span t-field="account.code"/> - <span t-field="account.name"/>
</div> </div>
@ -72,7 +73,7 @@
</template> </template>
<template id="account_financial_report.report_general_ledger_filters"> <template id="account_financial_report.report_general_ledger_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date range filter</div> <div class="act_as_cell">Date range filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -100,39 +101,43 @@
</template> </template>
<template id="account_financial_report.report_general_ledger_lines"> <template id="account_financial_report.report_general_ledger_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for lines --> <!-- Display table headers for lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## date--> <!--## date-->
<div class="act_as_cell first_column" style="width: 60px;">Date</div>
<div class="act_as_cell first_column" style="width: 5.74%;">
Date</div>
<!--## move--> <!--## move-->
<div class="act_as_cell" style="width: 100px;">Entry</div>
<div class="act_as_cell" style="width: 8.77%">Entry</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell" style="width: 40px;">Journal</div>
<div class="act_as_cell" style="width: 4.51%;">Journal</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<div class="act_as_cell" style="width: 5.19%;">Account</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 140px;">Partner</div>
<div class="act_as_cell" style="width: 10%;">Partner
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 290px;">Ref - Label</div>
<div class="act_as_cell" style="width: 25%;">Ref -
Label</div>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell" style="width: 100px;">Cost center</div>
<div class="act_as_cell" style="width: 8.77%;">Cost
center</div>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 25px;">Rec.</div>
<div class="act_as_cell" style="width: 2.63%;">Rec.</div>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount" style="width: 75px;">Debit</div>
<div class="act_as_cell amount" style="width: 6.57%;">Debit</div>
<!--## credit--> <!--## credit-->
<div class="act_as_cell amount" style="width: 75px;">Credit</div>
<div class="act_as_cell amount" style="width: 6.57%;">Credit</div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px;">Cumul. Bal.</div>
<div class="act_as_cell amount" style="width: 6.57%;">Cumul. Bal.</div>
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<div class="act_as_cell" style="width: 3.11%;">Cur.</div>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;">Amount cur.</div>
<div class="act_as_cell amount" style="width: 6.57%;">Amount cur.</div>
</div> </div>
</div> </div>
@ -230,31 +235,37 @@
<template id="account_financial_report.report_general_ledger_ending_cumul"> <template id="account_financial_report.report_general_ledger_ending_cumul">
<!-- Display ending balance line for account or partner --> <!-- Display ending balance line for account or partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## date--> <!--## date-->
<t t-if='type == "account_type"'> <t t-if='type == "account_type"'>
<div class="act_as_cell first_column" style="width: 380px;"><span t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell right" style="width: 290px;">Ending balance</div>
<div class="act_as_cell first_column"
style="width: 33.33%;"><span
t-field="account_or_partner_object.code"/> - <span t-field="account_or_partner_object.name"/></div>
<div class="act_as_cell right"
style="width: 25.44%;">Ending balance</div>
</t> </t>
<t t-if='type == "partner_type"'> <t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 380px;"/>
<div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
<div class="act_as_cell first_column" style="width: 33.33%;"/>
<div class="act_as_cell right" style="width: 25.44%;">Partner ending balance</div>
</t> </t>
<t t-if="show_cost_center"> <t t-if="show_cost_center">
<!--## cost_center--> <!--## cost_center-->
<div class="act_as_cell" style="width: 100px;"/>
<div class="act_as_cell" style="width: 8.77%"/>
</t> </t>
<!--## matching_number--> <!--## matching_number-->
<div class="act_as_cell" style="width: 25px;"/>
<div class="act_as_cell" style="width: 3.11%;"/>
<!--## debit--> <!--## debit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_debit"/></div>
<div class="act_as_cell amount" style="width: 6.57%;"><span
t-field="account_or_partner_object.final_debit"/></div>
<!--## credit--> <!--## credit-->
<div class="act_as_cell amount" style="width: 75px;"><span t-field="account_or_partner_object.final_credit"/></div>
<div class="act_as_cell amount" style="width: 6.57%;"><span
t-field="account_or_partner_object.final_credit"/></div>
<!--## balance cumulated--> <!--## balance cumulated-->
<div class="act_as_cell amount" style="width: 75px; padding-right: 1px;"><span t-field="account_or_partner_object.final_balance"/></div>
<div class="act_as_cell amount" style="width: 6.57%;"><span
t-field="account_or_partner_object.final_balance"/></div>
<!--## currency_name + amount_currency--> <!--## currency_name + amount_currency-->
<div class="act_as_cell" style="width: 110px;"/>
<div class="act_as_cell" style="width: 9.64%;"/>
</div> </div>
</div> </div>

57
account_financial_report/report/templates/open_items.xml

@ -28,7 +28,8 @@
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<div class="act_as_caption account_title"
style="width: 100%;">
<span t-field="account.code"/> <span t-field="account.code"/>
- -
<span t-field="account.name"/> <span t-field="account.name"/>
@ -64,7 +65,7 @@
</template> </template>
<template id="account_financial_report.report_open_items_filters"> <template id="account_financial_report.report_open_items_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date at filter</div> <div class="act_as_cell">Date at filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -87,34 +88,39 @@
</template> </template>
<template id="account_financial_report.report_open_items_lines"> <template id="account_financial_report.report_open_items_lines">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display table headers for lines --> <!-- Display table headers for lines -->
<div class="act_as_thead"> <div class="act_as_thead">
<div class="act_as_row labels"> <div class="act_as_row labels">
<!--## date--> <!--## date-->
<div class="act_as_cell first_column" style="width: 60px;">Date</div>
<div class="act_as_cell first_column" style="width: 6.76%;">
Date</div>
<!--## move--> <!--## move-->
<div class="act_as_cell" style="width: 100px;">Entry</div>
<div class="act_as_cell" style="width: 9.76%;">Entry</div>
<!--## journal--> <!--## journal-->
<div class="act_as_cell" style="width: 40px;">Journal</div>
<div class="act_as_cell" style="width: 4.78%;">Journal</div>
<!--## account code--> <!--## account code-->
<div class="act_as_cell" style="width: 50px;">Account</div>
<div class="act_as_cell" style="width: 5.38%;">Account</div>
<!--## partner--> <!--## partner-->
<div class="act_as_cell" style="width: 140px;">Partner</div>
<div class="act_as_cell" style="width: 12.0%;">Partner
</div>
<!--## ref - label--> <!--## ref - label-->
<div class="act_as_cell" style="width: 290px;">Ref - Label</div>
<div class="act_as_cell" style="width: 25.5%;">Ref -
Label</div>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;">Due date</div>
<div class="act_as_cell" style="width: 6.47%;">Due
date</div>
<!--## amount_total_due--> <!--## amount_total_due-->
<div class="act_as_cell" style="width: 75px;">Original</div>
<div class="act_as_cell" style="width: 6.57%;">Original
</div>
<!--## amount_residual--> <!--## amount_residual-->
<div class="act_as_cell" style="width: 75px;">Residual</div>
<div class="act_as_cell" style="width: 6.57%;">Residual</div>
<!--## currency_name--> <!--## currency_name-->
<div class="act_as_cell" style="width: 35px;">Cur.</div>
<div class="act_as_cell" style="width: 3.07%;">Cur.</div>
<!--## amount_total_due_currency--> <!--## amount_total_due_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Original</div>
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Original</div>
<!--## amount_residual_currency--> <!--## amount_residual_currency-->
<div class="act_as_cell amount" style="width: 75px;">Cur. Residual</div>
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Residual</div>
</div> </div>
</div> </div>
@ -201,31 +207,34 @@
<template id="account_financial_report.report_open_items_ending_cumul"> <template id="account_financial_report.report_open_items_ending_cumul">
<!-- Display ending balance line for account or partner --> <!-- Display ending balance line for account or partner -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## date--> <!--## date-->
<t t-if='type == "account_type"'> <t t-if='type == "account_type"'>
<div class="act_as_cell first_column" style="width: 380px;">
<div class="act_as_cell first_column" style="width: 34.3%;">
<span t-field="account_or_partner_object.code"/> <span t-field="account_or_partner_object.code"/>
- -
<span t-field="account_or_partner_object.name"/> <span t-field="account_or_partner_object.name"/>
</div> </div>
<div class="act_as_cell right" style="width: 290px;">Ending balance</div>
<div class="act_as_cell right" style="width: 26.4%;">Ending
balance</div>
</t> </t>
<t t-if='type == "partner_type"'> <t t-if='type == "partner_type"'>
<div class="act_as_cell first_column" style="width: 380px;"/>
<div class="act_as_cell right" style="width: 290px;">Partner ending balance</div>
<div class="act_as_cell first_column"
style="width: 34.3%;"/>
<div class="act_as_cell right"
style="width: 26.4%;">Partner ending balance</div>
</t> </t>
<!--## date_due--> <!--## date_due-->
<div class="act_as_cell" style="width: 60px;"/>
<div class="act_as_cell" style="width: 6.26%;"/>
<!--## amount_total_due--> <!--## amount_total_due-->
<div class="act_as_cell amount" style="width: 75px;"/>
<div class="act_as_cell amount" style="width: 7.57%;"/>
<!--## amount_currency--> <!--## amount_currency-->
<div class="act_as_cell amount" style="width: 75px;">
<div class="act_as_cell amount" style="width: 7.57%;">
<span t-field="account_or_partner_object.final_amount_residual"/> <span t-field="account_or_partner_object.final_amount_residual"/>
</div> </div>
<!--## currency_name + amount_total_due_currency + amount_residual_currency --> <!--## currency_name + amount_total_due_currency + amount_residual_currency -->
<div class="act_as_cell" style="width: 185px;"/>
<div class="act_as_cell" style="width: 17.90%;"/>
</div> </div>
</div> </div>
</template> </template>

40
account_financial_report/report/templates/trial_balance.xml

@ -24,7 +24,7 @@
<!-- Display account lines --> <!-- Display account lines -->
<t t-if="not show_partner_details"> <t t-if="not show_partner_details">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<!-- Display account header --> <!-- Display account header -->
<t t-call="account_financial_report.report_trial_balance_lines_header"/> <t t-call="account_financial_report.report_trial_balance_lines_header"/>
@ -42,11 +42,13 @@
<div class="page_break"> <div class="page_break">
<!-- Display account header --> <!-- Display account header -->
<div class="act_as_table list_table" style="margin-top: 10px;"/> <div class="act_as_table list_table" style="margin-top: 10px;"/>
<div class="act_as_caption account_title" style="width: 1141px !important;">
<div class="act_as_caption account_title"
style="width: 100%;">
<span t-field="account.code"/> - <span t-field="account.name"/> <span t-field="account.code"/> - <span t-field="account.name"/>
</div> </div>
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table"
style="width: 100%;">
<!-- Display account/partner header --> <!-- Display account/partner header -->
<t t-call="account_financial_report.report_trial_balance_lines_header"/> <t t-call="account_financial_report.report_trial_balance_lines_header"/>
@ -66,7 +68,7 @@
</template> </template>
<template id="account_financial_report.report_trial_balance_filters"> <template id="account_financial_report.report_trial_balance_filters">
<div class="act_as_table data_table" style="width: 1140px !important;">
<div class="act_as_table data_table" style="width: 100%;">
<div class="act_as_row labels"> <div class="act_as_row labels">
<div class="act_as_cell">Date range filter</div> <div class="act_as_cell">Date range filter</div>
<div class="act_as_cell">Target moves filter</div> <div class="act_as_cell">Target moves filter</div>
@ -94,22 +96,25 @@
<div class="act_as_row labels"> <div class="act_as_row labels">
<t t-if="not show_partner_details"> <t t-if="not show_partner_details">
<!--## Code--> <!--## Code-->
<div class="act_as_cell" style="width: 100px;">Code</div>
<div class="act_as_cell" style="width: 8.86%;">Code</div>
<!--## Account--> <!--## Account-->
<div class="act_as_cell" style="width: 600px;">Account</div>
<div class="act_as_cell" style="width: 52.58%;">Account
</div>
</t> </t>
<t t-if="show_partner_details"> <t t-if="show_partner_details">
<!--## Partner--> <!--## Partner-->
<div class="act_as_cell" style="width: 700px;">Partner</div>
<div class="act_as_cell" style="width: 61.44%;">Partner
</div>
</t> </t>
<!--## Initial balance--> <!--## Initial balance-->
<div class="act_as_cell" style="width: 110px;">Initial balance</div>
<div class="act_as_cell" style="width: 9.64%;">Initial
balance</div>
<!--## Debit--> <!--## Debit-->
<div class="act_as_cell" style="width: 110px;">Debit</div>
<div class="act_as_cell" style="width: 9.64%;">Debit</div>
<!--## Credit--> <!--## Credit-->
<div class="act_as_cell" style="width: 110px;">Credit</div>
<div class="act_as_cell" style="width: 9.64%;">Credit</div>
<!--## Ending balance--> <!--## Ending balance-->
<div class="act_as_cell" style="width: 110px;">Ending balance</div>
<div class="act_as_cell" style="width: 9.64%;">Ending balance</div>
</div> </div>
</div> </div>
</template> </template>
@ -136,18 +141,19 @@
<template id="account_financial_report.report_trial_balance_account_footer"> <template id="account_financial_report.report_trial_balance_account_footer">
<!-- Display account footer --> <!-- Display account footer -->
<div class="act_as_table list_table" style="width: 1141px !important;">
<div class="act_as_table list_table" style="width: 100%;">
<div class="act_as_row labels" style="font-weight: bold;"> <div class="act_as_row labels" style="font-weight: bold;">
<!--## Account--> <!--## Account-->
<div class="act_as_cell left" style="width: 700px;"><span t-field="account.code"/> - <span t-field="account.name"/></div>
<div class="act_as_cell left" style="width: 61.44%;"><span
t-field="account.code"/> - <span t-field="account.name"/></div>
<!--## Initial balance--> <!--## Initial balance-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.initial_balance"/></div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.initial_balance"/></div>
<!--## Debit--> <!--## Debit-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.debit"/></div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.debit"/></div>
<!--## Credit--> <!--## Credit-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.credit"/></div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.credit"/></div>
<!--## Ending balance--> <!--## Ending balance-->
<div class="act_as_cell amount" style="width: 110px;"><span t-field="account.final_balance"/></div>
<div class="act_as_cell amount" style="width: 9.64%;"><span t-field="account.final_balance"/></div>
</div> </div>
</div> </div>
</template> </template>

3
account_financial_report/static/src/css/report.css

@ -102,4 +102,7 @@ body, table, td, span, div {
background-color: @odoo-view-background-color; background-color: @odoo-view-background-color;
color: @odoo-main-text-color; color: @odoo-main-text-color;
padding-top: 10px; padding-top: 10px;
width: 90%;
margin-right: auto;
margin-left: auto;
} }

289
account_financial_report/tests/abstract_test.py

@ -3,64 +3,248 @@
# Copyright 2016 Camptocamp SA # Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
from odoo.tests import common
from odoo.tools import test_reports
import logging import logging
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
try:
from xlrd import open_workbook
except ImportError:
_logger.debug('Can not import xlsxwriter`.')
class AbstractTest(TransactionCase):
class AbstractTest(common.TransactionCase):
"""Common technical tests for all reports.""" """Common technical tests for all reports."""
at_install = False
post_install = True
accounts = {}
def with_context(self, *args, **kwargs):
context = dict(args[0] if args else self.env.context, **kwargs)
self.env = self.env(context=context)
return self
def _chart_template_create(self):
transfer_account_id = self.env['account.account.template'].create({
'code': '000',
'name': 'Liquidity Transfers',
'reconcile': True,
'user_type_id': self.ref(
"account.data_account_type_current_assets"),
})
self.chart = self.env['account.chart.template'].create({
'name': 'Test COA',
'code_digits': 4,
'bank_account_code_prefix': 1014,
'cash_account_code_prefix': 1014,
'currency_id': self.ref('base.USD'),
'transfer_account_id': transfer_account_id.id,
})
transfer_account_id.update({
'chart_template_id': self.chart.id,
})
self.env['ir.model.data'].create({
'res_id': transfer_account_id.id,
'model': transfer_account_id._name,
'name': 'Liquidity Transfers',
})
act = self.env['account.account.template'].create({
'code': '001',
'name': 'Expenses',
'user_type_id': self.ref("account.data_account_type_expenses"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'expenses',
})
act = self.env['account.account.template'].create({
'code': '002',
'name': 'Product Sales',
'user_type_id': self.ref("account.data_account_type_revenue"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'sales',
})
act = self.env['account.account.template'].create({
'code': '003',
'name': 'Account Receivable',
'user_type_id': self.ref("account.data_account_type_receivable"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'receivable',
})
act = self.env['account.account.template'].create({
'code': '004',
'name': 'Account Payable',
'user_type_id': self.ref("account.data_account_type_payable"),
'chart_template_id': self.chart.id,
'reconcile': True,
})
self.env['ir.model.data'].create({
'res_id': act.id,
'model': act._name,
'name': 'payable',
})
def setUp(cls):
super(AbstractTest, cls).setUp()
def _add_chart_of_accounts(self):
self.company = self.env['res.company'].create({
'name': 'Spanish test company',
'external_report_layout': 'standard',
})
self.env.ref('base.group_multi_company').write({
'users': [(4, self.env.uid)],
})
self.env.user.write({
'company_ids': [(4, self.company.id)],
'company_id': self.company.id,
})
self.with_context(
company_id=self.company.id, force_company=self.company.id)
wizard = self.env['wizard.multi.charts.accounts'].create({
'company_id': self.company.id,
'chart_template_id': self.chart.id,
'code_digits': 4,
'currency_id': self.ref('base.USD'),
'transfer_account_id': self.chart.transfer_account_id.id,
})
wizard.onchange_chart_template_id()
wizard.execute()
self.revenue = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_revenue"))], limit=1)
self.expense = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_expenses"))], limit=1)
self.receivable = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_receivable"))], limit=1)
self.payable = self.env['account.account'].search(
[('user_type_id', '=', self.ref(
"account.data_account_type_payable"))], limit=1)
return True
cls.model = cls._getReportModel()
def _journals_create(self):
self.journal_sale = self.env['account.journal'].create({
'company_id': self.company.id,
'name': 'Test journal for sale',
'type': 'sale',
'code': 'TSALE',
'default_debit_account_id': self.revenue.id,
'default_credit_account_id': self.revenue.id,
})
self.journal_purchase = self.env['account.journal'].create({
'company_id': self.company.id,
'name': 'Test journal for purchase',
'type': 'purchase',
'code': 'TPUR',
'default_debit_account_id': self.expense.id,
'default_credit_account_id': self.expense.id,
})
return True
cls.qweb_report_name = cls._getQwebReportName()
cls.xlsx_report_name = cls._getXlsxReportName()
cls.xlsx_action_name = cls._getXlsxReportActionName()
def _invoice_create(self):
self.partner = self.env['res.partner'].create({
'name': 'Test partner',
'company_id': self.company.id,
'property_account_receivable_id': self.receivable.id,
'property_account_payable_id': self.payable.id,
})
cls.report_title = cls._getReportTitle()
# customer invoice
customer_invoice_lines = [(0, False, {
'name': 'Test description #1',
'account_id': self.revenue.id,
'quantity': 1.0,
'price_unit': 100.0,
}), (0, False, {
'name': 'Test description #2',
'account_id': self.revenue.id,
'quantity': 2.0,
'price_unit': 25.0,
})]
self.invoice_out = self.env['account.invoice'].create({
'partner_id': self.partner.id,
'type': 'out_invoice',
'invoice_line_ids': customer_invoice_lines,
'account_id': self.partner.property_account_receivable_id.id,
'journal_id': self.journal_sale.id,
})
self.invoice_out.action_invoice_open()
# vendor bill
vendor_invoice_lines = [(0, False, {
'name': 'Test description #1',
'account_id': self.revenue.id,
'quantity': 1.0,
'price_unit': 100.0,
}), (0, False, {
'name': 'Test description #2',
'account_id': self.revenue.id,
'quantity': 2.0,
'price_unit': 25.0,
})]
self.invoice_in = self.env['account.invoice'].create({
'partner_id': self.partner.id,
'type': 'in_invoice',
'invoice_line_ids': vendor_invoice_lines,
'account_id': self.partner.property_account_payable_id.id,
'journal_id': self.journal_purchase.id,
})
self.invoice_in.action_invoice_open()
cls.base_filters = cls._getBaseFilters()
cls.additional_filters = cls._getAdditionalFiltersToBeTested()
def setUp(self):
super(AbstractTest, self).setUp()
cls.report = cls.model.create(cls.base_filters)
cls.report.compute_data_for_report()
self.with_context()
self._chart_template_create()
self._add_chart_of_accounts()
self._journals_create()
self._invoice_create()
def test_01_generation_report_qweb(self):
"""Check if report PDF/HTML is correctly generated"""
self.model = self._getReportModel()
# Check if returned report action is correct
report_type = 'qweb-pdf'
report_action = self.report.print_report(report_type)
self.assertDictContainsSubset(
{
'type': 'ir.actions.report',
'report_name': self.qweb_report_name,
'report_type': 'qweb-pdf',
},
report_action
)
self.qweb_report_name = self._getQwebReportName()
self.xlsx_report_name = self._getXlsxReportName()
self.xlsx_action_name = self._getXlsxReportActionName()
# Check if report template is correct
report = self.env['ir.actions.report'].search(
[('report_name', '=', self.qweb_report_name),
('report_type', '=', report_type)], limit=1)
self.assertEqual(report.report_type, 'qweb-pdf')
self.report_title = self._getReportTitle()
rep = report.render(self.report.ids, {})
self.base_filters = self._getBaseFilters()
self.additional_filters = self._getAdditionalFiltersToBeTested()
self.assertTrue(self.report_title.encode('utf8') in rep[0])
self.report = self.model.create(self.base_filters)
self.report.compute_data_for_report()
self.assertTrue(
self.report.account_ids[0].name.encode('utf8') in rep[0]
)
def test_html(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
[self.report.id],
report_type='qweb-html')
def test_qweb(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
[self.report.id],
report_type='qweb-pdf')
def test_xlsx(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.xlsx_report_name,
[self.report.id],
report_type='xlsx')
def test_print(self):
self.report.print_report('qweb')
self.report.print_report('xlsx')
def test_02_generation_report_html(self): def test_02_generation_report_html(self):
"""Check if report HTML is correctly generated""" """Check if report HTML is correctly generated"""
@ -90,29 +274,6 @@ class AbstractTest(TransactionCase):
self.report.account_ids[0].name.encode('utf8') in rep[0] self.report.account_ids[0].name.encode('utf8') in rep[0]
) )
def test_03_generation_report_xlsx(self):
"""Check if report XLSX is correctly generated"""
report_object = self.env['ir.actions.report']
# Check if returned report action is correct
report_type = 'xlsx'
report_action = self.report.print_report(report_type)
self.assertDictContainsSubset(
{
'type': 'ir.actions.report',
'report_name': self.xlsx_report_name,
'report_type': 'xlsx',
},
report_action
)
report = report_object._get_report_from_name(self.xlsx_report_name)
self.assertEqual(report.report_type, 'xlsx')
report_xlsx = report.render(self.report.ids, {})
wb = open_workbook(file_contents=report_xlsx[0])
sheet = wb.sheet_by_index(0)
class_name = 'report.%s' % report.report_name
self.assertEqual(sheet.cell(0, 0).value,
self.env[class_name]._get_report_name())
def test_04_compute_data(self): def test_04_compute_data(self):
"""Check that the SQL queries work with all filters options""" """Check that the SQL queries work with all filters options"""

4
account_financial_report/tests/test_aged_partner_balance.py

@ -26,12 +26,12 @@ class TestAgedPartnerBalance(abstract_test.AbstractTest):
'action_report_aged_partner_balance_xlsx' 'action_report_aged_partner_balance_xlsx'
def _getReportTitle(self): def _getReportTitle(self):
return 'Odoo Report'
return 'Odoo'
def _getBaseFilters(self): def _getBaseFilters(self):
return { return {
'date_at': time.strftime('%Y-12-31'), 'date_at': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):

10
account_financial_report/tests/test_general_ledger.py

@ -5,7 +5,7 @@
import time import time
from . import abstract_test from . import abstract_test
from odoo.tests.common import TransactionCase
from odoo.tests import common
class TestGeneralLedger(abstract_test.AbstractTest): class TestGeneralLedger(abstract_test.AbstractTest):
@ -27,13 +27,13 @@ class TestGeneralLedger(abstract_test.AbstractTest):
'action_report_general_ledger_xlsx' 'action_report_general_ledger_xlsx'
def _getReportTitle(self): def _getReportTitle(self):
return 'Odoo Report'
return 'Odoo'
def _getBaseFilters(self): def _getBaseFilters(self):
return { return {
'date_from': time.strftime('%Y-01-01'), 'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'), 'date_to': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
'fy_start_date': time.strftime('%Y-01-01'), 'fy_start_date': time.strftime('%Y-01-01'),
} }
@ -53,7 +53,9 @@ class TestGeneralLedger(abstract_test.AbstractTest):
] ]
class TestGeneralLedgerReport(TransactionCase):
@common.at_install(False)
@common.post_install(True)
class TestGeneralLedgerReport(common.TransactionCase):
def setUp(self): def setUp(self):
super(TestGeneralLedgerReport, self).setUp() super(TestGeneralLedgerReport, self).setUp()

4
account_financial_report/tests/test_open_items.py

@ -25,12 +25,12 @@ class TestOpenItems(abstract_test.AbstractTest):
return 'account_financial_report.action_report_open_items_xlsx' return 'account_financial_report.action_report_open_items_xlsx'
def _getReportTitle(self): def _getReportTitle(self):
return 'Odoo Report'
return 'Odoo'
def _getBaseFilters(self): def _getBaseFilters(self):
return { return {
'date_at': time.strftime('%Y-12-31'), 'date_at': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
} }
def _getAdditionalFiltersToBeTested(self): def _getAdditionalFiltersToBeTested(self):

4
account_financial_report/tests/test_trial_balance.py

@ -25,13 +25,13 @@ class TestTrialBalance(abstract_test.AbstractTest):
return 'account_financial_report.action_report_trial_balance_xlsx' return 'account_financial_report.action_report_trial_balance_xlsx'
def _getReportTitle(self): def _getReportTitle(self):
return 'Odoo Report'
return 'Odoo'
def _getBaseFilters(self): def _getBaseFilters(self):
return { return {
'date_from': time.strftime('%Y-01-01'), 'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-12-31'), 'date_to': time.strftime('%Y-12-31'),
'company_id': self.env.ref('base.main_company').id,
'company_id': self.company.id,
'fy_start_date': time.strftime('%Y-01-01'), 'fy_start_date': time.strftime('%Y-01-01'),
} }

2
account_financial_report/view/report_aged_partner_balance.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="report_aged_partner_balance"> <template id="report_aged_partner_balance">
<div class="container o_account_financial_reports_page">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report.report_buttons"/> <t t-call="account_financial_report.report_buttons"/>
<t t-call="account_financial_report.report_aged_partner_balance_base"/> <t t-call="account_financial_report.report_aged_partner_balance_base"/>
</div> </div>

2
account_financial_report/view/report_general_ledger.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="report_general_ledger"> <template id="report_general_ledger">
<div class="container o_account_financial_reports_page">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report.report_buttons"/> <t t-call="account_financial_report.report_buttons"/>
<t t-call="account_financial_report.report_general_ledger_base"/> <t t-call="account_financial_report.report_general_ledger_base"/>
</div> </div>

2
account_financial_report/view/report_open_items.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="report_open_items"> <template id="report_open_items">
<div class="container o_account_financial_reports_page">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report.report_buttons"/> <t t-call="account_financial_report.report_buttons"/>
<t t-call="account_financial_report.report_open_items_base"/> <t t-call="account_financial_report.report_open_items_base"/>
</div> </div>

2
account_financial_report/view/report_trial_balance.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="report_trial_balance"> <template id="report_trial_balance">
<div class="container o_account_financial_reports_page">
<div class="o_account_financial_reports_page">
<t t-call="account_financial_report.report_buttons"/> <t t-call="account_financial_report.report_buttons"/>
<t t-call="account_financial_report.report_trial_balance_base"/> <t t-call="account_financial_report.report_trial_balance_base"/>
</div> </div>

Loading…
Cancel
Save