mirror of
https://github.com/OCA/intrastat-extrastat.git
synced 2025-02-16 17:13:41 +02:00
Merge pull request #47 from akretion/11.0-mig-intrastat_product
11.0 mig intrastat product
This commit is contained in:
80
intrastat_base/README.rst
Normal file
80
intrastat_base/README.rst
Normal file
@@ -0,0 +1,80 @@
|
||||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
|
||||
==============
|
||||
Intrastat Base
|
||||
==============
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
WARNING:
|
||||
|
||||
This module conflicts with the module *report_intrastat* from the official addons.
|
||||
If you have already installed the module *report_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 28 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 a tab *Intrastat* on the company form view.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/227/11.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/intrastat/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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
|
||||
* Luc De Meyer, Noviat <info@noviat.com>
|
||||
* Kumar Aberer, brain-tec AG <kumar.aberer@braintec-group.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
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.
|
||||
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
1
intrastat_base/__init__.py
Normal file
1
intrastat_base/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
29
intrastat_base/__manifest__.py
Normal file
29
intrastat_base/__manifest__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright 2011-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
|
||||
# Copyright 2009-2019 Noviat (http://www.noviat.com)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Intrastat Reporting Base',
|
||||
'version': '11.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'],
|
||||
'conflicts': ['report_intrastat'],
|
||||
'data': [
|
||||
'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,
|
||||
}
|
||||
89
intrastat_base/data/country_data.xml
Normal file
89
intrastat_base/data/country_data.xml
Normal file
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="base.fr" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.de" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.at" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.cy" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.dk" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.es" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.ee" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.fi" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.gr" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.hu" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.ie" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.it" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.lv" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.lt" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.lu" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.mt" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.nl" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.pl" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.pt" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.sk" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.cz" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.uk" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.si" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.se" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.ro" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.bg" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.be" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
<record id="base.hr" model="res.country">
|
||||
<field name="intrastat" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
27
intrastat_base/demo/intrastat_demo.xml
Normal file
27
intrastat_base/demo/intrastat_demo.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2011-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="base.main_partner" model="res.partner">
|
||||
<field name="vat">FR58441019213</field>
|
||||
</record>
|
||||
|
||||
<record id="base.res_partner_2" model="res.partner"> <!-- Agrolait -->
|
||||
<field name="vat">BE0884025633</field>
|
||||
<field name="supplier">True</field>
|
||||
</record>
|
||||
|
||||
<record id="shipping_costs_exclude" model="product.product">
|
||||
<field name="name">Shipping costs</field>
|
||||
<field name="default_code">SHIP</field>
|
||||
<field name="type">service</field>
|
||||
<field name="categ_id" ref="product.product_category_all"/>
|
||||
<field name="list_price">30</field>
|
||||
<field name="is_accessory_cost">True</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
227
intrastat_base/i18n/fr.po
Normal file
227
intrastat_base/i18n/fr.po
Normal file
@@ -0,0 +1,227 @@
|
||||
# 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"
|
||||
"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:150
|
||||
#, 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:35
|
||||
#, 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_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: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: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: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:ir.ui.view,arch_db:intrastat_base.view_intrastat_res_config_settings
|
||||
msgid "Intrastat"
|
||||
msgstr "DEB/DES"
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.ui.view,arch_db:intrastat_base.product_template_form_view
|
||||
msgid "Intrastat Properties"
|
||||
msgstr "Propriétés DEB/DES"
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model: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:38
|
||||
#, python-format
|
||||
msgid "Missing e-mail address on user '%s'."
|
||||
msgstr "Adresse e-mail manquante pour l'utilisateur '%s'."
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view_note
|
||||
msgid "Notes"
|
||||
msgstr "Notes"
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model: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_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "Modèle d'article"
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model: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:48
|
||||
#, 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:39
|
||||
#, 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/intrastat_common.py:70
|
||||
#, python-format
|
||||
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."
|
||||
|
||||
#. module: intrastat_base
|
||||
#: code:addons/intrastat_base/models/product_template.py:23
|
||||
#, 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: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"
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model,name:intrastat_base.model_intrastat_result_view
|
||||
msgid "intrastat.result.view"
|
||||
msgstr "intrastat.result.view"
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model,name:intrastat_base.model_res_config_settings
|
||||
msgid "res.config.settings"
|
||||
msgstr "res.config.settings"
|
||||
|
||||
218
intrastat_base/i18n/intrastat_base.pot
Normal file
218
intrastat_base/i18n/intrastat_base.pot
Normal file
@@ -0,0 +1,218 @@
|
||||
# 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"
|
||||
"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:151
|
||||
#, 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:39
|
||||
#, python-format
|
||||
msgid "Company not yet set on intrastat report."
|
||||
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: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: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
|
||||
msgid "Exclude invoice line from intrastat if this tax is present"
|
||||
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
|
||||
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:ir.ui.view,arch_db:intrastat_base.view_intrastat_res_config_settings
|
||||
msgid "Intrastat"
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.ui.view,arch_db:intrastat_base.product_template_form_view
|
||||
msgid "Intrastat Properties"
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model: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:38
|
||||
#, python-format
|
||||
msgid "Missing e-mail address on user '%s'."
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model.fields,field_description:intrastat_base.field_intrastat_result_view_note
|
||||
msgid "Notes"
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.ui.view,arch_db:intrastat_base.intrastat_result_view_form
|
||||
msgid "Ok"
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model,name:intrastat_base.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model: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
|
||||
#: code:addons/intrastat_base/models/intrastat_common.py:52
|
||||
#, 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:43
|
||||
#, python-format
|
||||
msgid "The country is not set on the company '%s'."
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: code:addons/intrastat_base/models/product_template.py:23
|
||||
#, 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
|
||||
#: code:addons/intrastat_base/models/intrastat_common.py:73
|
||||
#, 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 ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model,name:intrastat_base.model_intrastat_result_view
|
||||
msgid "intrastat.result.view"
|
||||
msgstr ""
|
||||
|
||||
#. module: intrastat_base
|
||||
#: model:ir.model,name:intrastat_base.model_res_config_settings
|
||||
msgid "res.config.settings"
|
||||
msgstr ""
|
||||
|
||||
6
intrastat_base/models/__init__.py
Normal file
6
intrastat_base/models/__init__.py
Normal file
@@ -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
|
||||
24
intrastat_base/models/account_tax.py
Normal file
24
intrastat_base/models/account_tax.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# © 2011-2016 Akretion (http://www.akretion.com).
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
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.")
|
||||
164
intrastat_base/models/intrastat_common.py
Normal file
164
intrastat_base/models/intrastat_common.py
Normal file
@@ -0,0 +1,164 @@
|
||||
# Copyright 2010-2016 Akretion (<alexis.delattre@akretion.com>)
|
||||
# Copyright 2009-2019 Noviat (http://www.noviat.com)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from io import BytesIO
|
||||
from lxml import etree
|
||||
from sys import exc_info
|
||||
from traceback import format_exception
|
||||
import logging
|
||||
|
||||
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"
|
||||
|
||||
@api.multi
|
||||
@api.depends('declaration_line_ids.amount_company_currency')
|
||||
def _compute_numbers(self):
|
||||
for this in self:
|
||||
total_amount = 0 # it is an integer
|
||||
num_lines = 0
|
||||
for line in this.declaration_line_ids:
|
||||
total_amount += line.amount_company_currency
|
||||
num_lines += 1
|
||||
this.num_decl_lines = num_lines
|
||||
this.total_amount = total_amount
|
||||
|
||||
@api.multi
|
||||
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
|
||||
|
||||
@api.multi
|
||||
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_string, 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_string))
|
||||
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_string)
|
||||
logger.warning(e)
|
||||
usererror = '%s\n\n%s' % (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)
|
||||
|
||||
@api.multi
|
||||
def _attach_xml_file(self, xml_string, declaration_name):
|
||||
'''Attach the XML file to the report_intrastat_product/service
|
||||
object'''
|
||||
self.ensure_one()
|
||||
import base64
|
||||
filename = '%s_%s.xml' % (self.year_month, declaration_name)
|
||||
attach = self.env['ir.attachment'].create({
|
||||
'name': filename,
|
||||
'res_id': self.id,
|
||||
'res_model': self._name,
|
||||
'datas': base64.encodestring(xml_string),
|
||||
'datas_fname': filename})
|
||||
return attach.id
|
||||
|
||||
@api.multi
|
||||
def _unlink_attachments(self):
|
||||
atts = self.env['ir.attachment'].search(
|
||||
[('res_model', '=', self._name),
|
||||
('res_id', '=', self.id)])
|
||||
atts.unlink()
|
||||
|
||||
@api.model
|
||||
def _open_attach_view(self, attach_id, title='XML file'):
|
||||
'''Returns an action which opens the form view of the
|
||||
corresponding attachement'''
|
||||
action = {
|
||||
'name': title,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'ir.attachment',
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
'res_id': attach_id,
|
||||
}
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
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
|
||||
|
||||
@api.multi
|
||||
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
|
||||
|
||||
@api.multi
|
||||
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(IntrastatCommon, self).unlink()
|
||||
|
||||
|
||||
class IntrastatResultView(models.TransientModel):
|
||||
"""
|
||||
Transient Model to display Intrastat Report results
|
||||
"""
|
||||
_name = 'intrastat.result.view'
|
||||
|
||||
note = fields.Text(
|
||||
string='Notes', readonly=True,
|
||||
default=lambda self: self._context.get('note'))
|
||||
27
intrastat_base/models/product_template.py
Normal file
27
intrastat_base/models/product_template.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright 2010-2016 Akretion (<alexis.delattre@akretion.com>)
|
||||
# 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.multi
|
||||
@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.name, this.type))
|
||||
39
intrastat_base/models/res_company.py
Normal file
39
intrastat_base/models/res_company.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# Copyright 2013-2017 Akretion (<alexis.delattre@akretion.com>)
|
||||
# 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(
|
||||
'res.users', 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.multi
|
||||
@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.multi
|
||||
@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))
|
||||
12
intrastat_base/models/res_config_settings.py
Normal file
12
intrastat_base/models/res_config_settings.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
|
||||
# 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')
|
||||
12
intrastat_base/models/res_country.py
Normal file
12
intrastat_base/models/res_country.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright 2011-2014 Akretion (<alexis.delattre@akretion.com>)
|
||||
# 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.")
|
||||
BIN
intrastat_base/static/description/icon.png
Normal file
BIN
intrastat_base/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
1
intrastat_base/tests/__init__.py
Normal file
1
intrastat_base/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_all
|
||||
22
intrastat_base/tests/test_all.py
Normal file
22
intrastat_base/tests/test_all.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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.assertEquals(demo_company.intrastat_email_list, demo_user.email)
|
||||
21
intrastat_base/views/account_tax.xml
Normal file
21
intrastat_base/views/account_tax.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2011-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Add 'exclude_from_intrastat_if_present' on tax form view -->
|
||||
<record id="view_tax_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.base.tax</field>
|
||||
<field name="model">account.tax</field>
|
||||
<field name="inherit_id" ref="account.view_tax_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="active" position="before">
|
||||
<field name="exclude_from_intrastat_if_present"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
33
intrastat_base/views/intrastat.xml
Normal file
33
intrastat_base/views/intrastat.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2011-2016 Akretion (http://www.akretion.com/)
|
||||
© 2015-2016 Noviat (http://www.noviat.com/)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Menu entries for Intrastat -->
|
||||
<menuitem id="menu_intrastat_base_root"
|
||||
name="Intrastat"
|
||||
parent="account.menu_finance_reports" sequence="50"/>
|
||||
<menuitem id="menu_intrastat_config_root" name="Intrastat"
|
||||
parent="account.menu_finance_configuration" sequence="50"/>
|
||||
|
||||
|
||||
<record id="intrastat_result_view_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.result_view_form</field>
|
||||
<field name="model">intrastat.result.view</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Result View">
|
||||
<group name="main">
|
||||
<field name="note" nolabel="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Ok" class="oe_highlight" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
28
intrastat_base/views/product_template.xml
Normal file
28
intrastat_base/views/product_template.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2010-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="name">intrastat.base.product.template.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="account.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="properties" position="after">
|
||||
<group string="Intrastat Properties" name="intrastat">
|
||||
<!-- If you need this field, inherit this view in a
|
||||
localisation module to set invisible="0" -->
|
||||
<field name="is_accessory_cost"
|
||||
attrs="{'invisible': [('type', '!=', 'service')]}"
|
||||
invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
33
intrastat_base/views/res_config_settings.xml
Normal file
33
intrastat_base/views/res_config_settings.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2013-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
© 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_intrastat_res_config_settings" model="ir.ui.view">
|
||||
<field name="name">intrastat.res.config.settings.form</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='recommended_apps']" position="after">
|
||||
<h2>Intrastat</h2>
|
||||
<div class="row mt16 o_settings_container" id="intrastat">
|
||||
<div class="col-xs-12 col-md-12 o_setting_box">
|
||||
<div class="o_setting_left_pane"/>
|
||||
<div class="o_setting_right_pane">
|
||||
<div class="row">
|
||||
<label for="intrastat_remind_user_ids" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_remind_user_ids" widget="many2many_tags"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
48
intrastat_base/views/res_country.xml
Normal file
48
intrastat_base/views/res_country.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2011-2016 Akretion (http://www.akretion.com)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<!-- Add intrastat field on res_country -->
|
||||
<record id="view_country_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.base.country.tree</field>
|
||||
<field name="model">res.country</field>
|
||||
<field name="inherit_id" ref="base.view_country_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="code" position="after">
|
||||
<field name="intrastat" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_country_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.base.country.form</field>
|
||||
<field name="model">res.country</field>
|
||||
<field name="inherit_id" ref="base.view_country_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="code" position="after">
|
||||
<field name="intrastat" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- there is no native search view, so I can't inherit -->
|
||||
<record id="res_country_view_search" model="ir.ui.view">
|
||||
<field name="name">intrastat.base.country.search</field>
|
||||
<field name="model">res.country</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Countries">
|
||||
<field name="name" />
|
||||
<field name="code" />
|
||||
<filter name="intrastat" string="EU Country"
|
||||
domain="[('intrastat', '=', True)]" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
25
intrastat_base/views/res_partner.xml
Normal file
25
intrastat_base/views/res_partner.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2010-2016 Akretion (http://www.akretion.com/)
|
||||
@author David BEAL <david.beal@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Set country_id field to required on partner form view -->
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='country_id']" position="attributes">
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='country_id']"
|
||||
position="attributes">
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
104
intrastat_product/README.rst
Normal file
104
intrastat_product/README.rst
Normal file
@@ -0,0 +1,104 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
|
||||
=================
|
||||
Intrastat Product
|
||||
=================
|
||||
|
||||
This module contains common objects and fields for the Intrastat Product reporting, such as the *H.S. codes* (if you are not familiar with H.S. codes, read `Wikipedia <http://en.wikipedia.org/wiki/Harmonized_System>`) and the *country of origin* on the products.
|
||||
|
||||
It should be used in combination with country-specific Intrastat Product reporting modules
|
||||
such as:
|
||||
|
||||
- *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 Product Declaration for Belgium
|
||||
|
||||
These country-specific modules can be found in the OCA localization for those countries.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
WARNING:
|
||||
|
||||
This module conflicts with the module *report_intrastat* from the official addons.
|
||||
If you have already installed the module *report_intrastat*,
|
||||
you should uninstall it before installing this module.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
This module is used in combination with the country-specific
|
||||
localization module(s).
|
||||
|
||||
Coding guidelines for localization module:
|
||||
------------------------------------------
|
||||
|
||||
We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product
|
||||
and adapt the code for the specific needs of your country.
|
||||
|
||||
* Declaration Object
|
||||
|
||||
Create a new class as follows:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class L10nCcIntrastatProductDeclaration(models.Model):
|
||||
_name = 'l10n.cc.intrastat.product.declaration'
|
||||
_description = "Intrastat Product Declaration for YourCountry"
|
||||
_inherit = ['intrastat.product.declaration', 'mail.thread']
|
||||
|
||||
whereby cc = your country code
|
||||
|
||||
* Computation & Declaration Lines
|
||||
|
||||
Create also new objects inheriting from the Computation and Declaration Line Objects
|
||||
so that you can add methods or customise the methods from the base modules (make a PR when
|
||||
the customization or new method is required for multiple countries).
|
||||
|
||||
Adapt also the parent_id fields of the newly created objects
|
||||
(cf. l10n_be_intrastat_product as example).
|
||||
|
||||
* XML Files: Menu, Action, Views
|
||||
|
||||
Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code.
|
||||
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/227/10.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/intrastat/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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Alexis de Lattre, Akretion <alexis.delattre@akretion.com>
|
||||
* Luc De Meyer, Noviat <info@noviat.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
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.
|
||||
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
2
intrastat_product/__init__.py
Normal file
2
intrastat_product/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import models
|
||||
from . import report
|
||||
42
intrastat_product/__manifest__.py
Normal file
42
intrastat_product/__manifest__.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2019 Noviat (http://www.noviat.com)
|
||||
# Copyright 2018 brain-tec AG (http://www.braintec-group.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
# @author Kumar Aberer <kumar.aberer@braintec-group.com>
|
||||
|
||||
{
|
||||
'name': 'Intrastat Product',
|
||||
'version': '11.0.1.2.0',
|
||||
'category': 'Intrastat',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Base module for Intrastat Product',
|
||||
'author': 'brain-tec AG, Akretion, Noviat, '
|
||||
'Odoo Community Association (OCA)',
|
||||
'depends': [
|
||||
'intrastat_base',
|
||||
'product_harmonized_system',
|
||||
'sale_stock',
|
||||
'purchase',
|
||||
'report_xlsx_helper',
|
||||
],
|
||||
'excludes': ['report_intrastat'],
|
||||
'data': [
|
||||
'views/hs_code.xml',
|
||||
'views/intrastat_region.xml',
|
||||
'views/intrastat_unit.xml',
|
||||
'views/intrastat_transaction.xml',
|
||||
'views/intrastat_transport_mode.xml',
|
||||
'views/intrastat_product_declaration.xml',
|
||||
'views/res_config_settings.xml',
|
||||
'views/account_invoice.xml',
|
||||
'views/sale_order.xml',
|
||||
'views/stock_warehouse.xml',
|
||||
'security/intrastat_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'data/intrastat_transport_mode.xml',
|
||||
'data/intrastat_unit.xml',
|
||||
],
|
||||
'demo': ['demo/intrastat_demo.xml'],
|
||||
'installable': True,
|
||||
}
|
||||
50
intrastat_product/data/intrastat_transport_mode.xml
Normal file
50
intrastat_product/data/intrastat_transport_mode.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="intrastat_transport_1" model="intrastat.transport_mode">
|
||||
<field name="code">1</field>
|
||||
<field name="name">Sea</field>
|
||||
<field name="description">Sea Transport (including wagons, motor vehicles, trailers, semi-trailers and lighters on board of a ship)</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_2" model="intrastat.transport_mode">
|
||||
<field name="code">2</field>
|
||||
<field name="name">Rail</field>
|
||||
<field name="description">Railway transport (including lorries on railway wagons)</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_3" model="intrastat.transport_mode">
|
||||
<field name="code">3</field>
|
||||
<field name="name">Road</field>
|
||||
<field name="description">Road Transport</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_4" model="intrastat.transport_mode">
|
||||
<field name="code">4</field>
|
||||
<field name="name">Air</field>
|
||||
<field name="description">Air Transport</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_5" model="intrastat.transport_mode">
|
||||
<field name="code">5</field>
|
||||
<field name="name">Post</field>
|
||||
<field name="description">Postal consignments</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_7" model="intrastat.transport_mode">
|
||||
<field name="code">7</field>
|
||||
<field name="name">Fixed installations</field>
|
||||
<field name="description">Fixed transport installations (e.g. pipelines, high-tension cables)</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_8" model="intrastat.transport_mode">
|
||||
<field name="code">8</field>
|
||||
<field name="name">Inland waterway</field>
|
||||
<field name="description">Inland waterway transport</field>
|
||||
</record>
|
||||
<record id="intrastat_transport_9" model="intrastat.transport_mode">
|
||||
<field name="code">9</field>
|
||||
<field name="name">Own propulsion</field>
|
||||
<field name="description">Own propulsion (imported or exported means of transport crossing the border under their own power, e.g. aircraft, lorries, boats, etc.)</field>
|
||||
</record>
|
||||
|
||||
<!-- Set default value to Road trp on main company -->
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="intrastat_transport_id" ref="intrastat_transport_3"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
123
intrastat_product/data/intrastat_unit.xml
Normal file
123
intrastat_product/data/intrastat_unit.xml
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<!-- Extracted from the Official Journal of the European Union -->
|
||||
|
||||
<record id="intrastat_unit_c_k" model="intrastat.unit">
|
||||
<field name="name">c/k</field>
|
||||
<field name="description">Carats - 1 metric carat = 2 × 10exp(–4) kg</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_ce_el" model="intrastat.unit">
|
||||
<field name="name">ce/el</field>
|
||||
<field name="description">Number of cells</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_ct_l" model="intrastat.unit">
|
||||
<field name="name">ct/l</field>
|
||||
<field name="description">Carrying capacity in tonnes</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_g" model="intrastat.unit">
|
||||
<field name="name">g</field>
|
||||
<field name="description">Gram</field>
|
||||
<field name="uom_id" ref="product.product_uom_gram"/>
|
||||
</record>
|
||||
<record id="intrastat_unit_gi_FS" model="intrastat.unit">
|
||||
<field name="name">gi F/S</field>
|
||||
<field name="description">Gram of fissile isotopes</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_H2O2" model="intrastat.unit">
|
||||
<field name="name">kg H2O2</field>
|
||||
<field name="description">Kilogram of hydrogen peroxide</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_K2O" model="intrastat.unit">
|
||||
<field name="name">kg K2O</field>
|
||||
<field name="description">Kilogram of potassium oxide</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_KOH" model="intrastat.unit">
|
||||
<field name="name">kg KOH</field>
|
||||
<field name="description">Kilogram of potassium hydroxide (caustic potash)</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_ma" model="intrastat.unit">
|
||||
<field name="name">kg met.am.</field>
|
||||
<field name="description">Kilogram of methylamines</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_N" model="intrastat.unit">
|
||||
<field name="name">kg N</field>
|
||||
<field name="description">Kilogram of nitrogen</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_NaOH" model="intrastat.unit">
|
||||
<field name="name">kg NaOH</field>
|
||||
<field name="description">Kilogram of sodium hydroxide (caustic soda)</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_net_eda" model="intrastat.unit">
|
||||
<field name="name">kg/net eda</field>
|
||||
<field name="description">Kilogram drained net weight</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_P2O5" model="intrastat.unit">
|
||||
<field name="name">kg P2O5</field>
|
||||
<field name="description">Kilogram of diphosphorus pentaoxide</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_90_pct_sdt" model="intrastat.unit">
|
||||
<field name="name">kg 90 pct sdt</field>
|
||||
<field name="description">Kilogram of substance 90 % dry</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_kg_U" model="intrastat.unit">
|
||||
<field name="name">kg U</field>
|
||||
<field name="description">Kilogram of uranium</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_1000_kWh" model="intrastat.unit">
|
||||
<field name="name">1000 kWh</field>
|
||||
<field name="description">Thousand kilowatt hours</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_l" model="intrastat.unit">
|
||||
<field name="name">l</field>
|
||||
<field name="description">Litre</field>
|
||||
<field name="uom_id" ref="product.product_uom_litre"/>
|
||||
</record>
|
||||
<record id="intrastat_unit_1000l" model="intrastat.unit">
|
||||
<field name="name">1000 l</field>
|
||||
<field name="description">Thousand litres</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_l_alc_100_pct" model="intrastat.unit">
|
||||
<field name="name">l alc. 100 pct</field>
|
||||
<field name="description">Litre pure (100 %) alcohol</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_m" model="intrastat.unit">
|
||||
<field name="name">m</field>
|
||||
<field name="description">Metre</field>
|
||||
<field name="uom_id" ref="product.product_uom_meter"/>
|
||||
</record>
|
||||
<record id="intrastat_unit_m2" model="intrastat.unit">
|
||||
<field name="name">m2</field>
|
||||
<field name="description">Square metre</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_m3" model="intrastat.unit">
|
||||
<field name="name">m3</field>
|
||||
<field name="description">Cubic metre</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_1000m3" model="intrastat.unit">
|
||||
<field name="name">1000 m3</field>
|
||||
<field name="description">Thousand cubic metres</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_pa" model="intrastat.unit">
|
||||
<field name="name">pa</field>
|
||||
<field name="description">Number of pairs</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_pce" model="intrastat.unit">
|
||||
<field name="name">items</field>
|
||||
<field name="description">Number of items</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
</record>
|
||||
<record id="intrastat_unit_100pce" model="intrastat.unit">
|
||||
<field name="name">100 items</field>
|
||||
<field name="description">Hundred items</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_1000pce" model="intrastat.unit">
|
||||
<field name="name">1000 items</field>
|
||||
<field name="description">Thousand items</field>
|
||||
</record>
|
||||
<record id="intrastat_unit_TJ" model="intrastat.unit">
|
||||
<field name="name">TJ</field>
|
||||
<field name="description">Terajoule (gross calorific value)</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
25
intrastat_product/demo/intrastat_demo.xml
Normal file
25
intrastat_product/demo/intrastat_demo.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2011-2017 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="product_harmonized_system.84715000" model="hs.code">
|
||||
<field name="intrastat_unit_id" ref="intrastat_unit_pce"/>
|
||||
</record>
|
||||
|
||||
<record id="product_harmonized_system.84717050" model="hs.code">
|
||||
<field name="intrastat_unit_id" ref="intrastat_unit_pce"/>
|
||||
</record>
|
||||
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="intrastat_arrivals">extended</field>
|
||||
<field name="intrastat_dispatches">extended</field>
|
||||
<field name="intrastat_incoterm_id" ref="stock.incoterm_DDU"/>
|
||||
<field name="intrastat_transport_id" ref="intrastat_transport_3"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
1182
intrastat_product/i18n/fr.po
Normal file
1182
intrastat_product/i18n/fr.po
Normal file
File diff suppressed because it is too large
Load Diff
1181
intrastat_product/i18n/intrastat_product.pot
Normal file
1181
intrastat_product/i18n/intrastat_product.pot
Normal file
File diff suppressed because it is too large
Load Diff
11
intrastat_product/models/__init__.py
Normal file
11
intrastat_product/models/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from . import res_company
|
||||
from . import res_config_settings
|
||||
from . import account_invoice
|
||||
from . import hs_code
|
||||
from . import intrastat_product_declaration
|
||||
from . import intrastat_region
|
||||
from . import intrastat_transaction
|
||||
from . import intrastat_transport_mode
|
||||
from . import intrastat_unit
|
||||
from . import sale_order
|
||||
from . import stock_warehouse
|
||||
73
intrastat_product/models/account_invoice.py
Normal file
73
intrastat_product/models/account_invoice.py
Normal file
@@ -0,0 +1,73 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
# in v10, the sale_stock module defines an incoterms_id
|
||||
# Odoo v8 name: incoterm_id
|
||||
intrastat_transaction_id = fields.Many2one(
|
||||
comodel_name='intrastat.transaction',
|
||||
string='Intrastat Transaction Type',
|
||||
ondelete='restrict', track_visibility='onchange',
|
||||
help="Intrastat nature of transaction")
|
||||
intrastat_transport_id = fields.Many2one(
|
||||
comodel_name='intrastat.transport_mode',
|
||||
string='Intrastat Transport Mode',
|
||||
ondelete='restrict')
|
||||
src_dest_country_id = fields.Many2one(
|
||||
comodel_name='res.country',
|
||||
string='Origin/Destination Country',
|
||||
compute='_compute_intrastat_country',
|
||||
store=True, compute_sudo=True,
|
||||
help="Destination country for dispatches. Origin country for "
|
||||
"arrivals.")
|
||||
intrastat_country = fields.Boolean(
|
||||
compute='_compute_intrastat_country', string='Intrastat Country',
|
||||
store=True, readonly=True, compute_sudo=True)
|
||||
src_dest_region_id = fields.Many2one(
|
||||
comodel_name='intrastat.region',
|
||||
string='Origin/Destination Region',
|
||||
default=lambda self: self._default_src_dest_region_id(),
|
||||
help="Origin region for dispatches, destination region for "
|
||||
"arrivals. This field is used for the Intrastat Declaration.",
|
||||
ondelete='restrict')
|
||||
intrastat = fields.Char(
|
||||
string='Intrastat Declaration',
|
||||
related='company_id.intrastat', readonly=True, compute_sudo=True)
|
||||
|
||||
@api.multi
|
||||
@api.depends('partner_shipping_id.country_id', 'partner_id.country_id')
|
||||
def _compute_intrastat_country(self):
|
||||
for inv in self:
|
||||
country = inv.partner_shipping_id.country_id\
|
||||
or inv.partner_id.country_id
|
||||
if not country:
|
||||
country = inv.company_id.country_id
|
||||
inv.src_dest_country_id = country.id
|
||||
inv.intrastat_country = country.intrastat
|
||||
|
||||
@api.model
|
||||
def _default_src_dest_region_id(self):
|
||||
rco = self.env['res.company']
|
||||
company = rco._company_default_get('account.invoice')
|
||||
return company.intrastat_region_id
|
||||
|
||||
|
||||
class AccountInvoiceLine(models.Model):
|
||||
_inherit = 'account.invoice.line'
|
||||
|
||||
hs_code_id = fields.Many2one(
|
||||
comodel_name='hs.code',
|
||||
string='Intrastat Code', ondelete='restrict')
|
||||
|
||||
@api.onchange('product_id')
|
||||
def intrastat_product_id_change(self):
|
||||
if self.product_id:
|
||||
hs_code = self.product_id.get_hs_code_recursively()
|
||||
self.hs_code_id = hs_code and hs_code.id or False
|
||||
30
intrastat_product/models/hs_code.py
Normal file
30
intrastat_product/models/hs_code.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class HSCode(models.Model):
|
||||
_inherit = "hs.code"
|
||||
|
||||
intrastat_unit_id = fields.Many2one(
|
||||
comodel_name='intrastat.unit',
|
||||
string='Intrastat Supplementary Unit')
|
||||
|
||||
@api.constrains('local_code')
|
||||
def _hs_code(self):
|
||||
if self.company_id.country_id.intrastat:
|
||||
if not self.local_code.isdigit():
|
||||
raise ValidationError(_(
|
||||
"Intrastat Codes should only contain digits. "
|
||||
"This is not the case for code '%s'.")
|
||||
% self.local_code)
|
||||
if len(self.local_code) != 8:
|
||||
raise ValidationError(_(
|
||||
"Intrastat Codes should "
|
||||
"contain 8 digits. This is not the case for "
|
||||
"Intrastat Code '%s' which has %d digits.")
|
||||
% (self.local_code, len(self.local_code)))
|
||||
974
intrastat_product/models/intrastat_product_declaration.py
Normal file
974
intrastat_product/models/intrastat_product_declaration.py
Normal file
@@ -0,0 +1,974 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import RedirectWarning, ValidationError, UserError
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from datetime import datetime, date
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IntrastatProductDeclaration(models.Model):
|
||||
_name = 'intrastat.product.declaration'
|
||||
_description = "Intrastat Product Report Base Object"
|
||||
_rec_name = 'year_month'
|
||||
_inherit = ['mail.thread', 'intrastat.common']
|
||||
_order = 'year_month desc, type, revision'
|
||||
_sql_constraints = [
|
||||
('date_uniq',
|
||||
'unique(year_month, company_id, type, revision)',
|
||||
"A declaration of the same type already exists for this month !"
|
||||
"\nYou should update the existing declaration "
|
||||
"or change the revision number of this one."),
|
||||
]
|
||||
|
||||
@api.model
|
||||
def _default_year(self):
|
||||
if datetime.now().month == 1:
|
||||
year = datetime.now().year - 1
|
||||
else:
|
||||
year = datetime.now().year
|
||||
return str(year)
|
||||
|
||||
@api.model
|
||||
def _default_month(self):
|
||||
if datetime.now().month == 1:
|
||||
return 12
|
||||
else:
|
||||
return datetime.now().month - 1
|
||||
|
||||
@api.model
|
||||
def _default_action(self):
|
||||
return 'replace'
|
||||
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company', string='Company', readonly=True,
|
||||
default=lambda self: self.env['res.company']._company_default_get(
|
||||
'intrastat.product.declaration'))
|
||||
company_country_code = fields.Char(
|
||||
compute='_compute_company_country_code',
|
||||
string='Company Country Code', readonly=True, store=True,
|
||||
help="Used in views and methods of localization modules.")
|
||||
year = fields.Char(
|
||||
string='Year', required=True,
|
||||
default=lambda self: self._default_year(),
|
||||
states={'done': [('readonly', True)]})
|
||||
month = fields.Selection([
|
||||
(1, '01'),
|
||||
(2, '02'),
|
||||
(3, '03'),
|
||||
(4, '04'),
|
||||
(5, '05'),
|
||||
(6, '06'),
|
||||
(7, '07'),
|
||||
(8, '08'),
|
||||
(9, '09'),
|
||||
(10, '10'),
|
||||
(11, '11'),
|
||||
(12, '12')
|
||||
], string='Month', required=True,
|
||||
default=lambda self: self._default_month(),
|
||||
states={'done': [('readonly', True)]})
|
||||
year_month = fields.Char(
|
||||
compute='_compute_year_month', string='Period', readonly=True,
|
||||
track_visibility='onchange', store=True,
|
||||
help="Year and month of the declaration.")
|
||||
type = fields.Selection(
|
||||
selection='_get_type', string='Type', required=True,
|
||||
states={'done': [('readonly', True)]},
|
||||
track_visibility='onchange', help="Select the declaration type.")
|
||||
action = fields.Selection(
|
||||
selection='_get_action',
|
||||
string='Action', required=True,
|
||||
default=lambda self: self._default_action(),
|
||||
states={'done': [('readonly', True)]},
|
||||
track_visibility='onchange')
|
||||
revision = fields.Integer(
|
||||
string='Revision', default=1,
|
||||
states={'done': [('readonly', True)]},
|
||||
help="Used to keep track of changes")
|
||||
computation_line_ids = fields.One2many(
|
||||
comodel_name='intrastat.product.computation.line',
|
||||
inverse_name='parent_id',
|
||||
string='Intrastat Product Computation Lines',
|
||||
states={'done': [('readonly', True)]})
|
||||
declaration_line_ids = fields.One2many(
|
||||
comodel_name='intrastat.product.declaration.line',
|
||||
inverse_name='parent_id', string='Intrastat Product Declaration Lines',
|
||||
states={'done': [('readonly', True)]})
|
||||
num_decl_lines = fields.Integer(
|
||||
compute='_compute_numbers', string='Number of Declaration Lines',
|
||||
store=True, track_visibility='onchange')
|
||||
total_amount = fields.Integer(
|
||||
compute='_compute_numbers', string='Total Fiscal Amount', store=True,
|
||||
help="Total fiscal amount in company currency of the declaration.")
|
||||
currency_id = fields.Many2one(
|
||||
'res.currency', related='company_id.currency_id', readonly=True,
|
||||
string='Currency')
|
||||
state = fields.Selection(
|
||||
selection=[('draft', 'Draft'),
|
||||
('done', 'Done')],
|
||||
string='State', readonly=True, track_visibility='onchange',
|
||||
copy=False, default='draft',
|
||||
help="State of the declaration. When the state is set to 'Done', "
|
||||
"the parameters become read-only.")
|
||||
note = fields.Text(
|
||||
string='Notes',
|
||||
help="You can add some comments here if you want.")
|
||||
reporting_level = fields.Selection(
|
||||
selection='_get_reporting_level',
|
||||
string='Reporting Level',
|
||||
states={'done': [('readonly', True)]})
|
||||
valid = fields.Boolean(
|
||||
compute='_compute_check_validity',
|
||||
string='Valid')
|
||||
|
||||
@api.model
|
||||
def _get_type(self):
|
||||
res = []
|
||||
company = self.env.user.company_id
|
||||
arrivals = company.intrastat_arrivals
|
||||
dispatches = company.intrastat_dispatches
|
||||
if arrivals != 'exempt':
|
||||
res.append(('arrivals', _('Declaration for Arrivals')))
|
||||
if dispatches != 'exempt':
|
||||
res.append(('dispatches', _('Declaration for Dispatches')))
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def _get_reporting_level(self):
|
||||
return [
|
||||
('standard', _('Standard')),
|
||||
('extended', _('Extended'))]
|
||||
|
||||
@api.model
|
||||
def _get_action(self):
|
||||
return [
|
||||
('replace', 'Replace'),
|
||||
('append', 'Append'),
|
||||
('nihil', 'Nihil')]
|
||||
|
||||
@api.multi
|
||||
@api.depends('company_id')
|
||||
def _compute_company_country_code(self):
|
||||
for this in self:
|
||||
if this.company_id:
|
||||
if not this.company_id.country_id:
|
||||
raise ValidationError(
|
||||
_("You must set company's country !"))
|
||||
this.company_country_code = \
|
||||
this.company_id.country_id.code.lower()
|
||||
|
||||
@api.multi
|
||||
@api.depends('year', 'month')
|
||||
def _compute_year_month(self):
|
||||
for this in self:
|
||||
if this.year and this.month:
|
||||
this.year_month = '-'.join(
|
||||
[this.year, format(this.month, '02')])
|
||||
|
||||
@api.multi
|
||||
@api.depends('month')
|
||||
def _compute_check_validity(self):
|
||||
""" TO DO: logic based upon computation lines """
|
||||
for this in self:
|
||||
this.valid = True
|
||||
|
||||
@api.model
|
||||
@api.constrains('year')
|
||||
def _check_year(self):
|
||||
for this in self:
|
||||
if len(this.year) != 4 or this.year[0] != '2':
|
||||
raise ValidationError(_("Invalid Year !"))
|
||||
|
||||
@api.onchange('type')
|
||||
def _onchange_type(self):
|
||||
if self.type == 'arrivals':
|
||||
self.reporting_level = \
|
||||
self.company_id.intrastat_arrivals == 'extended' \
|
||||
and 'extended' or 'standard'
|
||||
if self.type == 'dispatches':
|
||||
self.reporting_level = \
|
||||
self.company_id.intrastat_dispatches == 'extended' \
|
||||
and 'extended' or 'standard'
|
||||
|
||||
@api.multi
|
||||
def copy(self, default=None):
|
||||
self.ensure_one()
|
||||
default = default or {}
|
||||
default['revision'] = self.revision + 1
|
||||
return super(IntrastatProductDeclaration, self).copy(default)
|
||||
|
||||
def _account_config_warning(self, msg):
|
||||
action = self.env.ref('account.action_account_config')
|
||||
raise RedirectWarning(
|
||||
msg, action.id,
|
||||
_('Go to Accounting Configuration Settings screen'))
|
||||
|
||||
def _get_partner_country(self, inv_line):
|
||||
country = inv_line.invoice_id.src_dest_country_id \
|
||||
or inv_line.invoice_id.partner_id.country_id
|
||||
if not country.intrastat:
|
||||
country = False
|
||||
elif country == self.company_id.country_id:
|
||||
country = False
|
||||
return country
|
||||
|
||||
def _get_intrastat_transaction(self, inv_line):
|
||||
invoice = inv_line.invoice_id
|
||||
if invoice.intrastat_transaction_id:
|
||||
return invoice.intrastat_transaction_id
|
||||
else:
|
||||
company = invoice.company_id
|
||||
if invoice.type == 'out_invoice':
|
||||
return company.intrastat_transaction_out_invoice
|
||||
elif invoice.type == 'out_refund':
|
||||
return company.intrastat_transaction_out_refund
|
||||
elif invoice.type == 'in_invoice':
|
||||
return company.intrastat_transaction_in_invoice
|
||||
elif invoice.type == 'in_refund':
|
||||
return company.intrastat_transaction_in_refund
|
||||
|
||||
def _get_weight_and_supplunits(self, inv_line, hs_code):
|
||||
line_qty = inv_line.quantity
|
||||
product = inv_line.product_id
|
||||
invoice = inv_line.invoice_id
|
||||
intrastat_unit_id = hs_code.intrastat_unit_id
|
||||
source_uom = inv_line.uom_id
|
||||
weight_uom_categ = self._get_uom_refs('weight_uom_categ')
|
||||
kg_uom = self._get_uom_refs('kg_uom')
|
||||
pce_uom_categ = self._get_uom_refs('pce_uom_categ')
|
||||
pce_uom = self._get_uom_refs('pce_uom')
|
||||
weight = suppl_unit_qty = 0.0
|
||||
|
||||
if not source_uom:
|
||||
note = "\n" + _(
|
||||
"Missing unit of measure on the line with %d "
|
||||
"product(s) '%s' on invoice '%s'."
|
||||
) % (line_qty, product.name_get()[0][1], invoice.number)
|
||||
note += "\n" + _(
|
||||
"Please adjust this line manually.")
|
||||
self._note += note
|
||||
return weight, suppl_unit_qty
|
||||
|
||||
if intrastat_unit_id:
|
||||
target_uom = intrastat_unit_id.uom_id
|
||||
if not target_uom:
|
||||
note = "\n" + _(
|
||||
"Conversion from Intrastat Supplementary Unit '%s' to "
|
||||
"Unit of Measure is not implemented yet."
|
||||
) % intrastat_unit_id.name
|
||||
note += "\n" + _(
|
||||
"Please correct the Intrastat Supplementary Unit "
|
||||
"settings and regenerate the lines or adjust the lines "
|
||||
"with Intrastat Code '%s' manually"
|
||||
) % hs_code.display_name
|
||||
self._note += note
|
||||
return weight, suppl_unit_qty
|
||||
if target_uom.category_id == source_uom.category_id:
|
||||
suppl_unit_qty = source_uom._compute_quantity(
|
||||
line_qty, target_uom)
|
||||
else:
|
||||
note = "\n" + _(
|
||||
"Conversion from unit of measure '%s' to '%s' "
|
||||
"is not implemented yet."
|
||||
) % (source_uom.name, target_uom.name)
|
||||
note += "\n" + _(
|
||||
"Please correct the unit of measure settings and "
|
||||
"regenerate the lines or adjust the impacted "
|
||||
"lines manually")
|
||||
self._note += note
|
||||
return weight, suppl_unit_qty
|
||||
|
||||
if source_uom == kg_uom:
|
||||
weight = line_qty
|
||||
elif source_uom.category_id == weight_uom_categ:
|
||||
weight = source_uom._compute_quantity(line_qty, kg_uom)
|
||||
elif source_uom.category_id == pce_uom_categ:
|
||||
if not product.weight: # re-create weight_net ?
|
||||
note = "\n" + _(
|
||||
"Missing weight on product %s."
|
||||
) % product.name_get()[0][1]
|
||||
note += "\n" + _(
|
||||
"Please correct the product record and regenerate "
|
||||
"the lines or adjust the impacted lines manually")
|
||||
self._note += note
|
||||
return weight, suppl_unit_qty
|
||||
if source_uom == pce_uom:
|
||||
weight = product.weight * line_qty # product.weight_net
|
||||
else:
|
||||
# Here, I suppose that, on the product, the
|
||||
# weight is per PCE and not per uom_id
|
||||
# product.weight_net
|
||||
weight = product.weight * \
|
||||
source_uom._compute_quantity(line_qty, pce_uom)
|
||||
else:
|
||||
note = "\n" + _(
|
||||
"Conversion from unit of measure '%s' to 'Kg' "
|
||||
"is not implemented yet. It is needed for product '%s'."
|
||||
) % (source_uom.name, product.name_get()[0][1])
|
||||
note += "\n" + _(
|
||||
"Please correct the unit of measure settings and "
|
||||
"regenerate the lines or adjust the impacted lines "
|
||||
"manually")
|
||||
self._note += note
|
||||
return weight, suppl_unit_qty
|
||||
|
||||
return weight, suppl_unit_qty
|
||||
|
||||
def _get_amount(self, inv_line):
|
||||
invoice = inv_line.invoice_id
|
||||
amount = invoice.currency_id.with_context(
|
||||
date=invoice.date_invoice).compute(
|
||||
inv_line.price_subtotal,
|
||||
self.company_id.currency_id)
|
||||
return amount
|
||||
|
||||
def _get_region(self, inv_line):
|
||||
"""
|
||||
For supplier invoices/refunds: if the invoice line is linked
|
||||
to a stock move, use the destination stock location ;
|
||||
otherwise, get the PO (which is linked to a stock location)
|
||||
and then get the warehouse.
|
||||
It is important to take into account the following scenario:
|
||||
I order a qty of 50 kg and my suppliers delivers and invoices 52 kg
|
||||
(quite common in some industries where the order qty cannot be exact
|
||||
due to some operational constraints) ; in this case, I have a qty of
|
||||
2 kg which is not linked to a PO, but it is linked to a stock move.
|
||||
|
||||
For customer invoices/refunds: if the invoice line is linked to a
|
||||
stock move, use the source stock location ;
|
||||
otherwise, get the sale order, which is linked to the warehouse.
|
||||
|
||||
If none found, get the company's default intrastat region.
|
||||
|
||||
"""
|
||||
region = False
|
||||
inv_type = inv_line.invoice_id.type
|
||||
if inv_type in ('in_invoice', 'in_refund'):
|
||||
po_lines = self.env['purchase.order.line'].search(
|
||||
[('invoice_lines', 'in', inv_line.id)])
|
||||
if po_lines:
|
||||
if po_lines[0].move_ids:
|
||||
region = po_lines[0].move_ids[0].location_dest_id\
|
||||
.get_intrastat_region()
|
||||
elif inv_type in ('out_invoice', 'out_refund'):
|
||||
so_lines = self.env['sale.order.line'].search(
|
||||
[('invoice_lines', 'in', inv_line.id)])
|
||||
if so_lines:
|
||||
so = so_lines[0].order_id
|
||||
region = so.warehouse_id.region_id
|
||||
if not region:
|
||||
if self.company_id.intrastat_region_id:
|
||||
region = self.company_id.intrastat_region_id
|
||||
return region
|
||||
|
||||
def _get_transport(self, inv_line):
|
||||
transport = inv_line.invoice_id.intrastat_transport_id \
|
||||
or self.company_id.intrastat_transport_id
|
||||
if not transport:
|
||||
msg = _(
|
||||
"The default Intrastat Transport Mode "
|
||||
"of the Company is not set, "
|
||||
"please configure it first.")
|
||||
self._account_config_warning(msg)
|
||||
return transport
|
||||
|
||||
def _get_incoterm(self, inv_line):
|
||||
incoterm = inv_line.invoice_id.incoterms_id \
|
||||
or self.company_id.intrastat_incoterm_id
|
||||
if not incoterm:
|
||||
msg = _(
|
||||
"The default Incoterm "
|
||||
"of the Company is not set, "
|
||||
"please configure it first.")
|
||||
self._account_config_warning(msg)
|
||||
return incoterm
|
||||
|
||||
def _get_product_origin_country(self, inv_line):
|
||||
return inv_line.product_id.origin_country_id
|
||||
|
||||
def _update_computation_line_vals(self, inv_line, line_vals):
|
||||
""" placeholder for localization modules """
|
||||
pass
|
||||
|
||||
def _handle_invoice_accessory_cost(
|
||||
self, invoice, lines_current_invoice,
|
||||
total_inv_accessory_costs_cc, total_inv_product_cc,
|
||||
total_inv_weight):
|
||||
"""
|
||||
Affect accessory costs pro-rata of the value
|
||||
(or pro-rata of the weight if the goods of the invoice
|
||||
have no value)
|
||||
|
||||
This method allows to implement a different logic
|
||||
in the localization modules.
|
||||
E.g. in Belgium accessory cost should not be added.
|
||||
"""
|
||||
if total_inv_accessory_costs_cc:
|
||||
if total_inv_product_cc:
|
||||
# pro-rata of the value
|
||||
for ac_line_vals in lines_current_invoice:
|
||||
ac_line_vals['amount_accessory_cost_company_currency'] = (
|
||||
total_inv_accessory_costs_cc *
|
||||
ac_line_vals['amount_company_currency'] /
|
||||
total_inv_product_cc)
|
||||
elif total_inv_weight:
|
||||
# pro-rata of the weight
|
||||
for ac_line_vals in lines_current_invoice:
|
||||
ac_line_vals['amount_accessory_cost_company_currency'] = (
|
||||
total_inv_accessory_costs_cc *
|
||||
ac_line_vals['weight'] /
|
||||
total_inv_weight)
|
||||
else:
|
||||
for ac_line_vals in lines_current_invoice:
|
||||
ac_line_vals['amount_accessory_cost_company_currency'] = (
|
||||
total_inv_accessory_costs_cc /
|
||||
len(lines_current_invoice))
|
||||
|
||||
def _prepare_invoice_domain(self):
|
||||
"""
|
||||
Complete this method in the localization module
|
||||
with the country-specific logic for arrivals and dispatches.
|
||||
Cf. l10n_be_intrastat_product_declaration for an example
|
||||
"""
|
||||
start_date = date(int(self.year), self.month, 1)
|
||||
end_date = start_date + relativedelta(day=1, months=+1, days=-1)
|
||||
domain = [
|
||||
('date_invoice', '>=', start_date),
|
||||
('date_invoice', '<=', end_date),
|
||||
('state', 'in', ['open', 'paid']),
|
||||
('intrastat_country', '=', True),
|
||||
('company_id', '=', self.company_id.id)]
|
||||
return domain
|
||||
|
||||
def _is_product(self, invoice_line):
|
||||
if (
|
||||
invoice_line.product_id and
|
||||
invoice_line.product_id.type in ('product', 'consu')):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def _gather_invoices_init(self):
|
||||
""" placeholder for localization modules """
|
||||
pass
|
||||
|
||||
def _gather_invoices(self):
|
||||
|
||||
lines = []
|
||||
accessory_costs = self.company_id.intrastat_accessory_costs
|
||||
|
||||
self._gather_invoices_init()
|
||||
domain = self._prepare_invoice_domain()
|
||||
invoices = self.env['account.invoice'].search(domain)
|
||||
|
||||
for invoice in invoices:
|
||||
|
||||
lines_current_invoice = []
|
||||
total_inv_accessory_costs_cc = 0.0 # in company currency
|
||||
total_inv_product_cc = 0.0 # in company currency
|
||||
total_inv_weight = 0.0
|
||||
for inv_line in invoice.invoice_line_ids:
|
||||
|
||||
if (
|
||||
accessory_costs and
|
||||
inv_line.product_id and
|
||||
inv_line.product_id.is_accessory_cost):
|
||||
acost = invoice.currency_id.with_context(
|
||||
date=invoice.date_invoice).compute(
|
||||
inv_line.price_subtotal,
|
||||
self.company_id.currency_id)
|
||||
total_inv_accessory_costs_cc += acost
|
||||
|
||||
continue
|
||||
|
||||
if not inv_line.quantity:
|
||||
_logger.info(
|
||||
'Skipping invoice line %s qty %s '
|
||||
'of invoice %s. Reason: qty = 0'
|
||||
% (inv_line.name, inv_line.quantity, invoice.number))
|
||||
continue
|
||||
|
||||
partner_country = self._get_partner_country(inv_line)
|
||||
if not partner_country:
|
||||
_logger.info(
|
||||
'Skipping invoice line %s qty %s '
|
||||
'of invoice %s. Reason: no partner_country'
|
||||
% (inv_line.name, inv_line.quantity, invoice.number))
|
||||
continue
|
||||
|
||||
if any([
|
||||
tax.exclude_from_intrastat_if_present
|
||||
for tax in inv_line.invoice_line_tax_ids]):
|
||||
_logger.info(
|
||||
'Skipping invoice line %s '
|
||||
'qty %s of invoice %s. Reason: '
|
||||
'tax.exclude_from_intrastat_if_present'
|
||||
% (inv_line.name, inv_line.quantity, invoice.number))
|
||||
continue
|
||||
|
||||
if inv_line.hs_code_id:
|
||||
hs_code = inv_line.hs_code_id
|
||||
elif inv_line.product_id and self._is_product(inv_line):
|
||||
hs_code = inv_line.product_id.get_hs_code_recursively()
|
||||
if not hs_code:
|
||||
note = "\n" + _(
|
||||
"Missing H.S. code on product %s. "
|
||||
"This product is present in invoice %s.") % (
|
||||
inv_line.product_id.name_get()[0][1],
|
||||
inv_line.invoice_id.number)
|
||||
self._note += note
|
||||
continue
|
||||
else:
|
||||
_logger.info(
|
||||
'Skipping invoice line %s qty %s '
|
||||
'of invoice %s. Reason: no product nor hs_code'
|
||||
% (inv_line.name, inv_line.quantity, invoice.number))
|
||||
continue
|
||||
|
||||
intrastat_transaction = \
|
||||
self._get_intrastat_transaction(inv_line)
|
||||
|
||||
weight, suppl_unit_qty = self._get_weight_and_supplunits(
|
||||
inv_line, hs_code)
|
||||
total_inv_weight += weight
|
||||
|
||||
amount_company_currency = self._get_amount(inv_line)
|
||||
total_inv_product_cc += amount_company_currency
|
||||
|
||||
product_origin_country = self._get_product_origin_country(
|
||||
inv_line)
|
||||
|
||||
region = self._get_region(inv_line)
|
||||
|
||||
line_vals = {
|
||||
'parent_id': self.id,
|
||||
'invoice_line_id': inv_line.id,
|
||||
'src_dest_country_id': partner_country.id,
|
||||
'product_id': inv_line.product_id.id,
|
||||
'hs_code_id': hs_code.id,
|
||||
'weight': weight,
|
||||
'suppl_unit_qty': suppl_unit_qty,
|
||||
'amount_company_currency': amount_company_currency,
|
||||
'amount_accessory_cost_company_currency': 0.0,
|
||||
'transaction_id': intrastat_transaction.id,
|
||||
'product_origin_country_id':
|
||||
product_origin_country.id or False,
|
||||
'region_id': region and region.id or False,
|
||||
}
|
||||
|
||||
# extended declaration
|
||||
if self._extended:
|
||||
transport = self._get_transport(inv_line)
|
||||
line_vals.update({
|
||||
'transport_id': transport.id,
|
||||
})
|
||||
|
||||
self._update_computation_line_vals(inv_line, line_vals)
|
||||
|
||||
if line_vals:
|
||||
lines_current_invoice.append((line_vals))
|
||||
|
||||
self._handle_invoice_accessory_cost(
|
||||
invoice, lines_current_invoice,
|
||||
total_inv_accessory_costs_cc, total_inv_product_cc,
|
||||
total_inv_weight)
|
||||
|
||||
for line_vals in lines_current_invoice:
|
||||
if (
|
||||
not line_vals['amount_company_currency'] and
|
||||
not
|
||||
line_vals['amount_accessory_cost_company_currency']):
|
||||
inv_line = self.env['account.invoice.line'].browse(
|
||||
line_vals['invoice_line_id'])
|
||||
_logger.info(
|
||||
'Skipping invoice line %s qty %s '
|
||||
'of invoice %s. Reason: price_subtotal = 0 '
|
||||
'and accessory costs = 0'
|
||||
% (inv_line.name, inv_line.quantity,
|
||||
inv_line.invoice_id.number))
|
||||
continue
|
||||
lines.append(line_vals)
|
||||
|
||||
return lines
|
||||
|
||||
def _get_uom_refs(self, ref):
|
||||
uom_refs = {
|
||||
'weight_uom_categ': self.env.ref('product.product_uom_categ_kgm'),
|
||||
'kg_uom': self.env.ref('product.product_uom_kgm'),
|
||||
'pce_uom_categ': self.env.ref('product.product_uom_categ_unit'),
|
||||
'pce_uom': self.env.ref('product.product_uom_unit')
|
||||
}
|
||||
return uom_refs[ref]
|
||||
|
||||
@api.multi
|
||||
def action_gather(self):
|
||||
self.ensure_one()
|
||||
self.message_post(body=_("Generate Lines from Invoices"))
|
||||
self._check_generate_lines()
|
||||
self._note = ''
|
||||
if (
|
||||
self.type == 'arrivals' and
|
||||
self.company_id.intrastat_arrivals == 'extended') or (
|
||||
self.type == 'dispatches' and
|
||||
self.company_id.intrastat_dispatches == 'extended'):
|
||||
self._extended = True
|
||||
else:
|
||||
self._extended = False
|
||||
|
||||
self.computation_line_ids.unlink()
|
||||
self.declaration_line_ids.unlink()
|
||||
lines = self._gather_invoices()
|
||||
|
||||
if not lines:
|
||||
self.action = 'nihil'
|
||||
note = "\n" + \
|
||||
_("No records found for the selected period !") + '\n' + \
|
||||
_("The Declaration Action has been set to 'nihil'.")
|
||||
self._note += note
|
||||
else:
|
||||
self.write({'computation_line_ids': [(0, 0, x) for x in lines]})
|
||||
|
||||
if self._note:
|
||||
note_header = '\n\n>>> ' + fields.Datetime.to_string(
|
||||
fields.Datetime.context_timestamp(self, datetime.now())) + '\n'
|
||||
self.note = note_header + self._note + (self.note or '')
|
||||
result_view = self.env.ref(
|
||||
'intrastat_base.intrastat_result_view_form')
|
||||
return {
|
||||
'name': _("Generate lines from invoices: results"),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'intrastat.result.view',
|
||||
'view_id': result_view.id,
|
||||
'target': 'new',
|
||||
'context': dict(self._context, note=self._note),
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
return True
|
||||
|
||||
@api.model
|
||||
def _group_line_hashcode_fields(self, computation_line):
|
||||
return {
|
||||
'country': computation_line.src_dest_country_id.id or False,
|
||||
'hs_code_id': computation_line.hs_code_id.id or False,
|
||||
'intrastat_unit': computation_line.intrastat_unit_id.id or False,
|
||||
'transaction': computation_line.transaction_id.id or False,
|
||||
'transport': computation_line.transport_id.id or False,
|
||||
'region': computation_line.region_id.id or False,
|
||||
'product_origin_country':
|
||||
computation_line.product_origin_country_id.id or False,
|
||||
}
|
||||
|
||||
def group_line_hashcode(self, computation_line):
|
||||
hc_fields = self._group_line_hashcode_fields(computation_line)
|
||||
hashcode = '-'.join([str(f) for f in hc_fields.values()])
|
||||
return hashcode
|
||||
|
||||
@api.model
|
||||
def _prepare_grouped_fields(self, computation_line, fields_to_sum):
|
||||
vals = {
|
||||
'src_dest_country_id': computation_line.src_dest_country_id.id,
|
||||
'intrastat_unit_id': computation_line.intrastat_unit_id.id,
|
||||
'hs_code_id': computation_line.hs_code_id.id,
|
||||
'transaction_id': computation_line.transaction_id.id,
|
||||
'transport_id': computation_line.transport_id.id,
|
||||
'region_id': computation_line.region_id.id,
|
||||
'parent_id': computation_line.parent_id.id,
|
||||
'product_origin_country_id':
|
||||
computation_line.product_origin_country_id.id,
|
||||
'amount_company_currency': 0.0,
|
||||
}
|
||||
for field in fields_to_sum:
|
||||
vals[field] = 0.0
|
||||
return vals
|
||||
|
||||
def _fields_to_sum(self):
|
||||
fields_to_sum = [
|
||||
'weight',
|
||||
'suppl_unit_qty',
|
||||
]
|
||||
return fields_to_sum
|
||||
|
||||
@api.model
|
||||
def _prepare_declaration_line(self, computation_lines):
|
||||
fields_to_sum = self._fields_to_sum()
|
||||
vals = self._prepare_grouped_fields(
|
||||
computation_lines[0], fields_to_sum)
|
||||
for computation_line in computation_lines:
|
||||
for field in fields_to_sum:
|
||||
vals[field] += computation_line[field]
|
||||
vals['amount_company_currency'] += (
|
||||
computation_line['amount_company_currency'] +
|
||||
computation_line['amount_accessory_cost_company_currency'])
|
||||
# round, otherwise odoo with truncate (6.7 -> 6... instead of 7 !)
|
||||
for field in fields_to_sum:
|
||||
vals[field] = int(round(vals[field]))
|
||||
if not vals['weight']:
|
||||
vals['weight'] = 1
|
||||
vals['amount_company_currency'] = int(round(
|
||||
vals['amount_company_currency']))
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
def generate_declaration(self):
|
||||
""" generate declaration lines """
|
||||
self.ensure_one()
|
||||
assert self.valid, 'Computation lines are not valid'
|
||||
self.message_post(body=_("Generate Declaration Lines"))
|
||||
# Delete existing declaration lines
|
||||
self.declaration_line_ids.unlink()
|
||||
# Regenerate declaration lines from computation lines
|
||||
dl_group = {}
|
||||
for cl in self.computation_line_ids:
|
||||
hashcode = self.group_line_hashcode(cl)
|
||||
if hashcode in dl_group:
|
||||
dl_group[hashcode].append(cl)
|
||||
else:
|
||||
dl_group[hashcode] = [cl]
|
||||
ipdl = self.declaration_line_ids
|
||||
for cl_lines in list(dl_group.values()):
|
||||
vals = self._prepare_declaration_line(cl_lines)
|
||||
declaration_line = ipdl.create(vals)
|
||||
for cl in cl_lines:
|
||||
cl.write({'declaration_line_id': declaration_line.id})
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def generate_xml(self):
|
||||
""" generate the INTRASTAT Declaration XML file """
|
||||
self.ensure_one()
|
||||
self.message_post(body=_("Generate XML Declaration File"))
|
||||
self._check_generate_xml()
|
||||
self._unlink_attachments()
|
||||
xml_string = self._generate_xml()
|
||||
if xml_string:
|
||||
attach_id = self._attach_xml_file(
|
||||
xml_string, '%s_%s' % (self.type, self.revision))
|
||||
return self._open_attach_view(attach_id)
|
||||
else:
|
||||
raise UserError(
|
||||
_("No XML File has been generated."))
|
||||
|
||||
@api.multi
|
||||
def create_xls(self):
|
||||
if self.env.context.get('computation_lines'):
|
||||
report_file = 'instrastat_transactions'
|
||||
else:
|
||||
report_file = 'instrastat_declaration_lines'
|
||||
return {
|
||||
'type': 'ir.actions.report',
|
||||
'report_type': 'xlsx',
|
||||
'report_name': 'intrastat_product.product_declaration_xls',
|
||||
'context': dict(self.env.context, report_file=report_file),
|
||||
'data': {'dynamic_report': True},
|
||||
}
|
||||
|
||||
@api.model
|
||||
def _xls_computation_line_fields(self):
|
||||
"""
|
||||
Update list in custom module to add/drop columns or change order
|
||||
"""
|
||||
return [
|
||||
'product', 'product_origin_country',
|
||||
'hs_code', 'src_dest_country',
|
||||
'amount_company_currency', 'accessory_cost',
|
||||
'transaction', 'weight', 'suppl_unit_qty', 'suppl_unit',
|
||||
'transport', 'invoice',
|
||||
]
|
||||
|
||||
@api.model
|
||||
def _xls_declaration_line_fields(self):
|
||||
"""
|
||||
Update list in custom module to add/drop columns or change order
|
||||
"""
|
||||
return [
|
||||
'hs_code', 'src_dest_country', 'amount_company_currency',
|
||||
'transaction', 'weight', 'suppl_unit_qty', 'suppl_unit',
|
||||
'transport',
|
||||
]
|
||||
|
||||
@api.model
|
||||
def _xls_template(self):
|
||||
"""
|
||||
Placeholder for excel report template updates
|
||||
|
||||
"""
|
||||
return {}
|
||||
|
||||
@api.multi
|
||||
def done(self):
|
||||
self.write({'state': 'done'})
|
||||
|
||||
@api.multi
|
||||
def back2draft(self):
|
||||
self.write({'state': 'draft'})
|
||||
|
||||
|
||||
class IntrastatProductComputationLine(models.Model):
|
||||
_name = 'intrastat.product.computation.line'
|
||||
_description = "Intrastat Product Computataion Lines"
|
||||
|
||||
parent_id = fields.Many2one(
|
||||
'intrastat.product.declaration',
|
||||
string='Intrastat Product Declaration',
|
||||
ondelete='cascade', readonly=True)
|
||||
company_id = fields.Many2one(
|
||||
'res.company', related='parent_id.company_id',
|
||||
string="Company", readonly=True)
|
||||
company_currency_id = fields.Many2one(
|
||||
'res.currency', related='company_id.currency_id',
|
||||
string="Company currency", readonly=True)
|
||||
type = fields.Selection(
|
||||
related='parent_id.type',
|
||||
string='Type',
|
||||
readonly=True)
|
||||
reporting_level = fields.Selection(
|
||||
related='parent_id.reporting_level',
|
||||
string='Reporting Level',
|
||||
readonly=True)
|
||||
valid = fields.Boolean(
|
||||
compute='_compute_check_validity',
|
||||
string='Valid')
|
||||
invoice_line_id = fields.Many2one(
|
||||
'account.invoice.line', string='Invoice Line', readonly=True)
|
||||
invoice_id = fields.Many2one(
|
||||
'account.invoice', related='invoice_line_id.invoice_id',
|
||||
string='Invoice', readonly=True)
|
||||
declaration_line_id = fields.Many2one(
|
||||
'intrastat.product.declaration.line',
|
||||
string='Declaration Line', readonly=True)
|
||||
src_dest_country_id = fields.Many2one(
|
||||
'res.country', string='Country',
|
||||
help="Country of Origin/Destination",
|
||||
domain=[('intrastat', '=', True)])
|
||||
product_id = fields.Many2one(
|
||||
'product.product', related='invoice_line_id.product_id',
|
||||
string='Product', readonly=True)
|
||||
hs_code_id = fields.Many2one(
|
||||
'hs.code', string='Intrastat Code')
|
||||
intrastat_unit_id = fields.Many2one(
|
||||
'intrastat.unit', related='hs_code_id.intrastat_unit_id',
|
||||
string='Suppl. Unit', readonly=True,
|
||||
help="Intrastat Supplementary Unit")
|
||||
weight = fields.Float(
|
||||
string='Weight',
|
||||
digits=dp.get_precision('Stock Weight'), help="Net weight in Kg")
|
||||
suppl_unit_qty = fields.Float(
|
||||
string='Suppl. Unit Qty',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
help="Supplementary Units Quantity")
|
||||
amount_company_currency = fields.Float(
|
||||
string='Fiscal Value',
|
||||
digits=dp.get_precision('Account'), required=True,
|
||||
help="Amount in company currency to write in the declaration. "
|
||||
"Amount in company currency = amount in invoice currency "
|
||||
"converted to company currency with the rate of the invoice date.")
|
||||
amount_accessory_cost_company_currency = fields.Float(
|
||||
string='Accessory Costs',
|
||||
digits=dp.get_precision('Account'),
|
||||
help="Amount in company currency of the accessory costs related to "
|
||||
"this invoice line (by default, these accessory costs are computed "
|
||||
"at the pro-rata of the amount of each invoice line.")
|
||||
transaction_id = fields.Many2one(
|
||||
'intrastat.transaction',
|
||||
string='Intrastat Transaction')
|
||||
region_id = fields.Many2one(
|
||||
'intrastat.region', string='Intrastat Region')
|
||||
# extended declaration
|
||||
incoterm_id = fields.Many2one(
|
||||
'stock.incoterms', string='Incoterm')
|
||||
transport_id = fields.Many2one(
|
||||
'intrastat.transport_mode',
|
||||
string='Transport Mode')
|
||||
product_origin_country_id = fields.Many2one(
|
||||
'res.country', string='Country of Origin of the Product',
|
||||
help="Country of origin of the product i.e. product 'made in ____'")
|
||||
|
||||
@api.multi
|
||||
@api.depends('transport_id')
|
||||
def _compute_check_validity(self):
|
||||
""" TO DO: logic based upon fields """
|
||||
for this in self:
|
||||
this.valid = True
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product(self):
|
||||
self.weight = 0.0
|
||||
self.suppl_unit_qty = 0.0
|
||||
self.intrastat_code_id = False
|
||||
self.intrastat_unit_id = False
|
||||
if self.product_id:
|
||||
self.intrastat_code_id = self.product_id.intrastat_id
|
||||
self.intrastat_unit_id =\
|
||||
self.product_id.intrastat_id.intrastat_unit_id
|
||||
if not self.intrastat_unit_id:
|
||||
self.weight = self.product_id.weight
|
||||
|
||||
|
||||
class IntrastatProductDeclarationLine(models.Model):
|
||||
_name = 'intrastat.product.declaration.line'
|
||||
_description = "Intrastat Product Declaration Lines"
|
||||
|
||||
parent_id = fields.Many2one(
|
||||
'intrastat.product.declaration',
|
||||
string='Intrastat Product Declaration',
|
||||
ondelete='cascade', readonly=True)
|
||||
company_id = fields.Many2one(
|
||||
'res.company', related='parent_id.company_id',
|
||||
string="Company", readonly=True)
|
||||
company_currency_id = fields.Many2one(
|
||||
'res.currency', related='company_id.currency_id',
|
||||
string="Company currency", readonly=True)
|
||||
type = fields.Selection(
|
||||
related='parent_id.type',
|
||||
string='Type',
|
||||
readonly=True)
|
||||
reporting_level = fields.Selection(
|
||||
related='parent_id.reporting_level',
|
||||
string='Reporting Level',
|
||||
readonly=True)
|
||||
computation_line_ids = fields.One2many(
|
||||
'intrastat.product.computation.line', 'declaration_line_id',
|
||||
string='Computation Lines', readonly=True)
|
||||
src_dest_country_id = fields.Many2one(
|
||||
'res.country', string='Country',
|
||||
help="Country of Origin/Destination",
|
||||
domain=[('intrastat', '=', True)])
|
||||
hs_code_id = fields.Many2one(
|
||||
'hs.code',
|
||||
string='Intrastat Code')
|
||||
intrastat_unit_id = fields.Many2one(
|
||||
'intrastat.unit', related='hs_code_id.intrastat_unit_id',
|
||||
string='Suppl. Unit', readonly=True,
|
||||
help="Intrastat Supplementary Unit")
|
||||
weight = fields.Integer(
|
||||
string='Weight', help="Net weight in Kg")
|
||||
suppl_unit_qty = fields.Integer(
|
||||
string='Suppl. Unit Qty',
|
||||
help="Supplementary Units Quantity")
|
||||
amount_company_currency = fields.Integer(
|
||||
string='Fiscal Value',
|
||||
help="Amount in company currency to write in the declaration. "
|
||||
"Amount in company currency = amount in invoice currency "
|
||||
"converted to company currency with the rate of the invoice date.")
|
||||
transaction_id = fields.Many2one(
|
||||
'intrastat.transaction',
|
||||
string='Intrastat Transaction')
|
||||
region_id = fields.Many2one(
|
||||
'intrastat.region', string='Intrastat Region')
|
||||
# extended declaration
|
||||
incoterm_id = fields.Many2one(
|
||||
'stock.incoterms', string='Incoterm')
|
||||
transport_id = fields.Many2one(
|
||||
'intrastat.transport_mode',
|
||||
string='Transport Mode')
|
||||
product_origin_country_id = fields.Many2one(
|
||||
'res.country', string='Country of Origin of the Product',
|
||||
help="Country of origin of the product i.e. product 'made in ____'")
|
||||
24
intrastat_product/models/intrastat_region.py
Normal file
24
intrastat_product/models/intrastat_region.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2009-2018 Noviat nv/sa (www.noviat.com).
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class IntrastatRegion(models.Model):
|
||||
_name = 'intrastat.region'
|
||||
_description = "Intrastat Region"
|
||||
_sql_constraints = [
|
||||
('intrastat_region_code_unique',
|
||||
'UNIQUE(code, country_id)', # TODO add company_id ?
|
||||
'Code must be unique.')]
|
||||
|
||||
code = fields.Char(string='Code', required=True)
|
||||
country_id = fields.Many2one(
|
||||
comodel_name='res.country',
|
||||
string='Country', required=True)
|
||||
name = fields.Char(string='Name', translate=True)
|
||||
description = fields.Char(string='Description')
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company', string='Company',
|
||||
default=lambda self: self.env['res.company']._company_default_get(
|
||||
'intrastat.region'))
|
||||
38
intrastat_product/models/intrastat_transaction.py
Normal file
38
intrastat_product/models/intrastat_transaction.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class IntrastatTransaction(models.Model):
|
||||
_name = 'intrastat.transaction'
|
||||
_description = "Intrastat Transaction"
|
||||
_order = 'code'
|
||||
_rec_name = 'display_name'
|
||||
_sql_constraints = [(
|
||||
'intrastat_transaction_code_unique',
|
||||
'UNIQUE(code, company_id)',
|
||||
'Code must be unique.')]
|
||||
|
||||
code = fields.Char(string='Code', required=True)
|
||||
description = fields.Text(string='Description')
|
||||
display_name = fields.Char(
|
||||
compute='_compute_display_name_field', string="Display Name",
|
||||
readonly=True, store=True)
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company', string='Company',
|
||||
default=lambda self: self.env['res.company']._company_default_get(
|
||||
'intrastat.transaction'))
|
||||
|
||||
@api.multi
|
||||
@api.depends('code', 'description')
|
||||
def _compute_display_name_field(self):
|
||||
for this in self:
|
||||
display_name = this.code
|
||||
if this.description:
|
||||
display_name += ' ' + this.description
|
||||
this.display_name = len(display_name) > 55 \
|
||||
and display_name[:55] + '...' \
|
||||
or display_name
|
||||
30
intrastat_product/models/intrastat_transport_mode.py
Normal file
30
intrastat_product/models/intrastat_transport_mode.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2019 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class IntrastatTransportMode(models.Model):
|
||||
_name = 'intrastat.transport_mode'
|
||||
_description = "Intrastat Transport Mode"
|
||||
_rec_name = 'display_name'
|
||||
_order = 'code'
|
||||
_sql_constraints = [(
|
||||
'intrastat_transport_code_unique',
|
||||
'UNIQUE(code)',
|
||||
'Code must be unique.')]
|
||||
|
||||
display_name = fields.Char(
|
||||
string='Display Name', compute='_compute_display_name', store=True,
|
||||
readonly=True)
|
||||
code = fields.Char(string='Code', required=True)
|
||||
name = fields.Char(string='Name', required=True, translate=True)
|
||||
description = fields.Char(string='Description', translate=True)
|
||||
|
||||
@api.multi
|
||||
@api.depends('name', 'code')
|
||||
def _compute_display_name(self):
|
||||
for this in self:
|
||||
this.display_name = '%s. %s' % (this.code, this.name)
|
||||
19
intrastat_product/models/intrastat_unit.py
Normal file
19
intrastat_product/models/intrastat_unit.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class IntrastatUnit(models.Model):
|
||||
_name = 'intrastat.unit'
|
||||
_description = 'Intrastat Supplementary Units'
|
||||
|
||||
name = fields.Char(string='Name', required=True)
|
||||
description = fields.Char(string='Description', required=True)
|
||||
uom_id = fields.Many2one(
|
||||
comodel_name='product.uom', string='Regular UoM',
|
||||
help="Select the regular Unit of Measure of Odoo that corresponds "
|
||||
"to this Intrastat Supplementary Unit.")
|
||||
active = fields.Boolean(default=True)
|
||||
73
intrastat_product/models/res_company.py
Normal file
73
intrastat_product/models/res_company.py
Normal file
@@ -0,0 +1,73 @@
|
||||
# Copyright 2011-2017 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
intrastat_incoterm_id = fields.Many2one(
|
||||
comodel_name='stock.incoterms',
|
||||
string='Default Incoterm for Intrastat',
|
||||
help="International Commercial Terms are a series of "
|
||||
"predefined commercial terms used in international "
|
||||
"transactions.")
|
||||
intrastat_arrivals = fields.Selection(
|
||||
selection='_intrastat_arrivals', string='Arrivals',
|
||||
default='extended', required=True)
|
||||
intrastat_dispatches = fields.Selection(
|
||||
selection='_intrastat_dispatches', string='Dispatches',
|
||||
default='extended', required=True)
|
||||
intrastat_transport_id = fields.Many2one(
|
||||
comodel_name='intrastat.transport_mode',
|
||||
string='Default Transport Mode', ondelete='restrict')
|
||||
intrastat = fields.Char(
|
||||
string='Intrastat Declaration', store=True, readonly=True,
|
||||
compute='_compute_intrastat')
|
||||
intrastat_region_id = fields.Many2one(
|
||||
comodel_name='intrastat.region',
|
||||
string='Default Intrastat Region')
|
||||
intrastat_transaction_out_invoice = fields.Many2one(
|
||||
comodel_name='intrastat.transaction',
|
||||
string='Default Intrastat Transaction For Customer Invoice')
|
||||
intrastat_transaction_out_refund = fields.Many2one(
|
||||
comodel_name='intrastat.transaction',
|
||||
string='Default Intrastat Transaction for Customer Refunds')
|
||||
intrastat_transaction_in_invoice = fields.Many2one(
|
||||
comodel_name='intrastat.transaction',
|
||||
string='Default Intrastat Transaction For Supplier Invoices')
|
||||
intrastat_transaction_in_refund = fields.Many2one(
|
||||
comodel_name='intrastat.transaction',
|
||||
string='Default Intrastat Transaction For Supplier Refunds')
|
||||
intrastat_accessory_costs = fields.Boolean(
|
||||
string='Include Accessory Costs in Fiscal Value of Product')
|
||||
|
||||
@api.model
|
||||
def _intrastat_arrivals(self):
|
||||
return [
|
||||
('exempt', 'Exempt'),
|
||||
('standard', 'Standard'),
|
||||
('extended', 'Extended')]
|
||||
|
||||
@api.model
|
||||
def _intrastat_dispatches(self):
|
||||
return [
|
||||
('exempt', 'Exempt'),
|
||||
('standard', 'Standard'),
|
||||
('extended', 'Extended')]
|
||||
|
||||
@api.multi
|
||||
@api.depends('intrastat_arrivals', 'intrastat_dispatches')
|
||||
def _compute_intrastat(self):
|
||||
for this in self:
|
||||
if this.intrastat_arrivals == 'exempt' \
|
||||
and this.intrastat_dispatches == 'exempt':
|
||||
this.intrastat = 'exempt'
|
||||
elif this.intrastat_arrivals == 'extended' \
|
||||
or this.intrastat_dispatches == 'extended':
|
||||
this.intrastat = 'extended'
|
||||
else:
|
||||
this.intrastat = 'standard'
|
||||
35
intrastat_product/models/res_config_settings.py
Normal file
35
intrastat_product/models/res_config_settings.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Copyright 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2009-2018 Noviat (http://www.noviat.com)
|
||||
# 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_incoterm_id = fields.Many2one(
|
||||
related='company_id.intrastat_incoterm_id')
|
||||
intrastat_arrivals = fields.Selection(
|
||||
related='company_id.intrastat_arrivals')
|
||||
intrastat_dispatches = fields.Selection(
|
||||
related='company_id.intrastat_dispatches')
|
||||
intrastat = fields.Char(related='company_id.intrastat', readonly=True)
|
||||
intrastat_transport_id = fields.Many2one(
|
||||
related='company_id.intrastat_transport_id')
|
||||
intrastat_region_id = fields.Many2one(
|
||||
related='company_id.intrastat_region_id')
|
||||
intrastat_transaction_out_invoice = fields.Many2one(
|
||||
related='company_id.intrastat_transaction_out_invoice')
|
||||
intrastat_transaction_out_refund = fields.Many2one(
|
||||
related='company_id.intrastat_transaction_out_refund')
|
||||
intrastat_transaction_in_invoice = fields.Many2one(
|
||||
related='company_id.intrastat_transaction_in_invoice')
|
||||
intrastat_transaction_in_refund = fields.Many2one(
|
||||
related='company_id.intrastat_transaction_in_refund')
|
||||
intrastat_accessory_costs = fields.Boolean(
|
||||
related='company_id.intrastat_accessory_costs')
|
||||
country_id = fields.Many2one(
|
||||
related='company_id.country_id', readonly=True)
|
||||
country_code = fields.Char(
|
||||
related='company_id.country_id.code', readonly=True)
|
||||
25
intrastat_product/models/sale_order.py
Normal file
25
intrastat_product/models/sale_order.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright 2010-2017 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
intrastat_transport_id = fields.Many2one(
|
||||
comodel_name='intrastat.transport_mode', string='Transport Mode',
|
||||
help="This information is used in Intrastat reports")
|
||||
intrastat = fields.Selection(
|
||||
string='Intrastat Declaration',
|
||||
related='company_id.intrastat_dispatches', readonly=True)
|
||||
|
||||
@api.multi
|
||||
def _prepare_invoice(self):
|
||||
'''Copy destination country to invoice'''
|
||||
vals = super(SaleOrder, self)._prepare_invoice()
|
||||
if self.intrastat_transport_id:
|
||||
vals['intrastat_transport_id'] = self.intrastat_transport_id.id
|
||||
if self.warehouse_id.region_id:
|
||||
vals['src_dest_region_id'] = self.warehouse_id.region_id.id
|
||||
return vals
|
||||
29
intrastat_product/models/stock_warehouse.py
Normal file
29
intrastat_product/models/stock_warehouse.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Copyright 2009-2018 Noviat nv/sa (www.noviat.com).
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockWarehouse(models.Model):
|
||||
_inherit = 'stock.warehouse'
|
||||
|
||||
region_id = fields.Many2one(
|
||||
comodel_name='intrastat.region', string='Intrastat Region')
|
||||
|
||||
|
||||
class StockLocation(models.Model):
|
||||
_inherit = 'stock.location'
|
||||
|
||||
@api.multi
|
||||
def get_intrastat_region(self):
|
||||
self.ensure_one()
|
||||
locations = self.search(
|
||||
[('parent_left', '<=', self.parent_left),
|
||||
('parent_right', '>=', self.parent_right)])
|
||||
warehouses = self.env['stock.warehouse'].search([
|
||||
('lot_stock_id', 'in', [x.id for x in locations]),
|
||||
('region_id', '!=', False)])
|
||||
if warehouses:
|
||||
return warehouses[0].region_id
|
||||
return None
|
||||
1
intrastat_product/report/__init__.py
Normal file
1
intrastat_product/report/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import intrastat_product_report_xls
|
||||
276
intrastat_product/report/intrastat_product_report_xls.py
Normal file
276
intrastat_product/report/intrastat_product_report_xls.py
Normal file
@@ -0,0 +1,276 @@
|
||||
# Copyright 2009-2018 Noviat
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import models
|
||||
from odoo.tools.translate import translate, _
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
IR_TRANSLATION_NAME = 'intrastat.product.report'
|
||||
|
||||
|
||||
class IntrastatProductDeclarationXlsx(models.AbstractModel):
|
||||
_name = 'report.intrastat_product.product_declaration_xls'
|
||||
_inherit = 'report.report_xlsx.abstract'
|
||||
|
||||
def _(self, src):
|
||||
lang = self.env.context.get('lang', 'en_US')
|
||||
val = translate(
|
||||
self.env.cr, IR_TRANSLATION_NAME, 'report', lang, src) or src
|
||||
return val
|
||||
|
||||
def _get_template(self, declaration):
|
||||
|
||||
template = {
|
||||
'product': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Product'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render(
|
||||
"line.product_id and line.product_id.name"),
|
||||
},
|
||||
'width': 36,
|
||||
},
|
||||
'product_origin_country': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Product C/O'),
|
||||
},
|
||||
'line': {
|
||||
'type': 'string',
|
||||
'value': self._render(
|
||||
"line.product_origin_country_id.name or ''"),
|
||||
},
|
||||
'width': 28,
|
||||
},
|
||||
'hs_code': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Intrastat Code'),
|
||||
},
|
||||
'line': {
|
||||
'type': 'string',
|
||||
'value': self._render(
|
||||
"line.hs_code_id.local_code"),
|
||||
},
|
||||
'width': 14,
|
||||
},
|
||||
'src_dest_country': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Country of Origin/Destination'),
|
||||
},
|
||||
'line': {
|
||||
'type': 'string',
|
||||
'value': self._render(
|
||||
"line.src_dest_country_id.name"),
|
||||
},
|
||||
'width': 28,
|
||||
},
|
||||
'amount_company_currency': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Fiscal Value'),
|
||||
'format': self.format_theader_yellow_right,
|
||||
},
|
||||
'line': {
|
||||
'type': 'number',
|
||||
'value': self._render("line.amount_company_currency"),
|
||||
'format': self.format_tcell_amount_right,
|
||||
},
|
||||
'width': 18,
|
||||
},
|
||||
'accessory_cost': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Accessory Costs'),
|
||||
'format': self.format_theader_yellow_right,
|
||||
},
|
||||
'line': {
|
||||
'type': 'number',
|
||||
'value': self._render(
|
||||
"line.amount_accessory_cost_company_currency"),
|
||||
'format': self.format_tcell_amount_right,
|
||||
},
|
||||
'width': 18,
|
||||
},
|
||||
'transaction': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Intrastat Transaction'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render(
|
||||
"line.transaction_id.display_name"),
|
||||
},
|
||||
'width': 36,
|
||||
},
|
||||
'weight': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Weight'),
|
||||
'format': self.format_theader_yellow_right,
|
||||
},
|
||||
'line': {
|
||||
'type': 'number',
|
||||
'value': self._render(
|
||||
"line.weight"),
|
||||
'format': self.format_tcell_amount_right,
|
||||
},
|
||||
'width': 18,
|
||||
},
|
||||
'suppl_unit_qty': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Suppl. Unit Qty'),
|
||||
'format': self.format_theader_yellow_right,
|
||||
},
|
||||
'line': {
|
||||
# we don't specify a type here and rely on the
|
||||
# report_xlsx_helper type detection to use
|
||||
# write_string when suppl_unit_qty is zero
|
||||
'value': self._render(
|
||||
"line.suppl_unit_qty or ''"),
|
||||
'format': self.format_tcell_amount_right,
|
||||
},
|
||||
'width': 18,
|
||||
},
|
||||
'suppl_unit': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Suppl. Unit'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render(
|
||||
"line.intrastat_unit_id.name or ''"),
|
||||
},
|
||||
'width': 14,
|
||||
},
|
||||
'incoterm': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Incoterm'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render("line.incoterm_id.name or ''"),
|
||||
},
|
||||
'width': 14,
|
||||
},
|
||||
'transport': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Transport Mode'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render("line.transport_id.name or ''"),
|
||||
},
|
||||
'width': 14,
|
||||
},
|
||||
'region': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Intrastat Region'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render("line.region_id.name or ''"),
|
||||
},
|
||||
'width': 28,
|
||||
},
|
||||
'invoice': {
|
||||
'header': {
|
||||
'type': 'string',
|
||||
'value': self._('Invoice'),
|
||||
},
|
||||
'line': {
|
||||
'value': self._render("line.invoice_id.number"),
|
||||
},
|
||||
'width': 18,
|
||||
},
|
||||
}
|
||||
template.update(declaration._xls_template())
|
||||
|
||||
return template
|
||||
|
||||
def _get_ws_params(self, wb, data, declaration):
|
||||
template = self._get_template(declaration)
|
||||
if self.env.context.get('computation_lines'):
|
||||
wl = declaration._xls_computation_line_fields()
|
||||
report = 'computation'
|
||||
else:
|
||||
wl = declaration._xls_declaration_line_fields()
|
||||
report = 'declaration'
|
||||
|
||||
title = self._get_title(declaration, report, format='normal')
|
||||
title_short = self._get_title(declaration, report, format='short')
|
||||
sheet_name = title_short[:31].replace('/', '-')
|
||||
|
||||
params = {
|
||||
'ws_name': sheet_name,
|
||||
'generate_ws_method': '_intrastat_report',
|
||||
'title': title,
|
||||
'wanted_list': wl,
|
||||
'col_specs': template,
|
||||
}
|
||||
return [params]
|
||||
|
||||
def _get_title(self, declaration, report, format='normal'):
|
||||
title = declaration.year_month
|
||||
if format == 'normal':
|
||||
if report == 'computation':
|
||||
title += ' : ' + _('Computation Lines')
|
||||
else:
|
||||
title += ' : ' + _('Declaration Lines')
|
||||
return title
|
||||
|
||||
def _report_title(self, ws, row_pos, ws_params, data, declaration):
|
||||
return self._write_ws_title(ws, row_pos, ws_params)
|
||||
|
||||
def _empty_report(self, ws, row_pos, ws_params, data, declaration,
|
||||
report):
|
||||
if report == 'computation':
|
||||
lines = _('Computation Lines')
|
||||
else:
|
||||
lines = _('Declaration Lines')
|
||||
no_entries = _("No") + " " + lines + " " + _("for period %s") \
|
||||
% declaration.year_month
|
||||
ws.write_string(row_pos, 0, no_entries, self.format_left_bold)
|
||||
|
||||
def _intrastat_report(self, workbook, ws, ws_params, data, declaration):
|
||||
|
||||
ws.set_landscape()
|
||||
ws.fit_to_pages(1, 0)
|
||||
ws.set_header(self.xls_headers['standard'])
|
||||
ws.set_footer(self.xls_footers['standard'])
|
||||
|
||||
self._set_column_width(ws, ws_params)
|
||||
|
||||
row_pos = 0
|
||||
row_pos = self._report_title(ws, row_pos, ws_params, data, declaration)
|
||||
|
||||
if self.env.context.get('computation_lines'):
|
||||
report = 'computation'
|
||||
lines = declaration.computation_line_ids
|
||||
else:
|
||||
report = 'declaration'
|
||||
lines = declaration.declaration_line_ids
|
||||
|
||||
if not lines:
|
||||
return self._empty_report(
|
||||
ws, row_pos, ws_params, data, declaration, report)
|
||||
|
||||
row_pos = self._write_line(
|
||||
ws, row_pos, ws_params, col_specs_section='header',
|
||||
default_format=self.format_theader_yellow_left)
|
||||
|
||||
ws.freeze_panes(row_pos, 0)
|
||||
|
||||
for line in lines:
|
||||
row_pos = self._write_line(
|
||||
ws, row_pos, ws_params, col_specs_section='line',
|
||||
render_space={'line': line},
|
||||
default_format=self.format_tcell_left)
|
||||
22
intrastat_product/security/intrastat_security.xml
Normal file
22
intrastat_product/security/intrastat_security.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="intrastat_transaction_company_rule" model="ir.rule">
|
||||
<field name="name">Intrastat Transaction Company rule</field>
|
||||
<field name="model_id" ref="model_intrastat_transaction"/>
|
||||
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_region_company_rule" model="ir.rule">
|
||||
<field name="name">Intrastat Region Company rule</field>
|
||||
<field name="model_id" ref="model_intrastat_region"/>
|
||||
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_declaration_company_rule" model="ir.rule">
|
||||
<field name="name">Intrastat Product Declaration Company rule</field>
|
||||
<field name="model_id" ref="model_intrastat_product_declaration"/>
|
||||
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
13
intrastat_product/security/ir.model.access.csv
Normal file
13
intrastat_product/security/ir.model.access.csv
Normal file
@@ -0,0 +1,13 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_intrastat_unit_read,Read access on Intrastat Supplementary Units to everybody,model_intrastat_unit,,1,0,0,0
|
||||
access_intrastat_unit_full,Full access on Intrastat Supplementary Units to Finance manager,model_intrastat_unit,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_transaction_read,Read access on Intrastat Transaction Types to everybody,model_intrastat_transaction,,1,0,0,0
|
||||
access_intrastat_transaction_full,Full access on Intrastat Transaction Types to Finance manager,model_intrastat_transaction,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_transport_mode_read,Read access on Intrastat Transport Modes to everybody,model_intrastat_transport_mode,,1,0,0,0
|
||||
access_intrastat_transport_mode_full,Full access on Intrastat Transport Modes to Finance manager,model_intrastat_transport_mode,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_region_read,Read access on Intrastat Regions,model_intrastat_region,,1,0,0,0
|
||||
access_intrastat_region_full,Full access on Intrastat Regions,model_intrastat_region,account.group_account_manager,1,1,1,1
|
||||
access_hs_code_financial_mgr_full,Full access on H.S. Code to financial mgr,product_harmonized_system.model_hs_code,account.group_account_manager,1,1,1,1
|
||||
access_intrastat_product_declaration,Full access on Intrastat Product Declarations to Accountant,model_intrastat_product_declaration,account.group_account_user,1,1,1,1
|
||||
access_intrastat_product_computation_line,Full access on Intrastat Product Computation Lines to Accountant,model_intrastat_product_computation_line,account.group_account_user,1,1,1,1
|
||||
access_intrastat_product_declaration_line,Full access on Intrastat Product Declaration Lines to Accountant,model_intrastat_product_declaration_line,account.group_account_user,1,1,1,1
|
||||
|
BIN
intrastat_product/static/description/icon.png
Normal file
BIN
intrastat_product/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
48
intrastat_product/views/account_invoice.xml
Normal file
48
intrastat_product/views/account_invoice.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="invoice_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.invoice.form</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='other_info']//field[@name='name']" position="after">
|
||||
<field name="intrastat_transaction_id"/>
|
||||
<field name="intrastat" invisible="1"/>
|
||||
<field name="intrastat_transport_id"
|
||||
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
|
||||
widget="selection"/>
|
||||
<field name="src_dest_country_id" string="Destination Country"/>
|
||||
<field name="src_dest_region_id" string="Origin Region" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='invoice_line_ids']//field[@name='account_id']" position="after">
|
||||
<field name="hs_code_id" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="invoice_supplier_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.invoice.supplier.form</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='payment_term_id']" position="after">
|
||||
<field name="incoterms_id"
|
||||
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page/group/group/field[@name='company_id']" position="after">
|
||||
<field name="intrastat_transaction_id"/>
|
||||
<field name="intrastat" invisible="1"/>
|
||||
<field name="intrastat_transport_id"
|
||||
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
|
||||
widget="selection"/>
|
||||
<field name="src_dest_country_id" string="Origin Country"/>
|
||||
<field name="src_dest_region_id" string="Destination Region" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='invoice_line_ids']//field[@name='account_id']" position="after">
|
||||
<field name="hs_code_id" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
42
intrastat_product/views/hs_code.xml
Normal file
42
intrastat_product/views/hs_code.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2010-2017 Akretion (http://www.akretion.com/)
|
||||
© 2015-2017 Noviat (http://www.noviat.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@author Luc De Meyer <luc.demeyer@noviat.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Add the H.S. code menu under the Intrastat Config menu -->
|
||||
<menuitem id="intrastat_code_menu"
|
||||
action="product_harmonized_system.hs_code_action"
|
||||
parent="intrastat_base.menu_intrastat_config_root"
|
||||
sequence="10"/>
|
||||
|
||||
<!-- Inherit tree view of H.S. code -->
|
||||
<record id="hs_code_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.hs.code.tree</field>
|
||||
<field name="model">hs.code</field>
|
||||
<field name="inherit_id" ref="product_harmonized_system.hs_code_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="local_code" position="after">
|
||||
<field name="intrastat_unit_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Inherit form view for H.S. code -->
|
||||
<record id="hs_code_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.hs.code.form</field>
|
||||
<field name="model">hs.code</field>
|
||||
<field name="inherit_id" ref="product_harmonized_system.hs_code_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="local_code" position="after">
|
||||
<field name="intrastat_unit_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
266
intrastat_product/views/intrastat_product_declaration.xml
Normal file
266
intrastat_product/views/intrastat_product_declaration.xml
Normal file
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="intrastat_product_declaration_view_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.declaration.form</field>
|
||||
<field name="model">intrastat.product.declaration</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Product Declaration">
|
||||
<header>
|
||||
<button name="action_gather" type="object"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('action', '=', 'nihil')]}"
|
||||
string="Generate Lines from Invoices"
|
||||
class="oe_highlight"/>
|
||||
<button name="generate_declaration" type="object"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('action', '=', 'nihil')]}"
|
||||
string="Generate Declaration Lines"/>
|
||||
<button name="generate_xml"
|
||||
string="Generate XML Declaration File"
|
||||
type="object"
|
||||
attrs="{'invisible': [('state', '!=', 'draft')]}"
|
||||
invisible="context.get('generic_intrastat_product_declaration')"/>
|
||||
<button name="done" string="Done" type="object" class="oe_highlight" states="draft"/>
|
||||
<button name="back2draft" string="Back to Draft" type="object" states="done"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet string="Intrastat Product Declaration">
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<span>Intrastat Product Declaration </span>
|
||||
<field name="year_month" class="oe_inline"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group name="top-block">
|
||||
<group name="properties-1">
|
||||
<field name="year"/>
|
||||
<field name="month"/>
|
||||
<field name="type"/>
|
||||
<field name="reporting_level" invisible="1"/>
|
||||
</group>
|
||||
<group name="properties-2">
|
||||
<field name="action"/>
|
||||
<field name="revision"/>
|
||||
<field name="total_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="num_decl_lines"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="company_country_code" invisible="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Transactions">
|
||||
<header>
|
||||
<button name="create_xls" type="object" string="Excel Export"
|
||||
context="{'computation_lines': 1}"/>
|
||||
</header>
|
||||
<group name="computation_lines">
|
||||
<field name="computation_line_ids"
|
||||
context="{'type': type, 'reporting_level': reporting_level}"
|
||||
nolabel="1"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Declaration Lines">
|
||||
<header>
|
||||
<button name="create_xls" type="object" string="Excel Export"
|
||||
context="{'declaration_lines': 1}"/>
|
||||
</header>
|
||||
<group name="declaration_lines">
|
||||
<field name="declaration_line_ids"
|
||||
context="{'type': type, 'reporting_level': reporting_level}"
|
||||
nolabel="1"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field name="note"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_ids" widget="mail_thread"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_declaration_view_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.declaration.tree</field>
|
||||
<field name="model">intrastat.product.declaration</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Product Declarations" colors="blue:state=='draft'">
|
||||
<field name="year_month"/>
|
||||
<field name="revision"/>
|
||||
<field name="type"/>
|
||||
<field name="num_decl_lines"/>
|
||||
<field name="total_amount" sum="Total amount"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_declaration_view_search" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.declaration.search</field>
|
||||
<field name="model">intrastat.product.declaration</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Intrastat Product Declarations">
|
||||
<filter name="arrivals" string="Arrivals" domain="[('type', '=', 'arrivals')]"/>
|
||||
<filter name="dispatches" string="Dispatches" domain="[('type', '=', 'dispatches')]"/>
|
||||
<filter name="draft" string="Draft" domain="[('state', '=', 'draft')]" />
|
||||
<filter name="done" string="Done" domain="[('state', '=', 'done')]" />
|
||||
<group string="Group By" name="group_by">
|
||||
<filter name="date_group_by" string="Date" context="{'group_by': 'year_month'}" />
|
||||
<filter name="type_group_by" string="Type" context="{'group_by': 'type'}" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_declaration_view_graph" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.declaration.graph</field>
|
||||
<field name="model">intrastat.product.declaration</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Intrastat Product" type="bar">
|
||||
<field name="year_month" type="row"/>
|
||||
<field name="type" type="row"/>
|
||||
<field name="total_amount" type="measure"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- No menuitem nor action since these are provided by the localization modules -->
|
||||
|
||||
<record id="intrastat_product_computation_line_view_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.computation.line.form</field>
|
||||
<field name="model">intrastat.product.computation.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Transaction">
|
||||
<group string="Transaction" name="transaction">
|
||||
<field name="parent_id"
|
||||
invisible="not context.get('intrastat_product_computation_line_main_view')"/>
|
||||
<field name="product_id"/>
|
||||
<field name="hs_code_id"/>
|
||||
<field name="src_dest_country_id" domain="[('intrastat', '=', True)]"/>
|
||||
<field name="amount_company_currency"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'company_currency_id'}"/>
|
||||
<field name="amount_accessory_cost_company_currency"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'company_currency_id'}"/>
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
<field name="transaction_id"/>
|
||||
<label for="weight"/>
|
||||
<div>
|
||||
<field name="weight" class="oe_inline"/>
|
||||
<label string=" Kg" class="oe_inline"/>
|
||||
</div>
|
||||
<field name="suppl_unit_qty"/>
|
||||
<field name="intrastat_unit_id"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="reporting_level" invisible="1"/>
|
||||
<field name="transport_id"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"/>
|
||||
<field name="incoterm_id" invisible="1"/>
|
||||
<field name="region_id" invisible="1"/>
|
||||
<field name="product_origin_country_id" invisible="1"/>
|
||||
<field name="invoice_id"/>
|
||||
</group>
|
||||
<group string="Declaration" name="declaration">
|
||||
<field name="declaration_line_id"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_computation_line_view_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.computation.line.tree</field>
|
||||
<field name="model">intrastat.product.computation.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Transactions">
|
||||
<field name="parent_id"
|
||||
invisible="not context.get('intrastat_product_computation_line_main_view')"/>
|
||||
<field name="product_id"/>
|
||||
<field name="hs_code_id"/>
|
||||
<field name="src_dest_country_id" domain="[('intrastat', '=', True)]"/>
|
||||
<field name="amount_company_currency"/>
|
||||
<field name="amount_accessory_cost_company_currency"/>
|
||||
<field name="transaction_id"/>
|
||||
<field name="weight"/>
|
||||
<field name="suppl_unit_qty"
|
||||
attrs="{'invisible': [('intrastat_unit_id', '=', False)], 'required': [('intrastat_unit_id', '!=', False)]}"/>
|
||||
<field name="intrastat_unit_id"/>
|
||||
<field name="transport_id"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"/>
|
||||
<field name="region_id" invisible="1"/>
|
||||
<field name="product_origin_country_id" invisible="1" string="Product C/O"/>
|
||||
<field name="invoice_id"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="reporting_level" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_declaration_line_view_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.declaration.line.form</field>
|
||||
<field name="model">intrastat.product.declaration.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Declaration Line">
|
||||
<group name="declaration">
|
||||
<field name="parent_id"
|
||||
invisible="not context.get('intrastat_product_declaration_line_main_view')"/>
|
||||
<field name="hs_code_id"/>
|
||||
<field name="src_dest_country_id" domain="[('intrastat', '=', True)]"/>
|
||||
<field name="amount_company_currency"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'company_currency_id'}"/>
|
||||
<field name="company_currency_id" invisible="1"/>
|
||||
<field name="transaction_id"/>
|
||||
<label for="weight"/>
|
||||
<div>
|
||||
<field name="weight" class="oe_inline"/>
|
||||
<label string=" Kg" class="oe_inline"/>
|
||||
</div>
|
||||
<field name="suppl_unit_qty"/>
|
||||
<field name="intrastat_unit_id"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="reporting_level" invisible="1"/>
|
||||
<field name="transport_id"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"/>
|
||||
<field name="region_id" invisible="1"/>
|
||||
<field name="incoterm_id" invisible="1"/>
|
||||
<field name="product_origin_country_id" invisible="1"/>
|
||||
</group>
|
||||
<group name="computation" string="Related Transactions">
|
||||
<field name="computation_line_ids" nolabel="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_product_declaration_line_view_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.product.declaration.line.tree</field>
|
||||
<field name="model">intrastat.product.declaration.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Declaration Lines">
|
||||
<field name="parent_id"
|
||||
invisible="not context.get('intrastat_product_declaration_line_main_view')"/>
|
||||
<field name="hs_code_id"/>
|
||||
<field name="src_dest_country_id" domain="[('intrastat', '=', True)]"/>
|
||||
<field name="amount_company_currency"/>
|
||||
<field name="transaction_id"/>
|
||||
<field name="weight"/>
|
||||
<field name="suppl_unit_qty"/>
|
||||
<field name="intrastat_unit_id"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="reporting_level" invisible="1"/>
|
||||
<field name="transport_id"
|
||||
attrs="{'required': [('reporting_level', '=', 'extended')], 'invisible': [('reporting_level', '!=', 'extended')]}"/>
|
||||
<field name="region_id" invisible="1"/>
|
||||
<field name="incoterm_id" invisible="1"/>
|
||||
<field name="product_origin_country_id" invisible="1" string="Product C/O"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
44
intrastat_product/views/intrastat_region.xml
Normal file
44
intrastat_product/views/intrastat_region.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="intrastat_region_view_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.region.form</field>
|
||||
<field name="model">intrastat.region</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Region">
|
||||
<group>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
<field name="country_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_region_view_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.region.tree</field>
|
||||
<field name="model">intrastat.region</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Region">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
<field name="country_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_region_action" model="ir.actions.act_window">
|
||||
<field name="name">Intrastat Regions</field>
|
||||
<field name="res_model">intrastat.region</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="intrastat_region_menu"
|
||||
action="intrastat_region_action"
|
||||
parent="intrastat_base.menu_intrastat_config_root"/>
|
||||
|
||||
</odoo>
|
||||
65
intrastat_product/views/intrastat_transaction.xml
Normal file
65
intrastat_product/views/intrastat_transaction.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2010-2017 Akretion (http://www.akretion.com/)
|
||||
© 2015-2017 Noviat (http://www.noviat.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@author Luc De Meyer <luc.demeyer@noviat.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Intrastat Transaction Type -->
|
||||
<record id="intrastat_transaction_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.transaction_form</field>
|
||||
<field name="model">intrastat.transaction</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Transaction Type">
|
||||
<group>
|
||||
<field name="code"/>
|
||||
<field name="description"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_transaction_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.transaction_tree</field>
|
||||
<field name="model">intrastat.transaction</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Transaction Types">
|
||||
<field name="code"/>
|
||||
<field name="description"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_transaction_mode_search" model="ir.ui.view">
|
||||
<field name="name">intrastat.transaction.mode.search</field>
|
||||
<field name="model">intrastat.transaction</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Intrastat Transaction Types">
|
||||
<field name="description" string="Code or Description"
|
||||
filter_domain="['|', ('code', 'ilike', self), ('description', 'ilike', self)]"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="company_groupby" string="Company"
|
||||
context="{'group_by': 'company_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_transaction_action" model="ir.actions.act_window">
|
||||
<field name="name">Transaction Types</field>
|
||||
<field name="res_model">intrastat.transaction</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="intrastat_transaction_menu"
|
||||
action="intrastat_transaction_action"
|
||||
parent="intrastat_base.menu_intrastat_config_root"
|
||||
sequence="20"/>
|
||||
|
||||
</odoo>
|
||||
61
intrastat_product/views/intrastat_transport_mode.xml
Normal file
61
intrastat_product/views/intrastat_transport_mode.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2010-2017 Akretion (http://www.akretion.com/)
|
||||
© 2015-2017 Noviat (http://www.noviat.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@author Luc De Meyer <luc.demeyer@noviat.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Intrastat Transport Mode -->
|
||||
<record id="intrastat_transport_mode_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.transport.mode.form</field>
|
||||
<field name="model">intrastat.transport_mode</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Transport Mode">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="description"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_transport_mode_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.transport.mode.tree</field>
|
||||
<field name="model">intrastat.transport_mode</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Transportat Modes">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_transport_mode_search" model="ir.ui.view">
|
||||
<field name="name">intrastat.transport.mode.search</field>
|
||||
<field name="model">intrastat.transport_mode</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Intrastat Transport Modes">
|
||||
<field name="name" string="Name, Code or Description"
|
||||
filter_domain="['|', '|', ('name', 'ilike', self), ('description', 'ilike', self), ('code', 'ilike', self)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_transport_action" model="ir.actions.act_window">
|
||||
<field name="name">Transport Modes</field>
|
||||
<field name="res_model">intrastat.transport_mode</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="intrastat_transport_menu"
|
||||
action="intrastat_transport_action"
|
||||
parent="intrastat_base.menu_intrastat_config_root"
|
||||
sequence="30"/>
|
||||
|
||||
</odoo>
|
||||
67
intrastat_product/views/intrastat_unit.xml
Normal file
67
intrastat_product/views/intrastat_unit.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2010-2017 Akretion (http://www.akretion.com/)
|
||||
© 2015-2017 Noviat (http://www.noviat.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@author Luc De Meyer <luc.demeyer@noviat.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Intrastat Supplementary Unit -->
|
||||
<record id="intrastat_unit_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.unit.form</field>
|
||||
<field name="model">intrastat.unit</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Intrastat Supplementary Unit">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="uom_id" required="1"/>
|
||||
<field name="description"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_unit_tree" model="ir.ui.view">
|
||||
<field name="name">intrastat.unit.tree</field>
|
||||
<field name="model">intrastat.unit</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Intrastat Supplementary Units">
|
||||
<field name="name"/>
|
||||
<field name="uom_id"/>
|
||||
<field name="description"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="intrastat_unit_search" model="ir.ui.view">
|
||||
<field name="name">intrastat.unit.search</field>
|
||||
<field name="model">intrastat.unit</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Intrastat Supplementary Units">
|
||||
<field name="name"
|
||||
filter_domain="['|', ('name', 'ilike', self), ('description', 'ilike', self)]"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="uom_groupby" string="Regular UoM"
|
||||
context="{'group_by': 'uom_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="intrastat_unit_action" model="ir.actions.act_window">
|
||||
<field name="name">Supplementary Units</field>
|
||||
<field name="res_model">intrastat.unit</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="intrastat_unit_menu"
|
||||
action="intrastat_unit_action"
|
||||
parent="intrastat_base.menu_intrastat_config_root"
|
||||
sequence="40"/>
|
||||
|
||||
</odoo>
|
||||
82
intrastat_product/views/res_config_settings.xml
Normal file
82
intrastat_product/views/res_config_settings.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
© 2018 brain-tec AG (Kumar Aberer <kumar.aberer@braintec-group.com>)
|
||||
© 2019 Noviat (www.noviat.com)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
<record id="view_res_config_settings" model="ir.ui.view">
|
||||
<field name="name">intrastat.account.config.settings.form</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="intrastat_base.view_intrastat_res_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
|
||||
<xpath expr="//div[@id='intrastat']" position="after">
|
||||
|
||||
<field name="country_id" invisible="1"/>
|
||||
<field name="country_code" invisible="1"/>
|
||||
|
||||
<div class="row mt16 o_settings_container" id="intrastat-product">
|
||||
|
||||
<div class="col-xs-12 col-md-12 o_setting_box">
|
||||
<div class="o_setting_left_pane"/>
|
||||
<div class="o_setting_right_pane">
|
||||
<div class="row">
|
||||
<label for="intrastat_arrivals" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_arrivals"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_dispatches" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_dispatches"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_transport_id" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_transport_id"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_incoterm_id" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_incoterm_id"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_transaction_out_invoice" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_transaction_out_invoice"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_transaction_out_refund" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_transaction_out_refund"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_transaction_in_invoice" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_transaction_in_invoice"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="intrastat_transaction_in_refund" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_transaction_in_refund"/>
|
||||
</div>
|
||||
<div class="row" attrs="{'invisible': [('country_code', 'not in', ['BE'])]}">
|
||||
<label for="intrastat_region_id" class="col-md-5 o_light_label"/>
|
||||
<field name="intrastat_region_id" domain="[('country_id','=', country_id)]"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="intrastat_accessory_costs"
|
||||
attrs="{'invisible': [('country_code', 'in', ['BE'])]}"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<div class="row">
|
||||
<label for="intrastat_accessory_costs" class="col-md-12 o_light_label"
|
||||
attrs="{'invisible': [('country_code', 'in', ['BE'])]}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
20
intrastat_product/views/sale_order.xml
Normal file
20
intrastat_product/views/sale_order.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="sale_order_form" model="ir.ui.view">
|
||||
<field name="name">intrastat.sale.order.form</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="incoterm" position="after">
|
||||
<field name="intrastat_transport_id"
|
||||
attrs="{'invisible': [('intrastat', '!=', 'extended')]}"
|
||||
widget="selection"/>
|
||||
<field name="intrastat" invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
15
intrastat_product/views/stock_warehouse.xml
Normal file
15
intrastat_product/views/stock_warehouse.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_warehouse" model="ir.ui.view">
|
||||
<field name="name">intrastat.stock.warehouse.form</field>
|
||||
<field name="model">stock.warehouse</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="region_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
55
intrastat_product_generic/README.rst
Normal file
55
intrastat_product_generic/README.rst
Normal file
@@ -0,0 +1,55 @@
|
||||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
||||
:target: https://www.gnu.org/licenses/agpl
|
||||
:alt: License: AGPL-3
|
||||
|
||||
=====================================
|
||||
Generic Intrastat Product Declaration
|
||||
=====================================
|
||||
|
||||
This module adds a menu entry for a Generic Intrastat Product Declaration.
|
||||
This is useful to cover countries for which there is no localization module.
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
There is no specific installation procedure for this module.
|
||||
|
||||
Configuration and Usage
|
||||
=======================
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/227/10.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/intrastat/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smash it by providing detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Luc De Meyer <luc.demeyer@noviat.com>
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
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.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
0
intrastat_product_generic/__init__.py
Normal file
0
intrastat_product_generic/__init__.py
Normal file
20
intrastat_product_generic/__manifest__.py
Normal file
20
intrastat_product_generic/__manifest__.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Copyright 2009-2018 Noviat.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Generic Intrastat Product Declaration',
|
||||
'version': '11.0.1.0.0',
|
||||
'category': 'Accounting & Finance',
|
||||
'website': 'https://github.com/OCA/intrastat',
|
||||
'author': 'Noviat,'
|
||||
'Odoo Community Association (OCA)',
|
||||
'license': 'AGPL-3',
|
||||
'installable': True,
|
||||
'depends': [
|
||||
'intrastat_product',
|
||||
],
|
||||
'data': [
|
||||
'security/intrastat_security.xml',
|
||||
'views/intrastat_product.xml'
|
||||
],
|
||||
}
|
||||
22
intrastat_product_generic/i18n/intrastat_product_generic.pot
Normal file
22
intrastat_product_generic/i18n/intrastat_product_generic.pot
Normal file
@@ -0,0 +1,22 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * intrastat_product_generic
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.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_product_generic
|
||||
#: model:ir.actions.act_window,name:intrastat_product_generic.intrastat_product_declaration_action_generic
|
||||
#: model:ir.ui.menu,name:intrastat_product_generic.intrastat_product_declaration_menu_generic
|
||||
#: model:res.groups,name:intrastat_product_generic.group_intrastat_product_generic
|
||||
msgid "Generic Intrastat Product Declaration"
|
||||
msgstr ""
|
||||
|
||||
12
intrastat_product_generic/security/intrastat_security.xml
Normal file
12
intrastat_product_generic/security/intrastat_security.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<record id="group_intrastat_product_generic" model="res.groups">
|
||||
<field name="name">Generic Intrastat Product Declaration</field>
|
||||
</record>
|
||||
|
||||
<record id="base.user_root" model="res.users">
|
||||
<field eval="[(4, ref('group_intrastat_product_generic'))]" name="groups_id"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
BIN
intrastat_product_generic/static/description/icon.png
Normal file
BIN
intrastat_product_generic/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
16
intrastat_product_generic/views/intrastat_product.xml
Normal file
16
intrastat_product_generic/views/intrastat_product.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="intrastat_product_declaration_action_generic" model="ir.actions.act_window">
|
||||
<field name="name">Generic Intrastat Product Declaration</field>
|
||||
<field name="res_model">intrastat.product.declaration</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="context">{'generic_intrastat_product_declaration': 1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="intrastat_product_declaration_menu_generic"
|
||||
parent="intrastat_base.menu_intrastat_base_root"
|
||||
action="intrastat_product_declaration_action_generic"
|
||||
groups="group_intrastat_product_generic"/>
|
||||
|
||||
</odoo>
|
||||
1
oca_dependencies.txt
Normal file
1
oca_dependencies.txt
Normal file
@@ -0,0 +1 @@
|
||||
reporting-engine
|
||||
@@ -1,4 +1,4 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
.. 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
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2018 brain-tec AG (http://www.braintec-group.com)
|
||||
# © 2011-2016 Akretion (http://www.akretion.com)
|
||||
# © 2009-2016 Noviat (http://www.noviat.com)
|
||||
# Copyright 2018 brain-tec AG (http://www.braintec-group.com)
|
||||
# Copyright 2011-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2016 Noviat (http://www.noviat.com)
|
||||
# @author Kumar Aberer <kumar.aberer@braintec-group.com>
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_harmonized_system
|
||||
# * product_harmonized_system
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
@@ -10,13 +10,14 @@ msgstr ""
|
||||
"PO-Revision-Date: 2015-07-16 13:11+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: product_harmonized_system
|
||||
#: field:hs.code,active:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_active
|
||||
msgid "Active"
|
||||
msgstr "Actif"
|
||||
|
||||
@@ -26,96 +27,118 @@ msgid "Automatic data-processing machines (computers)"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: help:hs.code,local_code:0
|
||||
msgid "Code used for the national Import/Export declaration. e.g. Intrastat for the European Union"
|
||||
msgstr "Code utilisé pour la déclaration nationale d'import/export, par exemple la DEB pour la France"
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_hs_code_local_code
|
||||
msgid ""
|
||||
"Code used for the national Import/Export declaration. The national code "
|
||||
"starts with the 6 digits of the H.S. and often has a few additional digits "
|
||||
"to extend the H.S. code."
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,company_id:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_company_id
|
||||
msgid "Company"
|
||||
msgstr "Société"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:product.template,origin_country_id:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_product_product_origin_country_id
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_product_template_origin_country_id
|
||||
msgid "Country of Origin"
|
||||
msgstr "Pays d'origine"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: help:product.template,origin_country_id:0
|
||||
msgid "Country of origin of the product i.e. product 'made in ____'. If you have different countries of origin depending on the supplier from which you purchased the product, leave this field empty and use the equivalent field on the 'product supplier info' form."
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_product_product_origin_country_id
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_product_template_origin_country_id
|
||||
msgid "Country of origin of the product i.e. product 'made in ____'."
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,create_uid:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créé par"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,create_date:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créé le"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,description:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_description
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,display_name:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model,name:product_harmonized_system.model_hs_code
|
||||
#: field:product.category,hs_code_id:0
|
||||
#: field:product.template,hs_code_id:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_hs_code
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_product_category_hs_code_id
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_product_product_hs_code_id
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_product_template_hs_code_id
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.hs_code_view_form
|
||||
msgid "H.S. Code"
|
||||
msgstr "Code S.H."
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: view:hs.code:product_harmonized_system.hs_code_form
|
||||
msgid "HS Code"
|
||||
#: model:ir.actions.act_window,name:product_harmonized_system.hs_code_action
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.hs_code_view_tree
|
||||
#, fuzzy
|
||||
msgid "H.S. Codes"
|
||||
msgstr "Code S.H."
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: view:hs.code:product_harmonized_system.hs_code_tree
|
||||
#: model:ir.actions.act_window,name:product_harmonized_system.hs_code_act
|
||||
#: model:ir.ui.menu,name:product_harmonized_system.hs_code_menu
|
||||
msgid "HS Codes"
|
||||
msgstr "Codes S.H."
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: help:product.category,hs_code_id:0
|
||||
msgid "Harmonised System Code. If this code is not set on the product itself, it will be read here, on the related product category."
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_product_category_hs_code_id
|
||||
msgid ""
|
||||
"Harmonised System Code. If this code is not set on the product itself, it "
|
||||
"will be read here, on the related product category."
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: help:product.template,hs_code_id:0
|
||||
msgid "Harmonised System Code. Nomenclature is available from the World Customs Organisation, see http://www.wcoomd.org/. You can leave this field empty and configure the H.S. code on the product category."
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_product_product_hs_code_id
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_product_template_hs_code_id
|
||||
msgid ""
|
||||
"Harmonised System Code. Nomenclature is available from the World Customs "
|
||||
"Organisation, see http://www.wcoomd.org/. You can leave this field empty and "
|
||||
"configure the H.S. code on the product category."
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,id:0
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_hs_code_hs_code
|
||||
msgid ""
|
||||
"Harmonized System code (6 digits). Full list is available from the World "
|
||||
"Customs Organisation, see http://www.wcoomd.org"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: view:product.category:product_harmonized_system.product_category_form_view
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.product_category_form_view
|
||||
msgid "Import/Export Properties"
|
||||
msgstr "Propriétés pour l'import/export"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,write_uid:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code___last_update
|
||||
#, fuzzy
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière modification par"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,write_date:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: field:hs.code,local_code:0
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_local_code
|
||||
msgid "Local Code"
|
||||
msgstr "Code local"
|
||||
|
||||
@@ -124,6 +147,19 @@ msgstr "Code local"
|
||||
msgid "Printed circuits"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model,name:product_harmonized_system.model_product_product
|
||||
#, fuzzy
|
||||
msgid "Product"
|
||||
msgstr "Catégorie d'articles"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_product_categ_ids
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.hs_code_view_form
|
||||
#, fuzzy
|
||||
msgid "Product Categories"
|
||||
msgstr "Catégorie d'articles"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model,name:product_harmonized_system.model_product_category
|
||||
msgid "Product Category"
|
||||
@@ -135,12 +171,19 @@ msgid "Product Template"
|
||||
msgstr "Modèle d'article"
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: view:hs.code:product_harmonized_system.hs_code_search
|
||||
msgid "Search HS Codes"
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_product_tmpl_ids
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.hs_code_view_form
|
||||
msgid "Products"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.hs_code_view_search
|
||||
#, fuzzy
|
||||
msgid "Search H.S. Codes"
|
||||
msgstr "Recherche dans les codes S.H."
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: help:hs.code,description:0
|
||||
#: model:ir.model.fields,help:product_harmonized_system.field_hs_code_description
|
||||
msgid "Short text description of the H.S. category"
|
||||
msgstr "Courte description de la catégorie H.S."
|
||||
|
||||
@@ -154,3 +197,15 @@ msgstr ""
|
||||
msgid "This code already exists for this company !"
|
||||
msgstr "Ce code existe déjà pour cette société !"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Code used for the national Import/Export declaration. e.g. Intrastat for "
|
||||
#~ "the European Union"
|
||||
#~ msgstr ""
|
||||
#~ "Code utilisé pour la déclaration nationale d'import/export, par exemple "
|
||||
#~ "la DEB pour la France"
|
||||
|
||||
#~ msgid "HS Code"
|
||||
#~ msgstr "Code S.H."
|
||||
|
||||
#~ msgid "HS Codes"
|
||||
#~ msgstr "Codes S.H."
|
||||
|
||||
@@ -132,6 +132,11 @@ msgstr ""
|
||||
msgid "Printed circuits"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model,name:product_harmonized_system.model_product_product
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_harmonized_system
|
||||
#: model:ir.model.fields,field_description:product_harmonized_system.field_hs_code_product_categ_ids
|
||||
#: model:ir.ui.view,arch_db:product_harmonized_system.hs_code_view_form
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import hs_code
|
||||
from . import product_category
|
||||
from . import product_template
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2011-2016 Akretion (http://www.akretion.com)
|
||||
# © 2009-2016 Noviat (http://www.noviat.com)
|
||||
# Copyright 2011-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2016 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class HSCode(models.Model):
|
||||
@@ -20,13 +19,13 @@ class HSCode(models.Model):
|
||||
"available from the World Customs Organisation, see "
|
||||
"http://www.wcoomd.org")
|
||||
description = fields.Char(
|
||||
'Description', translate=True,
|
||||
translate=True,
|
||||
help="Short text description of the H.S. category")
|
||||
display_name = fields.Char(
|
||||
compute='_compute_display_name_field', string="Display Name",
|
||||
compute='_compute_display_name_field',
|
||||
store=True, readonly=True)
|
||||
local_code = fields.Char(
|
||||
string='Local Code', required=True,
|
||||
required=True,
|
||||
help="Code used for the national Import/Export declaration. "
|
||||
"The national code starts with the 6 digits of the H.S. and often "
|
||||
"has a few additional digits to extend the H.S. code.")
|
||||
@@ -36,9 +35,15 @@ class HSCode(models.Model):
|
||||
default=lambda self: self.env['res.company']._company_default_get(
|
||||
'hs.code'))
|
||||
product_categ_ids = fields.One2many(
|
||||
'product.category', 'hs_code_id', string='Product Categories')
|
||||
comodel_name='product.category',
|
||||
inverse_name='hs_code_id',
|
||||
string='Product Categories',
|
||||
readonly=True)
|
||||
product_tmpl_ids = fields.One2many(
|
||||
'product.template', 'hs_code_id', string='Products')
|
||||
comodel_name='product.template',
|
||||
inverse_name='hs_code_id',
|
||||
string='Products',
|
||||
readonly=True)
|
||||
|
||||
@api.multi
|
||||
@api.depends('local_code')
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2011-2016 Akretion (http://www.akretion.com)
|
||||
# © 2009-2016 Noviat (http://www.noviat.com)
|
||||
# Copyright 2011-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2016 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProductCategory(models.Model):
|
||||
@@ -26,5 +25,5 @@ class ProductCategory(models.Model):
|
||||
elif self.parent_id:
|
||||
res = self.parent_id.get_hs_code_recursively()
|
||||
else:
|
||||
res = None
|
||||
res = self.env['hs.code']
|
||||
return res
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2011-2016 Akretion (http://www.akretion.com)
|
||||
# © 2009-2016 Noviat (http://www.noviat.com)
|
||||
# Copyright 2011-2016 Akretion (http://www.akretion.com)
|
||||
# Copyright 2009-2016 Noviat (http://www.noviat.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author Luc de Meyer <info@noviat.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
@@ -23,13 +22,19 @@ class ProductTemplate(models.Model):
|
||||
help="Country of origin of the product i.e. product "
|
||||
"'made in ____'.")
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
@api.multi
|
||||
def get_hs_code_recursively(self):
|
||||
self.ensure_one()
|
||||
if self.hs_code_id:
|
||||
res = self.hs_code_id
|
||||
elif self.categ_id:
|
||||
res = self.categ_id.get_hs_code_recursively()
|
||||
res = self.env['hs.code']
|
||||
if not self:
|
||||
return res
|
||||
else:
|
||||
res = None
|
||||
return res
|
||||
self.ensure_one()
|
||||
if self.hs_code_id:
|
||||
res = self.hs_code_id
|
||||
elif self.categ_id:
|
||||
res = self.categ_id.get_hs_code_recursively()
|
||||
return res
|
||||
|
||||
0
product_harmonized_system_delivery/__init__.py
Normal file
0
product_harmonized_system_delivery/__init__.py
Normal file
16
product_harmonized_system_delivery/__manifest__.py
Normal file
16
product_harmonized_system_delivery/__manifest__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright 2018 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Product Harmonized System Codes - Delivery',
|
||||
'version': '11.0.1.0.0',
|
||||
'category': 'Reporting',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Hide native hs_code field provided by the delivery module',
|
||||
'author': 'Akretion, Odoo Community Association (OCA)',
|
||||
'depends': ['delivery', 'product_harmonized_system'],
|
||||
'data': ['views/product_template.xml'],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
* Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@@ -0,0 +1 @@
|
||||
The OCA module *product_harmonized_system* adds a many2one field *hs_code_id* on product templates that points to an *H.S. Code* object. But the *delivery* module from the official addons adds a char field *hs_code* on product templates, which has the same purpose, but we can't use it because we need structured data for H.S. codes. This module hides the *hs_code* field added by the *delivery* module, to avoid confusion.
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Akretion France (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- product.template form view -->
|
||||
<record id="product_template_hs_code" model="ir.ui.view">
|
||||
<field name="name">hide_native_hs_code_field.product.template.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="delivery.product_template_hs_code" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="hs_code" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -1 +1 @@
|
||||
11.0.20190514.0
|
||||
11.0.20180821.0
|
||||
@@ -4,10 +4,11 @@ with open('VERSION.txt', 'r') as f:
|
||||
version = f.read().strip()
|
||||
|
||||
setuptools.setup(
|
||||
name="odoo11-addons-oca-intrastat-extrastat",
|
||||
description="Meta package for oca-intrastat-extrastat Odoo addons",
|
||||
name="odoo11-addons-oca-intrastat",
|
||||
description="Meta package for oca-intrastat Odoo addons",
|
||||
version=version,
|
||||
install_requires=[
|
||||
'odoo11-addon-intrastat_base',
|
||||
'odoo11-addon-product_harmonized_system',
|
||||
],
|
||||
classifiers=[
|
||||
|
||||
1
setup/intrastat_base/odoo/addons/intrastat_base
Symbolic link
1
setup/intrastat_base/odoo/addons/intrastat_base
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../intrastat_base
|
||||
2
setup/intrastat_base/setup.cfg
Normal file
2
setup/intrastat_base/setup.cfg
Normal file
@@ -0,0 +1,2 @@
|
||||
[bdist_wheel]
|
||||
universal=1
|
||||
6
setup/intrastat_base/setup.py
Normal file
6
setup/intrastat_base/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user