-
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] l10n_es_aeat_sii_oss: Migration to 16.0
- Loading branch information
Javier Iniesta
committed
Jun 28, 2023
1 parent
de12ab2
commit 3b66181
Showing
2 changed files
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# Copyright 2021 FactorLibre - Rodrigo Bonilla <[email protected]> | ||
# Copyright 2021 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.tests import Form | ||
|
||
from odoo.addons.l10n_es_aeat_sii_oca.tests.test_l10n_es_aeat_sii import ( | ||
TestL10nEsAeatSiiBase, | ||
) | ||
|
@@ -12,7 +9,7 @@ | |
class TestL10nEsAeatSiiBaseOss(TestL10nEsAeatSiiBase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(TestL10nEsAeatSiiBaseOss, cls).setUpClass() | ||
super().setUpClass() | ||
account_fiscal_position_env = cls.env["account.fiscal.position"] | ||
xml_id = "%s_account_tax_template_s_oss20" % cls.company.id | ||
cls.tax_fr_20 = cls._get_or_create_tax(xml_id, "Test tax 20%", "sale", 20) | ||
|
@@ -35,19 +32,25 @@ def setUpClass(cls): | |
|
||
def test_invoice_sii_oss(self): | ||
self.partner.sii_simplified_invoice = True | ||
invoice_form = Form( | ||
self.env["account.move"].with_context(default_move_type="out_invoice") | ||
) | ||
invoice_form.partner_id = self.partner | ||
invoice_form.invoice_date = "2021-07-01" | ||
invoice_form.fiscal_position_id = self.fpos_fr_id | ||
with invoice_form.invoice_line_ids.new() as line_form: | ||
line_form.product_id = self.product | ||
line_form.price_unit = 100 | ||
line_form.quantity = 1 | ||
line_form.tax_ids.clear() | ||
line_form.tax_ids.add(self.tax_fr_20) | ||
invoice = invoice_form.save() | ||
invoice_vals = { | ||
"move_type": "out_invoice", | ||
"partner_id": self.partner.id, | ||
"invoice_date": "2021-07-01", | ||
"fiscal_position_id": self.fpos_fr_id.id, | ||
"invoice_line_ids": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"product_id": self.product.id, | ||
"price_unit": 100, | ||
"quantity": 1, | ||
"tax_ids": [(6, 0, [self.tax_fr_20.id])], | ||
}, | ||
) | ||
], | ||
} | ||
invoice = self.env["account.move"].create(invoice_vals) | ||
res = invoice._get_sii_invoice_dict() | ||
res_issue = res["FacturaExpedida"] | ||
self.assertEqual(res_issue["ImporteTotal"], 100) |