diff --git a/l10n_it_fatturapa_out/tests/fatturapa_common.py b/l10n_it_fatturapa_out/tests/fatturapa_common.py index f2ffcaa5b4ce..c9f6f4eb436a 100644 --- a/l10n_it_fatturapa_out/tests/fatturapa_common.py +++ b/l10n_it_fatturapa_out/tests/fatturapa_common.py @@ -233,28 +233,12 @@ def getFile(self, filename, module_name=None): return self.getFilePath(path) def _create_invoice(self): - return self.invoice_model.create( - { - "name": "Test Invoice", - "journal_id": self.sales_journal.id, - "partner_id": self.res_partner_fatturapa_0.id, - "move_type": "out_invoice", - "invoice_line_ids": [ - ( - 0, - 0, - { - "account_id": self.a_sale.id, - "product_id": self.product_product_10.id, - "name": self.product_product_10.name, - "quantity": 1, - "price_unit": 1, - "tax_ids": [(6, 0, {self.tax_22.id})], - }, - ), - ], - } + invoice = self.init_invoice( + "out_invoice", + partner=self.res_partner_fatturapa_0, + products=self.product_product_10, ) + return invoice def _create_e_invoice(self): invoice = self._create_invoice() diff --git a/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py b/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py index 2ee5b78cea73..ac64e1e76a64 100644 --- a/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py +++ b/l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py @@ -947,3 +947,15 @@ def test_trasmittente_xml_export(self): self.set_e_invoice_file_id(attachment, "IT03297040366_00019.xml") xml_content = base64.decodebytes(attachment.datas) self.check_content(xml_content, "IT03297040366_00019.xml") + + def test_validate_invoice(self): + """ + Check that the invoice used for tests + is posted when validated. + """ + invoice = self._create_invoice() + self.assertEqual(invoice.state, "draft") + + invoice.action_post() + + self.assertEqual(invoice.state, "posted")