diff --git a/intrastat_base/README.rst b/intrastat_base/README.rst new file mode 100644 index 0000000..5c8888f --- /dev/null +++ b/intrastat_base/README.rst @@ -0,0 +1,109 @@ +======================== +Intrastat Reporting Base +======================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/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%2Fintrastat--extrastat-lightgray.png?logo=github + :target: https://github.com/OCA/intrastat-extrastat/tree/13.0/intrastat_base + :alt: OCA/intrastat-extrastat +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/intrastat-extrastat-13-0/intrastat-extrastat-13-0-intrastat_base + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/227/13.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module contains common functions for the intrastat reporting and +should be used in combination with the generic reporting module +*intrastat_product* and with the country-specific reporting modules such +as: + +- *l10n_fr_intrastat_service*: + the module for the *Déclaration Européenne des Services* (DES) for France +- *l10n_fr_intrastat_product*: + the module for the *Déclaration d'Echange de Biens* (DEB) for France +- *l10n_be_intrastat_product*: + the module for the Intrastat Declaration for Belgium. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +WARNING: + +This module conflicts with the module *account_intrastat* from Odoo Enterprise. +If you have already installed the module *account_intrastat*, +you should uninstall it first before installing this module. + +Usage +===== + +This module adds an intrastat property on countries and activates this property +on the countries of the European Union. + +With this module, the country field on partners becomes a required field. + +It adds an option *Exclude invoice line from intrastat if this tax is present* +on taxes. + +It adds an *Intrastat* section on the *Invoicing* configuration page. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion +* Noviat + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre, Akretion +* Luc De Meyer, Noviat +* Kumar Aberer, brain-tec AG +* Andrea Stirpe + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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/intrastat-extrastat `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/intrastat_base/__init__.py b/intrastat_base/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/intrastat_base/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/intrastat_base/__manifest__.py b/intrastat_base/__manifest__.py new file mode 100644 index 0000000..4d0f6d2 --- /dev/null +++ b/intrastat_base/__manifest__.py @@ -0,0 +1,28 @@ +# Copyright 2011-2020 Akretion (http://www.akretion.com) +# Copyright 2018-2020 brain-tec AG (Kumar Aberer ) +# Copyright 2009-2020 Noviat (http://www.noviat.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Intrastat Reporting Base", + "version": "14.0.1.0.0", + "category": "Intrastat", + "license": "AGPL-3", + "summary": "Base module for Intrastat reporting", + "author": "Akretion,Noviat,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/intrastat", + "depends": ["base_vat", "account"], + "excludes": ["account_intrastat"], + "data": [ + "security/ir.model.access.csv", + "data/country_data.xml", + "views/product_template.xml", + "views/res_partner.xml", + "views/res_country.xml", + "views/account_tax.xml", + "views/res_config_settings.xml", + "views/intrastat.xml", + ], + "demo": ["demo/intrastat_demo.xml"], + "installable": True, +} diff --git a/intrastat_base/data/country_data.xml b/intrastat_base/data/country_data.xml new file mode 100644 index 0000000..cb950e6 --- /dev/null +++ b/intrastat_base/data/country_data.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/intrastat_base/demo/intrastat_demo.xml b/intrastat_base/demo/intrastat_demo.xml new file mode 100644 index 0000000..6e6cd90 --- /dev/null +++ b/intrastat_base/demo/intrastat_demo.xml @@ -0,0 +1,23 @@ + + + + + FR58441019213 + + + + BE0884025633 + + + Shipping costs + SHIP_S + service + + 30 + + + diff --git a/intrastat_base/i18n/fr.po b/intrastat_base/i18n/fr.po new file mode 100644 index 0000000..c95b44d --- /dev/null +++ b/intrastat_base/i18n/fr.po @@ -0,0 +1,284 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * intrastat_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-29 09:52+0000\n" +"PO-Revision-Date: 2018-12-29 09:52+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_product_product__is_accessory_cost +#: model:ir.model.fields,help:intrastat_base.field_product_template__is_accessory_cost +msgid "" +"Activate this option for shipping costs, packaging costs and all services " +"related to the sale of products. This option is used for Intrastat reports." +msgstr "" +"Activer cette option pour les frais de port, les frais d'emballage et tous " +"les services associés à la vente de produits. Cette option est utilisée pour " +"la DEB et la DES." + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "Cannot delete the declaration %s because it is in Done state" +msgstr "" +"Impossible de supprimer la déclaration %s parce qu'elle est à l'état " +"'Terminé'." + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_intrastat_common +msgid "Common functions for intrastat reports for products " +msgstr "Common functions for intrastat reports for products " + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_res_company +msgid "Companies" +msgstr "Sociétés" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "Company not yet set on intrastat report." +msgstr "Société non configurée sur le rapport DEB/DES." + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_res_config_settings +#, fuzzy +msgid "Config Settings" +msgstr "res.config.settings" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_res_country +msgid "Country" +msgstr "Pays" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Currency" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_common__display_name +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__display_name +msgid "Display Name" +msgstr "Afficher le nom" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_res_country__intrastat +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "EU Country" +msgstr "Membre de l'UE" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_account_tax__exclude_from_intrastat_if_present +#: model:ir.model.fields,field_description:intrastat_base.field_account_tax_template__exclude_from_intrastat_if_present +msgid "Exclude invoice line from intrastat if this tax is present" +msgstr "" +"Ligne de facture exclue de la DEB et de la DES si cette taxe est présente" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Group By" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_common__id +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__id +msgid "ID" +msgstr "ID" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_account_tax__exclude_from_intrastat_if_present +#: model:ir.model.fields,help:intrastat_base.field_account_tax_template__exclude_from_intrastat_if_present +msgid "" +"If this tax is present on an invoice line, this invoice line will be skipped " +"when generating Intrastat Product or Service lines from invoices." +msgstr "" +"Si cette taxe est présente sur une ligne de facture, cette ligne de facture " +"sera sautée lors de la génération de la DEB et de la DES à partir des " +"factures." + +#. module: intrastat_base +#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root +#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_config_root +#: model_terms:ir.ui.view,arch_db:intrastat_base.view_intrastat_res_config_settings +msgid "Intrastat" +msgstr "DEB/DES" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.product_template_form_view +msgid "Intrastat Properties" +msgstr "Propriétés DEB/DES" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.intrastat_result_view_form +msgid "Intrastat Result View" +msgstr "Résultat DEB" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_product_product__is_accessory_cost +#: model:ir.model.fields,field_description:intrastat_base.field_product_template__is_accessory_cost +msgid "Is accessory cost" +msgstr "Est un frais accessoire" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_common____last_update +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__write_uid +msgid "Last Updated by" +msgstr "Dernière modification par" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__write_date +msgid "Last Updated on" +msgstr "Dernière modification le" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_res_company__intrastat_remind_user_ids +#: model:ir.model.fields,help:intrastat_base.field_res_config_settings__intrastat_remind_user_ids +msgid "" +"List of Odoo users who will receive a notification to remind them about the " +"Intrastat declaration." +msgstr "Liste d'utilisateurs Odoo qui recevront un rappel pour la DEB/DES." + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_res_company__intrastat_email_list +msgid "List of emails of Users Receiving the Intrastat Reminder" +msgstr "Liste des emails des utilisateurs qui reçoivent le rappel DEB/DES" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/res_company.py:0 +#, python-format +msgid "Missing e-mail address on user '%s'." +msgstr "Adresse e-mail manquante pour l'utilisateur '%s'." + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Name or Code" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__note +msgid "Notes" +msgstr "Notes" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.intrastat_result_view_form +msgid "Ok" +msgstr "Ok" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_intrastat_result_view +msgid "Pop-up to show errors on intrastat report generation" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_product_template +msgid "Product Template" +msgstr "Modèle d'article" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Search Countries" +msgstr "Recherche pays" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_res_country__intrastat +msgid "Set to True for all European Union countries." +msgstr "Cocher la case pour tous les pays de l'Union Européenne." + +#. module: intrastat_base +#: model:product.product,name:intrastat_base.shipping_costs_exclude +#: model:product.template,name:intrastat_base.shipping_costs_exclude_product_template +msgid "Shipping costs" +msgstr "Frais de port" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_account_tax +msgid "Tax" +msgstr "Taxe" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_account_tax_template +msgid "Templates for Taxes" +msgstr "Modèles pour les taxes" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "The VAT number is not set for the partner '%s'." +msgstr "Numéro de TVA non renseigné sur le partenaire '%s'." + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "The country is not set on the company '%s'." +msgstr "Pays non renseigné sur la société '%s'." + +#. module: intrastat_base +#: code:addons/intrastat_base/models/product_template.py:0 +#, python-format +msgid "" +"The option 'Is accessory cost?' should only be activated on 'Service' " +"products. You have activated this option for the product '%s' which is of " +"type '%s'" +msgstr "" +"L'option 'Est un frais accessoire' ne doit être activée que sur des articles " +"de service. Vous avez activé cette option pour l'article '%s' qui est de " +"type '%s'" + +#. module: intrastat_base +#: model:product.product,uom_name:intrastat_base.shipping_costs_exclude +#: model:product.template,uom_name:intrastat_base.shipping_costs_exclude_product_template +msgid "Units" +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "Unknown Error" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_res_company__intrastat_remind_user_ids +#: model:ir.model.fields,field_description:intrastat_base.field_res_config_settings__intrastat_remind_user_ids +msgid "Users Receiving the Intrastat Reminder" +msgstr "Utilisateurs qui reçoivent le rappel DEB/DES" + +#~ msgid "intrastat.result.view" +#~ msgstr "intrastat.result.view" + +#~ msgid "" +#~ "The generated XML file is not valid against the official XML Schema " +#~ "Definition. The generated XML file and the full error have been written " +#~ "in the server logs. Here is the error, which may give you an idea on the " +#~ "cause of the problem : %s." +#~ msgstr "" +#~ "Le fichier XML n'est pas valide au regard du schéma de définition XML. Le " +#~ "fichier XML généré et l'erreur complète ont été écrits dans les logs du " +#~ "serveur Odoo. Voici l'erreur, qui pourrait vous aiguiller sur la cause du " +#~ "problème : %s." diff --git a/intrastat_base/i18n/intrastat_base.pot b/intrastat_base/i18n/intrastat_base.pot new file mode 100644 index 0000000..40d82d2 --- /dev/null +++ b/intrastat_base/i18n/intrastat_base.pot @@ -0,0 +1,254 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * intrastat_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_product_product__is_accessory_cost +#: model:ir.model.fields,help:intrastat_base.field_product_template__is_accessory_cost +msgid "" +"Activate this option for shipping costs, packaging costs and all services " +"related to the sale of products. This option is used for Intrastat reports." +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "Cannot delete the declaration %s because it is in Done state" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_intrastat_common +msgid "Common functions for intrastat reports for products " +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_res_company +msgid "Companies" +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "Company not yet set on intrastat report." +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_res_country +msgid "Country" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__create_uid +msgid "Created by" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__create_date +msgid "Created on" +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Currency" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_common__display_name +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__display_name +msgid "Display Name" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_res_country__intrastat +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "EU Country" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_account_tax__exclude_from_intrastat_if_present +#: model:ir.model.fields,field_description:intrastat_base.field_account_tax_template__exclude_from_intrastat_if_present +msgid "Exclude invoice line from intrastat if this tax is present" +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Group By" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_common__id +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__id +msgid "ID" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_account_tax__exclude_from_intrastat_if_present +#: model:ir.model.fields,help:intrastat_base.field_account_tax_template__exclude_from_intrastat_if_present +msgid "" +"If this tax is present on an invoice line, this invoice line will be skipped" +" when generating Intrastat Product or Service lines from invoices." +msgstr "" + +#. module: intrastat_base +#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_base_root +#: model:ir.ui.menu,name:intrastat_base.menu_intrastat_config_root +#: model_terms:ir.ui.view,arch_db:intrastat_base.view_intrastat_res_config_settings +msgid "Intrastat" +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.product_template_form_view +msgid "Intrastat Properties" +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.intrastat_result_view_form +msgid "Intrastat Result View" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_product_product__is_accessory_cost +#: model:ir.model.fields,field_description:intrastat_base.field_product_template__is_accessory_cost +msgid "Is accessory cost" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_common____last_update +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view____last_update +msgid "Last Modified on" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__write_date +msgid "Last Updated on" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_res_company__intrastat_remind_user_ids +#: model:ir.model.fields,help:intrastat_base.field_res_config_settings__intrastat_remind_user_ids +msgid "" +"List of Odoo users who will receive a notification to remind them about the " +"Intrastat declaration." +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_res_company__intrastat_email_list +msgid "List of emails of Users Receiving the Intrastat Reminder" +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/res_company.py:0 +#, python-format +msgid "Missing e-mail address on user '%s'." +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Name or Code" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view__note +msgid "Notes" +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.intrastat_result_view_form +msgid "Ok" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_intrastat_result_view +msgid "Pop-up to show errors on intrastat report generation" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_product_template +msgid "Product Template" +msgstr "" + +#. module: intrastat_base +#: model_terms:ir.ui.view,arch_db:intrastat_base.res_country_view_search +msgid "Search Countries" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,help:intrastat_base.field_res_country__intrastat +msgid "Set to True for all European Union countries." +msgstr "" + +#. module: intrastat_base +#: model:product.product,name:intrastat_base.shipping_costs_exclude +#: model:product.template,name:intrastat_base.shipping_costs_exclude_product_template +msgid "Shipping costs" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_account_tax +msgid "Tax" +msgstr "" + +#. module: intrastat_base +#: model:ir.model,name:intrastat_base.model_account_tax_template +msgid "Templates for Taxes" +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "The VAT number is not set for the partner '%s'." +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "The country is not set on the company '%s'." +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/product_template.py:0 +#, python-format +msgid "" +"The option 'Is accessory cost?' should only be activated on 'Service' " +"products. You have activated this option for the product '%s' which is of " +"type '%s'" +msgstr "" + +#. module: intrastat_base +#: model:product.product,uom_name:intrastat_base.shipping_costs_exclude +#: model:product.template,uom_name:intrastat_base.shipping_costs_exclude_product_template +msgid "Units" +msgstr "" + +#. module: intrastat_base +#: code:addons/intrastat_base/models/intrastat_common.py:0 +#, python-format +msgid "Unknown Error" +msgstr "" + +#. module: intrastat_base +#: model:ir.model.fields,field_description:intrastat_base.field_res_company__intrastat_remind_user_ids +#: model:ir.model.fields,field_description:intrastat_base.field_res_config_settings__intrastat_remind_user_ids +msgid "Users Receiving the Intrastat Reminder" +msgstr "" diff --git a/intrastat_base/models/__init__.py b/intrastat_base/models/__init__.py new file mode 100644 index 0000000..68e2955 --- /dev/null +++ b/intrastat_base/models/__init__.py @@ -0,0 +1,6 @@ +from . import res_country +from . import product_template +from . import account_tax +from . import res_company +from . import res_config_settings +from . import intrastat_common diff --git a/intrastat_base/models/account_tax.py b/intrastat_base/models/account_tax.py new file mode 100644 index 0000000..ebe693b --- /dev/null +++ b/intrastat_base/models/account_tax.py @@ -0,0 +1,26 @@ +# Copyright 2011-2020 Akretion France (http://www.akretion.com). +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountTax(models.Model): + _inherit = "account.tax" + + exclude_from_intrastat_if_present = fields.Boolean( + string="Exclude invoice line from intrastat if this tax is present", + help="If this tax is present on an invoice line, this invoice " + "line will be skipped when generating Intrastat Product or " + "Service lines from invoices.", + ) + + +class AccountTaxTemplate(models.Model): + _inherit = "account.tax.template" + + exclude_from_intrastat_if_present = fields.Boolean( + string="Exclude invoice line from intrastat if this tax is present", + help="If this tax is present on an invoice line, this invoice " + "line will be skipped when generating Intrastat Product or " + "Service lines from invoices.", + ) diff --git a/intrastat_base/models/intrastat_common.py b/intrastat_base/models/intrastat_common.py new file mode 100644 index 0000000..a78ae4d --- /dev/null +++ b/intrastat_base/models/intrastat_common.py @@ -0,0 +1,146 @@ +# Copyright 2010-2020 Akretion () +# Copyright 2009-2020 Noviat (http://www.noviat.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import base64 +import logging +from io import BytesIO +from sys import exc_info +from traceback import format_exception + +from lxml import etree + +from odoo import _, api, fields, models, tools +from odoo.exceptions import UserError + +logger = logging.getLogger(__name__) + + +class IntrastatCommon(models.AbstractModel): + _name = "intrastat.common" + _description = "Common functions for intrastat reports for products " + "and services" + + # The method _compute_numbers has been removed + # because it was using a loop on lines, which is slow -> we should + # use read_group() instead, but then the code depends on + # the line object, so it can't be factorized here + + def _check_generate_lines(self): + """Check wether all requirements are met for generating lines.""" + for this in self: + if not this.company_id: + raise UserError(_("Company not yet set on intrastat report.")) + company = this.company_id + if not company.country_id: + raise UserError( + _("The country is not set on the company '%s'.") % company.name + ) + return True + + def _check_generate_xml(self): + for this in self: + if not this.company_id.partner_id.vat: + raise UserError( + _("The VAT number is not set for the partner '%s'.") + % this.company_id.partner_id.name + ) + return True + + @api.model + def _check_xml_schema(self, xml_bytes, xsd_file): + """Validate the XML file against the XSD""" + xsd_etree_obj = etree.parse(tools.file_open(xsd_file, mode="rb")) + official_schema = etree.XMLSchema(xsd_etree_obj) + try: + t = etree.parse(BytesIO(xml_bytes)) + official_schema.assertValid(t) + except (etree.XMLSchemaParseError, etree.DocumentInvalid) as e: + logger.warning("The XML file is invalid against the XML Schema Definition") + logger.warning(xml_bytes) + logger.warning(e) + usererror = "{}\n\n{}".format(e.__class__.__name__, str(e)) + raise UserError(usererror) + except Exception: + error = _("Unknown Error") + tb = "".join(format_exception(*exc_info())) + error += "\n%s" % tb + logger.warning(error) + raise UserError(error) + + def _attach_xml_file(self, xml_bytes, declaration_name): + """Attach the XML file to the report_intrastat_product/service + object""" + self.ensure_one() + filename = "{}_{}.xml".format(self.year_month, declaration_name) + attach = self.env["ir.attachment"].create( + { + "name": filename, + "res_id": self.id, + "res_model": self._name, + "datas": base64.encodebytes(xml_bytes), + } + ) + return attach.id + + def _unlink_attachments(self): + atts = self.env["ir.attachment"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)] + ) + atts.unlink() + + # Method _open_attach_view() removed + # Let's handle attachments like in l10n_fr_intrastat_service v14 + # with the field attachment_id on the declaration and the download + # link directly on the form view of the declaration. + + def _generate_xml(self): + """ + Inherit this method in the localization module + to generate the INTRASTAT Declaration XML file + + Returns: + string with XML data + + Call the _check_xml_schema() method + before returning the XML string. + """ + return False + + def send_reminder_email(self, mail_template_xmlid): + mail_template = self.env.ref(mail_template_xmlid) + for this in self: + if this.company_id.intrastat_remind_user_ids: + mail_template.send_mail(this.id) + logger.info( + "Intrastat Reminder email has been sent (XMLID: %s)." + % mail_template_xmlid + ) + else: + logger.warning( + "The list of users receiving the Intrastat Reminder is " + "empty on company %s" % this.company_id.name + ) + return True + + def unlink(self): + for intrastat in self: + if intrastat.state == "done": + raise UserError( + _("Cannot delete the declaration %s " "because it is in Done state") + % self.year_month + ) + return super().unlink() + + +class IntrastatResultView(models.TransientModel): + """ + Transient Model to display Intrastat Report results + """ + + _name = "intrastat.result.view" + _description = "Pop-up to show errors on intrastat report generation" + + note = fields.Text( + string="Notes", readonly=True, default=lambda self: self._context.get("note") + ) diff --git a/intrastat_base/models/product_template.py b/intrastat_base/models/product_template.py new file mode 100644 index 0000000..d63656c --- /dev/null +++ b/intrastat_base/models/product_template.py @@ -0,0 +1,30 @@ +# Copyright 2010-2020 Akretion () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + is_accessory_cost = fields.Boolean( + string="Is accessory cost", + help="Activate this option for shipping costs, packaging " + "costs and all services related to the sale of products. " + "This option is used for Intrastat reports.", + ) + + @api.constrains("type", "is_accessory_cost") + def _check_accessory_cost(self): + for this in self: + if this.is_accessory_cost and this.type != "service": + raise ValidationError( + _( + "The option 'Is accessory cost?' should only be " + "activated on 'Service' products. You have activated " + "this option for the product '%s' which is of type " + "'%s'" + ) + % (this.display_name, this.type) + ) diff --git a/intrastat_base/models/res_company.py b/intrastat_base/models/res_company.py new file mode 100644 index 0000000..eefce32 --- /dev/null +++ b/intrastat_base/models/res_company.py @@ -0,0 +1,42 @@ +# Copyright 2013-2020 Akretion France (http://www.akretion.com/) +# @author: +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + + +class ResCompany(models.Model): + _inherit = "res.company" + + intrastat_remind_user_ids = fields.Many2many( + comodel_name="res.users", + relation="company_intrastat_reminder_user_rel", + column1="company_id", + column2="user_id", + string="Users Receiving the Intrastat Reminder", + help="List of Odoo users who will receive a notification to " + "remind them about the Intrastat declaration.", + ) + intrastat_email_list = fields.Char( + compute="_compute_intrastat_email_list", + string="List of emails of Users Receiving the Intrastat Reminder", + ) + + @api.depends("intrastat_remind_user_ids", "intrastat_remind_user_ids.email") + def _compute_intrastat_email_list(self): + for this in self: + emails = [] + for user in this.intrastat_remind_user_ids: + if user.email: + emails.append(user.email) + this.intrastat_email_list = ",".join(emails) + + @api.constrains("intrastat_remind_user_ids") + def _check_intrastat_remind_users(self): + for this in self: + for user in this.intrastat_remind_user_ids: + if not user.email: + raise ValidationError( + _("Missing e-mail address on user '%s'.") % (user.name) + ) diff --git a/intrastat_base/models/res_config_settings.py b/intrastat_base/models/res_config_settings.py new file mode 100644 index 0000000..25e1b37 --- /dev/null +++ b/intrastat_base/models/res_config_settings.py @@ -0,0 +1,14 @@ +# Copyright 2017-2020 Akretion France (http://www.akretion.com/) +# Copyright 2018-2020 brain-tec AG (Kumar Aberer ) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + intrastat_remind_user_ids = fields.Many2many( + related="company_id.intrastat_remind_user_ids", readonly=False + ) diff --git a/intrastat_base/models/res_country.py b/intrastat_base/models/res_country.py new file mode 100644 index 0000000..10743b7 --- /dev/null +++ b/intrastat_base/models/res_country.py @@ -0,0 +1,13 @@ +# Copyright 2011-2020 Akretion France (http://www.akretion.com/) +# @author: +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCountry(models.Model): + _inherit = "res.country" + + intrastat = fields.Boolean( + string="EU Country", help="Set to True for all European Union countries." + ) diff --git a/intrastat_base/readme/CONTRIBUTORS.rst b/intrastat_base/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..6a9e1c1 --- /dev/null +++ b/intrastat_base/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Alexis de Lattre, Akretion +* Luc De Meyer, Noviat +* Kumar Aberer, brain-tec AG +* Andrea Stirpe diff --git a/intrastat_base/readme/DESCRIPTION.rst b/intrastat_base/readme/DESCRIPTION.rst new file mode 100644 index 0000000..179c7eb --- /dev/null +++ b/intrastat_base/readme/DESCRIPTION.rst @@ -0,0 +1,11 @@ +This module contains common functions for the intrastat reporting and +should be used in combination with the generic reporting module +*intrastat_product* and with the country-specific reporting modules such +as: + +- *l10n_fr_intrastat_service*: + the module for the *Déclaration Européenne des Services* (DES) for France +- *l10n_fr_intrastat_product*: + the module for the *Déclaration d'Echange de Biens* (DEB) for France +- *l10n_be_intrastat_product*: + the module for the Intrastat Declaration for Belgium. diff --git a/intrastat_base/readme/INSTALL.rst b/intrastat_base/readme/INSTALL.rst new file mode 100644 index 0000000..2f4f69f --- /dev/null +++ b/intrastat_base/readme/INSTALL.rst @@ -0,0 +1,5 @@ +WARNING: + +This module conflicts with the module *account_intrastat* from Odoo Enterprise. +If you have already installed the module *account_intrastat*, +you should uninstall it first before installing this module. diff --git a/intrastat_base/readme/USAGE.rst b/intrastat_base/readme/USAGE.rst new file mode 100644 index 0000000..32dbe07 --- /dev/null +++ b/intrastat_base/readme/USAGE.rst @@ -0,0 +1,9 @@ +This module adds an intrastat property on countries and activates this property +on the countries of the European Union. + +With this module, the country field on partners becomes a required field. + +It adds an option *Exclude invoice line from intrastat if this tax is present* +on taxes. + +It adds an *Intrastat* section on the *Invoicing* configuration page. diff --git a/intrastat_base/security/ir.model.access.csv b/intrastat_base/security/ir.model.access.csv new file mode 100644 index 0000000..fbe710c --- /dev/null +++ b/intrastat_base/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_intrastat_result_view,Access on intrastat.result.view,model_intrastat_result_view,account.group_account_user,1,1,1,0 diff --git a/intrastat_base/static/description/icon.png b/intrastat_base/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/intrastat_base/static/description/icon.png differ diff --git a/intrastat_base/static/description/index.html b/intrastat_base/static/description/index.html new file mode 100644 index 0000000..b12b2e2 --- /dev/null +++ b/intrastat_base/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + +Intrastat Reporting Base + + + +
+

Intrastat Reporting Base

+ + +

Beta License: AGPL-3 OCA/intrastat-extrastat Translate me on Weblate Try me on Runbot

+

This module contains common functions for the intrastat reporting and +should be used in combination with the generic reporting module +intrastat_product and with the country-specific reporting modules such +as:

+
    +
  • l10n_fr_intrastat_service: +the module for the Déclaration Européenne des Services (DES) for France
  • +
  • l10n_fr_intrastat_product: +the module for the Déclaration d’Echange de Biens (DEB) for France
  • +
  • l10n_be_intrastat_product: +the module for the Intrastat Declaration for Belgium.
  • +
+

Table of contents

+ +
+

Installation

+

WARNING:

+

This module conflicts with the module account_intrastat from Odoo Enterprise. +If you have already installed the module account_intrastat, +you should uninstall it first before installing this module.

+
+
+

Usage

+

This module adds an intrastat property on countries and activates this property +on the countries of the European Union.

+

With this module, the country field on partners becomes a required field.

+

It adds an option Exclude invoice line from intrastat if this tax is present +on taxes.

+

It adds an Intrastat section on the Invoicing configuration page.

+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
  • Noviat
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/intrastat-extrastat project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/intrastat_base/tests/__init__.py b/intrastat_base/tests/__init__.py new file mode 100644 index 0000000..7836283 --- /dev/null +++ b/intrastat_base/tests/__init__.py @@ -0,0 +1 @@ +from . import test_all diff --git a/intrastat_base/tests/test_all.py b/intrastat_base/tests/test_all.py new file mode 100644 index 0000000..62b1787 --- /dev/null +++ b/intrastat_base/tests/test_all.py @@ -0,0 +1,20 @@ +from odoo.tests.common import TransactionCase + + +class TestIntrastatBase(TransactionCase): + """Tests for this module""" + + def test_10_countries(self): + # check if only EU countries have the 'intrastat' bit set + france = self.env.ref("base.fr") + self.assertTrue(france.intrastat) + brazil = self.env.ref("base.br") + self.assertFalse(brazil.intrastat) + + def test_20_company(self): + # add 'Demo user' to intrastat_remind_user_ids + demo_user = self.env.ref("base.user_demo") + demo_company = self.env.ref("base.main_company") + demo_company.write({"intrastat_remind_user_ids": [(6, False, [demo_user.id])]}) + # then check if intrastat_email_list contains the email of the user + self.assertEqual(demo_company.intrastat_email_list, demo_user.email) diff --git a/intrastat_base/views/account_tax.xml b/intrastat_base/views/account_tax.xml new file mode 100644 index 0000000..a135bb5 --- /dev/null +++ b/intrastat_base/views/account_tax.xml @@ -0,0 +1,18 @@ + + + + + intrastat.base.tax + account.tax + + + + + + + + diff --git a/intrastat_base/views/intrastat.xml b/intrastat_base/views/intrastat.xml new file mode 100644 index 0000000..ca14bae --- /dev/null +++ b/intrastat_base/views/intrastat.xml @@ -0,0 +1,35 @@ + + + + + + + + intrastat.result_view_form + intrastat.result.view + +
+ + + +
+
+
+
+
+
diff --git a/intrastat_base/views/product_template.xml b/intrastat_base/views/product_template.xml new file mode 100644 index 0000000..4854cdd --- /dev/null +++ b/intrastat_base/views/product_template.xml @@ -0,0 +1,26 @@ + + + + + intrastat.base.product.template.form + product.template + + + + + + + + + + + diff --git a/intrastat_base/views/res_config_settings.xml b/intrastat_base/views/res_config_settings.xml new file mode 100644 index 0000000..934dfd7 --- /dev/null +++ b/intrastat_base/views/res_config_settings.xml @@ -0,0 +1,36 @@ + + + + + intrastat.res.config.settings.form + res.config.settings + + + +

Intrastat

+
+
+
+
+
+
+
+
+
+ + + + diff --git a/intrastat_base/views/res_country.xml b/intrastat_base/views/res_country.xml new file mode 100644 index 0000000..5ce3edb --- /dev/null +++ b/intrastat_base/views/res_country.xml @@ -0,0 +1,57 @@ + + + + + + intrastat.base.country.tree + res.country + + + + + + + + + intrastat.base.country.form + res.country + + + + + + + + + + intrastat.base.country.search + res.country + + + + + + + + + + + + + diff --git a/intrastat_base/views/res_partner.xml b/intrastat_base/views/res_partner.xml new file mode 100644 index 0000000..3b1d193 --- /dev/null +++ b/intrastat_base/views/res_partner.xml @@ -0,0 +1,24 @@ + + + + + + res.partner + + + + 1 + + + 1 + + + +