Skip to content

Commit

Permalink
[MIG] l10n_es_aeat_mod592: Migration to 17.0
Browse files Browse the repository at this point in the history
TT52330
  • Loading branch information
victoralmau authored and pedrobaeza committed Mar 9, 2025
1 parent 399066b commit b9cab9e
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 154 deletions.
66 changes: 37 additions & 29 deletions l10n_es_aeat_mod592/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ AEAT modelo 592
!! source digest: sha256:e97c74fdaa1e3e0a604a1ca357765eaabc9b8899b4ed6c24e530bbf7c23b2d99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
Expand All @@ -35,8 +35,8 @@ Informe -> Declaraciones AEAT -> AEAT 592 Model.

Es posible visualizar e imprimir por separado:

- Registro de asientos con productos en impuestos al plástico de los
asquirientes
- Registro de asientos con productos en impuestos al plástico de los
asquirientes

Es posible exportar los registros a archivo con extensión csv para subir
a la web de la AEAT.
Expand All @@ -51,11 +51,11 @@ Configuration

Se ha de confirgurar los tipos y pesos en la ficha del producto.

- Si tiene impuesto al plástico.
- Peso del plástico
- Tipo de clave del producto
- Concepto del producto
- Regimen fiscal
- Si tiene impuesto al plástico.
- Peso del plástico
- Tipo de clave del producto
- Concepto del producto
- Regimen fiscal

El código de producto y nombre se capturan de forma automática de la
ficha del producto
Expand All @@ -65,12 +65,12 @@ Usage

Para instalar este modulo necesitas:

- account
- stock
- l10n_es
- l10n_es_aeat
- report_xlsx
- report_csv
- account
- stock
- l10n_es
- l10n_es_aeat
- report_xlsx
- report_csv

Se instalan automáticamente si están disponibles en la lista de addons.

Expand All @@ -84,15 +84,15 @@ nivel de compañía (pestaña AEAT).
Known issues / Roadmap
======================

- Los movimientos que involucran adquisicion de plastico no reciclable
no se buscan por su fecha de factura, o día 15 del mes siguiente como
muy tarde. Solo se buscan en la fecha en que el movimiento quedó
realizado.
- No se contempla el caso de Fabricantes. Eso debe venir en un módulo
aparte con dependencia de mrp, y tener una fuerte trazabilidad de
cada quant para contemplar todos los casos de la ley.
- No se contempla el tratamiento de Canarias: Si el producto es
adquirido en Canarias con destino a la Península, debe tributar.
- Los movimientos que involucran adquisicion de plastico no reciclable
no se buscan por su fecha de factura, o día 15 del mes siguiente como
muy tarde. Solo se buscan en la fecha en que el movimiento quedó
realizado.
- No se contempla el caso de Fabricantes. Eso debe venir en un módulo
aparte con dependencia de mrp, y tener una fuerte trazabilidad de cada
quant para contemplar todos los casos de la ley.
- No se contempla el tratamiento de Canarias: Si el producto es
adquirido en Canarias con destino a la Península, debe tributar.

Bug Tracker
===========
Expand All @@ -116,12 +116,12 @@ Authors
Contributors
------------

- Nicolás Ramos (Binhex) <[email protected]>
- Javier Colmenero (Comunitea) <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:
- Nicolás Ramos (Binhex) <[email protected]>
- Javier Colmenero (Comunitea) <[email protected]>
- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez
- Pedro M. Baeza
- Víctor Martínez
- Pedro M. Baeza

Maintainers
-----------
Expand All @@ -136,6 +136,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_aeat_mod592>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 4 additions & 2 deletions l10n_es_aeat_mod592/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
"name": "AEAT modelo 592",
"version": "15.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Accounting",
"author": "Tecnativa, Binhex System Solutions, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-spain",
Expand All @@ -15,6 +15,7 @@
"data/ir_sequence_data.xml",
"security/aeat_security.xml",
"security/ir.model.access.csv",
"views/product_product_views.xml",
"views/product_template_views.xml",
"views/res_partner_views.xml",
"views/mod592_views.xml",
Expand All @@ -25,6 +26,7 @@
"report/common_templates.xml",
"report/report_views.xml",
],
"development_status": "Beta",
"development_status": "Production/Stable",
"maintainers": ["victoralmau"],
"installable": True,
}
3 changes: 0 additions & 3 deletions l10n_es_aeat_mod592/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,3 @@ msgstr "Año"
#: model:ir.actions.report,print_report_name:l10n_es_aeat_mod592.l10n_es_aeat_mod592_xlsx_man
msgid "object.get_report_file_name()"
msgstr "object.get_report_file_name()"

#~ msgid "Mod592 CSV report"
#~ msgstr "CSV del informe Mod592"
5 changes: 2 additions & 3 deletions l10n_es_aeat_mod592/models/mod592.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def calculate(self):
acquirer_lines = []
for sm in item._get_acquirer_moves():
acquirer_line = item.acquirer_line_ids.filtered(
lambda x: x.stock_move_id == sm
lambda x, sm=sm: x.stock_move_id == sm
)
acquirer_vals = {"stock_move_id": sm.id}
if acquirer_line:
Expand All @@ -324,15 +324,14 @@ def calculate(self):
manufacturer_lines = []
for sm in item._get_manufacturer_moves():
manufacturer_line = item.manufacturer_line_ids.filtered(

Check warning on line 326 in l10n_es_aeat_mod592/models/mod592.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_aeat_mod592/models/mod592.py#L326

Added line #L326 was not covered by tests
lambda x: x.stock_move_id == sm
lambda x, sm=sm: x.stock_move_id == sm
)
m_vals = {"stock_move_id": sm.id}

Check warning on line 329 in l10n_es_aeat_mod592/models/mod592.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_aeat_mod592/models/mod592.py#L329

Added line #L329 was not covered by tests
if manufacturer_line:
manufacturer_lines.append((1, manufacturer_line.id, m_vals))

Check warning on line 331 in l10n_es_aeat_mod592/models/mod592.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_aeat_mod592/models/mod592.py#L331

Added line #L331 was not covered by tests
else:
manufacturer_lines.append((0, 0, m_vals))

Check warning on line 333 in l10n_es_aeat_mod592/models/mod592.py

View check run for this annotation

Codecov / codecov/patch

l10n_es_aeat_mod592/models/mod592.py#L333

Added line #L333 was not covered by tests
item.manufacturer_line_ids = manufacturer_lines
item.recompute()
return res

def button_recover(self):
Expand Down
8 changes: 4 additions & 4 deletions l10n_es_aeat_mod592/models/mod592_manufacturer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ class L10nEsAeatmod592LineManufacturer(models.Model):
(
"3",
_(
"""(3) Return of products for destruction or reincorporation into the
manufacturing process"""
"(3) Return of products for destruction or reincorporation into "
"the manufacturing process"
),
),
("4", _("(4) Delivery or making available of the products accounted for")),
(
"5",
_(
"""(5) Other cancellations of the products accounted for other than
their delivery or availability"""
"(5) Other cancellations of the products accounted for other than "
"their delivery or availability"
),
),
],
Expand Down
19 changes: 12 additions & 7 deletions l10n_es_aeat_mod592/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">AEAT modelo 592</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e97c74fdaa1e3e0a604a1ca357765eaabc9b8899b4ed6c24e530bbf7c23b2d99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_aeat_mod592"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_aeat_mod592"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_aeat_mod592"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_aeat_mod592"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Módulo que calcula el impuesto al plástico Mod592.</p>
<p>Esto módulo introduce el menú “AEAT 592 Model” en Contabilidad -&gt;
Informe -&gt; Declaraciones AEAT -&gt; AEAT 592 Model.</p>
Expand Down Expand Up @@ -433,8 +434,8 @@ <h1><a class="toc-backref" href="#toc-entry-3">Known issues / Roadmap</a></h1>
muy tarde. Solo se buscan en la fecha en que el movimiento quedó
realizado.</li>
<li>No se contempla el caso de Fabricantes. Eso debe venir en un módulo
aparte con dependencia de mrp, y tener una fuerte trazabilidad de
cada quant para contemplar todos los casos de la ley.</li>
aparte con dependencia de mrp, y tener una fuerte trazabilidad de cada
quant para contemplar todos los casos de la ley.</li>
<li>No se contempla el tratamiento de Canarias: Si el producto es
adquirido en Canarias con destino a la Península, debe tributar.</li>
</ul>
Expand Down Expand Up @@ -471,10 +472,14 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_aeat_mod592">OCA/l10n-spain</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
Expand Down
32 changes: 13 additions & 19 deletions l10n_es_aeat_mod592/tests/test_l10n_es_aeat_mod592.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
_logger = logging.getLogger("aeat.592")


@freeze_time("2024-01-01", tick=True)
class TestL10nEsAeatMod592(TestL10nEsAeatModBase):
# Set 'debug' attribute to True to easy debug this test
# Do not forget to include '--log-handler aeat:DEBUG' in Odoo command line
Expand Down Expand Up @@ -110,11 +109,10 @@ def test_plastic_weight_non_recyclable(self):
self.product_a.write({"plastic_weight_non_recyclable": 12})
self.product_a.plastic_weight_non_recyclable = 8

@freeze_time("2024-01-01", tick=True)
def test_model_592(self):
self.picking.action_confirm()
res = self.picking.button_validate()
wizard = self.env[res["res_model"]].with_context(**res["context"]).create({})
wizard.process()
self.picking.button_validate()
self.model592.calculate()
acquirer_lines = self.model592.acquirer_line_ids
self.assertEqual(self.model592.total_acquirer_entries, 2)
Expand Down Expand Up @@ -208,9 +206,9 @@ def test_model_592(self):
self.assertTrue(self.model592.get_report_file_name())
# export_csv_acquirer
csv_result_acquirer = self.model592.export_csv_acquirer()
res = self.report_obj._get_report_from_name(
csv_result_acquirer["report_name"]
)._render(self.model592.ids, {})
res = self.report_obj._render(
csv_result_acquirer["report_name"], self.model592.ids, {}
)
str_io = StringIO(res[0])
csv_lines_acquirer = list(
csv.DictReader(str_io, delimiter=";", quoting=csv.QUOTE_ALL)
Expand All @@ -222,9 +220,9 @@ def test_model_592(self):
self.assertIn(self.picking.name, csv_line_1_acquirer)
# export_csv_manufacturer
csv_result_manufacturer = self.model592.export_csv_manufacturer()
res = self.report_obj._get_report_from_name(
csv_result_manufacturer["report_name"]
)._render(self.model592.ids, {})
res = self.report_obj._render(
csv_result_manufacturer["report_name"], self.model592.ids, {}
)
str_io = StringIO(res[0])
csv_lines_manufacturer = list(
csv.DictReader(str_io, delimiter=";", quoting=csv.QUOTE_ALL)
Expand All @@ -234,25 +232,21 @@ def test_model_592(self):
self.assertIn(self.picking.name, csv_line_1_manufacturer)
# export_xlsx_acquirer
xlsx_res = self.model592.export_xlsx_acquirer()
res = self.report_obj._get_report_from_name(xlsx_res["report_name"])._render(
self.model592.ids, {}
)
res = self.report_obj._render(xlsx_res["report_name"], self.model592.ids, {})
wb = open_workbook(file_contents=res[0])
sheet = wb.sheet_by_index(0)
self.assertEqual(sheet.cell(1, 0).value, "A001")
self.assertEqual(sheet.cell(2, 0).value, "A002")
# export_xlsx_manufacturer
xlsx_res = self.model592.export_xlsx_manufacturer()
res = self.report_obj._get_report_from_name(xlsx_res["report_name"])._render(
self.model592.ids, {}
)
res = self.report_obj._render(xlsx_res["report_name"], self.model592.ids, {})
wb = open_workbook(file_contents=res[0])
sheet = wb.sheet_by_index(0)
self.assertEqual(sheet.cell(1, 0).value, "M001")
# report_l10n_es_mod592_pdf
res = self.report_obj._get_report_from_name(
"l10n_es_aeat_mod592.report_l10n_es_mod592_pdf"
)._render_qweb_text(self.model592.ids)
res = self.env["ir.actions.report"]._render_qweb_text(
"l10n_es_aeat_mod592.report_l10n_es_mod592_pdf", self.model592.ids
)
res_text = str(res[0])
self.assertRegex(res_text, "A001")
self.assertRegex(res_text, "A002")
Expand Down
6 changes: 3 additions & 3 deletions l10n_es_aeat_mod592/views/mod592_acquirer_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<field name="fiscal_acquirer" optional="show" />
<field name="supplier_social_reason" optional="show" />
<field name="supplier_document_number" optional="show" />
<field name="entries_ok" invisible="1" />
<field name="entries_ok" column_invisible="1" />
<field name="error_text" optional="show" />
<field name="entry_note" optional="hide" />
<field name="supplier_document_type" optional="hide" />
Expand All @@ -34,7 +34,7 @@
<form string="AEAT 592 Acquirer Entries record detail">
<sheet>
<group>
<field name="entry_number" />
<field name="entry_number" />
<field name="concept" />
<field name="product_key" />
<field name="date_done" />
Expand All @@ -51,7 +51,7 @@
<field name="entries_ok" invisible="1" />
<field
name="error_text"
attrs="{'invisible': [('entries_ok', '=', True)]}"
invisible="entries_ok"
class="text-danger"
/>
<field name="report_id" invisible="1" />
Expand Down
Loading

0 comments on commit b9cab9e

Please sign in to comment.