summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Smet <las@odoo.com>2020-07-29 07:00:01 +0000
committerLaurent Smet <las@odoo.com>2020-08-06 11:22:06 +0000
commite2f81f182da00872ebd55e0b1b945981f41a06e6 (patch)
treed3220ad0898798a7b4e96ef6f22a2e8fa378ffbb
parent34d53ebc87187aa3609db5f1ca515e9f12e47928 (diff)
[REF] account: Make the render report tour independant to any demo data
--task: 2290120
-rw-r--r--addons/account/tests/test_account_onboarding.py58
1 files changed, 35 insertions, 23 deletions
diff --git a/addons/account/tests/test_account_onboarding.py b/addons/account/tests/test_account_onboarding.py
index ec56dd27cfc..c2b9c472eac 100644
--- a/addons/account/tests/test_account_onboarding.py
+++ b/addons/account/tests/test_account_onboarding.py
@@ -1,30 +1,42 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo.addons.account.tests.common import AccountTestInvoicingHttpCommon
+from odoo.tests.common import tagged
-from odoo.tests.common import tagged, HttpCase
-from odoo import tools
+@tagged('post_install', '-at_install')
+class TestTourRenderInvoiceReport(AccountTestInvoicingHttpCommon):
-@tagged('-at_install', 'post_install', 'document_layout')
-class TestAccountDocumentLayout(HttpCase):
+ @classmethod
+ def setUpClass(cls, chart_template_ref=None):
+ super().setUpClass(chart_template_ref=chart_template_ref)
+
+ cls.env.user.write({
+ 'groups_id': [
+ (6, 0, (cls.env.ref('account.group_account_invoice') + cls.env.ref('base.group_system')).ids),
+ ],
+ })
+
+ cls.out_invoice = cls.env['account.move'].create({
+ 'move_type': 'out_invoice',
+ 'partner_id': cls.partner_a.id,
+ 'invoice_date': '2019-05-01',
+ 'date': '2019-05-01',
+ 'invoice_line_ids': [
+ (0, 0, {'name': 'line1', 'price_unit': 100.0}),
+ ],
+ })
+ cls.out_invoice.action_post()
+
+ report_layout = cls.env.ref('web.report_layout_standard')
+
+ cls.company_data['company'].write({
+ 'primary_color': '#123456',
+ 'secondary_color': '#789101',
+ 'external_report_layout_id': report_layout.view_id.id,
+ })
+
+ cls.env.ref('account.account_invoices_without_payment').report_type = 'qweb-html'
def test_render_account_document_layout(self):
- # YTI TODO: Adapt this tour without demo data
- if not tools.config["without_demo"]:
- report_layout = self.env.ref('web.report_layout_standard')
- main_company = self.env.ref('base.main_company')
-
- # Tour can't be run if the setup if not the generic one.
- generic_coa = self.env.ref('l10n_generic_coa.configurable_chart_template', raise_if_not_found=False)
- if not main_company.chart_template_id or main_company.chart_template_id != generic_coa:
- self.skipTest("Test render account document layout skipped: generic coa not found.")
-
- main_company.write({
- 'primary_color': '#123456',
- 'secondary_color': '#789101',
- 'external_report_layout_id': report_layout.view_id.id,
- })
- self.env.ref('account.account_invoices_without_payment').write({
- 'report_type': 'qweb-html',
- })
- self.start_tour("/web", 'account_render_report', login='admin', timeout=200)
+ self.start_tour('/web', 'account_render_report', login=self.env.user.login, timeout=200)