Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] DES and EMEBI : update, improve and simplify #383

Open
wants to merge 7 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions l10n_fr_intrastat_product/README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===
DEB
===
=====
EMEBI
=====

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down Expand Up @@ -28,9 +28,9 @@ DEB

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

This module adds support for the *Déclaration d'Échange de Biens* (DEB) for France.
This module adds support for the *Enquête mensuelle statistique sur les échanges de biens intra-UE* (EMEBI), for France. Before 2022, this declaration was called Déclaration d'Échange de Biens (DEB).

More information about the DEB is available on this `official web page <http://www.douane.gouv.fr/articles/a10897-notions-essentielles-sur-la-declaration-d-echanges-de-biens>`_.
More information about the EMEBI is available on this `official web page <https://www.douane.gouv.fr/fiche/reglementation-sur-la-reponse-lenquete-mensuelle-statistique-sur-les-echanges-de-biens-intra>`_.

**Table of contents**

Expand All @@ -52,7 +52,7 @@ WARNING: there are A LOT of settings for DEB and all these settings need to be c
Usage
=====

To use this module, you need to go to the menu Invoicing > Reports > Intrastat > DEB and create a new DEB. Depending on your obligation levels, you may have to create 2 DEBs: one for export (Expéditions) and one for import (Introductions). Then, click on the button *Generate lines from invoices* to automatically generate the lines of DEB. After checking the lines that have been automatically generated, click on the button *Attach XML file* to create the XML file corresponding to the DEB. Eventually, connect to your account on `pro.douane <https://pro.douane.gouv.fr/>`_ and upload the DEB XML file.
To use this module, you need to go to the menu Invoicing > Reports > Intrastat > EMEBI and create a new EMEBI. Depending on your obligation levels, you may have to create 2 EMEBIs: one for departures (Expéditions) and one for arrivals (Introductions). Then, click on the button *Generate lines from invoices* to automatically generate the computation lines of EMEBI. After checking the lines that have been automatically generated, click on the button *Confirm* to generate the declaration lines, create the XML file and set the declaration readonly. Eventually, connect to your account on `douane.gouv.fr <https://www.douane.gouv.fr/>`_ and upload the EMEBI XML file.

Bug Tracker
===========
Expand Down
11 changes: 5 additions & 6 deletions l10n_fr_intrastat_product/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright 2010-2020 Akretion France (http://www.akretion.com)
# Copyright 2010-2022 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "DEB",
"name": "EMEBI",
"version": "14.0.2.0.0",
"category": "Localisation/Report Intrastat",
"license": "AGPL-3",
"summary": "DEB (Déclaration d'Échange de Biens) for France",
"summary": "EMEBI (ex-DEB) for France",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/l10n-france",
Expand All @@ -18,16 +18,15 @@
],
"data": [
"data/account_fiscal_position_template.xml",
"security/intrastat_product_security.xml",
"security/ir.model.access.csv",
"views/intrastat_product_declaration.xml",
"views/account_fiscal_position.xml",
"data/intrastat_transaction.xml",
"views/intrastat_transaction.xml",
"views/intrastat_unit.xml",
"data/intrastat_product_reminder.xml",
"views/res_config_settings.xml",
"views/res_partner.xml",
"views/product_template.xml",
"views/account_move.xml",
],
"post_init_hook": "set_fr_company_intrastat",
"demo": ["demo/intrastat_demo.xml"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
>
<field name="intrastat" eval="True" />
</record>
<record
id="l10n_fr.fiscal_position_template_intraeub2c"
model="account.fiscal.position.template"
>
<field name="intrastat" eval="True" />
</record>
</odoo>
27 changes: 15 additions & 12 deletions l10n_fr_intrastat_product/data/intrastat_product_reminder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
<odoo>
<data noupdate="1">
<record id="l10n_fr_intrastat_product_cron" model="ir.cron">
<field name="name">DEB Reminder</field>
<field name="name">EMEBI Reminder</field>
<field name="active" eval="False" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">months</field>
<field name="numbercall">-1</field>
<field name="model_id" ref="model_l10n_fr_intrastat_product_declaration" />
<field
name="model_id"
ref="intrastat_product.model_intrastat_product_declaration"
/>
<field name="state">code</field>
<field name="code">model._scheduler_reminder()</field>
</record>
Expand All @@ -23,10 +26,10 @@
id="l10n_fr_intrastat_product_reminder_email_template"
model="mail.template"
>
<field name="name">DEB Reminder</field>
<field name="name">EMEBI Reminder</field>
<field
name="model_id"
ref="l10n_fr_intrastat_product.model_l10n_fr_intrastat_product_declaration"
ref="intrastat_product.model_intrastat_product_declaration"
/>
<field name="auto_delete" eval="False" />
<field
Expand All @@ -35,31 +38,31 @@
<field name="email_to">${object.company_id.intrastat_email_list}</field>
<field
name="subject"
>${object.declaration_type} DEB ${object.year_month} for ${object.company_id.name}</field>
>${object.declaration_type} EMEBI ${object.year_month} for ${object.company_id.name}</field>
<field
name="body_html"
><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">

<p>I would like to remind you that we are approaching the deadline for the DEB for month ${object.year_month}.</p>
<p>I would like to remind you that we are approaching the deadline for the EMEBI for month ${object.year_month}.</p>

<p>As there were no ${object.declaration_type} DEB for that month in Odoo, a draft ${object.declaration_type} DEB has been generated automatically by Odoo.</p>
<p>As there were no ${object.declaration_type} EMEBI for that month in Odoo, a draft ${object.declaration_type} EMEBI has been generated automatically by Odoo.</p>

% if ctx.get('exception'):
<p>When trying to generate the lines of the ${object.declaration_type} DEB, the following error was encountered:</p>
<p>When trying to generate the lines of the ${object.declaration_type} EMEBI, the following error was encountered:</p>

<p>${ctx.get('error_msg')}</p>

<p>You should solve this error, then go to the menu "Invoicing > Reporting > Intrastat > DEB", open the ${object.declaration_type} declaration for month ${object.year_month} and click on the button "Generate lines from invoices".</p>
<p>You should solve this error, then go to the menu "Invoicing > Reporting > Intrastat > EMEBI", open the ${object.declaration_type} declaration for month ${object.year_month} and click on the button "Generate lines from invoices".</p>

% else:
% if object.num_lines and object.num_lines > 0:
<p>This draft ${object.declaration_type} DEB contains ${object.num_decl_lines} ${object.num_decl_lines == 1 and 'line' or 'lines'}.</p>
<p>This draft ${object.declaration_type} EMEBI contains ${object.num_decl_lines} ${object.num_decl_lines == 1 and 'line' or 'lines'}.</p>
% else:
<p>This draft ${object.declaration_type} DEB generated automatically by Odoo doesn't contain any line.</p>
<p>This draft ${object.declaration_type} EMEBI generated automatically by Odoo doesn't contain any line.</p>
% endif

<p>Go and check this declaration in Odoo in the menu "Invoicing > Reporting > Intrastat > DEB".</p>
<p>Go and check this declaration in Odoo in the menu "Invoicing > Reporting > Intrastat > EMEBI".</p>

% endif

Expand Down
17 changes: 15 additions & 2 deletions l10n_fr_intrastat_product/data/intrastat_transaction.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2014-2020 Akretion France (http://www.akretion.com/)
Copyright 2014-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
Expand All @@ -10,6 +10,7 @@
name="description"
>Achat Fournisseur (Acquisitions intracomm. taxables en France)</field>
<field name="code">11</field>
<field name="company_id" eval="False" />
<field name="fr_object_type">in_invoice</field>
<field name="fr_transaction_code">11</field>
<field name="fr_is_fiscal_only" eval="False" />
Expand All @@ -19,19 +20,31 @@
<record id="intrastat_transaction_21_11" model="intrastat.transaction">
<field
name="description"
>Vente Client (Livraisons intracomm. exo. en France et taxables dans l'Etat d'arrivée)</field>
>Vente Client B2B (Livraisons intracomm. exo. en France et taxables dans l'Etat d'arrivée)</field>
<field name="code">21</field>
<field name="company_id" eval="False" />
<field name="fr_object_type">out_invoice</field>
<field name="fr_transaction_code">11</field>
<field name="fr_is_fiscal_only" eval="False" />
<field name="fr_fiscal_value_multiplier">1</field>
<field name="fr_intrastat_product_type">dispatches</field>
</record>
<record id="intrastat_transaction_29_12" model="intrastat.transaction">
<field name="description">Vente Client B2C (soumises à TVA)</field>
<field name="code">29</field>
<field name="company_id" eval="False" />
<field name="fr_object_type">out_invoice</field>
<field name="fr_transaction_code">12</field>
<field name="fr_is_fiscal_only" eval="False" />
<field name="fr_fiscal_value_multiplier">0</field>
<field name="fr_intrastat_product_type">dispatches</field>
</record>
<record id="intrastat_transaction_25" model="intrastat.transaction">
<field
name="description"
>Avoir Client (Régularisation commerciale - minoration de valeur)</field>
<field name="code">25</field>
<field name="company_id" eval="False" />
<field name="fr_object_type">out_refund</field>
<field name="fr_is_fiscal_only" eval="True" />
<field name="fr_fiscal_value_multiplier">-1</field>
Expand Down
17 changes: 1 addition & 16 deletions l10n_fr_intrastat_product/demo/intrastat_demo.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2011-2020 Akretion France (http://www.akretion.com/)
Copyright 2011-2022 Akretion France (http://www.akretion.com/)
@author Alexis de Lattre <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">
<record id="base.main_company" model="res.company">
<field name="fr_intrastat_accreditation">A12B</field>
<field
name="intrastat_transaction_out_invoice"
ref="intrastat_transaction_21_11"
/>
<field name="intrastat_transaction_out_refund" ref="intrastat_transaction_25" />
<field
name="intrastat_transaction_in_invoice"
ref="intrastat_transaction_11_11"
/>
<field name="country_id" ref="base.fr" />
<field name="intrastat_accessory_costs">1</field>
</record>
Expand All @@ -29,10 +20,4 @@
<record id="intrastat_product.intrastat_unit_pce" model="intrastat.unit">
<field name="fr_xml_label">PCE</field>
</record>
<!-- Elec import is the fiscal rep of Asustek -->
<!--
<record id="base.res_partner_1" model="res.partner">
<field name="intrastat_fiscal_representative_id" ref="base.res_partner_2" />
</record>
-->
</odoo>
20 changes: 13 additions & 7 deletions l10n_fr_intrastat_product/migrations/14.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
# @author: Alexis de Lattre <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

def migrate(cr, version):
if not version:
return

cr.execute(
'ALTER TABLE "l10n_fr_intrastat_product_declaration" RENAME "type" '
'TO "declaration_type"'
)
@openupgrade.migrate()
def migrate(env, version):
if openupgrade.table_exists(
env.cr, "l10n_fr_intrastat_product_declaration"
) and openupgrade.column_exists(
env.cr, "l10n_fr_intrastat_product_declaration", "type"
):
openupgrade.logged_query(
env.cr,
"ALTER TABLE l10n_fr_intrastat_product_declaration RENAME type "
"TO declaration_type",
)
1 change: 0 additions & 1 deletion l10n_fr_intrastat_product/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import intrastat_transaction
from . import res_partner
from . import intrastat_unit
from . import stock
from . import res_company
Expand Down
Loading
Loading