[REF] account: Make the render report tour independant to any demo data
--task: 2290120
This commit is contained in:
@@ -1,30 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.tests.common import tagged, HttpCase
|
||||
from odoo import tools
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingHttpCommon
|
||||
from odoo.tests.common import tagged
|
||||
|
||||
|
||||
@tagged('-at_install', 'post_install', 'document_layout')
|
||||
class TestAccountDocumentLayout(HttpCase):
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestTourRenderInvoiceReport(AccountTestInvoicingHttpCommon):
|
||||
|
||||
@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)
|
||||
|
||||
Reference in New Issue
Block a user