Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions l10n_es_vat_book/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==================================
Libros registro del IVA y del IRPF
==================================
Expand All @@ -17,7 +13,7 @@ Libros registro del IVA y del IRPF
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |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
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
Expand Down Expand Up @@ -140,7 +136,10 @@ Contributors
- Fernando La Chica <fernandolachica@gmail.com>
- Victor Garcia <victor.garcia@kayuulab.com>
- Luis Lafaurie <ldlafaurie@gmail.com>
- Eduardo de miguel <edu@moduon.team>
- `Moduon Team <https://www.moduon.team/>`__:

- Eduardo de miguel
- Emilio Pascual

Maintainers
-----------
Expand Down
37 changes: 21 additions & 16 deletions l10n_es_vat_book/models/l10n_es_vat_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,26 +272,31 @@ def upsert_book_line_tax(self, move_line, vat_book_line, implied_taxes):
sign = 1
if move_line.tax_line_id:
res = {}
tax = move_line.tax_line_id
move_line._process_aeat_tax_fee_info(res, tax, sign)
key = self.get_book_line_tax_key(move_line, tax)
value = tax_lines.setdefault(key, default_dict | {"tax_id": tax.id})
value["tax_amount"] += res[tax]["amount"]
value["deductible_amount"] += res[tax]["deductible_amount"]
value["move_line_ids"].append((4, move_line.id))
move_line._process_aeat_tax_fee_info(res, move_line.tax_line_id, sign)
for child_tax, info in res.items():
key = self.get_book_line_tax_key(move_line, child_tax)
value = tax_lines.setdefault(
key, default_dict | {"tax_id": child_tax.id}
)
value["tax_amount"] += info["amount"]
value["deductible_amount"] += info["deductible_amount"]
value["move_line_ids"].append((4, move_line.id))
for i, tax in enumerate(move_line.tax_ids):
res = {}
move_line._process_aeat_tax_base_info(res, tax, sign)
if i == 0:
vat_book_line["base_amount"] += res[tax]["base"]
if tax not in implied_taxes:
continue
key = self.get_book_line_tax_key(move_line, tax)
value = tax_lines.setdefault(key, default_dict | {"tax_id": tax.id})
value["base_amount"] += res[tax]["base"]
value["base_move_line_ids"].append((4, move_line.id))
# For later matching special taxes
value["other_tax_ids"] = (move_line.tax_ids - tax).ids
vat_book_line["base_amount"] += next(iter(res.values()))["base"]
for child_tax, info in res.items():
if child_tax not in implied_taxes:
continue
key = self.get_book_line_tax_key(move_line, child_tax)
value = tax_lines.setdefault(
key, default_dict | {"tax_id": child_tax.id}
)
value["base_amount"] += info["base"]
value["base_move_line_ids"].append((4, move_line.id))
# For later matching special taxes
value["other_tax_ids"] = (move_line.tax_ids - tax).ids

def _clear_old_data(self):
"""
Expand Down
4 changes: 3 additions & 1 deletion l10n_es_vat_book/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
- Fernando La Chica \<<fernandolachica@gmail.com>\>
- Victor Garcia \<<victor.garcia@kayuulab.com>\>
- Luis Lafaurie \<<ldlafaurie@gmail.com>\>
- Eduardo de miguel \<<edu@moduon.team>\>
- [Moduon Team](https://www.moduon.team/):
- Eduardo de miguel
- Emilio Pascual
38 changes: 18 additions & 20 deletions l10n_es_vat_book/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Libros registro del IVA y del IRPF</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="libros-registro-del-iva-y-del-irpf">
<h1 class="title">Libros registro del IVA y del IRPF</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="libros-registro-del-iva-y-del-irpf">
<h1>Libros registro del IVA y del IRPF</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cea566b882b9c0161f58f0e307ada8673d08fce8414472d97ace270e6abc561d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/18.0/l10n_es_vat_book"><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-18-0/l10n-spain-18-0-l10n_es_vat_book"><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=18.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="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/18.0/l10n_es_vat_book"><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-18-0/l10n-spain-18-0-l10n_es_vat_book"><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=18.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 los libros de IVA e IRPF español.</p>
<p>Esto módulo introduce el menú “Libros de IVA y del IRPF” en Contabilidad
-&gt; Informe -&gt; Declaraciones AEAT.</p>
Expand Down Expand Up @@ -403,7 +398,7 @@ <h1>Libros registro del IVA y del IRPF</h1>
</ul>
</div>
<div class="section" id="installation">
<h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<p>Para instalar este modulo necesitas:</p>
<ul class="simple">
<li>account</li>
Expand All @@ -422,15 +417,15 @@ <h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
<p>Los códigos de impuestos incluidos en el Libro de IVA pueden verse en:
Contabilidad -&gt; Configuración -&gt; AEAT -&gt; Mapeo AEAT libro de IVA</p>
<p>Los clientes utilizados para ventas por caja deben tener marcado el
campo “AEAT - Cliente anónimo” para que no se muestren advertencias por
no tener NIF informado siguiendo lo especificado en el formato BOE.</p>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-3">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
<ol class="arabic simple">
<li>Ve a <em>Contabilidad &gt; Declaraciones AEAT &gt; Libro de IVA</em>.</li>
<li>Crea un nuevo registro.</li>
Expand All @@ -440,7 +435,7 @@ <h2><a class="toc-backref" href="#toc-entry-3">Usage</a></h2>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
<p>Funcionalidades del Libro Registro de IVA no incluídas por el momento:</p>
<ul class="simple">
<li>Criterio de caja</li>
Expand All @@ -452,25 +447,25 @@ <h2><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h2>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-spain/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_vat_book%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-6">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-6">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-7">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Authors</a></h2>
<ul class="simple">
<li>PRAXYA</li>
<li>ForgeFlow</li>
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-8">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
<ul class="simple">
<li>Daniel Rodriguez &lt;<a class="reference external" href="mailto:drl.9319&#64;gmail.com">drl.9319&#64;gmail.com</a>&gt;</li>
<li>Jordi Ballester (ForgeFlow) &lt;<a class="reference external" href="mailto:jordi.ballester&#64;forgeflow.com">jordi.ballester&#64;forgeflow.com</a>&gt;</li>
Expand All @@ -486,11 +481,15 @@ <h3><a class="toc-backref" href="#toc-entry-8">Contributors</a></h3>
<li>Fernando La Chica &lt;<a class="reference external" href="mailto:fernandolachica&#64;gmail.com">fernandolachica&#64;gmail.com</a>&gt;</li>
<li>Victor Garcia &lt;<a class="reference external" href="mailto:victor.garcia&#64;kayuulab.com">victor.garcia&#64;kayuulab.com</a>&gt;</li>
<li>Luis Lafaurie &lt;<a class="reference external" href="mailto:ldlafaurie&#64;gmail.com">ldlafaurie&#64;gmail.com</a>&gt;</li>
<li>Eduardo de miguel &lt;<a class="reference external" href="mailto:edu&#64;moduon.team">edu&#64;moduon.team</a>&gt;</li>
<li><a class="reference external" href="https://www.moduon.team/">Moduon Team</a>:<ul>
<li>Eduardo de miguel</li>
<li>Emilio Pascual</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-9">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" />
Expand All @@ -503,6 +502,5 @@ <h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
21 changes: 13 additions & 8 deletions l10n_es_vat_book/tests/test_l10n_es_aeat_vat_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TestL10nEsAeatVatBookBase(TestL10nEsAeatModBase):
"P_REQ014": (280, 3.92),
"P_REQ52": (290, 15.08),
"P_IRPF19": (1024, 194.56),
"P_IVA21_IBC_GROUP": (1000, 210),
}


Expand Down Expand Up @@ -79,38 +80,42 @@ def test_model_vat_book(self):
self.assertEqual(line.base_amount, 0.0)
self.assertEqual(line.tax_amount, 0.0)
# Check tax summary for received invoices
self.assertEqual(len(vat_book.received_tax_summary_ids), 7)
self.assertEqual(len(vat_book.received_tax_summary_ids), 8)
rec_summaries = sorted(
vat_book.received_tax_summary_ids,
key=lambda line: line.tax_amount,
reverse=True,
)
# P_IVA21_SC - 21% IVA soportado (servicios corrientes)
# P_IVA21_IBC_GROUP - IVA 21% Importaciones DUA bienes corrientes
line = rec_summaries[0]
self.assertAlmostEqual(line.base_amount, 1000)
self.assertAlmostEqual(line.tax_amount, 210)
# P_IVA21_SC - 21% IVA soportado (servicios corrientes)
line = rec_summaries[1]
self.assertAlmostEqual(line.base_amount, 230)
self.assertAlmostEqual(line.tax_amount, 48.3)
# P_IVA21_IC_BC - IVA 21% Adquisición Intracomunitaria. Bienes corrientes
line = rec_summaries[1]
line = rec_summaries[2]
self.assertAlmostEqual(line.base_amount, 200)
self.assertAlmostEqual(line.tax_amount, 42)
# P_IVA0_ND - 21% IVA Soportado no deducible
line = rec_summaries[2]
line = rec_summaries[3]
self.assertAlmostEqual(line.base_amount, 100)
self.assertAlmostEqual(line.tax_amount, 21)
# P_REQ52 - 5.2% Recargo de equivalencia sobre operaciones sujetas a IVA
line = rec_summaries[3]
line = rec_summaries[4]
self.assertAlmostEqual(line.base_amount, 290)
self.assertAlmostEqual(line.tax_amount, 15.08)
# P_REQ014 - 1.4% Recargo de equivalencia sobre operaciones sujetas a IVA
line = rec_summaries[4]
line = rec_summaries[5]
self.assertAlmostEqual(line.base_amount, 280)
self.assertAlmostEqual(line.tax_amount, 3.92)
# P_REQ05 - 0.5% Recargo de equivalencia sobre operaciones sujetas a IVA
line = rec_summaries[5]
line = rec_summaries[6]
self.assertAlmostEqual(line.base_amount, 270)
self.assertAlmostEqual(line.tax_amount, 1.35)
# P_IRPF19 - 19% Impuesto sobre la resta fisica
line = rec_summaries[6]
line = rec_summaries[7]
self.assertAlmostEqual(line.base_amount, 1024)
self.assertAlmostEqual(line.tax_amount, -194.56)
# Let's dig into this tax detail for checking the deductible amount
Expand Down
Loading