diff --git a/__init__.py b/__init__.py
index e69de29..b027b6f 100644
--- a/__init__.py
+++ b/__init__.py
@@ -0,0 +1,3 @@
+from . import dgii_mapping, tax
+
+__all__ = ['dgii_mapping', 'tax']
diff --git a/dgii_mapping.py b/dgii_mapping.py
new file mode 100644
index 0000000..53593db
--- /dev/null
+++ b/dgii_mapping.py
@@ -0,0 +1,89 @@
+from trytond.model import DeactivableMixin, ModelSQL, ModelView, fields
+
+
+DGII_FORMS = [
+ ('', ''),
+ ('606', '606 - Compras y Gastos'),
+ ('607', '607 - Ventas e Ingresos'),
+ ('608', '608 - NCF Anulados'),
+ ('609', '609 - Pagos al Exterior'),
+ ('it1', 'IT-1 - Declaracion mensual ITBIS'),
+ ('it1_annex_a', 'IT-1 Anexo A'),
+ ('ir17', 'IR-17 - Otras Retenciones y Retribuciones Complementarias'),
+ ('ir18', 'IR-18 - Dividendos'),
+ ('ir13', 'IR-13 - Retenciones del Estado'),
+ ('isc', 'ISC - Selectivo al Consumo'),
+ ('act', 'ACT - Impuesto sobre Activos'),
+ ('ir2', 'IR-2 - Impuesto sobre la Renta Personas Juridicas'),
+]
+
+DGII_AMOUNT_SOURCES = [
+ ('', ''),
+ ('tax_base', 'Base imponible'),
+ ('tax_amount', 'Monto impuesto'),
+ ('withholding_amount', 'Monto retenido'),
+ ('perception_amount', 'Monto percibido'),
+ ('account_balance', 'Saldo contable'),
+ ('informative', 'Informativo'),
+]
+
+DGII_OPERATORS = [
+ ('+', 'Suma'),
+ ('-', 'Resta'),
+ ('info', 'Informativo'),
+]
+
+DGII_FLOWS = [
+ ('', ''),
+ ('sale', 'Venta'),
+ ('purchase', 'Compra'),
+ ('payment', 'Pago o cobro'),
+ ('bank', 'Cargo bancario'),
+ ('asset', 'Transferencia de activo'),
+ ('annual', 'Declaracion anual'),
+]
+
+
+class DgiiTaxMapping(DeactivableMixin, ModelSQL, ModelView):
+ "DGII Tax Mapping"
+ __name__ = 'account.do.dgii.tax.mapping'
+
+ tax_template = fields.Many2One(
+ 'account.tax.template', 'Tax Template', required=True,
+ ondelete='CASCADE',
+ help='Impuesto de account_do que alimenta esta casilla DGII.')
+ account_template = fields.Many2One(
+ 'account.account.template', 'Account Template',
+ help='Cuenta contable principal usada como trazabilidad del mapeo.')
+ form = fields.Selection(
+ DGII_FORMS, 'DGII Form', required=True, sort=False)
+ box = fields.Char(
+ 'DGII Box', required=True, size=80,
+ help='Numero de casilla oficial o nombre tecnico del campo.')
+ box_label = fields.Char('DGII Box Label', required=True, size=180)
+ amount_source = fields.Selection(
+ DGII_AMOUNT_SOURCES, 'Amount Source', required=True, sort=False)
+ operator = fields.Selection(
+ DGII_OPERATORS, 'Operator', required=True, sort=False)
+ flow = fields.Selection(
+ DGII_FLOWS, 'Fiscal Flow', required=True, sort=False)
+ effective_from = fields.Date('Effective From')
+ effective_to = fields.Date('Effective To')
+ legal_basis = fields.Text('Legal Basis')
+ notes = fields.Text('Notes')
+
+ @staticmethod
+ def default_operator():
+ return '+'
+
+ @staticmethod
+ def default_amount_source():
+ return 'tax_amount'
+
+ @staticmethod
+ def default_flow():
+ return 'sale'
+
+ def get_rec_name(self, name):
+ return '%s %s - %s' % (
+ self.form.upper(), self.box, self.tax_template.rec_name)
diff --git a/dgii_mapping.xml b/dgii_mapping.xml
new file mode 100644
index 0000000..9006332
--- /dev/null
+++ b/dgii_mapping.xml
@@ -0,0 +1,57 @@
+
+
+
+
+ account.do.dgii.tax.mapping
+ tree
+ dgii_tax_mapping_tree
+
+
+
+ account.do.dgii.tax.mapping
+ form
+ dgii_tax_mapping_form
+
+
+
+ Mapeo DGII por Impuesto
+ account.do.dgii.tax.mapping
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.do.dgii.tax.mapping
+
+
+
+
+
+
+
+ account.do.dgii.tax.mapping
+
+
+
+
+
+
+
+
diff --git a/dgii_tax_mapping_data.xml b/dgii_tax_mapping_data.xml
new file mode 100644
index 0000000..d4037e9
--- /dev/null
+++ b/dgii_tax_mapping_data.xml
@@ -0,0 +1,623 @@
+
+
+
+
+
+
+
+
+ it1
+ 16
+ ITBIS cobrado 18%
+ tax_amount
+ +
+ sale
+ IT-1 casilla 16; Ley 11-92 arts. 335-392; Ley 253-12.
+
+
+
+
+ it1
+ 17
+ ITBIS cobrado 16%
+ tax_amount
+ +
+ sale
+ IT-1 casilla 17; tasa especial conservada para casos autorizados.
+
+
+
+
+ it1
+ 18
+ ITBIS cobrado 9% Ley 690-16
+ tax_amount
+ +
+ sale
+ IT-1 casilla 18; Ley 690-16.
+
+
+
+
+ it1
+ 19
+ ITBIS cobrado 8%
+ tax_amount
+ +
+ sale
+ IT-1 casilla 19; tasa reducida ITBIS.
+
+
+
+ it1_annex_a
+ 04
+ Operaciones exentas
+ tax_base
+ info
+ sale
+ IT-1 Anexo A; Ley 11-92 arts. 343-344.
+
+
+
+
+ it1_annex_a
+ 02
+ Exportaciones y operaciones tasa cero
+ tax_base
+ info
+ sale
+ IT-1 Anexo A; exportaciones y zonas francas.
+
+
+
+
+
+
+ it1
+ 22
+ ITBIS pagado en compras locales 18%
+ tax_amount
+ +
+ purchase
+ IT-1 casilla 22; credito fiscal ITBIS.
+
+
+
+
+ it1
+ 22
+ ITBIS pagado en compras locales 16%
+ tax_amount
+ +
+ purchase
+ IT-1 casilla 22; credito fiscal tasa especial 16%.
+
+
+
+
+ it1
+ 22
+ ITBIS pagado en compras locales 9%
+ tax_amount
+ +
+ purchase
+ IT-1 casilla 22; credito fiscal Ley 690-16.
+
+
+
+
+ it1
+ 22
+ ITBIS pagado en compras locales 8%
+ tax_amount
+ +
+ purchase
+ IT-1 casilla 22; credito fiscal tasa reducida 8%.
+
+
+
+
+
+
+ it1
+ 30
+ Pagos computables por retenciones/percepciones
+ withholding_amount
+ +
+ payment
+ IT-1 casilla 30; NG 06-23 adquirencias.
+
+
+
+
+ it1_annex_a
+ 28
+ Retenciones por transporte aereo BSP/IATA
+ withholding_amount
+ +
+ sale
+ IT-1 Anexo A pagos computables sectoriales.
+
+
+
+
+ it1_annex_a
+ 27
+ Retenciones ITBIS por sociedades
+ withholding_amount
+ +
+ sale
+ IT-1 Anexo A pagos computables por retenciones.
+
+
+
+
+ it1_annex_a
+ 30
+ Retenciones por paquetes de alojamiento
+ withholding_amount
+ +
+ sale
+ IT-1 Anexo A pagos computables sectoriales.
+
+
+
+
+ it1_annex_a
+ 31
+ Retenciones realizadas por entidades del Estado
+ withholding_amount
+ +
+ sale
+ IT-1 Anexo A pagos computables por entidades estatales.
+
+
+
+
+
+
+ it1_annex_a
+ 52
+ ITBIS retenido 30% sociedades/grandes contribuyentes
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 52.
+
+
+
+
+ it1_annex_a
+ 50
+ ITBIS por servicios sujetos a retencion 100%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 50.
+
+
+
+
+ it1_annex_a
+ 56
+ ITBIS bienes sujetos a retencion comprobante compras 18%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 56; comprobantes de compras.
+
+
+
+
+ it1_annex_a
+ 57
+ ITBIS bienes sujetos a retencion comprobante compras 16%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 57; comprobantes de compras.
+
+
+
+
+ it1_annex_a
+ 56
+ ITBIS bienes proveedor informal 100% tasa 18%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 56.
+
+
+
+
+ it1_annex_a
+ 57
+ ITBIS bienes proveedor informal 100% tasa 16%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 57.
+
+
+
+
+ it1_annex_a
+ 53
+ ITBIS retenido RST 18%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 53.
+
+
+
+
+ it1_annex_a
+ 54
+ ITBIS retenido RST 16%
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 54.
+
+
+
+
+ it1_annex_a
+ 50
+ ITBIS retenido en servicios de seguro
+ withholding_amount
+ +
+ purchase
+ IT-1 Anexo A casilla 50.
+
+
+
+
+
+
+ ir17
+ isr_services_pj_5
+ Retencion ISR servicios personas juridicas 5%
+ withholding_amount
+ +
+ purchase
+ IR-17; Art. 309 Codigo Tributario.
+
+
+
+
+ ir17
+ isr_services_pf_10
+ Retencion ISR servicios personas fisicas 10%
+ withholding_amount
+ +
+ purchase
+ IR-17; Art. 309 Codigo Tributario.
+
+
+
+
+ ir17
+ isr_rent_10
+ Retencion ISR alquileres 10%
+ withholding_amount
+ +
+ purchase
+ IR-17; Art. 309 Codigo Tributario.
+
+
+
+
+ ir17
+ isr_interest_individual_10
+ Retencion ISR intereses personas fisicas 10%
+ withholding_amount
+ +
+ payment
+ IR-17; Norma General 07-19.
+
+
+
+
+ ir17
+ isr_interest_legal_entity_1
+ Retencion ISR intereses personas juridicas 1%
+ withholding_amount
+ +
+ payment
+ IR-17; Norma General 07-19.
+
+
+
+
+ ir18
+ dividends_10
+ Retencion ISR dividendos 10%
+ withholding_amount
+ +
+ payment
+ IR-18; Art. 308 Codigo Tributario.
+
+
+
+
+ ir13
+ state_withholding_1_5
+ Retencion ISR Estado 1.5% sufrida
+ withholding_amount
+ +
+ sale
+ IR-13; retenciones del Estado.
+
+
+
+
+ ir13
+ state_withholding_5
+ Retencion ISR Estado 5% sufrida
+ withholding_amount
+ +
+ sale
+ IR-13; retenciones del Estado.
+
+
+
+
+ ir17
+ isr_bovine_meat_1
+ Retencion ISR ganaderia/carne bovina 1%
+ withholding_amount
+ +
+ purchase
+ IR-17; subsector ganaderia/carne bovina.
+
+
+
+
+ ir13
+ exporter_local_sales_2_5
+ Retencion ISR exportadores mercado local 2.5%
+ withholding_amount
+ +
+ sale
+ IR-13; retenciones a exportadores en mercado local.
+
+
+
+
+ ir17
+ isr_prizes_25
+ Retencion ISR premios 25%
+ withholding_amount
+ +
+ payment
+ IR-17; Art. 321 Codigo Tributario.
+
+
+
+
+ ir17
+ isr_prizes_10
+ Retencion ISR premios 10%
+ withholding_amount
+ +
+ payment
+ IR-17; premios por tramos.
+
+
+
+
+ ir17
+ isr_prizes_15
+ Retencion ISR premios 15%
+ withholding_amount
+ +
+ payment
+ IR-17; premios por tramos.
+
+
+
+
+ ir17
+ isr_slot_machine_prizes_10
+ Retencion ISR tragamonedas 10%
+ withholding_amount
+ +
+ payment
+ IR-17; premios maquinas tragamonedas.
+
+
+
+
+ ir17
+ isr_other_income_10
+ Retencion ISR otras rentas 10%
+ withholding_amount
+ +
+ purchase
+ IR-17; otras rentas no contempladas.
+
+
+
+
+ 609
+ isr_withheld_27
+ ISR retenido pagos al exterior 27%
+ withholding_amount
+ +
+ purchase
+ Formato 609; Arts. 305-306 Codigo Tributario.
+
+
+
+
+ 609
+ isr_withheld_10
+ ISR retenido pagos al exterior 10%
+ withholding_amount
+ +
+ purchase
+ Formato 609; intereses y asistencia tecnica al exterior.
+
+
+
+
+
+
+ isc
+ isc_alcohol_10
+ ISC bebidas alcoholicas 10%
+ tax_amount
+ +
+ sale
+ Declaracion ISC; Ley 11-92 selectivo al consumo.
+
+
+
+
+ isc
+ isc_tobacco_20
+ ISC tabaco y cigarrillos 20%
+ tax_amount
+ +
+ sale
+ Declaracion ISC; tabaco y cigarrillos.
+
+
+
+
+ isc
+ isc_telecom_10
+ ISC servicios de telecomunicaciones 10%
+ tax_amount
+ +
+ sale
+ Declaracion ISC; telecomunicaciones.
+
+
+
+
+ isc
+ isc_fossil_fuel_16
+ ISC combustibles fosiles 16%
+ tax_amount
+ +
+ sale
+ Declaracion ISC; combustibles fosiles.
+
+
+
+
+ isc
+ isc_avtur_6_5
+ ISC Avtur 6.5%
+ tax_amount
+ +
+ sale
+ Declaracion ISC; Avtur tasa reducida.
+
+
+
+
+ isc
+ isc_fuel_rd2_gallon
+ ISC adicional combustibles RD$2 por galon
+ tax_amount
+ +
+ sale
+ Declaracion ISC; adicional combustibles.
+
+
+
+
+ isc
+ isc_insurance_withholding_100
+ Retencion ISC seguros 100%
+ withholding_amount
+ +
+ purchase
+ Declaracion ISC; servicios de seguros.
+
+
+
+
+ isc
+ isc_vehicle_17
+ ISC vehiculos de motor 17%
+ tax_amount
+ +
+ asset
+ Declaracion ISC; vehiculos de motor.
+
+
+
+
+ 607
+ other_taxes
+ Otros impuestos: CDT INDOTEL 2%
+ tax_amount
+ +
+ sale
+ Formato 607; CDT Ley 153-98.
+
+
+
+
+ 607
+ legal_tip
+ Propina legal 10%
+ tax_amount
+ +
+ sale
+ Formato 607; propina legal restaurantes, bares y hoteles.
+
+
+
+
+ ir2
+ financial_expenses_check_transfer_tax_015
+ Impuesto cheques y transferencias 0.15%
+ account_balance
+ +
+ bank
+ 2026-07-02
+ IR-2 Anexo B gastos financieros; impuesto cheques/transferencias 0.15%.
+
+
+
+
+ ir2
+ financial_expenses_check_transfer_tax_020
+ Impuesto cheques y transferencias 0.20%
+ account_balance
+ +
+ bank
+ 2026-07-03
+ IR-2 Anexo B gastos financieros; tasa vigente desde 2026-07-03.
+
+
+
+
+ act
+ asset_tax_1
+ Impuesto minimo a los activos 1%
+ account_balance
+ +
+ annual
+ ACT; impuesto sobre activos.
+
+
+
+
+ ir2
+ asset_transfer_real_estate_3
+ Impuesto transferencia inmobiliaria 3%
+ account_balance
+ +
+ asset
+ IR-2 / soporte patrimonial; transferencia inmobiliaria ITI.
+
+
+
diff --git a/locale/es.po b/locale/es.po
index 79269ad..c71d3bb 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -1657,3 +1657,83 @@ msgstr "Impuesto cheques y transferencias 0.15% por pagar"
msgctxt "model:account.account.template,name:do_account_21021902"
msgid "Impuesto cheques y transferencias 0.20% por pagar"
msgstr "Impuesto cheques y transferencias 0.20% por pagar"
+
+msgctxt "field:account.do.dgii.tax.mapping,account_template:"
+msgid "Account Template"
+msgstr "Plantilla de cuenta"
+
+msgctxt "field:account.do.dgii.tax.mapping,amount_source:"
+msgid "Amount Source"
+msgstr "Fuente del importe"
+
+msgctxt "field:account.do.dgii.tax.mapping,box:"
+msgid "DGII Box"
+msgstr "Casilla DGII"
+
+msgctxt "field:account.do.dgii.tax.mapping,box_label:"
+msgid "DGII Box Label"
+msgstr "Etiqueta de casilla DGII"
+
+msgctxt "field:account.do.dgii.tax.mapping,effective_from:"
+msgid "Effective From"
+msgstr "Vigente desde"
+
+msgctxt "field:account.do.dgii.tax.mapping,effective_to:"
+msgid "Effective To"
+msgstr "Vigente hasta"
+
+msgctxt "field:account.do.dgii.tax.mapping,flow:"
+msgid "Fiscal Flow"
+msgstr "Flujo fiscal"
+
+msgctxt "field:account.do.dgii.tax.mapping,form:"
+msgid "DGII Form"
+msgstr "Formulario DGII"
+
+msgctxt "field:account.do.dgii.tax.mapping,legal_basis:"
+msgid "Legal Basis"
+msgstr "Base legal"
+
+msgctxt "field:account.do.dgii.tax.mapping,notes:"
+msgid "Notes"
+msgstr "Notas"
+
+msgctxt "field:account.do.dgii.tax.mapping,operator:"
+msgid "Operator"
+msgstr "Operador"
+
+msgctxt "field:account.do.dgii.tax.mapping,tax_template:"
+msgid "Tax Template"
+msgstr "Plantilla de impuesto"
+
+msgctxt "model:account.do.dgii.tax.mapping,string:"
+msgid "DGII Tax Mapping"
+msgstr "Mapeo DGII por impuesto"
+
+msgctxt "model:ir.action,name:act_dgii_tax_mapping"
+msgid "Mapeo DGII por Impuesto"
+msgstr "Mapeo DGII por Impuesto"
+
+msgctxt "model:ir.ui.menu,name:menu_dgii_tax_mapping"
+msgid "Mapeo DGII por Impuesto"
+msgstr "Mapeo DGII por Impuesto"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:account_balance"
+msgid "Account Balance"
+msgstr "Saldo contable"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:informative"
+msgid "Informative"
+msgstr "Informativo"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:tax_amount"
+msgid "Tax Amount"
+msgstr "Monto impuesto"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:tax_base"
+msgid "Tax Base"
+msgstr "Base imponible"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:withholding_amount"
+msgid "Withholding Amount"
+msgstr "Monto retenido"
diff --git a/locale/es_419.po b/locale/es_419.po
index 96ec3a8..a7afcaa 100644
--- a/locale/es_419.po
+++ b/locale/es_419.po
@@ -1713,3 +1713,83 @@ msgstr "Impuesto cheques y transferencias 0.15% por pagar"
msgctxt "model:account.account.template,name:do_account_21021902"
msgid "Impuesto cheques y transferencias 0.20% por pagar"
msgstr "Impuesto cheques y transferencias 0.20% por pagar"
+
+msgctxt "field:account.do.dgii.tax.mapping,account_template:"
+msgid "Account Template"
+msgstr "Plantilla de cuenta"
+
+msgctxt "field:account.do.dgii.tax.mapping,amount_source:"
+msgid "Amount Source"
+msgstr "Fuente del importe"
+
+msgctxt "field:account.do.dgii.tax.mapping,box:"
+msgid "DGII Box"
+msgstr "Casilla DGII"
+
+msgctxt "field:account.do.dgii.tax.mapping,box_label:"
+msgid "DGII Box Label"
+msgstr "Etiqueta de casilla DGII"
+
+msgctxt "field:account.do.dgii.tax.mapping,effective_from:"
+msgid "Effective From"
+msgstr "Vigente desde"
+
+msgctxt "field:account.do.dgii.tax.mapping,effective_to:"
+msgid "Effective To"
+msgstr "Vigente hasta"
+
+msgctxt "field:account.do.dgii.tax.mapping,flow:"
+msgid "Fiscal Flow"
+msgstr "Flujo fiscal"
+
+msgctxt "field:account.do.dgii.tax.mapping,form:"
+msgid "DGII Form"
+msgstr "Formulario DGII"
+
+msgctxt "field:account.do.dgii.tax.mapping,legal_basis:"
+msgid "Legal Basis"
+msgstr "Base legal"
+
+msgctxt "field:account.do.dgii.tax.mapping,notes:"
+msgid "Notes"
+msgstr "Notas"
+
+msgctxt "field:account.do.dgii.tax.mapping,operator:"
+msgid "Operator"
+msgstr "Operador"
+
+msgctxt "field:account.do.dgii.tax.mapping,tax_template:"
+msgid "Tax Template"
+msgstr "Plantilla de impuesto"
+
+msgctxt "model:account.do.dgii.tax.mapping,string:"
+msgid "DGII Tax Mapping"
+msgstr "Mapeo DGII por impuesto"
+
+msgctxt "model:ir.action,name:act_dgii_tax_mapping"
+msgid "Mapeo DGII por Impuesto"
+msgstr "Mapeo DGII por Impuesto"
+
+msgctxt "model:ir.ui.menu,name:menu_dgii_tax_mapping"
+msgid "Mapeo DGII por Impuesto"
+msgstr "Mapeo DGII por Impuesto"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:account_balance"
+msgid "Account Balance"
+msgstr "Saldo contable"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:informative"
+msgid "Informative"
+msgstr "Informativo"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:tax_amount"
+msgid "Tax Amount"
+msgstr "Monto impuesto"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:tax_base"
+msgid "Tax Base"
+msgstr "Base imponible"
+
+msgctxt "selection:account.do.dgii.tax.mapping,amount_source:withholding_amount"
+msgid "Withholding Amount"
+msgstr "Monto retenido"
diff --git a/tests/test_module.py b/tests/test_module.py
index 9882f24..ad2b40b 100644
--- a/tests/test_module.py
+++ b/tests/test_module.py
@@ -1,5 +1,6 @@
import unittest
from collections import Counter
+from datetime import date
from decimal import Decimal
from pathlib import Path
from xml.etree import ElementTree as ET
@@ -51,6 +52,7 @@ class AccountDoTestCase(ModuleTestCase):
Tax = pool.get('account.tax')
TaxCode = pool.get('account.tax.code')
TaxRule = pool.get('account.tax.rule')
+ DgiiTaxMapping = pool.get('account.do.dgii.tax.mapping')
CreateChart = pool.get('account.create_chart', type='wizard')
currency, = Currency.create([{
@@ -131,6 +133,14 @@ class AccountDoTestCase(ModuleTestCase):
('company', '=', company.id),
('kind', '=', 'purchase'),
], limit=1))
+ self.assertEqual(DgiiTaxMapping.search_count([]), 55)
+ self.assertTrue(DgiiTaxMapping.search([
+ ('tax_template', '=', ModelData.get_id(
+ 'account_do', 'do_tax_cheques_020')),
+ ('form', '=', 'ir2'),
+ ('box', '=', 'financial_expenses_check_transfer_tax_020'),
+ ('effective_from', '=', date(2026, 7, 3)),
+ ], limit=1))
self.assertTrue(Tax.search([
('company', '=', company.id),
('description', '=', 'ITBIS 18% Ventas'),
@@ -361,6 +371,52 @@ class AccountDoUnitTestCase(unittest.TestCase):
"Decimal('0.20')/100",
taxes['do_tax_cheques_020']['rate'])
+ def test_dgii_tax_mapping_formalizes_every_tax_template(self):
+ taxes = {
+ record_id: values
+ for _, record_id, model, values in _iter_xml_records('tax_do.xml')
+ if model == 'account.tax.template'
+ }
+ mappings = {
+ record_id: values
+ for _, record_id, model, values in _iter_xml_records(
+ 'dgii_tax_mapping_data.xml')
+ if model == 'account.do.dgii.tax.mapping'
+ }
+ mapped_taxes = {
+ values['tax_template'] for values in mappings.values()}
+
+ self.assertEqual(len(mappings), 55)
+ self.assertEqual(mapped_taxes, set(taxes))
+ for record_id, values in mappings.items():
+ with self.subTest(record_id=record_id):
+ self.assertTrue(values.get('form'))
+ self.assertTrue(values.get('box'))
+ self.assertTrue(values.get('box_label'))
+ self.assertTrue(values.get('amount_source'))
+ self.assertIn(values.get('operator'), {'+', '-', 'info'})
+ self.assertTrue(values.get('flow'))
+ self.assertTrue(values.get('legal_basis'))
+ tax = taxes[values['tax_template']]
+ if tax.get('type') != 'none':
+ self.assertTrue(values.get('account_template'))
+
+ by_tax = {
+ values['tax_template']: values
+ for values in mappings.values()
+ }
+ self.assertEqual(by_tax['do_tax_itbis_18_venta']['form'], 'it1')
+ self.assertEqual(by_tax['do_tax_itbis_18_venta']['box'], '16')
+ self.assertEqual(by_tax['do_tax_itbis_18_compra']['box'], '22')
+ self.assertEqual(by_tax['do_tax_itbis_exento']['form'], 'it1_annex_a')
+ self.assertEqual(by_tax['do_tax_itbis_exento']['box'], '04')
+ self.assertEqual(by_tax['do_tax_ret_itbis_75_inf']['box'], '56')
+ self.assertEqual(by_tax['do_tax_ret_isr_ext_27']['form'], '609')
+ self.assertEqual(by_tax['do_tax_cheques_015']['effective_to'],
+ '2026-07-02')
+ self.assertEqual(by_tax['do_tax_cheques_020']['effective_from'],
+ '2026-07-03')
+
def test_tax_code_templates_use_expected_signs(self):
codes = {
record_id: values
diff --git a/tryton.cfg b/tryton.cfg
index bc4b192..46b03df 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -10,9 +10,12 @@ xml:
tax_view.xml
tax_code_do.xml
tax_rule_do.xml
+ dgii_mapping.xml
+ dgii_tax_mapping_data.xml
[register]
model:
+ dgii_mapping.DgiiTaxMapping
tax.TaxTemplate
tax.Tax
tax.TaxCode
diff --git a/view/dgii_tax_mapping_form.xml b/view/dgii_tax_mapping_form.xml
new file mode 100644
index 0000000..13bb729
--- /dev/null
+++ b/view/dgii_tax_mapping_form.xml
@@ -0,0 +1,29 @@
+
+
diff --git a/view/dgii_tax_mapping_tree.xml b/view/dgii_tax_mapping_tree.xml
new file mode 100644
index 0000000..6cc5a7e
--- /dev/null
+++ b/view/dgii_tax_mapping_tree.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+