Browse Source

[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.
12.0
Pedro M. Baeza 5 years ago
parent
commit
124d1db26b
  1. 17
      report_qweb_parameter/tests/test_report_qweb_parameter.py

17
report_qweb_parameter/tests/test_report_qweb_parameter.py

@ -13,18 +13,13 @@ class TestReportQWebParameter(common.TransactionCase):
report_name = 'report_qweb_parameter.test_report_length' report_name = 'report_qweb_parameter.test_report_length'
report_obj = self.env['ir.actions.report'] report_obj = self.env['ir.actions.report']
report_object = report_obj._get_report_from_name(report_name) 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', 'street': '12345678901',
'vat': '12345678901', 'vat': '12345678901',
'website': '1234567890',
'company_registry': '1234567890' 'company_registry': '1234567890'
}) })
docs.website = '1234567890' # for avoding that Odoo adds http://
rep = report_object.render(docs.ids, False) rep = report_object.render(docs.ids, False)
root = ET.fromstring(rep[0]) root = ET.fromstring(rep[0])
self.assertEqual(root[0].text, "1234567890") self.assertEqual(root[0].text, "1234567890")
@ -42,9 +37,3 @@ class TestReportQWebParameter(common.TransactionCase):
{'website': '1234567890', 'company_registry': '12345678901'}) {'website': '1234567890', 'company_registry': '12345678901'})
with self.assertRaises(QWebException): with self.assertRaises(QWebException):
report_object.render(docs.ids, False) report_object.render(docs.ids, False)
docs.update({
'street': street,
'vat': vat,
'website': website,
'company_registry': company_registry
})
Loading…
Cancel
Save