[IMP] report_qweb_parameter: Avoid error on integration tests

If reusing existing records, there's the risk of conflicting tests, like modifying
the VAT for the existing company and that company having a country with VAT check.

We avoid it creating a new company instead.
pull/475/head
Pedro M. Baeza 2020-04-13 19:02:39 +02:00 committed by Francisco Ivan Anton Prieto
parent 45cb6b6615
commit c2503756bf
1 changed files with 3 additions and 14 deletions

View File

@ -13,18 +13,13 @@ class TestReportQWebParameter(common.TransactionCase):
report_name = 'report_qweb_parameter.test_report_length'
report_obj = self.env['ir.actions.report']
report_object = report_obj._get_report_from_name(report_name)
docs = self.env['res.company'].search([], limit=1)
vat = docs.vat
website = docs.website
street = docs.street
company_registry = docs.company_registry
docs.update({
docs = self.env['res.company'].create({
'name': 'Test company',
'street': '12345678901',
'vat': '12345678901',
'website': '1234567890',
'company_registry': '1234567890'
})
docs.website = '1234567890' # for avoding that Odoo adds http://
rep = report_object.render(docs.ids, False)
root = ET.fromstring(rep[0])
self.assertEqual(root[0].text, "1234567890")
@ -42,9 +37,3 @@ class TestReportQWebParameter(common.TransactionCase):
{'website': '1234567890', 'company_registry': '12345678901'})
with self.assertRaises(QWebException):
report_object.render(docs.ids, False)
docs.update({
'street': street,
'vat': vat,
'website': website,
'company_registry': company_registry
})