Skip to content

Commit

Permalink
[IMP] l10n_es_intrastat_report: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Josep-s73 authored and Faristol committed Jul 10, 2024
1 parent 698053c commit 916c3e1
Show file tree
Hide file tree
Showing 19 changed files with 245 additions and 209 deletions.
164 changes: 90 additions & 74 deletions l10n_es_intrastat_report/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ Intrastat Product Declaration for Spain
: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
:target: https://github.com/OCA/l10n-spain/tree/16.0/l10n_es_intrastat_report
:target: https://github.com/OCA/l10n-spain/tree/17.0/l10n_es_intrastat_report
:alt: OCA/l10n-spain
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-spain-16-0/l10n-spain-16-0-l10n_es_intrastat_report
:target: https://translation.odoo-community.org/projects/l10n-spain-17-0/l10n-spain-17-0-l10n_es_intrastat_report
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module implements the Spanish Intrastat reporting.

The report can be reviewed and corrected where needed before
the creation of the csv file for the declaration.
The report can be reviewed and corrected where needed before the
creation of the csv file for the declaration.

**Table of contents**

Expand All @@ -41,138 +41,154 @@ the creation of the csv file for the declaration.
Installation
============

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.
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.

You need to add HS product codes for your company through the installation
wizard. It's automatically launched if installing the module from the UI.
You need to add HS product codes for your company through the
installation wizard. It's automatically launched if installing the
module from the UI.

If any other installation method is used, you can go to
*Settings > Technical > Actions > Configuration Wizards* on developer mode,
and launch there the wizard called "Import Spanish Product HS Codes"
If any other installation method is used, you can go to *Settings >
Technical > Actions > Configuration Wizards* on developer mode, and
launch there the wizard called "Import Spanish Product HS Codes"

The included codes are for 2023. Please check possible updates for this codes in:
The included codes are for 2023. Please check possible updates for this
codes in:

https://sede.agenciatributaria.gob.es/Sede/estadisticas/estadisticas-comercio-exterior/nomenclatura-combinada-ano.html

This wizard also sets a sane default Intrastat transaction type for each kind
of invoice at company level, but it can be changed later.
This wizard also sets a sane default Intrastat transaction type for each
kind of invoice at company level, but it can be changed later.

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
=====

#. Go to *Invocing > Reporting > Intrastat > Spanish Intrastat Product Declaration*.
#. Create a new record.
#. Select or input following data:
1. Go to *Invocing > Reporting > Intrastat > Spanish Intrastat Product
Declaration*.

* Year
* Month
* Type: for selecting if arrivals or dispatches.
* Reporting level: standard or extended.
* Action:
2. Create a new record.

* if "Nihil", no recomputation is possible and the report is considered empty.
* if "Replace", everything is recomputed.
* if "Append", only new lines are added.
#. Click on "Generate Lines from invoices" for populating transaction lines.
3. Select or input following data:

- 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.

4. Click on "Generate Lines from invoices" for populating transaction
lines.

You can review them on "Transactions" page of the report.
#. Click on "Generate Declaration Lines" for populating the lines that summarize
transactions and will be the source for the exports.

5. Click on "Generate Declaration Lines" for populating the lines that
summarize transactions and will be the source for the exports.

You can review them on "Declaration Lines" page.
#. Click on "Generate CSV Declaration Line" for getting the CSV for declaring
the report in AEAT.
#. Click on "Excel Export" for having the information in a spreadsheet.

6. Click on "Generate CSV Declaration Line" for getting the CSV for
declaring the report in AEAT.

7. Click on "Excel Export" for having the information in a spreadsheet.

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
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/issues>`_.
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
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_intrastat_report%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_intrastat_report%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~
-------

* FactorLibre
* Noviat
* Tecnativa

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

* `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
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -184,6 +200,6 @@ 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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion l10n_es_intrastat_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{
"name": "Intrastat Product Declaration for Spain",
"version": "16.0.1.3.2",
"version": "17.0.1.0.0",
"category": "Intrastat",
"license": "AGPL-3",
"summary": "Spanish Intrastat Product Declaration",
Expand Down
18 changes: 6 additions & 12 deletions l10n_es_intrastat_report/migrations/16.0.1.0.0/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,40 +80,34 @@ def migrate(env, version):
)
new_fields = ", ".join(f'"{f}"' for f in ["old_l10n_es_id"] + intr_prod_dec_fields)
old_fields = ", ".join(f'"{f}"' for f in ["id"] + intr_prod_dec_fields)
query = """INSERT INTO intrastat_product_declaration ({new_fields})
query = f"""INSERT INTO intrastat_product_declaration ({new_fields})
SELECT {old_fields} FROM l10n_es_intrastat_product_declaration
""".format(
new_fields=new_fields, old_fields=old_fields
)
"""
openupgrade.logged_query(env.cr, query)

new_fields = ", ".join(
f"{f}" for f in ["old_l10n_es_id"] + intr_prod_dec_lin_fields
)
old_fields = ", ".join(f"leipd.{f}" for f in ["id"] + intr_prod_dec_lin_fields)
query = """INSERT INTO intrastat_product_declaration_line (parent_id, {new_fields})
query = f"""INSERT INTO intrastat_product_declaration_line (parent_id, {new_fields})
SELECT ipd.id, {old_fields}
FROM l10n_es_intrastat_product_declaration_line AS leipd
INNER JOIN intrastat_product_declaration
AS ipd ON ipd.old_l10n_es_id = leipd.parent_id
""".format(
new_fields=new_fields, old_fields=old_fields
)
"""
openupgrade.logged_query(env.cr, query)

new_fields = ", ".join(
f"{f}" for f in ["old_l10n_es_id"] + intr_prod_comp_lin_fields
)
old_fields = ", ".join(f"leipc.{f}" for f in ["id"] + intr_prod_comp_lin_fields)
query = """INSERT INTO intrastat_product_computation_line
query = f"""INSERT INTO intrastat_product_computation_line
(parent_id, declaration_line_id, {new_fields})
SELECT ipd.id, leipd.id, {old_fields}
FROM l10n_es_intrastat_product_computation_line AS leipc
INNER JOIN intrastat_product_declaration
AS ipd ON ipd.old_l10n_es_id = leipc.parent_id
INNER JOIN intrastat_product_declaration_line
AS leipd ON leipd.old_l10n_es_id = leipc.declaration_line_id
""".format(
new_fields=new_fields, old_fields=old_fields
)
"""
openupgrade.logged_query(env.cr, query)
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _attach_xml_file(self, xml_string, declaration_name):
attach_id = super()._attach_xml_file(xml_string, declaration_name)
self.ensure_one()
attach = self.env["ir.attachment"].browse(attach_id)
filename = "{}_{}.csv".format(self.year_month, declaration_name)
filename = f"{self.year_month}_{declaration_name}.csv"
attach.write({"name": filename})
return attach.id

Expand Down
3 changes: 3 additions & 0 deletions l10n_es_intrastat_report/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
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)

* Warehouse
- Warehouse

- 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.
13 changes: 13 additions & 0 deletions l10n_es_intrastat_report/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- 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
- [Sygel](https://www.sygel.es):
- Harald Panten
- Valentin Vinagre
- [GreenIce](https://www.greenice.com):
- Fernando La Chica
18 changes: 0 additions & 18 deletions l10n_es_intrastat_report/readme/CONTRIBUTORS.rst

This file was deleted.

Loading

0 comments on commit 916c3e1

Please sign in to comment.