diff --git a/l10n_es_aeat_mod123/__manifest__.py b/l10n_es_aeat_mod123/__manifest__.py
index 28d6643622e..c4eb797221c 100644
--- a/l10n_es_aeat_mod123/__manifest__.py
+++ b/l10n_es_aeat_mod123/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "AEAT modelo 123",
- "version": "16.0.1.0.2",
+ "version": "17.0.1.0.0",
"category": "Localisation/Accounting",
"author": "Tecnativa, "
"Spanish Localization Team, "
@@ -13,7 +13,9 @@
"depends": ["l10n_es", "l10n_es_aeat"],
"data": [
"data/aeat_export_mod123_data.xml",
- "data/tax_code_map_mod123.xml",
+ "data/l10n.es.aeat.map.tax.csv",
+ "data/l10n.es.aeat.map.tax.line.tax.csv", # This one should be before the next
+ "data/l10n.es.aeat.map.tax.line.csv",
"views/mod123_view.xml",
"security/ir.model.access.csv",
"security/mod_123_security.xml",
diff --git a/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.csv b/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.csv
new file mode 100644
index 00000000000..eb21a8adaf5
--- /dev/null
+++ b/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.csv
@@ -0,0 +1,2 @@
+id,model,date_from,date_to
+aeat_mod123_map,123,,
diff --git a/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.csv b/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.csv
new file mode 100644
index 00000000000..00beab44569
--- /dev/null
+++ b/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.csv
@@ -0,0 +1,3 @@
+id,field_number,field_type,inverse,map_parent_id:id,name,sum_type,account_xmlid_ids/id,tax_xmlid_ids/id
+aeat_mod123_map_line_02,02,base,True,aeat_mod123_map,Base retenciones,both,,"p_rp19,p_rrD19,p_irpf24_rdc"
+aeat_mod123_map_line_03,03,amount,False,aeat_mod123_map,Retenciones,credit,,"p_rp19,p_rrD19,p_irpf24_rdc"
diff --git a/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.tax.csv b/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.tax.csv
new file mode 100644
index 00000000000..315a650f62e
--- /dev/null
+++ b/l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.tax.csv
@@ -0,0 +1,4 @@
+id,name
+p_rp19,account_tax_template_p_rp19
+p_rrD19,account_tax_template_p_rrD19
+p_irpf24_rdc,account_tax_template_p_irpf24_rdc
diff --git a/l10n_es_aeat_mod123/data/tax_code_map_mod123.xml b/l10n_es_aeat_mod123/data/tax_code_map_mod123.xml
deleted file mode 100644
index bd5c4ee2e17..00000000000
--- a/l10n_es_aeat_mod123/data/tax_code_map_mod123.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
- 123
-
-
-
- 02
- Base retenciones
-
- regular
- base
- both
-
-
-
-
-
- 03
- Retenciones
-
- regular
- amount
- credit
-
-
-
-
diff --git a/l10n_es_aeat_mod123/models/mod123.py b/l10n_es_aeat_mod123/models/mod123.py
index 12030e585fe..420d2d3f117 100644
--- a/l10n_es_aeat_mod123/models/mod123.py
+++ b/l10n_es_aeat_mod123/models/mod123.py
@@ -13,32 +13,22 @@ class L10nEsAeatMod123Report(models.Model):
number = fields.Char(default="123")
casilla_01 = fields.Integer(
string="[01] Número de perceptores",
- readonly=True,
- states={"calculated": [("readonly", False)]},
help="Casilla [01] Número de perceptores",
)
casilla_02 = fields.Float(
string="[02] Base retenciones",
- readonly=True,
- states={"calculated": [("readonly", False)]},
help="Casilla [02] Base de la retención y/o del ingreso a cuenta",
)
casilla_03 = fields.Float(
string="[03] Retenciones",
- readonly=True,
- states={"calculated": [("readonly", False)]},
help="Casilla [03] Retenciones e ingresos a cuenta",
)
casilla_04 = fields.Float(
string="[04] Ingresos ejercicios anteriores",
- readonly=True,
- states={"calculated": [("readonly", False)]},
help="Casilla [04] Periodificación - Ingresos ejercicios anteriores",
)
casilla_05 = fields.Float(
string="[05] Regularización",
- readonly=True,
- states={"calculated": [("readonly", False)]},
help="Casilla [05] Periodificación - Regularización",
)
casilla_06 = fields.Float(
@@ -50,8 +40,6 @@ class L10nEsAeatMod123Report(models.Model):
)
casilla_07 = fields.Float(
string="[07] Ingresos ejercicios anteriores",
- readonly=True,
- states={"calculated": [("readonly", False)]},
help="Casilla [07] A deducir (exclusivamente en caso de declaración "
"complementaria) Resultados a ingresar de anteriores "
"declaraciones por el mismo concepto, ejercicio y período",
@@ -74,8 +62,6 @@ class L10nEsAeatMod123Report(models.Model):
("N", "Negativa"),
],
string="Tipo de declaración",
- readonly=True,
- states={"draft": [("readonly", False)]},
required=True,
)
diff --git a/l10n_es_aeat_mod123/tests/test_l10n_es_aeat_mod123.py b/l10n_es_aeat_mod123/tests/test_l10n_es_aeat_mod123.py
index 80f0bb2943c..c610c65c78b 100644
--- a/l10n_es_aeat_mod123/tests/test_l10n_es_aeat_mod123.py
+++ b/l10n_es_aeat_mod123/tests/test_l10n_es_aeat_mod123.py
@@ -68,7 +68,9 @@ def test_model_123(self):
# Check tax lines
for box, result in self.taxes_result.items():
_logger.debug("Checking tax line: %s" % box)
- lines = model123.tax_line_ids.filtered(lambda x: x.field_number == int(box))
+ lines = model123.tax_line_ids.filtered(
+ lambda x, box=box: x.field_number == int(box)
+ )
self.assertAlmostEqual(sum(lines.mapped("amount")), result, 2)
# Check result
_logger.debug("Checking results")
diff --git a/l10n_es_aeat_mod123/views/mod123_view.xml b/l10n_es_aeat_mod123/views/mod123_view.xml
index 6ada585a9b8..f9ae207d52f 100644
--- a/l10n_es_aeat_mod123/views/mod123_view.xml
+++ b/l10n_es_aeat_mod123/views/mod123_view.xml
@@ -6,23 +6,25 @@
-
+
-
+
@@ -30,11 +32,13 @@
@@ -49,7 +53,7 @@
name="casilla_07"
widget="monetary"
options="{'currency_field': 'currency_id'}"
- attrs="{'readonly': ['|', ('state', '!=', 'calculated'), ('statement_type', '!=', 'C')]}"
+ readonly="state != 'calculated' or statement_type != 'C'"
/>
-
+