From 7c35f9962b50bd392508c34401bce6a1786d491f Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 14 Feb 2020 12:11:35 +0100 Subject: [PATCH] Improve tests --- .../test_l10n_nl_xaf_auditfile_export.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py b/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py index 68283c078..a8b8c0b2a 100644 --- a/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py +++ b/l10n_nl_xaf_auditfile_export/tests/test_l10n_nl_xaf_auditfile_export.py @@ -1,4 +1,4 @@ -# Copyright 2018 Onestein () +# Copyright 2018-2020 Onestein () # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import base64 @@ -6,11 +6,30 @@ from io import BytesIO from zipfile import ZipFile -from odoo.tests.common import TransactionCase +from odoo import fields +from odoo.tests.common import Form, TransactionCase from odoo.tools import mute_logger class TestXafAuditfileExport(TransactionCase): + def setUp(self): + super().setUp() + + self.env.user.company_id.country_id = (self.env.ref("base.nl").id,) + + # create an invoice and post it, to ensure that there's some data to export + move_form = Form( + self.env["account.move"].with_context(default_type="out_invoice") + ) + move_form.invoice_date = fields.Date().today() + move_form.partner_id = self.env["res.partner"].create({"name": "Partner Test"}) + with move_form.invoice_line_ids.new() as line_form: + line_form.product_id = self.env["product.product"].create( + {"name": "product test", "standard_price": 800.0} + ) + self.invoice = move_form.save() + self.invoice.post() + def test_01_default_values(self): """ Check that the default values are filled on creation """ record = self.env["xaf.auditfile.export"].create({})