Skip to content
Merged
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
107 changes: 52 additions & 55 deletions l10n_es_intrastat_report/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

=======================================
Intrastat Product Declaration for Spain
=======================================
Expand All @@ -17,7 +13,7 @@ Intrastat Product Declaration for Spain
.. |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 @@ -70,32 +66,32 @@ Configuration

This module adds the following configuration parameters:

- Company
- Company

- Arrivals : Exempt, Standard or Extended
- Dispatches : Exempt, Standard or Extended
- Default Intrastat Transaction
- Default Intrastat Transport Mode (Extended Declaration)
- Default Intrastat Incoterm (Extended Declaration)
- Arrivals : Exempt, Standard or Extended
- Dispatches : Exempt, Standard or Extended
- Default Intrastat Transaction
- Default Intrastat Transport Mode (Extended Declaration)
- Default Intrastat Incoterm (Extended Declaration)

- Warehouse
- Warehouse

- Intrastat State to cope with warehouses in different states
- Intrastat State to cope with warehouses in different states

The configuration of the Intrastat State on a Warehouse, requires a
login belonging to the "Spanish Intrastat Product Declaration"
security group.
The configuration of the Intrastat State on a Warehouse, requires
a login belonging to the "Spanish Intrastat Product Declaration"
security group.

- Intrastat Codes, Supplementary Units, Transaction Types, Transport
Modes, States
- Intrastat Codes, Supplementary Units, Transaction Types, Transport
Modes, States

Cf. menu *Invoicing / Configuration / Miscellaneous / Intrastat
Configuration*
Cf. menu *Invoicing / Configuration / Miscellaneous / Intrastat
Configuration*

- Product
- Product

You can define a default Intrastat Code on the Product or the Product
Category.
You can define a default Intrastat Code on the Product or the Product
Category.

Usage
=====
Expand All @@ -107,16 +103,16 @@ Usage

3. Select or input following data:

- Year
- Month
- Type: for selecting if arrivals or dispatches.
- Reporting level: standard or extended.
- Action:
- Year
- Month
- Type: for selecting if arrivals or dispatches.
- Reporting level: standard or extended.
- Action:

- if "Nihil", no recomputation is possible and the report is
considered empty.
- if "Replace", everything is recomputed.
- if "Append", only new lines are added.
- if "Nihil", no recomputation is possible and the report is
considered empty.
- if "Replace", everything is recomputed.
- if "Append", only new lines are added.

4. Click on "Generate Lines from invoices" for populating transaction
lines.
Expand All @@ -136,18 +132,18 @@ Usage
Known issues / Roadmap
======================

- The current version of the Intrastat reporting module is only based on
invoices. Since associated stock moves are not taken into
consideration, it is possible that manual corrections are required,
e.g.
- The current version of the Intrastat reporting module is only based
on invoices. Since associated stock moves are not taken into
consideration, it is possible that manual corrections are required,
e.g.

- Product movements without invoices are not included in the current
version of this module and must be added manually to the report
lines before generating the declaration.
- Product movements without invoices are not included in the current
version of this module and must be added manually to the report
lines before generating the declaration.

- The current version of the Intrastat reporting module does not perform
a cross-check with the VAT declaration.
- Add tests.
- The current version of the Intrastat reporting module does not
perform a cross-check with the VAT declaration.
- Add tests.

Bug Tracker
===========
Expand All @@ -172,24 +168,25 @@ Authors
Contributors
------------

- Ismael Calvo, FactorLibre <ismael.calvo@factorlibre.com>
- Luc De Meyer, Noviat <info@noviat.com>
- Daniel Duque <daniel.duque@factorlibre.com>
- `Tecnativa <https://www.tecnativa.com>`__:
- Ismael Calvo, FactorLibre <ismael.calvo@factorlibre.com>
- Luc De Meyer, Noviat <info@noviat.com>
- Daniel Duque <daniel.duque@factorlibre.com>
- `Tecnativa <https://www.tecnativa.com>`__:

- Manuel Calero
- Pedro M. Baeza
- João Marques
- Víctor Martínez
- Manuel Calero
- Pedro M. Baeza
- João Marques
- Víctor Martínez
- Juan Carlos Oñate

- `Sygel <https://www.sygel.es>`__:
- `Sygel <https://www.sygel.es>`__:

- Harald Panten
- Valentin Vinagre
- Harald Panten
- Valentin Vinagre

- `GreenIce <https://www.greenice.com>`__:
- `GreenIce <https://www.greenice.com>`__:

- Fernando La Chica
- Fernando La Chica

Maintainers
-----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def _get_intrastat_state(self, inv_line):

def _update_computation_line_vals(self, inv_line, line_vals, notedict):
result = super()._update_computation_line_vals(inv_line, line_vals, notedict)
if self.company_id.country_id.code != "ES":
return result
intrastat_state = self._get_intrastat_state(inv_line)
if intrastat_state:
line_vals["intrastat_state_id"] = intrastat_state.id
Expand Down Expand Up @@ -71,6 +73,8 @@ def _prepare_invoice_domain(self):
- companies subject to arrivals or dispatches only
"""
domain = super()._prepare_invoice_domain()[:-1]
if self.company_id.country_id.code != "ES":
return super()._prepare_invoice_domain()
if self.declaration_type == "arrivals":
domain.append(("move_type", "in", ("in_invoice", "out_refund")))
elif self.declaration_type == "dispatches":
Expand All @@ -82,6 +86,8 @@ def _generate_xml(self):

def _attach_xml_file(self, xml_string, declaration_name):
attach_id = super()._attach_xml_file(xml_string, declaration_name)
if self.company_id.country_id.code != "ES":
return attach_id
self.ensure_one()
attach = self.env["ir.attachment"].browse(attach_id)
filename = f"{self.year_month}_{declaration_name}.csv"
Expand Down Expand Up @@ -158,19 +164,21 @@ def create_xls(self):
"data": {"dynamic_report": True},
}

@api.model
def _xls_computation_line_fields(self):
res = super()._xls_computation_line_fields()
if self.company_id.country_id.code != "ES":
return res
if (
self.env.context.get("declaration_type", False) == "dispatches"
and int(self.env.context.get("declaration_year", 0)) >= 2022
):
res.append("partner_vat")
return res

@api.model
def _xls_declaration_line_fields(self):
res = super()._xls_declaration_line_fields()
if self.company_id.country_id.code != "ES":
return res
if (
self.env.context.get("declaration_type", False) == "dispatches"
and int(self.env.context.get("declaration_year", 0)) >= 2022
Expand All @@ -190,6 +198,8 @@ class IntrastatProductComputationLine(models.Model):

def _prepare_grouped_fields(self, fields_to_sum):
vals = super()._prepare_grouped_fields(fields_to_sum)
if self.company_id.country_id.code != "ES":
return vals
vals["intrastat_state_id"] = self.intrastat_state_id.id
# TODO: Move set incoterm_id to intrastat_product
vals["incoterm_id"] = self.incoterm_id.id
Expand All @@ -199,6 +209,8 @@ def _prepare_grouped_fields(self, fields_to_sum):

def _prepare_declaration_line(self, line_number):
vals = super()._prepare_declaration_line(line_number)
if self.company_id.country_id.code != "ES":
return vals
# Avoid rounding in weight and fiscal value
vals["weight"] = 0.0
vals["amount_company_currency"] = 0.0
Expand All @@ -215,6 +227,8 @@ def _prepare_declaration_line(self, line_number):
@api.model
def _group_line_hashcode_fields(self):
res = super()._group_line_hashcode_fields()
if self.company_id.country_id.code != "ES":
return res
res["intrastat_state_id"] = self.intrastat_state_id.id
if self.declaration_type == "dispatches" and int(self.parent_id.year) >= 2022:
res["partner_vat"] = self.partner_vat
Expand Down
1 change: 1 addition & 0 deletions l10n_es_intrastat_report/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Pedro M. Baeza
- João Marques
- Víctor Martínez
- Juan Carlos Oñate
- [Sygel](https://www.sygel.es):
- Harald Panten
- Valentin Vinagre
Expand Down
45 changes: 20 additions & 25 deletions l10n_es_intrastat_report/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>Intrastat Product Declaration for Spain</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="intrastat-product-declaration-for-spain">
<h1 class="title">Intrastat Product Declaration for Spain</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="intrastat-product-declaration-for-spain">
<h1>Intrastat Product Declaration for Spain</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:40c9762f85d0daa42be107ab88e4b5fba263bd7e76aefb6dbcbf7b00aef83c8e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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_intrastat_report"><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_intrastat_report"><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_intrastat_report"><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_intrastat_report"><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>This module implements the Spanish Intrastat reporting.</p>
<p>The report can be reviewed and corrected where needed before the
creation of the csv file for the declaration.</p>
Expand All @@ -395,7 +390,7 @@ <h1>Intrastat Product Declaration for Spain</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>WARNING: This module conflicts with the Intrastat modules from the
official enterprise addons. If you have already installed these modules,
you should uninstall them before installing this module.</p>
Expand All @@ -412,7 +407,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
kind of invoice at company level, but it can be changed later.</p>
</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>This module adds the following configuration parameters:</p>
<ul>
<li><p class="first">Company</p>
Expand All @@ -427,8 +422,8 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
<li><p class="first">Warehouse</p>
<ul>
<li><p class="first">Intrastat State to cope with warehouses in different states</p>
<p>The configuration of the Intrastat State on a Warehouse, requires a
login belonging to the “Spanish Intrastat Product Declaration”
<p>The configuration of the Intrastat State on a Warehouse, requires
a login belonging to the “Spanish Intrastat Product Declaration”
security group.</p>
</li>
</ul>
Expand All @@ -445,7 +440,7 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
</ul>
</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">
<li><p class="first">Go to <em>Invocing &gt; Reporting &gt; Intrastat &gt; Spanish Intrastat Product
Declaration</em>.</p>
Expand Down Expand Up @@ -483,42 +478,42 @@ <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>
<ul class="simple">
<li>The current version of the Intrastat reporting module is only based on
invoices. Since associated stock moves are not taken into
<li>The current version of the Intrastat reporting module is only based
on invoices. Since associated stock moves are not taken into
consideration, it is possible that manual corrections are required,
e.g.<ul>
<li>Product movements without invoices are not included in the current
version of this module and must be added manually to the report
lines before generating the declaration.</li>
</ul>
</li>
<li>The current version of the Intrastat reporting module does not perform
a cross-check with the VAT declaration.</li>
<li>The current version of the Intrastat reporting module does not
perform a cross-check with the VAT declaration.</li>
<li>Add tests.</li>
</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_intrastat_report%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>FactorLibre</li>
<li>Noviat</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>Ismael Calvo, FactorLibre &lt;<a class="reference external" href="mailto:ismael.calvo&#64;factorlibre.com">ismael.calvo&#64;factorlibre.com</a>&gt;</li>
<li>Luc De Meyer, Noviat &lt;<a class="reference external" href="mailto:info&#64;noviat.com">info&#64;noviat.com</a>&gt;</li>
Expand All @@ -528,6 +523,7 @@ <h3><a class="toc-backref" href="#toc-entry-8">Contributors</a></h3>
<li>Pedro M. Baeza</li>
<li>João Marques</li>
<li>Víctor Martínez</li>
<li>Juan Carlos Oñate</li>
</ul>
</li>
<li><a class="reference external" href="https://www.sygel.es">Sygel</a>:<ul>
Expand All @@ -542,7 +538,7 @@ <h3><a class="toc-backref" href="#toc-entry-8">Contributors</a></h3>
</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 @@ -555,6 +551,5 @@ <h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Loading