diff --git a/l10n_es_intrastat_report/README.rst b/l10n_es_intrastat_report/README.rst index a7139af918f..57ca2223941 100644 --- a/l10n_es_intrastat_report/README.rst +++ b/l10n_es_intrastat_report/README.rst @@ -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 ======================================= @@ -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 @@ -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 ===== @@ -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. @@ -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 =========== @@ -172,24 +168,25 @@ Authors Contributors ------------ -- Ismael Calvo, FactorLibre -- Luc De Meyer, Noviat -- Daniel Duque -- `Tecnativa `__: +- Ismael Calvo, FactorLibre +- Luc De Meyer, Noviat +- Daniel Duque +- `Tecnativa `__: - - 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 `__: +- `Sygel `__: - - Harald Panten - - Valentin Vinagre + - Harald Panten + - Valentin Vinagre -- `GreenIce `__: +- `GreenIce `__: - - Fernando La Chica + - Fernando La Chica Maintainers ----------- diff --git a/l10n_es_intrastat_report/models/l10n_es_intrastat_product_declaration.py b/l10n_es_intrastat_report/models/l10n_es_intrastat_product_declaration.py index d03e1aa0b75..cfe35210973 100644 --- a/l10n_es_intrastat_report/models/l10n_es_intrastat_product_declaration.py +++ b/l10n_es_intrastat_report/models/l10n_es_intrastat_product_declaration.py @@ -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 @@ -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": @@ -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" @@ -158,9 +164,10 @@ 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 @@ -168,9 +175,10 @@ def _xls_computation_line_fields(self): 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 @@ -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 @@ -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 @@ -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 diff --git a/l10n_es_intrastat_report/readme/CONTRIBUTORS.md b/l10n_es_intrastat_report/readme/CONTRIBUTORS.md index 49731066cc2..cdf3391a5b2 100644 --- a/l10n_es_intrastat_report/readme/CONTRIBUTORS.md +++ b/l10n_es_intrastat_report/readme/CONTRIBUTORS.md @@ -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 diff --git a/l10n_es_intrastat_report/static/description/index.html b/l10n_es_intrastat_report/static/description/index.html index f5bc883a042..f99baf51393 100644 --- a/l10n_es_intrastat_report/static/description/index.html +++ b/l10n_es_intrastat_report/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Intrastat Product Declaration for Spain -
+
+

Intrastat Product Declaration for Spain

- - -Odoo Community Association - -
-

Intrastat Product Declaration for Spain

-

Beta License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/l10n-spain Translate me on Weblate Try me on Runboat

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.

@@ -395,7 +390,7 @@

Intrastat Product Declaration for Spain

-

Installation

+

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.

@@ -412,7 +407,7 @@

Installation

kind of invoice at company level, but it can be changed later.

-

Configuration

+

Configuration

This module adds the following configuration parameters:

  • Company

    @@ -427,8 +422,8 @@

    Configuration

  • 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” +

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

    @@ -445,7 +440,7 @@

    Configuration

-

Usage

+

Usage

  1. Go to Invocing > Reporting > Intrastat > Spanish Intrastat Product Declaration.

    @@ -483,10 +478,10 @@

    Usage

-

Known issues / Roadmap

+

Known issues / Roadmap

    -
  • The current version of the Intrastat reporting module is only based on -invoices. Since associated stock moves are not taken into +
  • 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 @@ -494,13 +489,13 @@

      Known issues / Roadmap

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

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub 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 @@ -508,9 +503,9 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • FactorLibre
  • Noviat
  • @@ -518,7 +513,7 @@

    Authors

-

Contributors

+

Contributors

  • Sygel:
  • -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association @@ -555,6 +551,5 @@

    Maintainers

    -
    diff --git a/l10n_es_intrastat_report/views/l10n_es_intrastat_product.xml b/l10n_es_intrastat_report/views/l10n_es_intrastat_product.xml index 51d145bd742..1f5a8e357d7 100644 --- a/l10n_es_intrastat_report/views/l10n_es_intrastat_product.xml +++ b/l10n_es_intrastat_report/views/l10n_es_intrastat_product.xml @@ -10,19 +10,26 @@ name="inherit_id" ref="intrastat_product.intrastat_product_computation_line_view_form" /> - primary + extension - + - reporting_level != 'extended' - reporting_level == 'extended' + reporting_level != 'extended' or company_country_code != 'ES' + reporting_level == 'extended' and company_country_code == 'ES' @@ -33,20 +40,28 @@ > intrastat.product.computation.line.list intrastat.product.computation.line - primary + extension - + - 1 + parent.company_country_code == 'ES' - + @@ -56,20 +71,24 @@ > intrastat.product.declaration.line.form intrastat.product.declaration.line - primary + extension - reporting_level != 'extended' - reporting_level == 'extended' + reporting_level != 'extended' or company_country_code != 'ES' + reporting_level == 'extended' and company_country_code == 'ES' @@ -80,95 +99,24 @@ > intrastat.product.declaration.line.list intrastat.product.declaration.line - primary + extension - + - + - - intrastat.product.declaration.form - intrastat.product.declaration - primary - - -
    - Spanish Intrastat Product Declaration -
    -
    -
    - - intrastat.product.declaration.list - intrastat.product.declaration - primary - - - - Spanish Intrastat Product Declaration - - - - - intrastat.product.declaration.search - intrastat.product.declaration - primary - - - - Search Spanish Intrastat Product Declaration - - - - - intrastat.product.declaration.graph - intrastat.product.declaration - primary - - - - Spanish Intrastat Product Declaration - - - - - Spanish Intrastat Product Declaration - intrastat.product.declaration - list,form,graph - -