Skip to content

Commit e715471

Browse files
committed
test_coverage
1 parent b873190 commit e715471

File tree

4 files changed

+142
-0
lines changed

4 files changed

+142
-0
lines changed

l10n_es_verifactu_oca/tests/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ def setUpClass(cls):
2121
cls.fp_registration_key_01 = cls.env.ref(
2222
"l10n_es_verifactu_oca.verifactu_registration_keys_01"
2323
)
24+
cls.fp_registration_key_02 = cls.env.ref(
25+
"l10n_es_verifactu_oca.verifactu_registration_keys_02"
26+
)
2427
cls.fp_nacional.verifactu_registration_key = cls.fp_registration_key_01
2528
cls.fp_recargo = cls.env.ref(f"l10n_es.{cls.company.id}_fp_recargo")
2629
cls.fp_recargo.verifactu_registration_key = cls.fp_registration_key_01
30+
cls.fp_extra = cls.env.ref(f"l10n_es.{cls.company.id}_fp_extra")
31+
cls.fp_extra.verifactu_registration_key = cls.fp_registration_key_02
2732
cls.partner = cls.env["res.partner"].create(
2833
{
2934
"name": "Test partner",
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"RegistroAlta": {
3+
"IDVersion": 1.0,
4+
"IDFactura": {
5+
"IDEmisorFactura": "G87846952",
6+
"NumSerieFactura": "TEST_NO_EXEMPT_001",
7+
"FechaExpedicionFactura": "01-01-2026"
8+
},
9+
"NombreRazonEmisor": "Spanish test company",
10+
"TipoFactura": "F1",
11+
"DescripcionOperacion": "/",
12+
"Destinatarios": {
13+
"IDDestinatario": {
14+
"NombreRazon": "Test partner",
15+
"NIF": "89890001K"
16+
}
17+
},
18+
"Desglose": {
19+
"DetalleDesglose": [
20+
{
21+
"Impuesto": "01",
22+
"ClaveRegimen": "02",
23+
"CalificacionOperacion": "N1",
24+
"BaseImponibleOimporteNoSujeto": 100.0
25+
}
26+
]
27+
},
28+
"CuotaTotal": 0.0,
29+
"ImporteTotal": 100.0,
30+
"Encadenamiento": {
31+
"PrimerRegistro": "S"
32+
},
33+
"SistemaInformatico": {
34+
"NombreRazon": "Odoo Developer",
35+
"NIF": "A12345674",
36+
"NombreSistemaInformatico": "odoo",
37+
"IdSistemaInformatico": "11",
38+
"Version": "1.0",
39+
"NumeroInstalacion": 1,
40+
"TipoUsoPosibleSoloVerifactu": "S",
41+
"TipoUsoPosibleMultiOT": "S",
42+
"IndicadorMultiplesOT": "N",
43+
"IDOtro": {
44+
"IDType": "",
45+
"ID": ""
46+
}
47+
}
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"RegistroAlta": {
3+
"IDVersion": 1.0,
4+
"IDFactura": {
5+
"IDEmisorFactura": "G87846952",
6+
"NumSerieFactura": "TEST_EXEMPT_001",
7+
"FechaExpedicionFactura": "01-01-2026"
8+
},
9+
"NombreRazonEmisor": "Spanish test company",
10+
"TipoFactura": "F1",
11+
"DescripcionOperacion": "/",
12+
"Destinatarios": {
13+
"IDDestinatario": {
14+
"NombreRazon": "Test partner",
15+
"NIF": "89890001K"
16+
}
17+
},
18+
"Desglose": {
19+
"DetalleDesglose": [
20+
{
21+
"Impuesto": "01",
22+
"ClaveRegimen": "02",
23+
"BaseImponibleOimporteNoSujeto": 200.0,
24+
"OperacionExenta": "E5"
25+
}
26+
]
27+
},
28+
"CuotaTotal": 0.0,
29+
"ImporteTotal": 200.0,
30+
"Encadenamiento": {
31+
"PrimerRegistro": "S"
32+
},
33+
"SistemaInformatico": {
34+
"NombreRazon": "Odoo Developer",
35+
"NIF": "A12345674",
36+
"NombreSistemaInformatico": "odoo",
37+
"IdSistemaInformatico": "11",
38+
"Version": "1.0",
39+
"NumeroInstalacion": 1,
40+
"TipoUsoPosibleSoloVerifactu": "S",
41+
"TipoUsoPosibleMultiOT": "S",
42+
"IndicadorMultiplesOT": "N",
43+
"IDOtro": {
44+
"IDType": "",
45+
"ID": ""
46+
}
47+
}
48+
}
49+
}

l10n_es_verifactu_oca/tests/test_10n_es_verifactu.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,45 @@ def test_verifactu_start_date(self):
167167
self.company.verifactu_start_date = False
168168
self.assertTrue(invoice2.verifactu_enabled)
169169

170+
def test_verifactu_export_invoice_data(self):
171+
mapping = [
172+
(
173+
"TEST_NO_EXEMPT_001",
174+
"out_invoice",
175+
[(100, ["s_iva0_e"])],
176+
{
177+
"fiscal_position_id": self.fp_extra.id,
178+
"verifactu_registration_key": self.fp_registration_key_02.id,
179+
"verifactu_registration_date": "2026-01-01 19:20:30",
180+
},
181+
)
182+
]
183+
for name, inv_type, lines, extra_vals in mapping:
184+
self._create_and_test_invoice_verifactu_dict(
185+
name, inv_type, lines, extra_vals
186+
)
187+
188+
def test_verifactu_export_with_exemption_invoice_data(self):
189+
# set exemption cause and test again
190+
self.fp_extra.verifactu_exemption_cause = "E5"
191+
mapping = [
192+
(
193+
"TEST_EXEMPT_001",
194+
"out_invoice",
195+
[(200, ["s_iva_e"])],
196+
{
197+
"fiscal_position_id": self.fp_extra.id,
198+
"verifactu_registration_key": self.fp_registration_key_02.id,
199+
"verifactu_registration_date": "2026-01-01 19:20:30",
200+
},
201+
)
202+
]
203+
for name, inv_type, lines, extra_vals in mapping:
204+
self._create_and_test_invoice_verifactu_dict(
205+
name, inv_type, lines, extra_vals
206+
)
207+
return
208+
170209

171210
class TestL10nEsAeatVerifactuQR(TestVerifactuCommon):
172211
def _get_required_qr_params(self):

0 commit comments

Comments
 (0)