Skip to content

Commit

Permalink
[MIG] l10n_es_aeat_mod123: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelregidor committed Apr 17, 2024
1 parent 1e2c149 commit 04f4bf4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 60 deletions.
6 changes: 4 additions & 2 deletions l10n_es_aeat_mod123/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand All @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,model,date_from,date_to
aeat_mod123_map,123,,
3 changes: 3 additions & 0 deletions l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.csv
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions l10n_es_aeat_mod123/data/l10n.es.aeat.map.tax.line.tax.csv
Original file line number Diff line number Diff line change
@@ -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
34 changes: 0 additions & 34 deletions l10n_es_aeat_mod123/data/tax_code_map_mod123.xml

This file was deleted.

14 changes: 0 additions & 14 deletions l10n_es_aeat_mod123/models/mod123.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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",
Expand All @@ -74,8 +62,6 @@ class L10nEsAeatMod123Report(models.Model):
("N", "Negativa"),
],
string="Tipo de declaración",
readonly=True,
states={"draft": [("readonly", False)]},
required=True,
)

Expand Down
4 changes: 3 additions & 1 deletion l10n_es_aeat_mod123/tests/test_l10n_es_aeat_mod123.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
19 changes: 10 additions & 9 deletions l10n_es_aeat_mod123/views/mod123_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,39 @@
<field name="inherit_id" ref="l10n_es_aeat.view_l10n_es_aeat_report_form" />
<field name="arch" type="xml">
<field name="previous_number" position="after">
<field name="tipo_declaracion" />
<field name="tipo_declaracion" readonly="state != 'draft'" />
</field>
<group name="group_declaration" position="after">
<group
string="Resultado"
colspan="4"
states="calculated,done,cancelled"
invisible="state not in ['calculated','done','cancelled']"
>
<group string="Retenciones e ingresos a cuenta">
<field name="casilla_01" />
<field name="casilla_01" readonly="state != 'calculated'" />
<field
name="casilla_02"
readonly="state != 'calculated'"
widget="monetary"
options="{'currency_field': 'currency_id'}"
/>
<field
name="casilla_03"
readonly="state != 'calculated'"
widget="monetary"
options="{'currency_field': 'currency_id'}"
/>
</group>
<group string="Periodificación">
<field
name="casilla_04"
readonly="state != 'calculated'"
widget="monetary"
options="{'currency_field': 'currency_id'}"
/>
<field
name="casilla_05"
readonly="state != 'calculated'"
widget="monetary"
options="{'currency_field': 'currency_id'}"
/>
Expand All @@ -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'"
/>
<field
name="casilla_08"
Expand All @@ -58,15 +62,12 @@
/>
</group>
</group>
<separator
string="Tax lines"
attrs="{'invisible': [('state', '=', 'draft')]}"
/>
<separator string="Tax lines" invisible="state == 'draft'" />
<field
name="tax_line_ids"
nolabel="1"
readonly="1"
attrs="{'invisible': [('state', '=', 'draft')]}"
invisible="state == 'draft'"
/>
</group>
<form position="inside">
Expand Down

0 comments on commit 04f4bf4

Please sign in to comment.