Fase produccion: alinear plantilla fiscal con campos de impuestos

Actualiza invoice.fodt para usar itbis_invoiced_line y tip_invoiced tras la normalizacion de campos. Agrega prueba de regresion para evitar referencias al campo heredado itbis_line.
This commit is contained in:
José Arturo García
2026-07-23 18:42:45 -04:00
parent 5140cb4845
commit fb8f108216
2 changed files with 17 additions and 7 deletions
+7 -7
View File
@@ -1750,7 +1750,7 @@
<text:p text:style-name="P49"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p> <text:p text:style-name="P49"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name="Table1.E5" office:value-type="string"> <table:table-cell table:style-name="Table1.E5" office:value-type="string">
<text:p text:style-name="P50"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.itbis_line, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p> <text:p text:style-name="P50"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.itbis_invoiced_line, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
<table:table-row> <table:table-row>
@@ -2046,7 +2046,7 @@
</table:table-row> </table:table-row>
<table:table-row table:style-name="Table4.2"> <table:table-row table:style-name="Table4.2">
<table:table-cell table:style-name="Table4.A2" table:number-columns-spanned="2" office:value-type="string"> <table:table-cell table:style-name="Table4.A2" table:number-columns-spanned="2" office:value-type="string">
<text:p text:style-name="P45"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.tip &gt; 0&quot;&gt;</text:placeholder></text:p> <text:p text:style-name="P45"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.tip_invoiced &gt; 0&quot;&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
<table:covered-table-cell/> <table:covered-table-cell/>
</table:table-row> </table:table-row>
@@ -2055,7 +2055,7 @@
<text:p text:style-name="P73">Propina:</text:p> <text:p text:style-name="P73">Propina:</text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name="Table4.B12" office:value-type="string"> <table:table-cell table:style-name="Table4.B12" office:value-type="string">
<text:p text:style-name="P71"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.tip, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p> <text:p text:style-name="P71"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.tip_invoiced, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
<table:table-row table:style-name="Table4.1"> <table:table-row table:style-name="Table4.1">
@@ -2539,7 +2539,7 @@
<text:p text:style-name="P49"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p> <text:p text:style-name="P49"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name="Table5.E5" office:value-type="string"> <table:table-cell table:style-name="Table5.E5" office:value-type="string">
<text:p text:style-name="P50"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.itbis_line, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p> <text:p text:style-name="P50"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.itbis_invoiced_line, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
<table:table-row> <table:table-row>
@@ -2835,7 +2835,7 @@
</table:table-row> </table:table-row>
<table:table-row table:style-name="Table13.2"> <table:table-row table:style-name="Table13.2">
<table:table-cell table:style-name="Table13.A2" table:number-columns-spanned="2" office:value-type="string"> <table:table-cell table:style-name="Table13.A2" table:number-columns-spanned="2" office:value-type="string">
<text:p text:style-name="P45"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.tip &gt; 0&quot;&gt;</text:placeholder></text:p> <text:p text:style-name="P45"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.tip_invoiced &gt; 0&quot;&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
<table:covered-table-cell/> <table:covered-table-cell/>
</table:table-row> </table:table-row>
@@ -2844,7 +2844,7 @@
<text:p text:style-name="P73">Propina:</text:p> <text:p text:style-name="P73">Propina:</text:p>
</table:table-cell> </table:table-cell>
<table:table-cell table:style-name="Table13.B12" office:value-type="string"> <table:table-cell table:style-name="Table13.B12" office:value-type="string">
<text:p text:style-name="P71"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.cdt_invoiced, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p> <text:p text:style-name="P71"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.tip_invoiced, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
<table:table-row table:style-name="Table13.1"> <table:table-row table:style-name="Table13.1">
@@ -3258,4 +3258,4 @@
<text:p text:style-name="P53"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p> <text:p text:style-name="P53"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</office:text> </office:text>
</office:body> </office:body>
</office:document> </office:document>
+10
View File
@@ -1,5 +1,6 @@
import datetime import datetime
from decimal import Decimal from decimal import Decimal
from pathlib import Path
from types import SimpleNamespace from types import SimpleNamespace
import unittest import unittest
@@ -221,6 +222,15 @@ del ModuleTestCase
class NcfManagerUnitTestCase(unittest.TestCase): class NcfManagerUnitTestCase(unittest.TestCase):
def test_invoice_report_uses_current_tax_field_names(self):
path = Path(__file__).parents[1] / 'invoice.fodt'
template = path.read_text(encoding='utf-8')
self.assertNotIn('line.itbis_line', template)
self.assertEqual(template.count('line.itbis_invoiced_line'), 2)
self.assertEqual(template.count('if test=&quot;invoice.tip_invoiced'), 2)
self.assertEqual(template.count('format_currency(invoice.tip_invoiced'), 2)
def test_sequence_defaults_match_ncf_type(self): def test_sequence_defaults_match_ncf_type(self):
sequence = SimpleNamespace( sequence = SimpleNamespace(
sequence_type=SimpleNamespace(name='Factura de Crédito Fiscal')) sequence_type=SimpleNamespace(name='Factura de Crédito Fiscal'))