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 committed Mar 4, 2025
1 parent e00827b commit 9e861ce
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 125 deletions.
12 changes: 10 additions & 2 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 Down Expand Up @@ -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(
lambda x: x.stock_move_id == sm
lambda x, sm=sm: x.stock_move_id == sm
)
m_vals = {"stock_move_id": sm.id}
if manufacturer_line:
manufacturer_lines.append((1, manufacturer_line.id, m_vals))
else:
manufacturer_lines.append((0, 0, m_vals))
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
15 changes: 10 additions & 5 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 @@ -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
12 changes: 3 additions & 9 deletions l10n_es_aeat_mod592/views/mod592_manufacturer_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="model">l10n.es.aeat.mod592.report.line.manufacturer</field>
<field name="arch" type="xml">
<tree decoration-danger="entries_ok==False">
<field name="sequence" invisible="1" />
<field name="sequence" column_invisible="1" />
<field name="entry_number" optional="show" />
<field name="stock_move_id" optional="show" />
<field name="date_done" optional="show" />
Expand All @@ -21,7 +21,7 @@
<field name="kgs" optional="show" />
<field name="no_recycling_kgs" optional="show" />
<field name="entry_note" optional="show" />
<field name="entries_ok" invisible="1" />
<field name="entries_ok" column_invisible="1" />
<field name="error_text" optional="hide" />
</tree>
</field>
Expand All @@ -35,7 +35,7 @@
<group>
<field
name="error_text"
attrs="{'invisible': [('entries_ok', '=', True)]}"
invisible="entries_ok"
class="text-danger"
/>
<field name="entry_number" />
Expand All @@ -51,12 +51,6 @@
<field name="entry_note" />
<field name="sequence" invisible="1" />
<field name="entries_ok" invisible="1" />
<field name="error_text" optional="show" />
<field
name="error_text"
attrs="{'invisible': [('entries_ok', '=', True)]}"
optional="hide"
/>
<field name="report_id" invisible="1" />
</group>
</form>
Expand Down
Loading

0 comments on commit 9e861ce

Please sign in to comment.