Browse Source

[11.0][account_financial_report] Fix report name test

pull/585/head
Tonow-c2c 5 years ago
parent
commit
f5ff2eb49a
  1. 3
      account_financial_report/report/general_ledger.py
  2. 4
      account_financial_report/report/templates/general_ledger.xml
  3. 2
      account_financial_report/reports.xml
  4. 13
      account_financial_report/tests/abstract_test.py
  5. 3
      account_financial_report/tests/test_general_ledger.py

3
account_financial_report/report/general_ledger.py

@ -219,6 +219,9 @@ class GeneralLedgerReportCompute(models.TransientModel):
self.ensure_one()
if report_type == 'xlsx':
report_name = 'a_f_r.report_general_ledger_xlsx'
elif report_type == 'qweb-html':
report_name = 'account_financial_report.' \
'report_general_ledger_html_qweb'
else:
report_name = 'account_financial_report.' \
'report_general_ledger_qweb'

4
account_financial_report/report/templates/general_ledger.xml

@ -11,6 +11,10 @@
</t>
</template>
<template id="report_general_ledger_html_qweb">
<t t-call="account_financial_report.report_general_ledger_qweb"/>
</template>
<template id="report_general_ledger_base">
<!-- Saved flag fields into variables, used to define columns display -->
<t t-set="show_analytic_tags" t-value="o.show_analytic_tags"/>

2
account_financial_report/reports.xml

@ -17,7 +17,7 @@
model="report_general_ledger"
string="General Ledger"
report_type="qweb-html"
name="account_financial_report.report_general_ledger_qweb"
name="account_financial_report.report_general_ledger_html_qweb"
file="account_financial_report.report_general_ledger_html"
/>

13
account_financial_report/tests/abstract_test.py

@ -213,6 +213,7 @@ class AbstractTest(common.TransactionCase):
self.model = self._getReportModel()
self.qweb_report_name = self._getQwebReportName()
self.html_report_name = self._getHtmlReportName()
self.xlsx_report_name = self._getXlsxReportName()
self.xlsx_action_name = self._getXlsxReportActionName()
@ -226,7 +227,7 @@ class AbstractTest(common.TransactionCase):
def test_html(self):
test_reports.try_report(self.env.cr, self.env.uid,
self.qweb_report_name,
self.html_report_name,
[self.report.id],
report_type='qweb-html')
@ -255,7 +256,7 @@ class AbstractTest(common.TransactionCase):
self.assertDictContainsSubset(
{
'type': 'ir.actions.report',
'report_name': self.qweb_report_name,
'report_name': self.html_report_name,
'report_type': 'qweb-html',
},
report_action
@ -263,7 +264,7 @@ class AbstractTest(common.TransactionCase):
# Check if report template is correct
report = self.env['ir.actions.report'].search(
[('report_name', '=', self.qweb_report_name),
[('report_name', '=', self.html_report_name),
('report_type', '=', report_type)], limit=1)
self.assertEqual(report.report_type, 'qweb-html')
@ -377,6 +378,12 @@ class AbstractTest(common.TransactionCase):
"""
raise NotImplementedError()
def _getHtmlReportName(self):
"""
:return: the html report name
"""
raise NotImplementedError()
def _getXlsxReportName(self):
"""
:return: the xlsx report name

3
account_financial_report/tests/test_general_ledger.py

@ -19,6 +19,9 @@ class TestGeneralLedger(a_t_f_c.AbstractTestForeignCurrency):
def _getQwebReportName(self):
return 'account_financial_report.report_general_ledger_qweb'
def _getHtmlReportName(self):
return 'account_financial_report.report_general_ledger_html_qweb'
def _getXlsxReportName(self):
return 'a_f_r.report_general_ledger_xlsx'

Loading…
Cancel
Save