From 2d5a0bda71ac4903389abee733025b0959e1e431 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 26 Nov 2019 16:21:12 +0100 Subject: [PATCH 01/29] Check-in of the l10n_fr_fec module from github.com/odoo/odoo 12.0 branch under the name l10n_fr_fec_oca This module was initially developped by Alexis de Lattre in OCA/l10n-france for v8, then moved to odoo core and received several contribution/improvements by Odoo SA employees and it also received fixes and improvements by community members. --- l10n_fr_fec_oca/README.rst | 40 ++ l10n_fr_fec_oca/__init__.py | 1 + l10n_fr_fec_oca/__manifest__.py | 15 + l10n_fr_fec_oca/i18n/fr.po | 293 +++++++++++++ l10n_fr_fec_oca/i18n/l10n_fr_fec.pot | 290 +++++++++++++ l10n_fr_fec_oca/wizard/__init__.py | 1 + l10n_fr_fec_oca/wizard/account_fr_fec.py | 397 ++++++++++++++++++ .../wizard/account_fr_fec_view.xml | 128 ++++++ 8 files changed, 1165 insertions(+) create mode 100644 l10n_fr_fec_oca/README.rst create mode 100644 l10n_fr_fec_oca/__init__.py create mode 100644 l10n_fr_fec_oca/__manifest__.py create mode 100644 l10n_fr_fec_oca/i18n/fr.po create mode 100644 l10n_fr_fec_oca/i18n/l10n_fr_fec.pot create mode 100644 l10n_fr_fec_oca/wizard/__init__.py create mode 100644 l10n_fr_fec_oca/wizard/account_fr_fec.py create mode 100644 l10n_fr_fec_oca/wizard/account_fr_fec_view.xml diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/README.rst new file mode 100644 index 000000000..cbd9da1da --- /dev/null +++ b/l10n_fr_fec_oca/README.rst @@ -0,0 +1,40 @@ +Fichier d'Échange Informatisé (FEC) pour la France +================================================== + +Ce module permet de générer le fichier FEC tel que définit par `l'arrêté du 29 +Juillet 2013 ` +portant modification des dispositions de l'article A. 47 A-1 du +livre des procédures fiscales. + +Cet arrêté prévoit l'obligation pour les sociétés ayant une comptabilité +informatisée de pouvoir fournir à l'administration fiscale un fichier +regroupant l'ensemble des écritures comptables de l'exercice. Le format de ce +fichier, appelé *FEC*, est définit dans l'arrêté. + +Le détail du format du FEC est spécifié dans le bulletin officiel des finances publiques `BOI-CF-IOR-60-40-20-20131213 ` du 13 Décembre 2013. Ce module implémente le fichier +FEC au format texte et non au format XML, car le format texte sera facilement +lisible et vérifiable par le comptable en utilisant un tableur. + +La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel +*Test Compta Demat* version 1_00_05 disponible sur +`le site de la direction générale des finances publiques ` +en utilisant une base de donnée Odoo réelle. + +Configuration +============= + +Aucune configuration n'est nécessaire. + +Utilisation +=========== + +Pour générer le *FEC*, allez dans le menu *Accounting > Reporting > French Statements > FEC* qui va démarrer l'assistant de génération du FEC. + +Credits +======= + +Contributors +------------ + +* Alexis de Lattre + diff --git a/l10n_fr_fec_oca/__init__.py b/l10n_fr_fec_oca/__init__.py new file mode 100644 index 000000000..40272379f --- /dev/null +++ b/l10n_fr_fec_oca/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py new file mode 100644 index 000000000..8fbeac81d --- /dev/null +++ b/l10n_fr_fec_oca/__manifest__.py @@ -0,0 +1,15 @@ +#-*- coding:utf-8 -*- + +# Copyright (C) 2013-2015 Akretion (http://www.akretion.com) + +{ + 'name': 'France - FEC', + 'category': 'Accounting', + 'summary': "Fichier d'Échange Informatisé (FEC) for France", + 'author': "Akretion,Odoo Community Association (OCA)", + 'depends': ['l10n_fr', 'account'], + 'data': [ + 'wizard/account_fr_fec_view.xml', + ], + 'auto_install': True, +} diff --git a/l10n_fr_fec_oca/i18n/fr.po b/l10n_fr_fec_oca/i18n/fr.po new file mode 100644 index 000000000..65a48fe7f --- /dev/null +++ b/l10n_fr_fec_oca/i18n/fr.po @@ -0,0 +1,293 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_fr_fec +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-09-17 13:45+0000\n" +"PO-Revision-Date: 2014-02-03 10:27+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: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 10" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 11" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 12" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 13" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 14" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 15" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 16" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 17" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Cancel" +msgstr "Annuler" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Column" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Comment" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompAuxLib" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompAuxNum" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompteLib" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompteNum" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_uid +msgid "Created by" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_date +msgid "Created on" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Credit" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "DateLet" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Debit" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__display_name +msgid "Display Name" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureDate" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureLet" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureLib" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureNum" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_to +msgid "End Date" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__export_type +msgid "Export Type" +msgstr "Type d'export" + +#. module: l10n_fr_fec +#: model:ir.actions.act_window,name:l10n_fr_fec.account_fr_fec_action +#: model:ir.ui.menu,name:l10n_fr_fec.account_fr_fec_menu +msgid "FEC" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__fec_data +msgid "FEC File" +msgstr "Fichier FEC" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "FEC File Generation" +msgstr "Génération Fichier FEC" + +#. module: l10n_fr_fec +#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:117 +#, python-format +msgid "FEC is for French companies only !" +msgstr "Le FEC est uniquement pour les sociétés françaises !" + +#. module: l10n_fr_fec +#: model:ir.model,name:l10n_fr_fec.model_account_fr_fec +msgid "Ficher Echange Informatise" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__filename +msgid "Filename" +msgstr "Nom du fichier" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Generate" +msgstr "Générer" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__id +msgid "ID" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Idevise" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "JournalCode" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "JournalLib" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_date +msgid "Last Updated on" +msgstr "" + +#. module: l10n_fr_fec +#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:114 +#, python-format +msgid "Missing VAT number for company %s" +msgstr "Numéro de TVA manquant sur la société %s" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Montantdevise" +msgstr "" + +#. module: l10n_fr_fec +#: selection:account.fr.fec,export_type:0 +msgid "Non-official FEC report (posted and unposted entries)" +msgstr "Rapport FEC non-officiel (entrées postées et non-postées)" + +#. module: l10n_fr_fec +#: selection:account.fr.fec,export_type:0 +msgid "Official FEC report (posted entries only)" +msgstr "Rapport FEC officiel (entrées postées uniquement)" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Options" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "PieceDate" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "PieceRef" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_from +msgid "Start Date" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Technical Info" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Technical Name" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "" +"The encoding of this text file is UTF-8. The structure of file is CSV " +"separated by pipe '|'." +msgstr "Ce fichier texte est encodé en UTF-8. Le format du fichier est CSV " +"avec séparateur '|'." + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "ValidDate" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "We use partner.id" +msgstr "" diff --git a/l10n_fr_fec_oca/i18n/l10n_fr_fec.pot b/l10n_fr_fec_oca/i18n/l10n_fr_fec.pot new file mode 100644 index 000000000..3d41fa5bd --- /dev/null +++ b/l10n_fr_fec_oca/i18n/l10n_fr_fec.pot @@ -0,0 +1,290 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_fr_fec +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~11.5+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-09-17 13:45+0000\n" +"PO-Revision-Date: 2018-09-17 13:45+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: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 10" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 11" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 12" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 13" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 14" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 15" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 16" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "# 17" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Cancel" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Column" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Comment" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompAuxLib" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompAuxNum" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompteLib" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "CompteNum" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_uid +msgid "Created by" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_date +msgid "Created on" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Credit" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "DateLet" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Debit" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__display_name +msgid "Display Name" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureDate" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureLet" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureLib" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "EcritureNum" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_to +msgid "End Date" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__export_type +msgid "Export Type" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.actions.act_window,name:l10n_fr_fec.account_fr_fec_action +#: model:ir.ui.menu,name:l10n_fr_fec.account_fr_fec_menu +msgid "FEC" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__fec_data +msgid "FEC File" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "FEC File Generation" +msgstr "" + +#. module: l10n_fr_fec +#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:117 +#, python-format +msgid "FEC is for French companies only !" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model,name:l10n_fr_fec.model_account_fr_fec +msgid "Ficher Echange Informatise" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__filename +msgid "Filename" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Generate" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__id +msgid "ID" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Idevise" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "JournalCode" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "JournalLib" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_date +msgid "Last Updated on" +msgstr "" + +#. module: l10n_fr_fec +#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:114 +#, python-format +msgid "Missing VAT number for company %s" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Montantdevise" +msgstr "" + +#. module: l10n_fr_fec +#: selection:account.fr.fec,export_type:0 +msgid "Non-official FEC report (posted and unposted entries)" +msgstr "" + +#. module: l10n_fr_fec +#: selection:account.fr.fec,export_type:0 +msgid "Official FEC report (posted entries only)" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Options" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "PieceDate" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "PieceRef" +msgstr "" + +#. module: l10n_fr_fec +#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_from +msgid "Start Date" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Technical Info" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "Technical Name" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "The encoding of this text file is UTF-8. The structure of file is CSV separated by pipe '|'." +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "ValidDate" +msgstr "" + +#. module: l10n_fr_fec +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +msgid "We use partner.id" +msgstr "" + diff --git a/l10n_fr_fec_oca/wizard/__init__.py b/l10n_fr_fec_oca/wizard/__init__.py new file mode 100644 index 000000000..2cc8a2511 --- /dev/null +++ b/l10n_fr_fec_oca/wizard/__init__.py @@ -0,0 +1 @@ +from . import account_fr_fec diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec.py b/l10n_fr_fec_oca/wizard/account_fr_fec.py new file mode 100644 index 000000000..5b6bb9539 --- /dev/null +++ b/l10n_fr_fec_oca/wizard/account_fr_fec.py @@ -0,0 +1,397 @@ +#-*- coding:utf-8 -*- + +# Copyright (C) 2013-2015 Akretion (http://www.akretion.com) + +import base64 +import io + +from odoo import api, fields, models, _ +from odoo.exceptions import Warning +from odoo.tools import float_is_zero, pycompat + + +class AccountFrFec(models.TransientModel): + _name = 'account.fr.fec' + _description = 'Ficher Echange Informatise' + + date_from = fields.Date(string='Start Date', required=True) + date_to = fields.Date(string='End Date', required=True) + fec_data = fields.Binary('FEC File', readonly=True) + filename = fields.Char(string='Filename', size=256, readonly=True) + export_type = fields.Selection([ + ('official', 'Official FEC report (posted entries only)'), + ('nonofficial', 'Non-official FEC report (posted and unposted entries)'), + ], string='Export Type', required=True, default='official') + + def do_query_unaffected_earnings(self): + ''' Compute the sum of ending balances for all accounts that are of a type that does not bring forward the balance in new fiscal years. + This is needed because we have to display only one line for the initial balance of all expense/revenue accounts in the FEC. + ''' + + sql_query = ''' + SELECT + 'OUV' AS JournalCode, + 'Balance initiale' AS JournalLib, + 'OUVERTURE/' || %s AS EcritureNum, + %s AS EcritureDate, + '120/129' AS CompteNum, + 'Benefice (perte) reporte(e)' AS CompteLib, + '' AS CompAuxNum, + '' AS CompAuxLib, + '-' AS PieceRef, + %s AS PieceDate, + '/' AS EcritureLib, + replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, + '' AS EcritureLet, + '' AS DateLet, + %s AS ValidDate, + '' AS Montantdevise, + '' AS Idevise + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id + WHERE + am.date < %s + AND am.company_id = %s + AND aat.include_initial_balance = 'f' + AND (aml.debit != 0 OR aml.credit != 0) + ''' + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + company = self.env.user.company_id + formatted_date_from = fields.Date.to_string(self.date_from).replace('-', '') + date_from = self.date_from + formatted_date_year = date_from.year + self._cr.execute( + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) + listrow = [] + row = self._cr.fetchone() + listrow = list(row) + return listrow + + def _get_company_legal_data(self, company): + """ + Dom-Tom are excluded from the EU's fiscal territory + Those regions do not have SIREN + sources: + https://www.service-public.fr/professionnels-entreprises/vosdroits/F23570 + http://www.douane.gouv.fr/articles/a11024-tva-dans-les-dom + """ + dom_tom_group = self.env.ref('l10n_fr.dom-tom') + is_dom_tom = company.country_id.code in dom_tom_group.country_ids.mapped('code') + if not is_dom_tom and not company.vat: + raise Warning( + _("Missing VAT number for company %s") % company.name) + if not is_dom_tom and company.vat[0:2] != 'FR': + raise Warning( + _("FEC is for French companies only !")) + + return { + 'siren': company.vat[4:13] if not is_dom_tom else '', + } + + @api.multi + def generate_fec(self): + self.ensure_one() + # We choose to implement the flat file instead of the XML + # file for 2 reasons : + # 1) the XSD file impose to have the label on the account.move + # but Odoo has the label on the account.move.line, so that's a + # problem ! + # 2) CSV files are easier to read/use for a regular accountant. + # So it will be easier for the accountant to check the file before + # sending it to the fiscal administration + company = self.env.user.company_id + company_legal_data = self._get_company_legal_data(company) + + header = [ + u'JournalCode', # 0 + u'JournalLib', # 1 + u'EcritureNum', # 2 + u'EcritureDate', # 3 + u'CompteNum', # 4 + u'CompteLib', # 5 + u'CompAuxNum', # 6 We use partner.id + u'CompAuxLib', # 7 + u'PieceRef', # 8 + u'PieceDate', # 9 + u'EcritureLib', # 10 + u'Debit', # 11 + u'Credit', # 12 + u'EcritureLet', # 13 + u'DateLet', # 14 + u'ValidDate', # 15 + u'Montantdevise', # 16 + u'Idevise', # 17 + ] + + rows_to_write = [header] + # INITIAL BALANCE + unaffected_earnings_xml_ref = self.env.ref('account.data_unaffected_earnings') + unaffected_earnings_line = True # used to make sure that we add the unaffected earning initial balance only once + if unaffected_earnings_xml_ref: + #compute the benefit/loss of last year to add in the initial balance of the current year earnings account + unaffected_earnings_results = self.do_query_unaffected_earnings() + unaffected_earnings_line = False + + sql_query = ''' + SELECT + 'OUV' AS JournalCode, + 'Balance initiale' AS JournalLib, + 'OUVERTURE/' || %s AS EcritureNum, + %s AS EcritureDate, + MIN(aa.code) AS CompteNum, + replace(replace(MIN(aa.name), '|', '/'), '\t', '') AS CompteLib, + '' AS CompAuxNum, + '' AS CompAuxLib, + '-' AS PieceRef, + %s AS PieceDate, + '/' AS EcritureLib, + replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, + '' AS EcritureLet, + '' AS DateLet, + %s AS ValidDate, + '' AS Montantdevise, + '' AS Idevise, + MIN(aa.id) AS CompteID + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id + WHERE + am.date < %s + AND am.company_id = %s + AND aat.include_initial_balance = 't' + AND (aml.debit != 0 OR aml.credit != 0) + ''' + + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + + sql_query += ''' + GROUP BY aml.account_id, aat.type + HAVING round(sum(aml.balance), %s) != 0 + AND aat.type not in ('receivable', 'payable') + ''' + formatted_date_from = fields.Date.to_string(self.date_from).replace('-', '') + date_from = self.date_from + formatted_date_year = date_from.year + currency_digits = 2 + + self._cr.execute( + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id, currency_digits)) + + for row in self._cr.fetchall(): + listrow = list(row) + account_id = listrow.pop() + if not unaffected_earnings_line: + account = self.env['account.account'].browse(account_id) + if account.user_type_id.id == self.env.ref('account.data_unaffected_earnings').id: + #add the benefit/loss of previous fiscal year to the first unaffected earnings account found. + unaffected_earnings_line = True + current_amount = float(listrow[11].replace(',', '.')) - float(listrow[12].replace(',', '.')) + unaffected_earnings_amount = float(unaffected_earnings_results[11].replace(',', '.')) - float(unaffected_earnings_results[12].replace(',', '.')) + listrow_amount = current_amount + unaffected_earnings_amount + if float_is_zero(listrow_amount, precision_digits=currency_digits): + continue + if listrow_amount > 0: + listrow[11] = str(listrow_amount).replace('.', ',') + listrow[12] = '0,00' + else: + listrow[11] = '0,00' + listrow[12] = str(-listrow_amount).replace('.', ',') + rows_to_write.append(listrow) + + #if the unaffected earnings account wasn't in the selection yet: add it manually + if (not unaffected_earnings_line + and unaffected_earnings_results + and (unaffected_earnings_results[11] != '0,00' + or unaffected_earnings_results[12] != '0,00')): + #search an unaffected earnings account + unaffected_earnings_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_unaffected_earnings').id)], limit=1) + if unaffected_earnings_account: + unaffected_earnings_results[4] = unaffected_earnings_account.code + unaffected_earnings_results[5] = unaffected_earnings_account.name + rows_to_write.append(unaffected_earnings_results) + + # INITIAL BALANCE - receivable/payable + sql_query = ''' + SELECT + 'OUV' AS JournalCode, + 'Balance initiale' AS JournalLib, + 'OUVERTURE/' || %s AS EcritureNum, + %s AS EcritureDate, + MIN(aa.code) AS CompteNum, + replace(MIN(aa.name), '|', '/') AS CompteLib, + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID ' || rp.id, '') + ELSE replace(rp.ref, '|', '/') + END + AS CompAuxNum, + COALESCE(replace(rp.name, '|', '/'), '') AS CompAuxLib, + '-' AS PieceRef, + %s AS PieceDate, + '/' AS EcritureLib, + replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, + '' AS EcritureLet, + '' AS DateLet, + %s AS ValidDate, + '' AS Montantdevise, + '' AS Idevise, + MIN(aa.id) AS CompteID + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + LEFT JOIN res_partner rp ON rp.id=aml.partner_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id + WHERE + am.date < %s + AND am.company_id = %s + AND aat.include_initial_balance = 't' + AND (aml.debit != 0 OR aml.credit != 0) + ''' + + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + + sql_query += ''' + GROUP BY aml.account_id, aat.type, rp.ref, rp.id + HAVING round(sum(aml.balance), %s) != 0 + AND aat.type in ('receivable', 'payable') + ''' + self._cr.execute( + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id, currency_digits)) + + for row in self._cr.fetchall(): + listrow = list(row) + account_id = listrow.pop() + rows_to_write.append(listrow) + + # LINES + sql_query = ''' + SELECT + replace(replace(aj.code, '|', '/'), '\t', '') AS JournalCode, + replace(replace(aj.name, '|', '/'), '\t', '') AS JournalLib, + replace(replace(am.name, '|', '/'), '\t', '') AS EcritureNum, + TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, + aa.code AS CompteNum, + replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID ' || rp.id, '') + ELSE replace(rp.ref, '|', '/') + END + AS CompAuxNum, + COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') AS CompAuxLib, + CASE WHEN am.ref IS null OR am.ref = '' + THEN '-' + ELSE replace(replace(am.ref, '|', '/'), '\t', '') + END + AS PieceRef, + TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, + CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' + WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/' + ELSE replace(replace(replace(replace(aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') END AS EcritureLib, + replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit, + replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit, + CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet, + CASE WHEN aml.full_reconcile_id IS NULL THEN '' ELSE TO_CHAR(rec.create_date, 'YYYYMMDD') END AS DateLet, + TO_CHAR(am.date, 'YYYYMMDD') AS ValidDate, + CASE + WHEN aml.amount_currency IS NULL OR aml.amount_currency = 0 THEN '' + ELSE replace(to_char(aml.amount_currency, '000000000000000D99'), '.', ',') + END AS Montantdevise, + CASE WHEN aml.currency_id IS NULL THEN '' ELSE rc.name END AS Idevise + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + LEFT JOIN res_partner rp ON rp.id=aml.partner_id + JOIN account_journal aj ON aj.id = am.journal_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN res_currency rc ON rc.id = aml.currency_id + LEFT JOIN account_full_reconcile rec ON rec.id = aml.full_reconcile_id + WHERE + am.date >= %s + AND am.date <= %s + AND am.company_id = %s + AND (aml.debit != 0 OR aml.credit != 0) + ''' + + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + + sql_query += ''' + ORDER BY + am.date, + am.name, + aml.id + ''' + self._cr.execute( + sql_query, (self.date_from, self.date_to, company.id)) + + for row in self._cr.fetchall(): + rows_to_write.append(list(row)) + + fecvalue = self._csv_write_rows(rows_to_write) + end_date = fields.Date.to_string(self.date_to).replace('-', '') + suffix = '' + if self.export_type == "nonofficial": + suffix = '-NONOFFICIAL' + + self.write({ + 'fec_data': base64.encodestring(fecvalue), + # Filename = FECYYYYMMDD where YYYMMDD is the closing date + 'filename': '%sFEC%s%s.csv' % (company_legal_data['siren'], end_date, suffix), + }) + + action = { + 'name': 'FEC', + 'type': 'ir.actions.act_url', + 'url': "web/content/?model=account.fr.fec&id=" + str(self.id) + "&filename_field=filename&field=fec_data&download=true&filename=" + self.filename, + 'target': 'self', + } + return action + + def _csv_write_rows(self, rows, lineterminator=u'\r\n'): + """ + Write FEC rows into a file + It seems that Bercy's bureaucracy is not too happy about the + empty new line at the End Of File. + + @param {list(list)} rows: the list of rows. Each row is a list of strings + @param {unicode string} [optional] lineterminator: effective line terminator + Has nothing to do with the csv writer parameter + The last line written won't be terminated with it + + @return the value of the file + """ + fecfile = io.BytesIO() + writer = pycompat.csv_writer(fecfile, delimiter='|', lineterminator='') + + rows_length = len(rows) + for i, row in enumerate(rows): + if not i == rows_length - 1: + row[-1] += lineterminator + writer.writerow(row) + + fecvalue = fecfile.getvalue() + fecfile.close() + return fecvalue diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_view.xml b/l10n_fr_fec_oca/wizard/account_fr_fec_view.xml new file mode 100644 index 000000000..e4a5cd75b --- /dev/null +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_view.xml @@ -0,0 +1,128 @@ + + + + account.fr.fec.form.view + account.fr.fec + +
+ + + + + + + + + + +
+ The encoding of this text file is UTF-8. The structure of file is CSV separated by pipe '|'. +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Technical NameColumnComment
JournalCode# 0
JournalLib + # 1
EcritureNum# 2
EcritureDate + # 3
CompteNum# 4
CompteLib# 5
CompAuxNum# 6We use partner.id
CompAuxLib# 7
PieceRef# 8
PieceDate# 9
EcritureLib# 10
Debit# 11
Credit# 12
EcritureLet# 13
DateLet# 14
ValidDate# 15
Montantdevise# 16
Idevise# 17
+
+
+
+
+
+
+
+
+ + + FEC + account.fr.fec + form + new + + + +
From 951195dd5e64707aa02faefff7976fe7426e27ff Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 27 Nov 2019 00:03:10 +0100 Subject: [PATCH 02/29] Improve FEC generation: encoding, field delimiter, partner export are now configurable Fix filename when VAT number contrains spaces PEP8 --- l10n_fr_fec_oca/__manifest__.py | 17 +- l10n_fr_fec_oca/readme/CONTRIBUTORS.rst | 2 + .../{README.rst => readme/DESCRIPTION.rst} | 31 +- l10n_fr_fec_oca/readme/USAGE.rst | 1 + l10n_fr_fec_oca/wizard/__init__.py | 2 +- l10n_fr_fec_oca/wizard/account_fr_fec.py | 397 ------------ l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 589 ++++++++++++++++++ ...c_view.xml => account_fr_fec_oca_view.xml} | 47 +- 8 files changed, 634 insertions(+), 452 deletions(-) create mode 100644 l10n_fr_fec_oca/readme/CONTRIBUTORS.rst rename l10n_fr_fec_oca/{README.rst => readme/DESCRIPTION.rst} (52%) create mode 100644 l10n_fr_fec_oca/readme/USAGE.rst delete mode 100644 l10n_fr_fec_oca/wizard/account_fr_fec.py create mode 100644 l10n_fr_fec_oca/wizard/account_fr_fec_oca.py rename l10n_fr_fec_oca/wizard/{account_fr_fec_view.xml => account_fr_fec_oca_view.xml} (74%) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 8fbeac81d..965c16131 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -1,15 +1,20 @@ -#-*- coding:utf-8 -*- - -# Copyright (C) 2013-2015 Akretion (http://www.akretion.com) +# Copyright 2013-2019 Akretion France (http://www.akretion.com/) +# Copyright 2016-2019 Odoo SA (https://www.odoo.com/fr_FR/) +# @author: Alexis de Lattre { 'name': 'France - FEC', 'category': 'Accounting', + 'license': 'LGPL-3', 'summary': "Fichier d'Échange Informatisé (FEC) for France", 'author': "Akretion,Odoo Community Association (OCA)", - 'depends': ['l10n_fr', 'account'], + 'website': 'https://github.com/OCA/l10n-france', + 'depends': ['l10n_fr', 'account', 'date_range'], + 'external_dependencies': { + 'python': ['unicodecsv', 'unidecode'], + }, 'data': [ - 'wizard/account_fr_fec_view.xml', + 'wizard/account_fr_fec_oca_view.xml', ], - 'auto_install': True, + 'installable': True, } diff --git a/l10n_fr_fec_oca/readme/CONTRIBUTORS.rst b/l10n_fr_fec_oca/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..8f7930ebb --- /dev/null +++ b/l10n_fr_fec_oca/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Alexis de Lattre +* Odoo S.A. diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/readme/DESCRIPTION.rst similarity index 52% rename from l10n_fr_fec_oca/README.rst rename to l10n_fr_fec_oca/readme/DESCRIPTION.rst index cbd9da1da..38786b46c 100644 --- a/l10n_fr_fec_oca/README.rst +++ b/l10n_fr_fec_oca/readme/DESCRIPTION.rst @@ -1,17 +1,13 @@ -Fichier d'Échange Informatisé (FEC) pour la France -================================================== - -Ce module permet de générer le fichier FEC tel que définit par `l'arrêté du 29 -Juillet 2013 ` -portant modification des dispositions de l'article A. 47 A-1 du -livre des procédures fiscales. +Ce module permet de générer le fichier FEC tel que définit par l'arrêté du 29 +Juillet 2013 portant modification des dispositions de l'article `A. 47 A-1 du +livre des procédures fiscales `_. Cet arrêté prévoit l'obligation pour les sociétés ayant une comptabilité informatisée de pouvoir fournir à l'administration fiscale un fichier regroupant l'ensemble des écritures comptables de l'exercice. Le format de ce fichier, appelé *FEC*, est définit dans l'arrêté. -Le détail du format du FEC est spécifié dans le bulletin officiel des finances publiques `BOI-CF-IOR-60-40-20-20131213 ` du 13 Décembre 2013. Ce module implémente le fichier +Le détail du format du FEC est spécifié dans le bulletin officiel des finances publiques `BOI-CF-IOR-60-40-20-20131213 ` du 13 Décembre 2013. Ce module implémente le fichier FEC au format texte et non au format XML, car le format texte sera facilement lisible et vérifiable par le comptable en utilisant un tableur. @@ -19,22 +15,3 @@ La structure du fichier FEC généré par ce module a été vérifiée avec le l *Test Compta Demat* version 1_00_05 disponible sur `le site de la direction générale des finances publiques ` en utilisant une base de donnée Odoo réelle. - -Configuration -============= - -Aucune configuration n'est nécessaire. - -Utilisation -=========== - -Pour générer le *FEC*, allez dans le menu *Accounting > Reporting > French Statements > FEC* qui va démarrer l'assistant de génération du FEC. - -Credits -======= - -Contributors ------------- - -* Alexis de Lattre - diff --git a/l10n_fr_fec_oca/readme/USAGE.rst b/l10n_fr_fec_oca/readme/USAGE.rst new file mode 100644 index 000000000..1e21b58bd --- /dev/null +++ b/l10n_fr_fec_oca/readme/USAGE.rst @@ -0,0 +1 @@ +Pour générer le *FEC*, allez dans le menu *Invoicing > Reporting > France > FEC* qui va démarrer l'assistant de génération du FEC. diff --git a/l10n_fr_fec_oca/wizard/__init__.py b/l10n_fr_fec_oca/wizard/__init__.py index 2cc8a2511..786e3b470 100644 --- a/l10n_fr_fec_oca/wizard/__init__.py +++ b/l10n_fr_fec_oca/wizard/__init__.py @@ -1 +1 @@ -from . import account_fr_fec +from . import account_fr_fec_oca diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec.py b/l10n_fr_fec_oca/wizard/account_fr_fec.py deleted file mode 100644 index 5b6bb9539..000000000 --- a/l10n_fr_fec_oca/wizard/account_fr_fec.py +++ /dev/null @@ -1,397 +0,0 @@ -#-*- coding:utf-8 -*- - -# Copyright (C) 2013-2015 Akretion (http://www.akretion.com) - -import base64 -import io - -from odoo import api, fields, models, _ -from odoo.exceptions import Warning -from odoo.tools import float_is_zero, pycompat - - -class AccountFrFec(models.TransientModel): - _name = 'account.fr.fec' - _description = 'Ficher Echange Informatise' - - date_from = fields.Date(string='Start Date', required=True) - date_to = fields.Date(string='End Date', required=True) - fec_data = fields.Binary('FEC File', readonly=True) - filename = fields.Char(string='Filename', size=256, readonly=True) - export_type = fields.Selection([ - ('official', 'Official FEC report (posted entries only)'), - ('nonofficial', 'Non-official FEC report (posted and unposted entries)'), - ], string='Export Type', required=True, default='official') - - def do_query_unaffected_earnings(self): - ''' Compute the sum of ending balances for all accounts that are of a type that does not bring forward the balance in new fiscal years. - This is needed because we have to display only one line for the initial balance of all expense/revenue accounts in the FEC. - ''' - - sql_query = ''' - SELECT - 'OUV' AS JournalCode, - 'Balance initiale' AS JournalLib, - 'OUVERTURE/' || %s AS EcritureNum, - %s AS EcritureDate, - '120/129' AS CompteNum, - 'Benefice (perte) reporte(e)' AS CompteLib, - '' AS CompAuxNum, - '' AS CompAuxLib, - '-' AS PieceRef, - %s AS PieceDate, - '/' AS EcritureLib, - replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, - replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, - '' AS EcritureLet, - '' AS DateLet, - %s AS ValidDate, - '' AS Montantdevise, - '' AS Idevise - FROM - account_move_line aml - LEFT JOIN account_move am ON am.id=aml.move_id - JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id - WHERE - am.date < %s - AND am.company_id = %s - AND aat.include_initial_balance = 'f' - AND (aml.debit != 0 OR aml.credit != 0) - ''' - # For official report: only use posted entries - if self.export_type == "official": - sql_query += ''' - AND am.state = 'posted' - ''' - company = self.env.user.company_id - formatted_date_from = fields.Date.to_string(self.date_from).replace('-', '') - date_from = self.date_from - formatted_date_year = date_from.year - self._cr.execute( - sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) - listrow = [] - row = self._cr.fetchone() - listrow = list(row) - return listrow - - def _get_company_legal_data(self, company): - """ - Dom-Tom are excluded from the EU's fiscal territory - Those regions do not have SIREN - sources: - https://www.service-public.fr/professionnels-entreprises/vosdroits/F23570 - http://www.douane.gouv.fr/articles/a11024-tva-dans-les-dom - """ - dom_tom_group = self.env.ref('l10n_fr.dom-tom') - is_dom_tom = company.country_id.code in dom_tom_group.country_ids.mapped('code') - if not is_dom_tom and not company.vat: - raise Warning( - _("Missing VAT number for company %s") % company.name) - if not is_dom_tom and company.vat[0:2] != 'FR': - raise Warning( - _("FEC is for French companies only !")) - - return { - 'siren': company.vat[4:13] if not is_dom_tom else '', - } - - @api.multi - def generate_fec(self): - self.ensure_one() - # We choose to implement the flat file instead of the XML - # file for 2 reasons : - # 1) the XSD file impose to have the label on the account.move - # but Odoo has the label on the account.move.line, so that's a - # problem ! - # 2) CSV files are easier to read/use for a regular accountant. - # So it will be easier for the accountant to check the file before - # sending it to the fiscal administration - company = self.env.user.company_id - company_legal_data = self._get_company_legal_data(company) - - header = [ - u'JournalCode', # 0 - u'JournalLib', # 1 - u'EcritureNum', # 2 - u'EcritureDate', # 3 - u'CompteNum', # 4 - u'CompteLib', # 5 - u'CompAuxNum', # 6 We use partner.id - u'CompAuxLib', # 7 - u'PieceRef', # 8 - u'PieceDate', # 9 - u'EcritureLib', # 10 - u'Debit', # 11 - u'Credit', # 12 - u'EcritureLet', # 13 - u'DateLet', # 14 - u'ValidDate', # 15 - u'Montantdevise', # 16 - u'Idevise', # 17 - ] - - rows_to_write = [header] - # INITIAL BALANCE - unaffected_earnings_xml_ref = self.env.ref('account.data_unaffected_earnings') - unaffected_earnings_line = True # used to make sure that we add the unaffected earning initial balance only once - if unaffected_earnings_xml_ref: - #compute the benefit/loss of last year to add in the initial balance of the current year earnings account - unaffected_earnings_results = self.do_query_unaffected_earnings() - unaffected_earnings_line = False - - sql_query = ''' - SELECT - 'OUV' AS JournalCode, - 'Balance initiale' AS JournalLib, - 'OUVERTURE/' || %s AS EcritureNum, - %s AS EcritureDate, - MIN(aa.code) AS CompteNum, - replace(replace(MIN(aa.name), '|', '/'), '\t', '') AS CompteLib, - '' AS CompAuxNum, - '' AS CompAuxLib, - '-' AS PieceRef, - %s AS PieceDate, - '/' AS EcritureLib, - replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, - replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, - '' AS EcritureLet, - '' AS DateLet, - %s AS ValidDate, - '' AS Montantdevise, - '' AS Idevise, - MIN(aa.id) AS CompteID - FROM - account_move_line aml - LEFT JOIN account_move am ON am.id=aml.move_id - JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id - WHERE - am.date < %s - AND am.company_id = %s - AND aat.include_initial_balance = 't' - AND (aml.debit != 0 OR aml.credit != 0) - ''' - - # For official report: only use posted entries - if self.export_type == "official": - sql_query += ''' - AND am.state = 'posted' - ''' - - sql_query += ''' - GROUP BY aml.account_id, aat.type - HAVING round(sum(aml.balance), %s) != 0 - AND aat.type not in ('receivable', 'payable') - ''' - formatted_date_from = fields.Date.to_string(self.date_from).replace('-', '') - date_from = self.date_from - formatted_date_year = date_from.year - currency_digits = 2 - - self._cr.execute( - sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id, currency_digits)) - - for row in self._cr.fetchall(): - listrow = list(row) - account_id = listrow.pop() - if not unaffected_earnings_line: - account = self.env['account.account'].browse(account_id) - if account.user_type_id.id == self.env.ref('account.data_unaffected_earnings').id: - #add the benefit/loss of previous fiscal year to the first unaffected earnings account found. - unaffected_earnings_line = True - current_amount = float(listrow[11].replace(',', '.')) - float(listrow[12].replace(',', '.')) - unaffected_earnings_amount = float(unaffected_earnings_results[11].replace(',', '.')) - float(unaffected_earnings_results[12].replace(',', '.')) - listrow_amount = current_amount + unaffected_earnings_amount - if float_is_zero(listrow_amount, precision_digits=currency_digits): - continue - if listrow_amount > 0: - listrow[11] = str(listrow_amount).replace('.', ',') - listrow[12] = '0,00' - else: - listrow[11] = '0,00' - listrow[12] = str(-listrow_amount).replace('.', ',') - rows_to_write.append(listrow) - - #if the unaffected earnings account wasn't in the selection yet: add it manually - if (not unaffected_earnings_line - and unaffected_earnings_results - and (unaffected_earnings_results[11] != '0,00' - or unaffected_earnings_results[12] != '0,00')): - #search an unaffected earnings account - unaffected_earnings_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_unaffected_earnings').id)], limit=1) - if unaffected_earnings_account: - unaffected_earnings_results[4] = unaffected_earnings_account.code - unaffected_earnings_results[5] = unaffected_earnings_account.name - rows_to_write.append(unaffected_earnings_results) - - # INITIAL BALANCE - receivable/payable - sql_query = ''' - SELECT - 'OUV' AS JournalCode, - 'Balance initiale' AS JournalLib, - 'OUVERTURE/' || %s AS EcritureNum, - %s AS EcritureDate, - MIN(aa.code) AS CompteNum, - replace(MIN(aa.name), '|', '/') AS CompteLib, - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID ' || rp.id, '') - ELSE replace(rp.ref, '|', '/') - END - AS CompAuxNum, - COALESCE(replace(rp.name, '|', '/'), '') AS CompAuxLib, - '-' AS PieceRef, - %s AS PieceDate, - '/' AS EcritureLib, - replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Debit, - replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '000000000000000D99') END, '.', ',') AS Credit, - '' AS EcritureLet, - '' AS DateLet, - %s AS ValidDate, - '' AS Montantdevise, - '' AS Idevise, - MIN(aa.id) AS CompteID - FROM - account_move_line aml - LEFT JOIN account_move am ON am.id=aml.move_id - LEFT JOIN res_partner rp ON rp.id=aml.partner_id - JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id - WHERE - am.date < %s - AND am.company_id = %s - AND aat.include_initial_balance = 't' - AND (aml.debit != 0 OR aml.credit != 0) - ''' - - # For official report: only use posted entries - if self.export_type == "official": - sql_query += ''' - AND am.state = 'posted' - ''' - - sql_query += ''' - GROUP BY aml.account_id, aat.type, rp.ref, rp.id - HAVING round(sum(aml.balance), %s) != 0 - AND aat.type in ('receivable', 'payable') - ''' - self._cr.execute( - sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id, currency_digits)) - - for row in self._cr.fetchall(): - listrow = list(row) - account_id = listrow.pop() - rows_to_write.append(listrow) - - # LINES - sql_query = ''' - SELECT - replace(replace(aj.code, '|', '/'), '\t', '') AS JournalCode, - replace(replace(aj.name, '|', '/'), '\t', '') AS JournalLib, - replace(replace(am.name, '|', '/'), '\t', '') AS EcritureNum, - TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, - aa.code AS CompteNum, - replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID ' || rp.id, '') - ELSE replace(rp.ref, '|', '/') - END - AS CompAuxNum, - COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') AS CompAuxLib, - CASE WHEN am.ref IS null OR am.ref = '' - THEN '-' - ELSE replace(replace(am.ref, '|', '/'), '\t', '') - END - AS PieceRef, - TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, - CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' - WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/' - ELSE replace(replace(replace(replace(aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') END AS EcritureLib, - replace(CASE WHEN aml.debit = 0 THEN '0,00' ELSE to_char(aml.debit, '000000000000000D99') END, '.', ',') AS Debit, - replace(CASE WHEN aml.credit = 0 THEN '0,00' ELSE to_char(aml.credit, '000000000000000D99') END, '.', ',') AS Credit, - CASE WHEN rec.name IS NULL THEN '' ELSE rec.name END AS EcritureLet, - CASE WHEN aml.full_reconcile_id IS NULL THEN '' ELSE TO_CHAR(rec.create_date, 'YYYYMMDD') END AS DateLet, - TO_CHAR(am.date, 'YYYYMMDD') AS ValidDate, - CASE - WHEN aml.amount_currency IS NULL OR aml.amount_currency = 0 THEN '' - ELSE replace(to_char(aml.amount_currency, '000000000000000D99'), '.', ',') - END AS Montantdevise, - CASE WHEN aml.currency_id IS NULL THEN '' ELSE rc.name END AS Idevise - FROM - account_move_line aml - LEFT JOIN account_move am ON am.id=aml.move_id - LEFT JOIN res_partner rp ON rp.id=aml.partner_id - JOIN account_journal aj ON aj.id = am.journal_id - JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN res_currency rc ON rc.id = aml.currency_id - LEFT JOIN account_full_reconcile rec ON rec.id = aml.full_reconcile_id - WHERE - am.date >= %s - AND am.date <= %s - AND am.company_id = %s - AND (aml.debit != 0 OR aml.credit != 0) - ''' - - # For official report: only use posted entries - if self.export_type == "official": - sql_query += ''' - AND am.state = 'posted' - ''' - - sql_query += ''' - ORDER BY - am.date, - am.name, - aml.id - ''' - self._cr.execute( - sql_query, (self.date_from, self.date_to, company.id)) - - for row in self._cr.fetchall(): - rows_to_write.append(list(row)) - - fecvalue = self._csv_write_rows(rows_to_write) - end_date = fields.Date.to_string(self.date_to).replace('-', '') - suffix = '' - if self.export_type == "nonofficial": - suffix = '-NONOFFICIAL' - - self.write({ - 'fec_data': base64.encodestring(fecvalue), - # Filename = FECYYYYMMDD where YYYMMDD is the closing date - 'filename': '%sFEC%s%s.csv' % (company_legal_data['siren'], end_date, suffix), - }) - - action = { - 'name': 'FEC', - 'type': 'ir.actions.act_url', - 'url': "web/content/?model=account.fr.fec&id=" + str(self.id) + "&filename_field=filename&field=fec_data&download=true&filename=" + self.filename, - 'target': 'self', - } - return action - - def _csv_write_rows(self, rows, lineterminator=u'\r\n'): - """ - Write FEC rows into a file - It seems that Bercy's bureaucracy is not too happy about the - empty new line at the End Of File. - - @param {list(list)} rows: the list of rows. Each row is a list of strings - @param {unicode string} [optional] lineterminator: effective line terminator - Has nothing to do with the csv writer parameter - The last line written won't be terminated with it - - @return the value of the file - """ - fecfile = io.BytesIO() - writer = pycompat.csv_writer(fecfile, delimiter='|', lineterminator='') - - rows_length = len(rows) - for i, row in enumerate(rows): - if not i == rows_length - 1: - row[-1] += lineterminator - writer.writerow(row) - - fecvalue = fecfile.getvalue() - fecfile.close() - return fecvalue diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py new file mode 100644 index 000000000..97b5e3416 --- /dev/null +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -0,0 +1,589 @@ +# Copyright 2013-2019 Akretion France (http://www.akretion.com) +# Copyright 2016-2019 Odoo SA (https://www.odoo.com/fr_FR/) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + + +import base64 +import io + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError +from odoo.tools import float_is_zero +import logging +logger = logging.getLogger(__name__) + +try: + from unidecode import unidecode +except ImportError: + logger.debug('Cannot import unidecode') +try: + import unicodecsv +except ImportError: + logger.debug('Cannot import unicodecsv') + + +class AccountFrFecOca(models.TransientModel): + _name = 'account.fr.fec.oca' + _description = 'Ficher Echange Informatise' + + date_range_id = fields.Many2one('date.range', string='Date Range') + date_from = fields.Date(string='Start Date', required=True) + date_to = fields.Date(string='End Date', required=True) + encoding = fields.Selection([ + ('iso8859_15', 'ISO-8859-15'), + ('utf-8', 'UTF-8'), + # ('cp500', 'EBCDIC'), + ('ascii', 'ASCII'), + ], string='Encoding', default='iso8859_15', required=True) + delimiter = fields.Selection([ + ('|', '|'), + ('tab', 'Tab'), + ], default='|', string='Field Delimiter', required=True) + partner_option = fields.Selection([ + ('all', 'All'), + ('types', 'Selected Account Types'), + ('accounts', 'Selected Accounts'), + ], default='types', required=True, string='Partner Export Option') + partner_account_type_ids = fields.Many2many( + 'account.account.type', string='Account Types', + default=lambda self: self._default_partner_account_type_ids()) + partner_account_ids = fields.Many2many( + 'account.account', string='Accounts', + default=lambda self: self._default_partner_account_ids()) + fec_data = fields.Binary('FEC File', readonly=True) + filename = fields.Char(string='Filename', size=256, readonly=True) + export_type = fields.Selection([ + ('official', 'Official FEC report (posted entries only)'), + ('nonofficial', + 'Non-official FEC report (posted and unposted entries)'), + ], string='Export Type', required=True, default='official') + + @api.onchange('date_range_id') + def date_range_change(self): + if self.date_range_id: + self.date_from = self.date_range_id.date_start + self.date_to = self.date_range_id.date_end + + @api.model + def _default_partner_account_type_ids(self): + receivable = self.env.ref('account.data_account_type_receivable') + payable = self.env.ref('account.data_account_type_payable') + return receivable + payable + + @api.model + def _default_partner_account_ids(self): + pay = self.env['ir.property'].get( + 'property_account_payable_id', 'res.partner') + rec = self.env['ir.property'].get( + 'property_account_receivable_id', 'res.partner') + return pay + rec + + def do_query_unaffected_earnings(self): + ''' Compute the sum of ending balances for all accounts that are + of a type that does not bring forward the balance in new fiscal years. + This is needed because we have to display only one line for the initial + balance of all expense/revenue accounts in the FEC. + ''' + + sql_query = ''' + SELECT + 'OUV' AS JournalCode, + 'Balance initiale' AS JournalLib, + 'OUVERTURE/' || %(formatted_date_year)s AS EcritureNum, + %(formatted_date_from)s AS EcritureDate, + '120/129' AS CompteNum, + 'Benefice (perte) reporte(e)' AS CompteLib, + '' AS CompAuxNum, + '' AS CompAuxLib, + '-' AS PieceRef, + %(formatted_date_from)s AS PieceDate, + '/' AS EcritureLib, + replace( + CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 + THEN '0,00' + ELSE to_char(SUM(aml.balance), '000000000000000D99') + END, '.', ',') AS Debit, + replace( + CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 + THEN '0,00' + ELSE to_char(-SUM(aml.balance), '000000000000000D99') + END, '.', ',') AS Credit, + '' AS EcritureLet, + '' AS DateLet, + %(formatted_date_from)s AS ValidDate, + '' AS Montantdevise, + '' AS Idevise + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id + WHERE + am.date < %(date_from)s + AND am.company_id = %(company_id)s + AND aat.include_initial_balance = 'f' + AND (aml.debit != 0 OR aml.credit != 0) + ''' + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + company = self.env.user.company_id + formatted_date_from = fields.Date.to_string(self.date_from).replace( + '-', '') + date_from = self.date_from + formatted_date_year = date_from.year + self._cr.execute(sql_query, { + 'formatted_date_year': formatted_date_year, + 'formatted_date_from': formatted_date_from, + 'date_from': self.date_from, + 'company_id': company.id, + }) + listrow = [] + row = self._cr.fetchone() + listrow = list(row) + return listrow + + def _get_siren(self, company): + """ + Dom-Tom are excluded from the EU's fiscal territory + Those regions do not have SIREN + sources: + https://www.service-public.fr/professionnels-entreprises/vosdroits/F23570 + http://www.douane.gouv.fr/articles/a11024-tva-dans-les-dom + """ + dom_tom_group = self.env.ref('l10n_fr.dom-tom') + is_dom_tom = company.country_id.code in\ + dom_tom_group.country_ids.mapped('code') + if not is_dom_tom and not company.vat: + raise UserError( + _("Missing VAT number for company %s") % company.name) + vat = company.vat.upper().replace(' ', '') + if not is_dom_tom and vat[0:2] != 'FR': + raise UserError( + _("FEC is for French companies only !")) + + siren = vat[4:13] if not is_dom_tom else '' + return siren + + def generate_fec(self): + self.ensure_one() + # We choose to implement the flat file instead of the XML + # file for 2 reasons : + # 1) the XSD file impose to have the label on the account.move + # but Odoo has the label on the account.move.line, so that's a + # problem ! + # 2) CSV files are easier to read/use for a regular accountant. + # So it will be easier for the accountant to check the file before + # sending it to the fiscal administration + company = self.env.user.company_id + + header = [ + 'JournalCode', # 0 + 'JournalLib', # 1 + 'EcritureNum', # 2 + 'EcritureDate', # 3 + 'CompteNum', # 4 + 'CompteLib', # 5 + 'CompAuxNum', # 6 We use partner.id + 'CompAuxLib', # 7 + 'PieceRef', # 8 + 'PieceDate', # 9 + 'EcritureLib', # 10 + 'Debit', # 11 + 'Credit', # 12 + 'EcritureLet', # 13 + 'DateLet', # 14 + 'ValidDate', # 15 + 'Montantdevise', # 16 + 'Idevise', # 17 + ] + + rows_to_write = [header] + # INITIAL BALANCE + unaffected_earnings_xml_ref = self.env.ref( + 'account.data_unaffected_earnings') + # used to make sure that we add the unaffected earning initial balance + # only once + unaffected_earnings_line = True + if unaffected_earnings_xml_ref: + # compute the benefit/loss of last year to add in the + # initial balance of the current year earnings account + unaffected_earnings_results = self.do_query_unaffected_earnings() + unaffected_earnings_line = False + + sql_query = ''' + SELECT + 'OUV' AS JournalCode, + 'Balance initiale' AS JournalLib, + 'OUVERTURE/' || %(formatted_date_year)s AS EcritureNum, + %(formatted_date_from)s AS EcritureDate, + MIN(aa.code) AS CompteNum, + replace(replace(MIN(aa.name), '|', '/'), '\t', '') AS CompteLib, + '' AS CompAuxNum, + '' AS CompAuxLib, + '-' AS PieceRef, + %(formatted_date_from)s AS PieceDate, + '/' AS EcritureLib, + replace( + CASE WHEN sum(aml.balance) <= 0 + THEN '0,00' + ELSE to_char(SUM(aml.balance), '000000000000000D99') + END, '.', ',') AS Debit, + replace( + CASE WHEN sum(aml.balance) >= 0 + THEN '0,00' + ELSE to_char(-SUM(aml.balance), '000000000000000D99') + END, '.', ',') AS Credit, + '' AS EcritureLet, + '' AS DateLet, + %(formatted_date_from)s AS ValidDate, + '' AS Montantdevise, + '' AS Idevise, + MIN(aa.id) AS CompteID + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id + WHERE + am.date < %(date_from)s + AND am.company_id = %(company_id)s + AND aat.include_initial_balance = 't' + AND (aml.debit != 0 OR aml.credit != 0) + ''' + + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + + sql_query += ''' + GROUP BY aml.account_id, aat.type + HAVING round(sum(aml.balance), %(currency_digits)s) != 0 + AND aat.type not in ('receivable', 'payable') + ''' + formatted_date_from = fields.Date.to_string(self.date_from).replace( + '-', '') + date_from = self.date_from + formatted_date_year = date_from.year + currency_digits = 2 + + self._cr.execute( + sql_query, { + 'formatted_date_year': formatted_date_year, + 'formatted_date_from': formatted_date_from, + 'date_from': self.date_from, + 'company_id': company.id, + 'currency_digits': currency_digits, + }) + + unaffected_earnings_type_id = self.env.ref( + 'account.data_unaffected_earnings').id + for row in self._cr.fetchall(): + listrow = list(row) + account_id = listrow.pop() + if not unaffected_earnings_line: + account = self.env['account.account'].browse(account_id) + if account.user_type_id.id == unaffected_earnings_type_id: + # add the benefit/loss of previous fiscal year to + # the first unaffected earnings account found. + unaffected_earnings_line = True + current_amount = float(listrow[11].replace(',', '.'))\ + - float(listrow[12].replace(',', '.')) + unaffected_earnings_amount =\ + float( + unaffected_earnings_results[11].replace(',', '.'))\ + - float( + unaffected_earnings_results[12].replace(',', '.')) + listrow_amount =\ + current_amount + unaffected_earnings_amount + if float_is_zero( + listrow_amount, precision_digits=currency_digits): + continue + if listrow_amount > 0: + listrow[11] = str(listrow_amount).replace('.', ',') + listrow[12] = '0,00' + else: + listrow[11] = '0,00' + listrow[12] = str(-listrow_amount).replace('.', ',') + rows_to_write.append(listrow) + + # if the unaffected earnings account wasn't in the selection yet: + # add it manually + if (not unaffected_earnings_line + and unaffected_earnings_results + and (unaffected_earnings_results[11] != '0,00' + or unaffected_earnings_results[12] != '0,00')): + # search an unaffected earnings account + unaffected_earnings_account = self.env['account.account'].search( + [('user_type_id', '=', unaffected_earnings_type_id)], limit=1) + if unaffected_earnings_account: + unaffected_earnings_results[4] =\ + unaffected_earnings_account.code + unaffected_earnings_results[5] =\ + unaffected_earnings_account.name + rows_to_write.append(unaffected_earnings_results) + + # INITIAL BALANCE - receivable/payable + sql_query = ''' + SELECT + 'OUV' AS JournalCode, + 'Balance initiale' AS JournalLib, + 'OUVERTURE/' || %(formatted_date_year)s AS EcritureNum, + %(formatted_date_from)s AS EcritureDate, + MIN(aa.code) AS CompteNum, + replace(MIN(aa.name), '|', '/') AS CompteLib, + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID' || rp.id, '') + ELSE replace(rp.ref, '|', '/') + END + AS CompAuxNum, + COALESCE(replace(rp.name, '|', '/'), '') AS CompAuxLib, + '-' AS PieceRef, + %(formatted_date_from)s AS PieceDate, + '/' AS EcritureLib, + replace( + CASE WHEN sum(aml.balance) <= 0 + THEN '0,00' + ELSE to_char(SUM(aml.balance), '000000000000000D99') + END, '.', ',') AS Debit, + replace( + CASE WHEN sum(aml.balance) >= 0 + THEN '0,00' + ELSE to_char(-SUM(aml.balance), '000000000000000D99') + END, '.', ',') AS Credit, + '' AS EcritureLet, + '' AS DateLet, + %(formatted_date_from)s AS ValidDate, + '' AS Montantdevise, + '' AS Idevise, + MIN(aa.id) AS CompteID + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + LEFT JOIN res_partner rp ON rp.id=aml.partner_id + JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id + WHERE + am.date < %(date_from)s + AND am.company_id = %(company_id)s + AND aat.include_initial_balance = 't' + AND (aml.debit != 0 OR aml.credit != 0) + ''' + + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + + sql_query += ''' + GROUP BY aml.account_id, aat.type, rp.ref, rp.id + HAVING round(sum(aml.balance), %(currency_digits)s) != 0 + AND aat.type in ('receivable', 'payable') + ''' + self._cr.execute( + sql_query, { + 'formatted_date_year': formatted_date_year, + 'formatted_date_from': formatted_date_from, + 'date_from': self.date_from, + 'company_id': company.id, + 'currency_digits': currency_digits, + }) + + for row in self._cr.fetchall(): + listrow = list(row) + account_id = listrow.pop() + rows_to_write.append(listrow) + + sql_args = { + 'date_from': self.date_from, + 'date_to': self.date_to, + 'company_id': company.id, + } + sql_aux_num_base = ''' + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID' || rp.id, '') + ELSE replace(rp.ref, '|', '/') + END + ''' + sql_aux_lib_base = ''' + COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') + ''' + if self.partner_option == 'types': + aux_fields = ''' + CASE WHEN aat.id IN %(partner_account_type_ids)s + THEN ''' + sql_aux_num_base + ''' + ELSE '' + END + AS CompAuxNum, + CASE WHEN aat.id IN %(partner_account_type_ids)s + THEN ''' + sql_aux_lib_base + ''' + ELSE '' + END + AS CompAuxLib, + ''' + sql_args['partner_account_type_ids'] =\ + tuple(self.partner_account_type_ids.ids) + elif self.partner_option == 'accounts': + aux_fields = ''' + CASE WHEN aa.id IN %(partner_account_ids)s + THEN ''' + sql_aux_num_base + ''' + ELSE '' + END + AS CompAuxNum, + CASE WHEN aa.id IN %(partner_account_ids)s + THEN ''' + sql_aux_lib_base + ''' + ELSE '' + END + AS CompAuxLib, + ''' + sql_args['partner_account_ids'] =\ + tuple(self.partner_account_ids.ids) + else: + aux_fields = sql_aux_num_base + 'AS CompAuxNum, '\ + + sql_aux_lib_base + 'AS CompAuxLib,' + + # LINES + sql_query = ''' + SELECT + replace(replace(aj.code, '|', '/'), '\t', '') AS JournalCode, + replace(replace(aj.name, '|', '/'), '\t', '') AS JournalLib, + replace(replace(am.name, '|', '/'), '\t', '') AS EcritureNum, + TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, + aa.code AS CompteNum, + replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, + ''' + aux_fields + ''' + CASE + WHEN am.ref IS null OR am.ref = '' + THEN '-' + ELSE replace(replace(am.ref, '|', '/'), '\t', '') + END AS PieceRef, + TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, + CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' + WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/' + ELSE replace(replace(replace(replace( + aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') + END AS EcritureLib, + replace( + CASE WHEN aml.debit = 0 + THEN '0,00' + ELSE to_char(aml.debit, '000000000000000D99') + END, '.', ',') AS Debit, + replace( + CASE WHEN aml.credit = 0 + THEN '0,00' + ELSE to_char(aml.credit, '000000000000000D99') + END, '.', ',') AS Credit, + CASE WHEN rec.name IS NULL + THEN '' + ELSE rec.name + END AS EcritureLet, + CASE + WHEN aml.full_reconcile_id IS NULL + THEN '' + ELSE TO_CHAR(rec.create_date, 'YYYYMMDD') + END AS DateLet, + TO_CHAR(am.date, 'YYYYMMDD') AS ValidDate, + CASE + WHEN aml.amount_currency IS NULL OR aml.amount_currency = 0 + THEN '' + ELSE replace(to_char( + aml.amount_currency, '000000000000000D99'), '.', ',') + END AS Montantdevise, + CASE + WHEN aml.currency_id IS NULL + THEN '' + ELSE rc.name + END AS Idevise + FROM + account_move_line aml + LEFT JOIN account_move am ON am.id=aml.move_id + LEFT JOIN res_partner rp ON rp.id=aml.partner_id + JOIN account_journal aj ON aj.id = am.journal_id + JOIN account_account aa ON aa.id = aml.account_id + JOIN account_account_type aat ON aat.id = aa.user_type_id + LEFT JOIN res_currency rc ON rc.id = aml.currency_id + LEFT JOIN account_full_reconcile rec + ON rec.id = aml.full_reconcile_id + WHERE + am.date >= %(date_from)s + AND am.date <= %(date_to)s + AND am.company_id = %(company_id)s + AND (aml.debit != 0 OR aml.credit != 0) + ''' + + # For official report: only use posted entries + if self.export_type == "official": + sql_query += ''' + AND am.state = 'posted' + ''' + + sql_query += ''' + ORDER BY + am.date, + am.name, + aml.id + ''' + self._cr.execute(sql_query, sql_args) + + for row in self._cr.fetchall(): + rows_to_write.append(list(row)) + + fecvalue = self._csv_write_rows(rows_to_write) + end_date = fields.Date.to_string(self.date_to).replace('-', '') + suffix = '' + if self.export_type == "nonofficial": + suffix = '-NONOFFICIAL' + + siren = self._get_siren(company) + self.write({ + 'fec_data': base64.encodestring(fecvalue), + # Filename = FECYYYYMMDD where YYYMMDD is the closing date + 'filename': '%sFEC%s%s.txt' % (siren, end_date, suffix), + }) + + action = { + 'name': 'FEC', + 'type': 'ir.actions.act_url', + 'url': "web/content/?model=%s&id=%d&filename_field=filename&" + "field=fec_data&download=true&filename=%s" % ( + self._name, self.id, self.filename), + 'target': 'self', + } + return action + + def _csv_write_rows(self, rows): + """ + Write FEC rows into a file + It seems that Bercy's bureaucracy is not too happy about the + empty new line at the End Of File. + + @param {list(list)} rows: the list of rows. Each row is a list of + strings + + @return the value of the file + """ + fecfile = io.BytesIO() + encoding = self.encoding + delimiter = self.delimiter + if delimiter == 'tab': + delimiter = '\t' + writer = unicodecsv.writer( + fecfile, + delimiter=delimiter, + lineterminator='\r\n', + encoding=encoding, + errors='replace') + for row in rows: + if encoding == 'ascii': + for j, cell_content in enumerate(row): + row[j] = unidecode(row[j]) + writer.writerow(row) + + fecvalue = fecfile.getvalue() + fecfile.close() + return fecvalue diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_view.xml b/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml similarity index 74% rename from l10n_fr_fec_oca/wizard/account_fr_fec_view.xml rename to l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml index e4a5cd75b..5fa199533 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_view.xml +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml @@ -1,24 +1,29 @@ - - account.fr.fec.form.view - account.fr.fec + + + + account.fr.fec.oca.form + account.fr.fec.oca -
+ + - + + + + + + - -
- The encoding of this text file is UTF-8. The structure of file is CSV separated by pipe '|'. -
-
@@ -32,8 +37,7 @@ - + @@ -41,8 +45,7 @@ - + @@ -55,7 +58,7 @@ - + @@ -107,22 +110,24 @@
- + FEC - account.fr.fec + account.fr.fec.oca form new - + action="account_fr_fec_oca_action" + sequence="110" /> + + From 6c6a264fe488f81254b69bf623c90edc1cfa2603 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Thu, 13 Feb 2020 14:59:09 +0000 Subject: [PATCH 03/29] [UPD] Update l10n_fr_fec_oca.pot --- l10n_fr_fec_oca/i18n/fr.po | 297 +++++++++++-------- l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot | 348 +++++++++++++++++++++++ 2 files changed, 529 insertions(+), 116 deletions(-) create mode 100644 l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot diff --git a/l10n_fr_fec_oca/i18n/fr.po b/l10n_fr_fec_oca/i18n/fr.po index 65a48fe7f..e3b6f249f 100644 --- a/l10n_fr_fec_oca/i18n/fr.po +++ b/l10n_fr_fec_oca/i18n/fr.po @@ -16,278 +16,343 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 10" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 11" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 12" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 13" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 14" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 15" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 16" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "# 17" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,encoding:0 +msgid "ASCII" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_type_ids +msgid "Account Types" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_ids +msgid "Accounts" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,partner_option:0 +msgid "All" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Cancel" msgstr "Annuler" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Column" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Comment" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "CompAuxLib" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "CompAuxNum" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "CompteLib" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "CompteNum" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_uid +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_uid msgid "Created by" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_date +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_date msgid "Created on" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Credit" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_range_id +msgid "Date Range" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "DateLet" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Debit" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__display_name +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__display_name msgid "Display Name" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "EcritureDate" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "EcritureLet" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "EcritureLib" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "EcritureNum" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_to +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__encoding +msgid "Encoding" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_to msgid "End Date" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__export_type +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__export_type msgid "Export Type" msgstr "Type d'export" -#. module: l10n_fr_fec -#: model:ir.actions.act_window,name:l10n_fr_fec.account_fr_fec_action -#: model:ir.ui.menu,name:l10n_fr_fec.account_fr_fec_menu +#. module: l10n_fr_fec_oca +#: model:ir.actions.act_window,name:l10n_fr_fec_oca.account_fr_fec_oca_action +#: model:ir.ui.menu,name:l10n_fr_fec_oca.account_fr_fec_oca_menu msgid "FEC" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__fec_data +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__fec_data msgid "FEC File" msgstr "Fichier FEC" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "FEC File Generation" +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +#, fuzzy +msgid "FEC File Generation by OCA" msgstr "Génération Fichier FEC" -#. module: l10n_fr_fec -#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:117 +#. module: l10n_fr_fec_oca +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:165 #, python-format msgid "FEC is for French companies only !" msgstr "Le FEC est uniquement pour les sociétés françaises !" -#. module: l10n_fr_fec -#: model:ir.model,name:l10n_fr_fec.model_account_fr_fec +#. module: l10n_fr_fec_oca +#: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca msgid "Ficher Echange Informatise" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__filename +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__delimiter +msgid "Field Delimiter" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__filename msgid "Filename" msgstr "Nom du fichier" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Generate" msgstr "Générer" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__id +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__id msgid "ID" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,encoding:0 +msgid "ISO-8859-15" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Idevise" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "JournalCode" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "JournalLib" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec____last_update +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca____last_update msgid "Last Modified on" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_uid +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__write_uid msgid "Last Updated by" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_date +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__write_date msgid "Last Updated on" msgstr "" -#. module: l10n_fr_fec -#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:114 +#. module: l10n_fr_fec_oca +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:161 #, python-format msgid "Missing VAT number for company %s" msgstr "Numéro de TVA manquant sur la société %s" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Montantdevise" msgstr "" -#. module: l10n_fr_fec -#: selection:account.fr.fec,export_type:0 +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,export_type:0 msgid "Non-official FEC report (posted and unposted entries)" msgstr "Rapport FEC non-officiel (entrées postées et non-postées)" -#. module: l10n_fr_fec -#: selection:account.fr.fec,export_type:0 +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,export_type:0 msgid "Official FEC report (posted entries only)" msgstr "Rapport FEC officiel (entrées postées uniquement)" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Options" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_option +msgid "Partner Export Option" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "PieceDate" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "PieceRef" msgstr "" -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_from +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,partner_option:0 +msgid "Selected Account Types" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,partner_option:0 +msgid "Selected Accounts" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_from msgid "Start Date" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,delimiter:0 +msgid "Tab" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Technical Info" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Technical Name" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "" -"The encoding of this text file is UTF-8. The structure of file is CSV " -"separated by pipe '|'." -msgstr "Ce fichier texte est encodé en UTF-8. Le format du fichier est CSV " -"avec séparateur '|'." +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,encoding:0 +msgid "UTF-8" +msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "ValidDate" msgstr "" -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "We use partner.id" +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" msgstr "" + +#~ msgid "" +#~ "The encoding of this text file is UTF-8. The structure of file is CSV " +#~ "separated by pipe '|'." +#~ msgstr "" +#~ "Ce fichier texte est encodé en UTF-8. Le format du fichier est CSV avec " +#~ "séparateur '|'." diff --git a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot new file mode 100644 index 000000000..f95eb4eca --- /dev/null +++ b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot @@ -0,0 +1,348 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_fr_fec_oca +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 10" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 11" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 12" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 13" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 14" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 15" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 16" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "# 17" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,encoding:0 +msgid "ASCII" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_type_ids +msgid "Account Types" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_ids +msgid "Accounts" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,partner_option:0 +msgid "All" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Cancel" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Column" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Comment" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "CompAuxLib" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "CompAuxNum" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "CompteLib" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "CompteNum" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_uid +msgid "Created by" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_date +msgid "Created on" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Credit" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_range_id +msgid "Date Range" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "DateLet" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Debit" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__display_name +msgid "Display Name" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "EcritureDate" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "EcritureLet" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "EcritureLib" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "EcritureNum" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__encoding +msgid "Encoding" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_to +msgid "End Date" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__export_type +msgid "Export Type" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.actions.act_window,name:l10n_fr_fec_oca.account_fr_fec_oca_action +#: model:ir.ui.menu,name:l10n_fr_fec_oca.account_fr_fec_oca_menu +msgid "FEC" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__fec_data +msgid "FEC File" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "FEC File Generation by OCA" +msgstr "" + +#. module: l10n_fr_fec_oca +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:165 +#, python-format +msgid "FEC is for French companies only !" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca +msgid "Ficher Echange Informatise" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__delimiter +msgid "Field Delimiter" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__filename +msgid "Filename" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Generate" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__id +msgid "ID" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,encoding:0 +msgid "ISO-8859-15" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Idevise" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "JournalCode" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "JournalLib" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca____last_update +msgid "Last Modified on" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__write_date +msgid "Last Updated on" +msgstr "" + +#. module: l10n_fr_fec_oca +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:161 +#, python-format +msgid "Missing VAT number for company %s" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Montantdevise" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,export_type:0 +msgid "Non-official FEC report (posted and unposted entries)" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,export_type:0 +msgid "Official FEC report (posted entries only)" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Options" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_option +msgid "Partner Export Option" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "PieceDate" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "PieceRef" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,partner_option:0 +msgid "Selected Account Types" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,partner_option:0 +msgid "Selected Accounts" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_from +msgid "Start Date" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,delimiter:0 +msgid "Tab" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Technical Info" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "Technical Name" +msgstr "" + +#. module: l10n_fr_fec_oca +#: selection:account.fr.fec.oca,encoding:0 +msgid "UTF-8" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "ValidDate" +msgstr "" + +#. module: l10n_fr_fec_oca +#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form +msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" +msgstr "" + From e03e67761122f2c4a58f51fead272bfaab093868 Mon Sep 17 00:00:00 2001 From: David Beal Date: Tue, 18 Feb 2020 15:55:30 +0100 Subject: [PATCH 04/29] FIX non compliant code with oca rules --- l10n_fr_fec_oca/README.rst | 1 + l10n_fr_fec_oca/__manifest__.py | 25 ++++++++++---------- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 22 ++++++++--------- 3 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 l10n_fr_fec_oca/README.rst diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/README.rst new file mode 100644 index 000000000..f24a174a7 --- /dev/null +++ b/l10n_fr_fec_oca/README.rst @@ -0,0 +1 @@ +autogenerated diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 965c16131..a45f16b78 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -3,18 +3,19 @@ # @author: Alexis de Lattre { - 'name': 'France - FEC', - 'category': 'Accounting', - 'license': 'LGPL-3', - 'summary': "Fichier d'Échange Informatisé (FEC) for France", - 'author': "Akretion,Odoo Community Association (OCA)", - 'website': 'https://github.com/OCA/l10n-france', - 'depends': ['l10n_fr', 'account', 'date_range'], - 'external_dependencies': { - 'python': ['unicodecsv', 'unidecode'], + "name": "France - FEC", + "category": "Accounting", + "version": "12.0.1.0.0", + "license": "LGPL-3", + "summary": "Fichier d'Échange Informatisé (FEC) for France", + "author": "Akretion,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/l10n-france", + "depends": ["l10n_fr", "account", "date_range"], + "external_dependencies": { + "python": ["unicodecsv", "unidecode"], }, - 'data': [ - 'wizard/account_fr_fec_oca_view.xml', + "data": [ + "wizard/account_fr_fec_oca_view.xml", ], - 'installable': True, + "installable": True, } diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 97b5e3416..8782598ec 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -446,7 +446,7 @@ def generate_fec(self): else: aux_fields = sql_aux_num_base + 'AS CompAuxNum, '\ + sql_aux_lib_base + 'AS CompAuxLib,' - + sql_args['aux_fields'] = aux_fields # LINES sql_query = ''' SELECT @@ -456,7 +456,7 @@ def generate_fec(self): TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, aa.code AS CompteNum, replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, - ''' + aux_fields + ''' + %(aux_fields)s CASE WHEN am.ref IS null OR am.ref = '' THEN '-' @@ -464,7 +464,7 @@ def generate_fec(self): END AS PieceRef, TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' - WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/' + WHEN aml.name SIMILAR TO '[\t|\\s|\n]*' THEN '/' ELSE replace(replace(replace(replace( aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') END AS EcritureLib, @@ -514,20 +514,18 @@ def generate_fec(self): AND am.date <= %(date_to)s AND am.company_id = %(company_id)s AND (aml.debit != 0 OR aml.credit != 0) - ''' - - # For official report: only use posted entries - if self.export_type == "official": - sql_query += ''' - AND am.state = 'posted' - ''' - - sql_query += ''' + %(posted)s ORDER BY am.date, am.name, aml.id ''' + + sql_args["posted"] = "" + # For official report: only use posted entries + if self.export_type == "official": + sql_args["posted"] = "AND am.state = 'posted'" + self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): From 16584b5c62ff08f4c47cb71367dcf2650dc8d610 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 18 Feb 2020 15:35:49 +0000 Subject: [PATCH 05/29] [UPD] README.rst --- l10n_fr_fec_oca/README.rst | 96 +++- l10n_fr_fec_oca/static/description/index.html | 438 ++++++++++++++++++ 2 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 l10n_fr_fec_oca/static/description/index.html diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/README.rst index f24a174a7..77da8de88 100644 --- a/l10n_fr_fec_oca/README.rst +++ b/l10n_fr_fec_oca/README.rst @@ -1 +1,95 @@ -autogenerated +============ +France - FEC +============ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github + :target: https://github.com/OCA/l10n-france/tree/12.0/l10n_fr_fec_oca + :alt: OCA/l10n-france +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/l10n-france-12-0/l10n-france-12-0-l10n_fr_fec_oca + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/121/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Ce module permet de générer le fichier FEC tel que définit par l'arrêté du 29 +Juillet 2013 portant modification des dispositions de l'article `A. 47 A-1 du +livre des procédures fiscales `_. + +Cet arrêté prévoit l'obligation pour les sociétés ayant une comptabilité +informatisée de pouvoir fournir à l'administration fiscale un fichier +regroupant l'ensemble des écritures comptables de l'exercice. Le format de ce +fichier, appelé *FEC*, est définit dans l'arrêté. + +Le détail du format du FEC est spécifié dans le bulletin officiel des finances publiques `BOI-CF-IOR-60-40-20-20131213 ` du 13 Décembre 2013. Ce module implémente le fichier +FEC au format texte et non au format XML, car le format texte sera facilement +lisible et vérifiable par le comptable en utilisant un tableur. + +La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel +*Test Compta Demat* version 1_00_05 disponible sur +`le site de la direction générale des finances publiques ` +en utilisant une base de donnée Odoo réelle. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Pour générer le *FEC*, allez dans le menu *Invoicing > Reporting > France > FEC* qui va démarrer l'assistant de génération du FEC. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre +* Odoo S.A. + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/l10n-france `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_fr_fec_oca/static/description/index.html b/l10n_fr_fec_oca/static/description/index.html new file mode 100644 index 000000000..a04212926 --- /dev/null +++ b/l10n_fr_fec_oca/static/description/index.html @@ -0,0 +1,438 @@ + + + + + + +France - FEC + + + +
+

France - FEC

+ + +

Beta License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

+

Ce module permet de générer le fichier FEC tel que définit par l’arrêté du 29 +Juillet 2013 portant modification des dispositions de l’article A. 47 A-1 du +livre des procédures fiscales.

+

Cet arrêté prévoit l’obligation pour les sociétés ayant une comptabilité +informatisée de pouvoir fournir à l’administration fiscale un fichier +regroupant l’ensemble des écritures comptables de l’exercice. Le format de ce +fichier, appelé FEC, est définit dans l’arrêté.

+

Le détail du format du FEC est spécifié dans le bulletin officiel des finances publiques BOI-CF-IOR-60-40-20-20131213 <http://bofip.impots.gouv.fr/bofip/9028-PGP.html?identifiant=BOI-CF-IOR-60-40-20-20131213> du 13 Décembre 2013. Ce module implémente le fichier +FEC au format texte et non au format XML, car le format texte sera facilement +lisible et vérifiable par le comptable en utilisant un tableur.

+

La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel +Test Compta Demat version 1_00_05 disponible sur +le site de la direction générale des finances publiques <http://www.economie.gouv.fr/dgfip/outil-test-des-fichiers-des-ecritures-comptables-fec> +en utilisant une base de donnée Odoo réelle.

+

Table of contents

+ +
+

Usage

+

Pour générer le FEC, allez dans le menu Invoicing > Reporting > France > FEC qui va démarrer l’assistant de génération du FEC.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/l10n-france project on GitHub.

+

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

+
+
+
+ + From 892d1f940cb1a250d50ce0ccfa551ccc5ffc3df7 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 18 Feb 2020 15:35:49 +0000 Subject: [PATCH 06/29] [ADD] icon.png --- l10n_fr_fec_oca/static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 l10n_fr_fec_oca/static/description/icon.png diff --git a/l10n_fr_fec_oca/static/description/icon.png b/l10n_fr_fec_oca/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*2Yt6+coY`6jGbb7tF#6nHA zuKk=GGJ;ZwON1iAfG$E#Y7MnZVmrY|j0eVI(DN_MNFJmyZ|;w4tf@=CCDZ#5N_0K= z$;R~bbk?}TpfDjfB&aiQ$VA}s?P}xPERJG{kxk5~R`iRS(SK5d+Xs9swCozZISbnS zk!)I0>t=A<-^z(cmSFz3=jZ23u13X><0b)P)^1T_))Kr`e!-pb#q&J*Q`p+B6la%C zuVl&0duN<;uOsB3%T9Fp8t{ED108<+W(nOZd?gDnfNBC3>M8WE61$So|P zVvqH0SNtDTcsUdzaMDpT=Ty0pDHHNL@Z0w$Y`XO z2M-_r1S+GaH%pz#Uy0*w$Vdl=X=rQXEzO}d6J^R6zjM1u&c9vYLvLp?W7w(?np9x1 zE_0JSAJCPB%i7p*Wvg)pn5T`8k3-uR?*NT|J`eS#_#54p>!p(mLDvmc-3o0mX*mp_ zN*AeS<>#^-{S%W<*mz^!X$w_2dHWpcJ6^j64qFBft-o}o_Vx80o0>}Du;>kLts;$8 zC`7q$QI(dKYG`Wa8#wl@V4jVWBRGQ@1dr-hstpQL)Tl+aqVpGpbSfN>5i&QMXfiZ> zaA?T1VGe?rpQ@;+pkrVdd{klI&jVS@I5_iz!=UMpTsa~mBga?1r}aRBm1WS;TT*s0f0lY=JBl66Upy)-k4J}lh=P^8(SXk~0xW=T9v*B|gzIhN z>qsO7dFd~mgxAy4V?&)=5ieYq?zi?ZEoj)&2o)RLy=@hbCRcfT5jigwtQGE{L*8<@Yd{zg;CsL5mvzfDY}P-wos_6PfprFVaeqNE%h zKZhLtcQld;ZD+>=nqN~>GvROfueSzJD&BE*}XfU|H&(FssBqY=hPCt`d zH?@s2>I(|;fcW&YM6#V#!kUIP8$Nkdh0A(bEVj``-AAyYgwY~jB zT|I7Bf@%;7aL7Wf4dZ%VqF$eiaC38OV6oy3Z#TER2G+fOCd9Iaoy6aLYbPTN{XRPz z;U!V|vBf%H!}52L2gH_+j;`bTcQRXB+y9onc^wLm5wi3-Be}U>k_u>2Eg$=k!(l@I zcCg+flakT2Nej3i0yn+g+}%NYb?ta;R?(g5SnwsQ49U8Wng8d|{B+lyRcEDvR3+`O{zfmrmvFrL6acVP%yG98X zo&+VBg@px@i)%o?dG(`T;n*$S5*rnyiR#=wW}}GsAcfyQpE|>a{=$Hjg=-*_K;UtD z#z-)AXwSRY?OPefw^iI+ z)AXz#PfEjlwTes|_{sB?4(O@fg0AJ^g8gP}ex9Ucf*@_^J(s_5jJV}c)s$`Myn|Kd z$6>}#q^n{4vN@+Os$m7KV+`}c%4)4pv@06af4-x5#wj!KKb%caK{A&Y#Rfs z-po?Dcb1({W=6FKIUirH&(yg=*6aLCekcKwyfK^JN5{wcA3nhO(o}SK#!CINhI`-I z1)6&n7O&ZmyFMuNwvEic#IiOAwNkR=u5it{B9n2sAJV5pNhar=j5`*N!Na;c7g!l$ z3aYBqUkqqTJ=Re-;)s!EOeij=7SQZ3Hq}ZRds%IM*PtM$wV z@;rlc*NRK7i3y5BETSKuumEN`Xu_8GP1Ri=OKQ$@I^ko8>H6)4rjiG5{VBM>B|%`&&s^)jS|-_95&yc=GqjNo{zFkw%%HHhS~e=s zD#sfS+-?*t|J!+ozP6KvtOl!R)@@-z24}`9{QaVLD^9VCSR2b`b!KC#o;Ki<+wXB6 zx3&O0LOWcg4&rv4QG0)4yb}7BFSEg~=IR5#ZRj8kg}dS7_V&^%#Do==#`u zpy6{ox?jWuR(;pg+f@mT>#HGWHAJRRDDDv~@(IDw&R>9643kK#HN`!1vBJHnC+RM&yIh8{gG2q zA%e*U3|N0XSRa~oX-3EAneep)@{h2vvd3Xvy$7og(sayr@95+e6~Xvi1tUqnIxoIH zVWo*OwYElb#uyW{Imam6f2rGbjR!Y3`#gPqkv57dB6K^wRGxc9B(t|aYDGS=m$&S!NmCtrMMaUg(c zc2qC=2Z`EEFMW-me5B)24AqF*bV5Dr-M5ig(l-WPS%CgaPzs6p_gnCIvTJ=Y<6!gT zVt@AfYCzjjsMEGi=rDQHo0yc;HqoRNnNFeWZgcm?f;cp(6CNylj36DoL(?TS7eU#+ z7&mfr#y))+CJOXQKUMZ7QIdS9@#-}7y2K1{8)cCt0~-X0O!O?Qx#E4Og+;A2SjalQ zs7r?qn0H044=sDN$SRG$arw~n=+T_DNdSrarmu)V6@|?1-ZB#hRn`uilTGPJ@fqEy zGt(f0B+^JDP&f=r{#Y_wi#AVDf-y!RIXU^0jXsFpf>=Ji*TeqSY!H~AMbJdCGLhC) zn7Rx+sXw6uYj;WRYrLd^5IZq@6JI1C^YkgnedZEYy<&4(z%Q$5yv#Boo{AH8n$a zhb4Y3PWdr269&?V%uI$xMcUrMzl=;w<_nm*qr=c3Rl@i5wWB;e-`t7D&c-mcQl7x! zZWB`UGcw=Y2=}~wzrfLx=uet<;m3~=8I~ZRuzvMQUQdr+yTV|ATf1Uuomr__nDf=X zZ3WYJtHp_ri(}SQAPjv+Y+0=fH4krOP@S&=zZ-t1jW1o@}z;xk8 z(Nz1co&El^HK^NrhVHa-_;&88vTU>_J33=%{if;BEY*J#1n59=07jrGQ#IP>@u#3A z;!q+E1Rj3ZJ+!4bq9F8PXJ@yMgZL;>&gYA0%_Kbi8?S=XGM~dnQZQ!yBSgcZhY96H zrWnU;k)qy`rX&&xlDyA%(a1Hhi5CWkmg(`Gb%m(HKi-7Z!LKGRP_B8@`7&hdDy5n= z`OIxqxiVfX@OX1p(mQu>0Ai*v_cTMiw4qRt3~NBvr9oBy0)r>w3p~V0SCm=An6@3n)>@z!|o-$HvDK z|3D2ZMJkLE5loMKl6R^ez@Zz%S$&mbeoqH5`Bb){Ei21q&VP)hWS2tjShfFtGE+$z zzCR$P#uktu+#!w)cX!lWN1XU%K-r=s{|j?)Akf@q#3b#{6cZCuJ~gCxuMXRmI$nGtnH+-h z+GEi!*X=AP<|fG`1>MBdTb?28JYc=fGvAi2I<$B(rs$;eoJCyR6_bc~p!XR@O-+sD z=eH`-ye})I5ic1eL~TDmtfJ|8`0VJ*Yr=hNCd)G1p2MMz4C3^Mj?7;!w|Ly%JqmuW zlIEW^Ft%z?*|fpXda>Jr^1noFZEwFgVV%|*XhH@acv8rdGxeEX{M$(vG{Zw+x(ei@ zmfXb22}8-?Fi`vo-YVrTH*C?a8%M=Hv9MqVH7H^J$KsD?>!SFZ;ZsvnHr_gn=7acz z#W?0eCdVhVMWN12VV^$>WlQ?f;P^{(&pYTops|btm6aj>_Uz+hqpGwB)vWp0Cf5y< zft8-je~nn?W11plq}N)4A{l8I7$!ks_x$PXW-2XaRFswX_BnF{R#6YIwMhAgd5F9X zGmwdadS6(a^fjHtXg8=l?Rc0Sm%hk6E9!5cLVloEy4eh(=FwgP`)~I^5~pBEWo+F6 zSf2ncyMurJN91#cJTy_u8Y}@%!bq1RkGC~-bV@SXRd4F{R-*V`bS+6;W5vZ(&+I<9$;-V|eNfLa5n-6% z2(}&uGRF;p92eS*sE*oR$@pexaqr*meB)VhmIg@h{uzkk$9~qh#cHhw#>O%)b@+(| z^IQgqzuj~Sk(J;swEM-3TrJAPCq9k^^^`q{IItKBRXYe}e0Tdr=Huf7da3$l4PdpwWDop%^}n;dD#K4s#DYA8SHZ z&1!riV4W4R7R#C))JH1~axJ)RYnM$$lIR%6fIVA@zV{XVyx}C+a-Dt8Y9M)^KU0+H zR4IUb2CJ{Hg>CuaXtD50jB(_Tcx=Z$^WYu2u5kubqmwp%drJ6 z?Fo40g!Qd<-l=TQxqHEOuPX0;^z7iX?Ke^a%XT<13TA^5`4Xcw6D@Ur&VT&CUe0d} z1GjOVF1^L@>O)l@?bD~$wzgf(nxX1OGD8fEV?TdJcZc2KoUe|oP1#=$$7ee|xbY)A zDZq+cuTpc(fFdj^=!;{k03C69lMQ(|>uhRfRu%+!k&YOi-3|1QKB z z?n?eq1XP>p-IM$Z^C;2L3itnbJZAip*Zo0aw2bs8@(s^~*8T9go!%dHcAz2lM;`yp zD=7&xjFV$S&5uDaiScyD?B-i1ze`+CoRtz`Wn+Zl&#s4&}MO{@N!ufrzjG$B79)Y2d3tBk&)TxUTw@QS0TEL_?njX|@vq?Uz(nBFK5Pq7*xj#u*R&i|?7+6# z+|r_n#SW&LXhtheZdah{ZVoqwyT{D>MC3nkFF#N)xLi{p7J1jXlmVeb;cP5?e(=f# zuT7fvjSbjS781v?7{)-X3*?>tq?)Yd)~|1{BDS(pqC zC}~H#WXlkUW*H5CDOo<)#x7%RY)A;ShGhI5s*#cRDA8YgqG(HeKDx+#(ZQ?386dv! zlXCO)w91~Vw4AmOcATuV653fa9R$fyK8ul%rG z-wfS zihugoZyr38Im?Zuh6@RcF~t1anQu7>#lPpb#}4cOA!EM11`%f*07RqOVkmX{p~KJ9 z^zP;K#|)$`^Rb{rnHGH{~>1(fawV0*Z#)}M`m8-?ZJV<+e}s9wE# z)l&az?w^5{)`S(%MRzxdNqrs1n*-=jS^_jqE*5XDrA0+VE`5^*p3CuM<&dZEeCjoz zR;uu_H9ZPZV|fQq`Cyw4nscrVwi!fE6ciMmX$!_hN7uF;jjKG)d2@aC4ropY)8etW=xJvni)8eHi`H$%#zn^WJ5NLc-rqk|u&&4Z6fD_m&JfSI1Bvb?b<*n&sfl0^t z=HnmRl`XrFvMKB%9}>PaA`m-fK6a0(8=qPkWS5bb4=v?XcWi&hRY?O5HdulRi4?fN zlsJ*N-0Qw+Yic@s0(2uy%F@ib;GjXt01Fmx5XbRo6+n|pP(&nodMoap^z{~q ziEeaUT@Mxe3vJSfI6?uLND(CNr=#^W<1b}jzW58bIfyWTDle$mmS(|x-0|2UlX+9k zQ^EX7Nw}?EzVoBfT(-LT|=9N@^hcn-_p&sqG z&*oVs2JSU+N4ZD`FhCAWaS;>|wH2G*Id|?pa#@>tyxX`+4HyIArWDvVrX)2WAOQff z0qyHu&-S@i^MS-+j--!pr4fPBj~_8({~e1bfcl0wI1kaoN>mJL6KUPQm5N7lB(ui1 zE-o%kq)&djzWJ}ob<-GfDlkB;F31j-VHKvQUGQ3sp`CwyGJk_i!y^sD0fqC@$9|jO zOqN!r!8-p==F@ZVP=U$qSpY(gQ0)59P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From c594951a5d61eacb3d616fd122ed590edee0a22b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 21 Feb 2020 11:31:25 +0100 Subject: [PATCH 07/29] l10n_fr_fec_oca: restore working code --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 8782598ec..97b5e3416 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -446,7 +446,7 @@ def generate_fec(self): else: aux_fields = sql_aux_num_base + 'AS CompAuxNum, '\ + sql_aux_lib_base + 'AS CompAuxLib,' - sql_args['aux_fields'] = aux_fields + # LINES sql_query = ''' SELECT @@ -456,7 +456,7 @@ def generate_fec(self): TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, aa.code AS CompteNum, replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, - %(aux_fields)s + ''' + aux_fields + ''' CASE WHEN am.ref IS null OR am.ref = '' THEN '-' @@ -464,7 +464,7 @@ def generate_fec(self): END AS PieceRef, TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' - WHEN aml.name SIMILAR TO '[\t|\\s|\n]*' THEN '/' + WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/' ELSE replace(replace(replace(replace( aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') END AS EcritureLib, @@ -514,18 +514,20 @@ def generate_fec(self): AND am.date <= %(date_to)s AND am.company_id = %(company_id)s AND (aml.debit != 0 OR aml.credit != 0) - %(posted)s - ORDER BY - am.date, - am.name, - aml.id ''' - sql_args["posted"] = "" # For official report: only use posted entries if self.export_type == "official": - sql_args["posted"] = "AND am.state = 'posted'" + sql_query += ''' + AND am.state = 'posted' + ''' + sql_query += ''' + ORDER BY + am.date, + am.name, + aml.id + ''' self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): From c7118fdd638a7e3d6ab954e06cb1ffd88b6fe1e8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 1 Dec 2020 18:42:41 +0100 Subject: [PATCH 08/29] [MIG] l10n_fr_fec_oca to v14 --- l10n_fr_fec_oca/__manifest__.py | 11 +- l10n_fr_fec_oca/readme/DESCRIPTION.rst | 2 +- l10n_fr_fec_oca/security/ir.model.access.csv | 2 + l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 182 +++++++++---------- 4 files changed, 97 insertions(+), 100 deletions(-) create mode 100644 l10n_fr_fec_oca/security/ir.model.access.csv diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index a45f16b78..646bcbb41 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -1,20 +1,23 @@ -# Copyright 2013-2019 Akretion France (http://www.akretion.com/) -# Copyright 2016-2019 Odoo SA (https://www.odoo.com/fr_FR/) +# Copyright 2013-2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# Copyright 2016-2020 Odoo SA (https://www.odoo.com/fr_FR/) # @author: Alexis de Lattre { "name": "France - FEC", "category": "Accounting", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "license": "LGPL-3", "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", + "maintainers": ["alexis-via"], "website": "https://github.com/OCA/l10n-france", "depends": ["l10n_fr", "account", "date_range"], "external_dependencies": { "python": ["unicodecsv", "unidecode"], - }, + }, "data": [ + "security/ir.model.access.csv", "wizard/account_fr_fec_oca_view.xml", ], "installable": True, diff --git a/l10n_fr_fec_oca/readme/DESCRIPTION.rst b/l10n_fr_fec_oca/readme/DESCRIPTION.rst index 38786b46c..8cc7d463c 100644 --- a/l10n_fr_fec_oca/readme/DESCRIPTION.rst +++ b/l10n_fr_fec_oca/readme/DESCRIPTION.rst @@ -12,6 +12,6 @@ FEC au format texte et non au format XML, car le format texte sera facilement lisible et vérifiable par le comptable en utilisant un tableur. La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel -*Test Compta Demat* version 1_00_05 disponible sur +*Test Compta Demat* version 1_00_06 disponible sur `le site de la direction générale des finances publiques ` en utilisant une base de donnée Odoo réelle. diff --git a/l10n_fr_fec_oca/security/ir.model.access.csv b/l10n_fr_fec_oca/security/ir.model.access.csv new file mode 100644 index 000000000..b981eba22 --- /dev/null +++ b/l10n_fr_fec_oca/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_l10n_fr_fec_oca_user,Access to wizard account.fr.fec.oca to accountant,model_account_fr_fec_oca,account.group_account_user,1,1,1,0 diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 97b5e3416..eb73ff5ea 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -1,5 +1,6 @@ -# Copyright 2013-2019 Akretion France (http://www.akretion.com) -# Copyright 2016-2019 Odoo SA (https://www.odoo.com/fr_FR/) +# Copyright 2013-2020 Akretion France (http://www.akretion.com) +# @author: Alexis de Lattre +# Copyright 2016-2020 Odoo SA (https://www.odoo.com/fr_FR/) # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). @@ -40,9 +41,9 @@ class AccountFrFecOca(models.TransientModel): ('tab', 'Tab'), ], default='|', string='Field Delimiter', required=True) partner_option = fields.Selection([ - ('all', 'All'), ('types', 'Selected Account Types'), ('accounts', 'Selected Accounts'), + ('all', 'All'), ], default='types', required=True, string='Partner Export Option') partner_account_type_ids = fields.Many2many( 'account.account.type', string='Account Types', @@ -50,7 +51,7 @@ class AccountFrFecOca(models.TransientModel): partner_account_ids = fields.Many2many( 'account.account', string='Accounts', default=lambda self: self._default_partner_account_ids()) - fec_data = fields.Binary('FEC File', readonly=True) + fec_data = fields.Binary('FEC File', readonly=True, attachment=False) filename = fields.Char(string='Filename', size=256, readonly=True) export_type = fields.Selection([ ('official', 'Official FEC report (posted entries only)'), @@ -72,9 +73,9 @@ def _default_partner_account_type_ids(self): @api.model def _default_partner_account_ids(self): - pay = self.env['ir.property'].get( + pay = self.env['ir.property']._get( 'property_account_payable_id', 'res.partner') - rec = self.env['ir.property'].get( + rec = self.env['ir.property']._get( 'property_account_receivable_id', 'res.partner') return pay + rec @@ -84,20 +85,20 @@ def do_query_unaffected_earnings(self): This is needed because we have to display only one line for the initial balance of all expense/revenue accounts in the FEC. ''' - + # BENEFIT and LOSS sql_query = ''' SELECT 'OUV' AS JournalCode, 'Balance initiale' AS JournalLib, 'OUVERTURE/' || %(formatted_date_year)s AS EcritureNum, %(formatted_date_from)s AS EcritureDate, - '120/129' AS CompteNum, - 'Benefice (perte) reporte(e)' AS CompteLib, + '120000' AS CompteNum, + E'Résultat de l\\'exercice (Bénéfice)' AS CompteLib, '' AS CompAuxNum, '' AS CompAuxLib, '-' AS PieceRef, %(formatted_date_from)s AS PieceDate, - '/' AS EcritureLib, + 'Report à nouveau' AS EcritureLib, replace( CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' @@ -115,13 +116,13 @@ def do_query_unaffected_earnings(self): '' AS Idevise FROM account_move_line aml - LEFT JOIN account_move am ON am.id=aml.move_id + LEFT JOIN account_move am ON am.id = aml.move_id JOIN account_account aa ON aa.id = aml.account_id LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id WHERE am.date < %(date_from)s AND am.company_id = %(company_id)s - AND aat.include_initial_balance = 'f' + AND aat.include_initial_balance IS NOT true AND (aml.debit != 0 OR aml.credit != 0) ''' # For official report: only use posted entries @@ -129,7 +130,7 @@ def do_query_unaffected_earnings(self): sql_query += ''' AND am.state = 'posted' ''' - company = self.env.user.company_id + company = self.env.company formatted_date_from = fields.Date.to_string(self.date_from).replace( '-', '') date_from = self.date_from @@ -143,6 +144,10 @@ def do_query_unaffected_earnings(self): listrow = [] row = self._cr.fetchone() listrow = list(row) + # Hack to replace 120 by 129 when it's a loss + if listrow[11] != "0,00" and listrow[12] == "0,00" and listrow[4] == "120000": + listrow[4] = "129000" + listrow[5] = "Résultat de l'exercice (perte)" return listrow def _get_siren(self, company): @@ -177,7 +182,10 @@ def generate_fec(self): # 2) CSV files are easier to read/use for a regular accountant. # So it will be easier for the accountant to check the file before # sending it to the fiscal administration - company = self.env.user.company_id + if self.date_from >= self.date_to: + raise UserError(_('The start date must be before the end date.')) + + company = self.env.company header = [ 'JournalCode', # 0 @@ -186,7 +194,7 @@ def generate_fec(self): 'EcritureDate', # 3 'CompteNum', # 4 'CompteLib', # 5 - 'CompAuxNum', # 6 We use partner.id + 'CompAuxNum', # 6 'CompAuxLib', # 7 'PieceRef', # 8 'PieceDate', # 9 @@ -201,7 +209,6 @@ def generate_fec(self): ] rows_to_write = [header] - # INITIAL BALANCE unaffected_earnings_xml_ref = self.env.ref( 'account.data_unaffected_earnings') # used to make sure that we add the unaffected earning initial balance @@ -213,6 +220,7 @@ def generate_fec(self): unaffected_earnings_results = self.do_query_unaffected_earnings() unaffected_earnings_line = False + # INITIAL BALANCE other than payable/receivable sql_query = ''' SELECT 'OUV' AS JournalCode, @@ -225,7 +233,7 @@ def generate_fec(self): '' AS CompAuxLib, '-' AS PieceRef, %(formatted_date_from)s AS PieceDate, - '/' AS EcritureLib, + 'Report à nouveau' AS EcritureLib, replace( CASE WHEN sum(aml.balance) <= 0 THEN '0,00' @@ -244,13 +252,13 @@ def generate_fec(self): MIN(aa.id) AS CompteID FROM account_move_line aml - LEFT JOIN account_move am ON am.id=aml.move_id + LEFT JOIN account_move am ON am.id = aml.move_id JOIN account_account aa ON aa.id = aml.account_id LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id WHERE am.date < %(date_from)s AND am.company_id = %(company_id)s - AND aat.include_initial_balance = 't' + AND aat.include_initial_balance IS true AND (aml.debit != 0 OR aml.credit != 0) ''' @@ -267,21 +275,20 @@ def generate_fec(self): ''' formatted_date_from = fields.Date.to_string(self.date_from).replace( '-', '') - date_from = self.date_from - formatted_date_year = date_from.year currency_digits = 2 - self._cr.execute( - sql_query, { - 'formatted_date_year': formatted_date_year, - 'formatted_date_from': formatted_date_from, - 'date_from': self.date_from, - 'company_id': company.id, - 'currency_digits': currency_digits, - }) + sql_args = { # Use for the 2 INITIAL BALANCEs and for LINES + 'formatted_date_year': self.date_from.year, + 'formatted_date_from': formatted_date_from, + 'date_from': self.date_from, + 'date_to': self.date_to, + 'company_id': company.id, + 'currency_digits': currency_digits, + } unaffected_earnings_type_id = self.env.ref( 'account.data_unaffected_earnings').id + self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): listrow = list(row) account_id = listrow.pop() @@ -327,6 +334,51 @@ def generate_fec(self): unaffected_earnings_account.name rows_to_write.append(unaffected_earnings_results) + sql_aux_num_base = ''' + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID' || rp.id, '') + ELSE replace(rp.ref, '|', '/') + END + ''' + sql_aux_lib_base = ''' + COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') + ''' + if self.partner_option == 'types': + aux_fields = ''' + CASE WHEN aat.id IN %(partner_account_type_ids)s + THEN ''' + sql_aux_num_base + ''' + ELSE '' + END + AS CompAuxNum, + CASE WHEN aat.id IN %(partner_account_type_ids)s + THEN ''' + sql_aux_lib_base + ''' + ELSE '' + END + AS CompAuxLib, + ''' + sql_args['partner_account_type_ids'] =\ + tuple(self.partner_account_type_ids.ids) + elif self.partner_option == 'accounts': + aux_fields = ''' + CASE WHEN aa.id IN %(partner_account_ids)s + THEN ''' + sql_aux_num_base + ''' + ELSE '' + END + AS CompAuxNum, + CASE WHEN aa.id IN %(partner_account_ids)s + THEN ''' + sql_aux_lib_base + ''' + ELSE '' + END + AS CompAuxLib, + ''' + sql_args['partner_account_ids'] =\ + tuple(self.partner_account_ids.ids) + else: + aux_fields = sql_aux_num_base + 'AS CompAuxNum, '\ + + sql_aux_lib_base + 'AS CompAuxLib,' + + aux_fields_ini_bal = aux_fields.replace('aa.id IN', 'MIN(aa.id) IN').replace( + 'aat.id IN', 'MIN(aat.id) IN') # INITIAL BALANCE - receivable/payable sql_query = ''' SELECT @@ -336,15 +388,10 @@ def generate_fec(self): %(formatted_date_from)s AS EcritureDate, MIN(aa.code) AS CompteNum, replace(MIN(aa.name), '|', '/') AS CompteLib, - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID' || rp.id, '') - ELSE replace(rp.ref, '|', '/') - END - AS CompAuxNum, - COALESCE(replace(rp.name, '|', '/'), '') AS CompAuxLib, + ''' + aux_fields_ini_bal + ''' '-' AS PieceRef, %(formatted_date_from)s AS PieceDate, - '/' AS EcritureLib, + 'Report à nouveau' AS EcritureLib, replace( CASE WHEN sum(aml.balance) <= 0 THEN '0,00' @@ -370,7 +417,7 @@ def generate_fec(self): WHERE am.date < %(date_from)s AND am.company_id = %(company_id)s - AND aat.include_initial_balance = 't' + AND aat.include_initial_balance IS true AND (aml.debit != 0 OR aml.credit != 0) ''' @@ -381,72 +428,17 @@ def generate_fec(self): ''' sql_query += ''' - GROUP BY aml.account_id, aat.type, rp.ref, rp.id + GROUP BY aml.account_id, aat.type, rp.id HAVING round(sum(aml.balance), %(currency_digits)s) != 0 AND aat.type in ('receivable', 'payable') ''' - self._cr.execute( - sql_query, { - 'formatted_date_year': formatted_date_year, - 'formatted_date_from': formatted_date_from, - 'date_from': self.date_from, - 'company_id': company.id, - 'currency_digits': currency_digits, - }) + self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): listrow = list(row) account_id = listrow.pop() rows_to_write.append(listrow) - sql_args = { - 'date_from': self.date_from, - 'date_to': self.date_to, - 'company_id': company.id, - } - sql_aux_num_base = ''' - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID' || rp.id, '') - ELSE replace(rp.ref, '|', '/') - END - ''' - sql_aux_lib_base = ''' - COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') - ''' - if self.partner_option == 'types': - aux_fields = ''' - CASE WHEN aat.id IN %(partner_account_type_ids)s - THEN ''' + sql_aux_num_base + ''' - ELSE '' - END - AS CompAuxNum, - CASE WHEN aat.id IN %(partner_account_type_ids)s - THEN ''' + sql_aux_lib_base + ''' - ELSE '' - END - AS CompAuxLib, - ''' - sql_args['partner_account_type_ids'] =\ - tuple(self.partner_account_type_ids.ids) - elif self.partner_option == 'accounts': - aux_fields = ''' - CASE WHEN aa.id IN %(partner_account_ids)s - THEN ''' + sql_aux_num_base + ''' - ELSE '' - END - AS CompAuxNum, - CASE WHEN aa.id IN %(partner_account_ids)s - THEN ''' + sql_aux_lib_base + ''' - ELSE '' - END - AS CompAuxLib, - ''' - sql_args['partner_account_ids'] =\ - tuple(self.partner_account_ids.ids) - else: - aux_fields = sql_aux_num_base + 'AS CompAuxNum, '\ - + sql_aux_lib_base + 'AS CompAuxLib,' - # LINES sql_query = ''' SELECT @@ -541,7 +533,7 @@ def generate_fec(self): siren = self._get_siren(company) self.write({ - 'fec_data': base64.encodestring(fecvalue), + 'fec_data': base64.encodebytes(fecvalue), # Filename = FECYYYYMMDD where YYYMMDD is the closing date 'filename': '%sFEC%s%s.txt' % (siren, end_date, suffix), }) From 8c798128846316b274acd366005826d236ff2130 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 1 Dec 2020 19:40:28 +0100 Subject: [PATCH 09/29] l10n_fr_fec_oca: make my hack for 120000/129000 work on a well-configured DB too --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index eb73ff5ea..78685cac0 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -297,6 +297,12 @@ def generate_fec(self): if account.user_type_id.id == unaffected_earnings_type_id: # add the benefit/loss of previous fiscal year to # the first unaffected earnings account found. + # Alexis note: on a normal accounting DB, we should + # never enter in the IF above because the account + # 120000 is supposed to have a balance at 0 at the end + # of each fiscal year, because benefit or loss + # is supposed to be re-affected by the general assembly + # during the year unaffected_earnings_line = True current_amount = float(listrow[11].replace(',', '.'))\ - float(listrow[12].replace(',', '.')) @@ -324,14 +330,6 @@ def generate_fec(self): and unaffected_earnings_results and (unaffected_earnings_results[11] != '0,00' or unaffected_earnings_results[12] != '0,00')): - # search an unaffected earnings account - unaffected_earnings_account = self.env['account.account'].search( - [('user_type_id', '=', unaffected_earnings_type_id)], limit=1) - if unaffected_earnings_account: - unaffected_earnings_results[4] =\ - unaffected_earnings_account.code - unaffected_earnings_results[5] =\ - unaffected_earnings_account.name rows_to_write.append(unaffected_earnings_results) sql_aux_num_base = ''' From f3374f91f344cfe17a4b481fd34bed86e017a3a7 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 27 Jan 2021 14:36:26 +0100 Subject: [PATCH 10/29] Run pre-commit --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 419 ++++++++++-------- .../wizard/account_fr_fec_oca_view.xml | 49 +- 2 files changed, 266 insertions(+), 202 deletions(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 78685cac0..760bdd9e0 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -6,60 +6,84 @@ import base64 import io +import logging -from odoo import api, fields, models, _ +from odoo import _, api, fields, models from odoo.exceptions import UserError from odoo.tools import float_is_zero -import logging + logger = logging.getLogger(__name__) try: from unidecode import unidecode except ImportError: - logger.debug('Cannot import unidecode') + logger.debug("Cannot import unidecode") try: import unicodecsv except ImportError: - logger.debug('Cannot import unicodecsv') + logger.debug("Cannot import unicodecsv") class AccountFrFecOca(models.TransientModel): - _name = 'account.fr.fec.oca' - _description = 'Ficher Echange Informatise' - - date_range_id = fields.Many2one('date.range', string='Date Range') - date_from = fields.Date(string='Start Date', required=True) - date_to = fields.Date(string='End Date', required=True) - encoding = fields.Selection([ - ('iso8859_15', 'ISO-8859-15'), - ('utf-8', 'UTF-8'), - # ('cp500', 'EBCDIC'), - ('ascii', 'ASCII'), - ], string='Encoding', default='iso8859_15', required=True) - delimiter = fields.Selection([ - ('|', '|'), - ('tab', 'Tab'), - ], default='|', string='Field Delimiter', required=True) - partner_option = fields.Selection([ - ('types', 'Selected Account Types'), - ('accounts', 'Selected Accounts'), - ('all', 'All'), - ], default='types', required=True, string='Partner Export Option') + _name = "account.fr.fec.oca" + _description = "Ficher Echange Informatise" + + date_range_id = fields.Many2one("date.range", string="Date Range") + date_from = fields.Date(string="Start Date", required=True) + date_to = fields.Date(string="End Date", required=True) + encoding = fields.Selection( + [ + ("iso8859_15", "ISO-8859-15"), + ("utf-8", "UTF-8"), + # ('cp500', 'EBCDIC'), + ("ascii", "ASCII"), + ], + string="Encoding", + default="iso8859_15", + required=True, + ) + delimiter = fields.Selection( + [ + ("|", "|"), + ("tab", "Tab"), + ], + default="|", + string="Field Delimiter", + required=True, + ) + partner_option = fields.Selection( + [ + ("types", "Selected Account Types"), + ("accounts", "Selected Accounts"), + ("all", "All"), + ], + default="types", + required=True, + string="Partner Export Option", + ) partner_account_type_ids = fields.Many2many( - 'account.account.type', string='Account Types', - default=lambda self: self._default_partner_account_type_ids()) + "account.account.type", + string="Account Types", + default=lambda self: self._default_partner_account_type_ids(), + ) partner_account_ids = fields.Many2many( - 'account.account', string='Accounts', - default=lambda self: self._default_partner_account_ids()) - fec_data = fields.Binary('FEC File', readonly=True, attachment=False) - filename = fields.Char(string='Filename', size=256, readonly=True) - export_type = fields.Selection([ - ('official', 'Official FEC report (posted entries only)'), - ('nonofficial', - 'Non-official FEC report (posted and unposted entries)'), - ], string='Export Type', required=True, default='official') - - @api.onchange('date_range_id') + "account.account", + string="Accounts", + default=lambda self: self._default_partner_account_ids(), + ) + fec_data = fields.Binary("FEC File", readonly=True, attachment=False) + filename = fields.Char(string="Filename", size=256, readonly=True) + export_type = fields.Selection( + [ + ("official", "Official FEC report (posted entries only)"), + ("nonofficial", "Non-official FEC report (posted and unposted entries)"), + ], + string="Export Type", + required=True, + default="official", + ) + + @api.onchange("date_range_id") def date_range_change(self): if self.date_range_id: self.date_from = self.date_range_id.date_start @@ -67,26 +91,26 @@ def date_range_change(self): @api.model def _default_partner_account_type_ids(self): - receivable = self.env.ref('account.data_account_type_receivable') - payable = self.env.ref('account.data_account_type_payable') + receivable = self.env.ref("account.data_account_type_receivable") + payable = self.env.ref("account.data_account_type_payable") return receivable + payable @api.model def _default_partner_account_ids(self): - pay = self.env['ir.property']._get( - 'property_account_payable_id', 'res.partner') - rec = self.env['ir.property']._get( - 'property_account_receivable_id', 'res.partner') + pay = self.env["ir.property"]._get("property_account_payable_id", "res.partner") + rec = self.env["ir.property"]._get( + "property_account_receivable_id", "res.partner" + ) return pay + rec def do_query_unaffected_earnings(self): - ''' Compute the sum of ending balances for all accounts that are + """Compute the sum of ending balances for all accounts that are of a type that does not bring forward the balance in new fiscal years. This is needed because we have to display only one line for the initial balance of all expense/revenue accounts in the FEC. - ''' + """ # BENEFIT and LOSS - sql_query = ''' + sql_query = """ SELECT 'OUV' AS JournalCode, 'Balance initiale' AS JournalLib, @@ -124,23 +148,25 @@ def do_query_unaffected_earnings(self): AND am.company_id = %(company_id)s AND aat.include_initial_balance IS NOT true AND (aml.debit != 0 OR aml.credit != 0) - ''' + """ # For official report: only use posted entries if self.export_type == "official": - sql_query += ''' + sql_query += """ AND am.state = 'posted' - ''' + """ company = self.env.company - formatted_date_from = fields.Date.to_string(self.date_from).replace( - '-', '') + formatted_date_from = fields.Date.to_string(self.date_from).replace("-", "") date_from = self.date_from formatted_date_year = date_from.year - self._cr.execute(sql_query, { - 'formatted_date_year': formatted_date_year, - 'formatted_date_from': formatted_date_from, - 'date_from': self.date_from, - 'company_id': company.id, - }) + self._cr.execute( + sql_query, + { + "formatted_date_year": formatted_date_year, + "formatted_date_from": formatted_date_from, + "date_from": self.date_from, + "company_id": company.id, + }, + ) listrow = [] row = self._cr.fetchone() listrow = list(row) @@ -158,18 +184,15 @@ def _get_siren(self, company): https://www.service-public.fr/professionnels-entreprises/vosdroits/F23570 http://www.douane.gouv.fr/articles/a11024-tva-dans-les-dom """ - dom_tom_group = self.env.ref('l10n_fr.dom-tom') - is_dom_tom = company.country_id.code in\ - dom_tom_group.country_ids.mapped('code') + dom_tom_group = self.env.ref("l10n_fr.dom-tom") + is_dom_tom = company.country_id.code in dom_tom_group.country_ids.mapped("code") if not is_dom_tom and not company.vat: - raise UserError( - _("Missing VAT number for company %s") % company.name) - vat = company.vat.upper().replace(' ', '') - if not is_dom_tom and vat[0:2] != 'FR': - raise UserError( - _("FEC is for French companies only !")) - - siren = vat[4:13] if not is_dom_tom else '' + raise UserError(_("Missing VAT number for company %s") % company.name) + vat = company.vat.upper().replace(" ", "") + if not is_dom_tom and vat[0:2] != "FR": + raise UserError(_("FEC is for French companies only !")) + + siren = vat[4:13] if not is_dom_tom else "" return siren def generate_fec(self): @@ -183,34 +206,33 @@ def generate_fec(self): # So it will be easier for the accountant to check the file before # sending it to the fiscal administration if self.date_from >= self.date_to: - raise UserError(_('The start date must be before the end date.')) + raise UserError(_("The start date must be before the end date.")) company = self.env.company header = [ - 'JournalCode', # 0 - 'JournalLib', # 1 - 'EcritureNum', # 2 - 'EcritureDate', # 3 - 'CompteNum', # 4 - 'CompteLib', # 5 - 'CompAuxNum', # 6 - 'CompAuxLib', # 7 - 'PieceRef', # 8 - 'PieceDate', # 9 - 'EcritureLib', # 10 - 'Debit', # 11 - 'Credit', # 12 - 'EcritureLet', # 13 - 'DateLet', # 14 - 'ValidDate', # 15 - 'Montantdevise', # 16 - 'Idevise', # 17 - ] + "JournalCode", # 0 + "JournalLib", # 1 + "EcritureNum", # 2 + "EcritureDate", # 3 + "CompteNum", # 4 + "CompteLib", # 5 + "CompAuxNum", # 6 + "CompAuxLib", # 7 + "PieceRef", # 8 + "PieceDate", # 9 + "EcritureLib", # 10 + "Debit", # 11 + "Credit", # 12 + "EcritureLet", # 13 + "DateLet", # 14 + "ValidDate", # 15 + "Montantdevise", # 16 + "Idevise", # 17 + ] rows_to_write = [header] - unaffected_earnings_xml_ref = self.env.ref( - 'account.data_unaffected_earnings') + unaffected_earnings_xml_ref = self.env.ref("account.data_unaffected_earnings") # used to make sure that we add the unaffected earning initial balance # only once unaffected_earnings_line = True @@ -221,7 +243,7 @@ def generate_fec(self): unaffected_earnings_line = False # INITIAL BALANCE other than payable/receivable - sql_query = ''' + sql_query = """ SELECT 'OUV' AS JournalCode, 'Balance initiale' AS JournalLib, @@ -260,40 +282,40 @@ def generate_fec(self): AND am.company_id = %(company_id)s AND aat.include_initial_balance IS true AND (aml.debit != 0 OR aml.credit != 0) - ''' + """ # For official report: only use posted entries if self.export_type == "official": - sql_query += ''' + sql_query += """ AND am.state = 'posted' - ''' + """ - sql_query += ''' + sql_query += """ GROUP BY aml.account_id, aat.type HAVING round(sum(aml.balance), %(currency_digits)s) != 0 AND aat.type not in ('receivable', 'payable') - ''' - formatted_date_from = fields.Date.to_string(self.date_from).replace( - '-', '') + """ + formatted_date_from = fields.Date.to_string(self.date_from).replace("-", "") currency_digits = 2 sql_args = { # Use for the 2 INITIAL BALANCEs and for LINES - 'formatted_date_year': self.date_from.year, - 'formatted_date_from': formatted_date_from, - 'date_from': self.date_from, - 'date_to': self.date_to, - 'company_id': company.id, - 'currency_digits': currency_digits, - } + "formatted_date_year": self.date_from.year, + "formatted_date_from": formatted_date_from, + "date_from": self.date_from, + "date_to": self.date_to, + "company_id": company.id, + "currency_digits": currency_digits, + } unaffected_earnings_type_id = self.env.ref( - 'account.data_unaffected_earnings').id + "account.data_unaffected_earnings" + ).id self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): listrow = list(row) account_id = listrow.pop() if not unaffected_earnings_line: - account = self.env['account.account'].browse(account_id) + account = self.env["account.account"].browse(account_id) if account.user_type_id.id == unaffected_earnings_type_id: # add the benefit/loss of previous fiscal year to # the first unaffected earnings account found. @@ -304,81 +326,100 @@ def generate_fec(self): # is supposed to be re-affected by the general assembly # during the year unaffected_earnings_line = True - current_amount = float(listrow[11].replace(',', '.'))\ - - float(listrow[12].replace(',', '.')) - unaffected_earnings_amount =\ - float( - unaffected_earnings_results[11].replace(',', '.'))\ - - float( - unaffected_earnings_results[12].replace(',', '.')) - listrow_amount =\ - current_amount + unaffected_earnings_amount - if float_is_zero( - listrow_amount, precision_digits=currency_digits): + current_amount = float(listrow[11].replace(",", ".")) - float( + listrow[12].replace(",", ".") + ) + unaffected_earnings_amount = float( + unaffected_earnings_results[11].replace(",", ".") + ) - float(unaffected_earnings_results[12].replace(",", ".")) + listrow_amount = current_amount + unaffected_earnings_amount + if float_is_zero(listrow_amount, precision_digits=currency_digits): continue if listrow_amount > 0: - listrow[11] = str(listrow_amount).replace('.', ',') - listrow[12] = '0,00' + listrow[11] = str(listrow_amount).replace(".", ",") + listrow[12] = "0,00" else: - listrow[11] = '0,00' - listrow[12] = str(-listrow_amount).replace('.', ',') + listrow[11] = "0,00" + listrow[12] = str(-listrow_amount).replace(".", ",") rows_to_write.append(listrow) # if the unaffected earnings account wasn't in the selection yet: # add it manually - if (not unaffected_earnings_line + if ( + not unaffected_earnings_line and unaffected_earnings_results - and (unaffected_earnings_results[11] != '0,00' - or unaffected_earnings_results[12] != '0,00')): + and ( + unaffected_earnings_results[11] != "0,00" + or unaffected_earnings_results[12] != "0,00" + ) + ): rows_to_write.append(unaffected_earnings_results) - sql_aux_num_base = ''' + sql_aux_num_base = """ CASE WHEN rp.ref IS null OR rp.ref = '' THEN COALESCE('ID' || rp.id, '') ELSE replace(rp.ref, '|', '/') END - ''' - sql_aux_lib_base = ''' + """ + sql_aux_lib_base = """ COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') - ''' - if self.partner_option == 'types': - aux_fields = ''' + """ + if self.partner_option == "types": + aux_fields = ( + """ CASE WHEN aat.id IN %(partner_account_type_ids)s - THEN ''' + sql_aux_num_base + ''' + THEN """ + + sql_aux_num_base + + """ ELSE '' END AS CompAuxNum, CASE WHEN aat.id IN %(partner_account_type_ids)s - THEN ''' + sql_aux_lib_base + ''' + THEN """ + + sql_aux_lib_base + + """ ELSE '' END AS CompAuxLib, - ''' - sql_args['partner_account_type_ids'] =\ - tuple(self.partner_account_type_ids.ids) - elif self.partner_option == 'accounts': - aux_fields = ''' + """ + ) + sql_args["partner_account_type_ids"] = tuple( + self.partner_account_type_ids.ids + ) + elif self.partner_option == "accounts": + aux_fields = ( + """ CASE WHEN aa.id IN %(partner_account_ids)s - THEN ''' + sql_aux_num_base + ''' + THEN """ + + sql_aux_num_base + + """ ELSE '' END AS CompAuxNum, CASE WHEN aa.id IN %(partner_account_ids)s - THEN ''' + sql_aux_lib_base + ''' + THEN """ + + sql_aux_lib_base + + """ ELSE '' END AS CompAuxLib, - ''' - sql_args['partner_account_ids'] =\ - tuple(self.partner_account_ids.ids) + """ + ) + sql_args["partner_account_ids"] = tuple(self.partner_account_ids.ids) else: - aux_fields = sql_aux_num_base + 'AS CompAuxNum, '\ - + sql_aux_lib_base + 'AS CompAuxLib,' - - aux_fields_ini_bal = aux_fields.replace('aa.id IN', 'MIN(aa.id) IN').replace( - 'aat.id IN', 'MIN(aat.id) IN') + aux_fields = ( + sql_aux_num_base + + "AS CompAuxNum, " + + sql_aux_lib_base + + "AS CompAuxLib," + ) + + aux_fields_ini_bal = aux_fields.replace("aa.id IN", "MIN(aa.id) IN").replace( + "aat.id IN", "MIN(aat.id) IN" + ) # INITIAL BALANCE - receivable/payable - sql_query = ''' + sql_query = ( + """ SELECT 'OUV' AS JournalCode, 'Balance initiale' AS JournalLib, @@ -386,7 +427,9 @@ def generate_fec(self): %(formatted_date_from)s AS EcritureDate, MIN(aa.code) AS CompteNum, replace(MIN(aa.name), '|', '/') AS CompteLib, - ''' + aux_fields_ini_bal + ''' + """ + + aux_fields_ini_bal + + """ '-' AS PieceRef, %(formatted_date_from)s AS PieceDate, 'Report à nouveau' AS EcritureLib, @@ -417,19 +460,20 @@ def generate_fec(self): AND am.company_id = %(company_id)s AND aat.include_initial_balance IS true AND (aml.debit != 0 OR aml.credit != 0) - ''' + """ + ) # For official report: only use posted entries if self.export_type == "official": - sql_query += ''' + sql_query += """ AND am.state = 'posted' - ''' + """ - sql_query += ''' + sql_query += """ GROUP BY aml.account_id, aat.type, rp.id HAVING round(sum(aml.balance), %(currency_digits)s) != 0 AND aat.type in ('receivable', 'payable') - ''' + """ self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): @@ -438,7 +482,8 @@ def generate_fec(self): rows_to_write.append(listrow) # LINES - sql_query = ''' + sql_query = ( + """ SELECT replace(replace(aj.code, '|', '/'), '\t', '') AS JournalCode, replace(replace(aj.name, '|', '/'), '\t', '') AS JournalLib, @@ -446,7 +491,9 @@ def generate_fec(self): TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, aa.code AS CompteNum, replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, - ''' + aux_fields + ''' + """ + + aux_fields + + """ CASE WHEN am.ref IS null OR am.ref = '' THEN '-' @@ -454,7 +501,7 @@ def generate_fec(self): END AS PieceRef, TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' - WHEN aml.name SIMILAR TO '[\t|\s|\n]*' THEN '/' + WHEN aml.name SIMILAR TO '[\t|\\s|\n]*' THEN '/' ELSE replace(replace(replace(replace( aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') END AS EcritureLib, @@ -504,46 +551,49 @@ def generate_fec(self): AND am.date <= %(date_to)s AND am.company_id = %(company_id)s AND (aml.debit != 0 OR aml.credit != 0) - ''' + """ + ) # For official report: only use posted entries if self.export_type == "official": - sql_query += ''' + sql_query += """ AND am.state = 'posted' - ''' + """ - sql_query += ''' + sql_query += """ ORDER BY am.date, am.name, aml.id - ''' + """ self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): rows_to_write.append(list(row)) fecvalue = self._csv_write_rows(rows_to_write) - end_date = fields.Date.to_string(self.date_to).replace('-', '') - suffix = '' + end_date = fields.Date.to_string(self.date_to).replace("-", "") + suffix = "" if self.export_type == "nonofficial": - suffix = '-NONOFFICIAL' + suffix = "-NONOFFICIAL" siren = self._get_siren(company) - self.write({ - 'fec_data': base64.encodebytes(fecvalue), - # Filename = FECYYYYMMDD where YYYMMDD is the closing date - 'filename': '%sFEC%s%s.txt' % (siren, end_date, suffix), - }) + self.write( + { + "fec_data": base64.encodebytes(fecvalue), + # Filename = FECYYYYMMDD where YYYMMDD is the closing date + "filename": "{}FEC{}{}.txt".format(siren, end_date, suffix), + } + ) action = { - 'name': 'FEC', - 'type': 'ir.actions.act_url', - 'url': "web/content/?model=%s&id=%d&filename_field=filename&" - "field=fec_data&download=true&filename=%s" % ( - self._name, self.id, self.filename), - 'target': 'self', - } + "name": "FEC", + "type": "ir.actions.act_url", + "url": "web/content/?model=%s&id=%d&filename_field=filename&" + "field=fec_data&download=true&filename=%s" + % (self._name, self.id, self.filename), + "target": "self", + } return action def _csv_write_rows(self, rows): @@ -560,16 +610,17 @@ def _csv_write_rows(self, rows): fecfile = io.BytesIO() encoding = self.encoding delimiter = self.delimiter - if delimiter == 'tab': - delimiter = '\t' + if delimiter == "tab": + delimiter = "\t" writer = unicodecsv.writer( fecfile, delimiter=delimiter, - lineterminator='\r\n', + lineterminator="\r\n", encoding=encoding, - errors='replace') + errors="replace", + ) for row in rows: - if encoding == 'ascii': + if encoding == "ascii": for j, cell_content in enumerate(row): row[j] = unidecode(row[j]) writer.writerow(row) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml b/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml index 5fa199533..2da35cbfe 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml @@ -1,4 +1,4 @@ - + @@ -10,17 +10,23 @@ - - - - - - - - - + + + + + + + + + @@ -58,7 +64,8 @@
- + @@ -109,9 +116,13 @@
-
@@ -124,10 +135,12 @@ new - + sequence="110" + /> From 4acac39d221eeb3d344da3847f5ac1b19d4b53c7 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 27 Jan 2021 14:37:48 +0100 Subject: [PATCH 11/29] Store attachment in filestore instead of db The file can be huge in big databases and postgresql will then throw an error and can't process it. --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 760bdd9e0..760545ecd 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -71,7 +71,7 @@ class AccountFrFecOca(models.TransientModel): string="Accounts", default=lambda self: self._default_partner_account_ids(), ) - fec_data = fields.Binary("FEC File", readonly=True, attachment=False) + fec_data = fields.Binary("FEC File", readonly=True, attachment=True) filename = fields.Char(string="Filename", size=256, readonly=True) export_type = fields.Selection( [ From 092d951049ac81f6e534d3562e9303553ab9cf12 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 1 Feb 2021 08:02:05 +0000 Subject: [PATCH 12/29] [UPD] README.rst --- l10n_fr_fec_oca/README.rst | 20 +++++++++++++------ l10n_fr_fec_oca/static/description/index.html | 10 ++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/README.rst index 77da8de88..a6ff407fa 100644 --- a/l10n_fr_fec_oca/README.rst +++ b/l10n_fr_fec_oca/README.rst @@ -14,13 +14,13 @@ France - FEC :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--france-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-france/tree/12.0/l10n_fr_fec_oca + :target: https://github.com/OCA/l10n-france/tree/14.0/l10n_fr_fec_oca :alt: OCA/l10n-france .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-france-12-0/l10n-france-12-0-l10n_fr_fec_oca + :target: https://translation.odoo-community.org/projects/l10n-france-14-0/l10n-france-14-0-l10n_fr_fec_oca :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/121/12.0 + :target: https://runbot.odoo-community.org/runbot/121/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -39,7 +39,7 @@ FEC au format texte et non au format XML, car le format texte sera facilement lisible et vérifiable par le comptable en utilisant un tableur. La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel -*Test Compta Demat* version 1_00_05 disponible sur +*Test Compta Demat* version 1_00_06 disponible sur `le site de la direction générale des finances publiques ` en utilisant une base de donnée Odoo réelle. @@ -59,7 +59,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -90,6 +90,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/l10n-france `_ project on GitHub. +.. |maintainer-alexis-via| image:: https://github.com/alexis-via.png?size=40px + :target: https://github.com/alexis-via + :alt: alexis-via + +Current `maintainer `__: + +|maintainer-alexis-via| + +This module is part of the `OCA/l10n-france `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_fr_fec_oca/static/description/index.html b/l10n_fr_fec_oca/static/description/index.html index a04212926..302488e6f 100644 --- a/l10n_fr_fec_oca/static/description/index.html +++ b/l10n_fr_fec_oca/static/description/index.html @@ -367,7 +367,7 @@

France - FEC

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

Ce module permet de générer le fichier FEC tel que définit par l’arrêté du 29 Juillet 2013 portant modification des dispositions de l’article A. 47 A-1 du livre des procédures fiscales.

@@ -379,7 +379,7 @@

France - FEC

FEC au format texte et non au format XML, car le format texte sera facilement lisible et vérifiable par le comptable en utilisant un tableur.

La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel -Test Compta Demat version 1_00_05 disponible sur +Test Compta Demat version 1_00_06 disponible sur le site de la direction générale des finances publiques <http://www.economie.gouv.fr/dgfip/outil-test-des-fichiers-des-ecritures-comptables-fec> en utilisant une base de donnée Odoo réelle.

Table of contents

@@ -404,7 +404,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -429,7 +429,9 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

This module is part of the OCA/l10n-france project on GitHub.

+

Current maintainer:

+

alexis-via

+

This module is part of the OCA/l10n-france project on GitHub.

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

From c812c6228ea8b0ea328d8d107a8a0eb0b216ac39 Mon Sep 17 00:00:00 2001 From: Yves Le Doeuff Date: Fri, 14 May 2021 15:48:12 +0000 Subject: [PATCH 13/29] Translated using Weblate (French) Currently translated at 42.4% (28 of 66 strings) Translation: l10n-france-14.0/l10n-france-14.0-l10n_fr_fec_oca Translate-URL: https://translation.odoo-community.org/projects/l10n-france-14-0/l10n-france-14-0-l10n_fr_fec_oca/fr/ --- l10n_fr_fec_oca/i18n/fr.po | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/l10n_fr_fec_oca/i18n/fr.po b/l10n_fr_fec_oca/i18n/fr.po index e3b6f249f..adbdd4599 100644 --- a/l10n_fr_fec_oca/i18n/fr.po +++ b/l10n_fr_fec_oca/i18n/fr.po @@ -7,14 +7,15 @@ msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-09-17 13:45+0000\n" -"PO-Revision-Date: 2014-02-03 10:27+0000\n" -"Last-Translator: <>\n" +"PO-Revision-Date: 2021-05-14 18:47+0000\n" +"Last-Translator: Yves Le Doeuff \n" "Language-Team: \n" -"Language: \n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -64,17 +65,17 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_type_ids msgid "Account Types" -msgstr "" +msgstr "Types de comptes" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_ids msgid "Accounts" -msgstr "" +msgstr "Comptes" #. module: l10n_fr_fec_oca #: selection:account.fr.fec.oca,partner_option:0 msgid "All" -msgstr "" +msgstr "Tout" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -84,12 +85,12 @@ msgstr "Annuler" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Column" -msgstr "" +msgstr "Colonne" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Comment" -msgstr "" +msgstr "Commentaire" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -114,12 +115,12 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_uid msgid "Created by" -msgstr "" +msgstr "Créé par" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_date msgid "Created on" -msgstr "" +msgstr "Créé le" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -129,7 +130,7 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_range_id msgid "Date Range" -msgstr "" +msgstr "Période" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -169,12 +170,12 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__encoding msgid "Encoding" -msgstr "" +msgstr "Encodage" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_to msgid "End Date" -msgstr "" +msgstr "Date de fin" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__export_type @@ -194,9 +195,8 @@ msgstr "Fichier FEC" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -#, fuzzy msgid "FEC File Generation by OCA" -msgstr "Génération Fichier FEC" +msgstr "Génération Fichier FEC (OCA)" #. module: l10n_fr_fec_oca #: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:165 @@ -207,12 +207,12 @@ msgstr "Le FEC est uniquement pour les sociétés françaises !" #. module: l10n_fr_fec_oca #: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca msgid "Ficher Echange Informatise" -msgstr "" +msgstr "Fichier Echange Informatise" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__delimiter msgid "Field Delimiter" -msgstr "" +msgstr "Séparateur de champ" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__filename @@ -293,7 +293,7 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_option msgid "Partner Export Option" -msgstr "" +msgstr "Option d'export du partenaire" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -308,17 +308,17 @@ msgstr "" #. module: l10n_fr_fec_oca #: selection:account.fr.fec.oca,partner_option:0 msgid "Selected Account Types" -msgstr "" +msgstr "Types de comptes sélectionnés" #. module: l10n_fr_fec_oca #: selection:account.fr.fec.oca,partner_option:0 msgid "Selected Accounts" -msgstr "" +msgstr "Comptes sélectionnés" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_from msgid "Start Date" -msgstr "" +msgstr "Date de début" #. module: l10n_fr_fec_oca #: selection:account.fr.fec.oca,delimiter:0 @@ -328,12 +328,12 @@ msgstr "" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Technical Info" -msgstr "" +msgstr "Info technique" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "Technical Name" -msgstr "" +msgstr "Nom technique" #. module: l10n_fr_fec_oca #: selection:account.fr.fec.oca,encoding:0 From b4229a1d1ee711d31cfaa559364e47b44fd44bcb Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 28 May 2021 10:53:17 +0200 Subject: [PATCH 14/29] l10n_fr_fec_oca: support companies not subject to VAT --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 21 +++++--------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 760545ecd..8367e6831 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -177,22 +177,11 @@ def do_query_unaffected_earnings(self): return listrow def _get_siren(self, company): - """ - Dom-Tom are excluded from the EU's fiscal territory - Those regions do not have SIREN - sources: - https://www.service-public.fr/professionnels-entreprises/vosdroits/F23570 - http://www.douane.gouv.fr/articles/a11024-tva-dans-les-dom - """ - dom_tom_group = self.env.ref("l10n_fr.dom-tom") - is_dom_tom = company.country_id.code in dom_tom_group.country_ids.mapped("code") - if not is_dom_tom and not company.vat: - raise UserError(_("Missing VAT number for company %s") % company.name) - vat = company.vat.upper().replace(" ", "") - if not is_dom_tom and vat[0:2] != "FR": - raise UserError(_("FEC is for French companies only !")) - - siren = vat[4:13] if not is_dom_tom else "" + # Get SIREN from SIRET and not from VAT + # so that it also work on companies that are not subject to VAT + if not company.siret: + raise UserError(_("Missing SIRET on company %s.") % company.display_name) + siren = company.siret[:9] return siren def generate_fec(self): From 63b2cdfb11bb1dc95b504d274c370be3c9eae71d Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 10 Aug 2021 12:23:12 +0200 Subject: [PATCH 15/29] [REF] Fix pre-commit ignoring modules --- l10n_fr_fec_oca/__manifest__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 646bcbb41..2ab170a29 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -11,6 +11,7 @@ "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", "maintainers": ["alexis-via"], + "development_status": "Alpha", "website": "https://github.com/OCA/l10n-france", "depends": ["l10n_fr", "account", "date_range"], "external_dependencies": { From d3a5c16a0ff94dd21393785df2506434fe3152f6 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 10 Aug 2021 22:16:51 +0000 Subject: [PATCH 16/29] [UPD] README.rst --- l10n_fr_fec_oca/README.rst | 9 +++++++-- l10n_fr_fec_oca/static/description/index.html | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/README.rst index a6ff407fa..8b9fe9ec7 100644 --- a/l10n_fr_fec_oca/README.rst +++ b/l10n_fr_fec_oca/README.rst @@ -7,9 +7,9 @@ France - FEC !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png :target: https://odoo-community.org/page/development-status - :alt: Beta + :alt: Alpha .. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 @@ -43,6 +43,11 @@ La structure du fichier FEC généré par ce module a été vérifiée avec le l `le site de la direction générale des finances publiques ` en utilisant une base de donnée Odoo réelle. +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + **Table of contents** .. contents:: diff --git a/l10n_fr_fec_oca/static/description/index.html b/l10n_fr_fec_oca/static/description/index.html index 302488e6f..2cc858e16 100644 --- a/l10n_fr_fec_oca/static/description/index.html +++ b/l10n_fr_fec_oca/static/description/index.html @@ -367,7 +367,7 @@

France - FEC

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

+

Alpha License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

Ce module permet de générer le fichier FEC tel que définit par l’arrêté du 29 Juillet 2013 portant modification des dispositions de l’article A. 47 A-1 du livre des procédures fiscales.

@@ -382,6 +382,12 @@

France - FEC

Test Compta Demat version 1_00_06 disponible sur le site de la direction générale des finances publiques <http://www.economie.gouv.fr/dgfip/outil-test-des-fichiers-des-ecritures-comptables-fec> en utilisant une base de donnée Odoo réelle.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+

Table of contents

    From 52b7844a466d66653f224360c0b5f59fb1f6a96e Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 10 Aug 2021 22:17:04 +0000 Subject: [PATCH 17/29] l10n_fr_fec_oca 14.0.1.0.1 --- l10n_fr_fec_oca/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 2ab170a29..0474358a6 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -6,7 +6,7 @@ { "name": "France - FEC", "category": "Accounting", - "version": "14.0.1.0.0", + "version": "14.0.1.0.1", "license": "LGPL-3", "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", From 1adcfb9e7c290a6d0f374019083deb1013a5a5be Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 1 Sep 2021 22:51:51 +0200 Subject: [PATCH 18/29] Restore tests and remove Alpha status Unfuck the "Donald Trump" pull request: this is the real/serious work made by the anti-Donald Trump squad. --- l10n_fr_fec_oca/__manifest__.py | 1 - l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 0474358a6..b4013dfb9 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -11,7 +11,6 @@ "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", "maintainers": ["alexis-via"], - "development_status": "Alpha", "website": "https://github.com/OCA/l10n-france", "depends": ["l10n_fr", "account", "date_range"], "external_dependencies": { diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 8367e6831..b8af70bd1 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -3,6 +3,14 @@ # Copyright 2016-2020 Odoo SA (https://www.odoo.com/fr_FR/) # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +# This module is a fork of l10n_fr_fec from official addons +# (which itself was copied from OCA with my authorisation) +# The construction of SQL requests don't respect pylint E8103 +# The problem is that fixing this would require large changes in the code +# which would make this module a deeper fork of l10n_fr_fec +# and would make it more difficult to compare the 2 modules and port +# changes/improvements between each other +# pylint: skip-file import base64 import io @@ -184,6 +192,7 @@ def _get_siren(self, company): siren = company.siret[:9] return siren + # flake8: noqa: C901 def generate_fec(self): self.ensure_one() # We choose to implement the flat file instead of the XML @@ -610,7 +619,7 @@ def _csv_write_rows(self, rows): ) for row in rows: if encoding == "ascii": - for j, cell_content in enumerate(row): + for j, _cell_content in enumerate(row): row[j] = unidecode(row[j]) writer.writerow(row) From ccfa59fe043b5691d76ade3d0232283ed5dac3a7 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Thu, 2 Sep 2021 12:08:14 +0000 Subject: [PATCH 19/29] [UPD] Update l10n_fr_fec_oca.pot --- l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot | 41 ++++++++++++------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot index f95eb4eca..e084a4fd4 100644 --- a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot +++ b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * l10n_fr_fec_oca +# * l10n_fr_fec_oca # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -54,7 +54,7 @@ msgid "# 17" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,encoding:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__ascii msgid "ASCII" msgstr "" @@ -69,7 +69,7 @@ msgid "Accounts" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,partner_option:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__all msgid "All" msgstr "" @@ -194,12 +194,6 @@ msgstr "" msgid "FEC File Generation by OCA" msgstr "" -#. module: l10n_fr_fec_oca -#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:165 -#, python-format -msgid "FEC is for French companies only !" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca msgid "Ficher Echange Informatise" @@ -226,7 +220,7 @@ msgid "ID" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,encoding:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__iso8859_15 msgid "ISO-8859-15" msgstr "" @@ -261,9 +255,9 @@ msgid "Last Updated on" msgstr "" #. module: l10n_fr_fec_oca -#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:161 +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 #, python-format -msgid "Missing VAT number for company %s" +msgid "Missing SIRET on company %s." msgstr "" #. module: l10n_fr_fec_oca @@ -272,12 +266,12 @@ msgid "Montantdevise" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,export_type:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__nonofficial msgid "Non-official FEC report (posted and unposted entries)" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,export_type:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__official msgid "Official FEC report (posted entries only)" msgstr "" @@ -302,12 +296,12 @@ msgid "PieceRef" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,partner_option:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__types msgid "Selected Account Types" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,partner_option:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__accounts msgid "Selected Accounts" msgstr "" @@ -317,7 +311,7 @@ msgid "Start Date" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,delimiter:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__delimiter__tab msgid "Tab" msgstr "" @@ -332,7 +326,13 @@ msgid "Technical Name" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,encoding:0 +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 +#, python-format +msgid "The start date must be before the end date." +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__utf-8 msgid "UTF-8" msgstr "" @@ -345,4 +345,3 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" msgstr "" - From 7dfb1ab9a914bebcd4490b29a6ff69aa385093d4 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 2 Sep 2021 12:13:44 +0000 Subject: [PATCH 20/29] [UPD] README.rst --- l10n_fr_fec_oca/README.rst | 9 ++------- l10n_fr_fec_oca/static/description/index.html | 8 +------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/l10n_fr_fec_oca/README.rst b/l10n_fr_fec_oca/README.rst index 8b9fe9ec7..a6ff407fa 100644 --- a/l10n_fr_fec_oca/README.rst +++ b/l10n_fr_fec_oca/README.rst @@ -7,9 +7,9 @@ France - FEC !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status - :alt: Alpha + :alt: Beta .. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 @@ -43,11 +43,6 @@ La structure du fichier FEC généré par ce module a été vérifiée avec le l `le site de la direction générale des finances publiques ` en utilisant une base de donnée Odoo réelle. -.. IMPORTANT:: - This is an alpha version, the data model and design can change at any time without warning. - Only for development or testing purpose, do not use in production. - `More details on development status `_ - **Table of contents** .. contents:: diff --git a/l10n_fr_fec_oca/static/description/index.html b/l10n_fr_fec_oca/static/description/index.html index 2cc858e16..302488e6f 100644 --- a/l10n_fr_fec_oca/static/description/index.html +++ b/l10n_fr_fec_oca/static/description/index.html @@ -367,7 +367,7 @@

    France - FEC

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Alpha License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

    +

    Beta License: LGPL-3 OCA/l10n-france Translate me on Weblate Try me on Runbot

    Ce module permet de générer le fichier FEC tel que définit par l’arrêté du 29 Juillet 2013 portant modification des dispositions de l’article A. 47 A-1 du livre des procédures fiscales.

    @@ -382,12 +382,6 @@

    France - FEC

    Test Compta Demat version 1_00_06 disponible sur le site de la direction générale des finances publiques <http://www.economie.gouv.fr/dgfip/outil-test-des-fichiers-des-ecritures-comptables-fec> en utilisant une base de donnée Odoo réelle.

    -
    -

    Important

    -

    This is an alpha version, the data model and design can change at any time without warning. -Only for development or testing purpose, do not use in production. -More details on development status

    -

    Table of contents

      From 5595e23a2efdc55e03491ebe72bbea0fc49db470 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 2 Sep 2021 12:13:51 +0000 Subject: [PATCH 21/29] l10n_fr_fec_oca 14.0.1.0.2 --- l10n_fr_fec_oca/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index b4013dfb9..e01991a44 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -6,7 +6,7 @@ { "name": "France - FEC", "category": "Accounting", - "version": "14.0.1.0.1", + "version": "14.0.1.0.2", "license": "LGPL-3", "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", From 40c97cac241dd0cab83cbbef432febeb4c6acec0 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Thu, 2 Sep 2021 12:14:05 +0000 Subject: [PATCH 22/29] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: l10n-france-14.0/l10n-france-14.0-l10n_fr_fec_oca Translate-URL: https://translation.odoo-community.org/projects/l10n-france-14-0/l10n-france-14-0-l10n_fr_fec_oca/ --- l10n_fr_fec_oca/i18n/fr.po | 42 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/l10n_fr_fec_oca/i18n/fr.po b/l10n_fr_fec_oca/i18n/fr.po index adbdd4599..9b7c817ab 100644 --- a/l10n_fr_fec_oca/i18n/fr.po +++ b/l10n_fr_fec_oca/i18n/fr.po @@ -58,7 +58,7 @@ msgid "# 17" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,encoding:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__ascii msgid "ASCII" msgstr "" @@ -73,7 +73,7 @@ msgid "Accounts" msgstr "Comptes" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,partner_option:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__all msgid "All" msgstr "Tout" @@ -198,12 +198,6 @@ msgstr "Fichier FEC" msgid "FEC File Generation by OCA" msgstr "Génération Fichier FEC (OCA)" -#. module: l10n_fr_fec_oca -#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:165 -#, python-format -msgid "FEC is for French companies only !" -msgstr "Le FEC est uniquement pour les sociétés françaises !" - #. module: l10n_fr_fec_oca #: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca msgid "Ficher Echange Informatise" @@ -230,7 +224,7 @@ msgid "ID" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,encoding:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__iso8859_15 msgid "ISO-8859-15" msgstr "" @@ -265,10 +259,10 @@ msgid "Last Updated on" msgstr "" #. module: l10n_fr_fec_oca -#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:161 +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 #, python-format -msgid "Missing VAT number for company %s" -msgstr "Numéro de TVA manquant sur la société %s" +msgid "Missing SIRET on company %s." +msgstr "" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -276,12 +270,12 @@ msgid "Montantdevise" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,export_type:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__nonofficial msgid "Non-official FEC report (posted and unposted entries)" msgstr "Rapport FEC non-officiel (entrées postées et non-postées)" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,export_type:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__official msgid "Official FEC report (posted entries only)" msgstr "Rapport FEC officiel (entrées postées uniquement)" @@ -306,12 +300,12 @@ msgid "PieceRef" msgstr "" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,partner_option:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__types msgid "Selected Account Types" msgstr "Types de comptes sélectionnés" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,partner_option:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__accounts msgid "Selected Accounts" msgstr "Comptes sélectionnés" @@ -321,7 +315,7 @@ msgid "Start Date" msgstr "Date de début" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,delimiter:0 +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__delimiter__tab msgid "Tab" msgstr "" @@ -336,7 +330,13 @@ msgid "Technical Name" msgstr "Nom technique" #. module: l10n_fr_fec_oca -#: selection:account.fr.fec.oca,encoding:0 +#: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 +#, python-format +msgid "The start date must be before the end date." +msgstr "" + +#. module: l10n_fr_fec_oca +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__utf-8 msgid "UTF-8" msgstr "" @@ -350,6 +350,12 @@ msgstr "" msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" msgstr "" +#~ msgid "FEC is for French companies only !" +#~ msgstr "Le FEC est uniquement pour les sociétés françaises !" + +#~ msgid "Missing VAT number for company %s" +#~ msgstr "Numéro de TVA manquant sur la société %s" + #~ msgid "" #~ "The encoding of this text file is UTF-8. The structure of file is CSV " #~ "separated by pipe '|'." From 3a5006702de811709107cdecd1f30edd0ab3825a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 6 Oct 2022 16:16:15 +0200 Subject: [PATCH 23/29] l10n_fr_fec_oca: always exclude cancelled moves --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index b8af70bd1..c1e8bee96 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -84,7 +84,7 @@ class AccountFrFecOca(models.TransientModel): export_type = fields.Selection( [ ("official", "Official FEC report (posted entries only)"), - ("nonofficial", "Non-official FEC report (posted and unposted entries)"), + ("nonofficial", "Non-official FEC report (posted and draft entries)"), ], string="Export Type", required=True, @@ -159,9 +159,9 @@ def do_query_unaffected_earnings(self): """ # For official report: only use posted entries if self.export_type == "official": - sql_query += """ - AND am.state = 'posted' - """ + sql_query += " AND am.state = 'posted' " + else: + sql_query += " AND am.state IN ('draft', 'posted') " company = self.env.company formatted_date_from = fields.Date.to_string(self.date_from).replace("-", "") date_from = self.date_from @@ -284,9 +284,9 @@ def generate_fec(self): # For official report: only use posted entries if self.export_type == "official": - sql_query += """ - AND am.state = 'posted' - """ + sql_query += " AND am.state = 'posted' " + else: + sql_query += " AND am.state IN ('draft', 'posted') " sql_query += """ GROUP BY aml.account_id, aat.type @@ -463,9 +463,9 @@ def generate_fec(self): # For official report: only use posted entries if self.export_type == "official": - sql_query += """ - AND am.state = 'posted' - """ + sql_query += " AND am.state = 'posted' " + else: + sql_query += " AND am.state IN ('draft', 'posted') " sql_query += """ GROUP BY aml.account_id, aat.type, rp.id @@ -554,9 +554,9 @@ def generate_fec(self): # For official report: only use posted entries if self.export_type == "official": - sql_query += """ - AND am.state = 'posted' - """ + sql_query += " AND am.state = 'posted' " + else: + sql_query += " AND am.state IN ('draft', 'posted') " sql_query += """ ORDER BY From 835139b9a3a2bb2d1c94e8b0aed906db4df15a3a Mon Sep 17 00:00:00 2001 From: oca-ci Date: Sat, 15 Oct 2022 13:22:48 +0000 Subject: [PATCH 24/29] [UPD] Update l10n_fr_fec_oca.pot --- l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot index e084a4fd4..20a60ba64 100644 --- a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot +++ b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot @@ -267,7 +267,7 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__nonofficial -msgid "Non-official FEC report (posted and unposted entries)" +msgid "Non-official FEC report (posted and draft entries)" msgstr "" #. module: l10n_fr_fec_oca From 0b66185cc2e0932a724238d53921c13f9da1057a Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sat, 15 Oct 2022 13:27:27 +0000 Subject: [PATCH 25/29] l10n_fr_fec_oca 14.0.1.1.0 --- l10n_fr_fec_oca/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index e01991a44..68949c643 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -6,7 +6,7 @@ { "name": "France - FEC", "category": "Accounting", - "version": "14.0.1.0.2", + "version": "14.0.1.1.0", "license": "LGPL-3", "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", From 638e5ab688fa81f877ea5576bf81f049603b37a7 Mon Sep 17 00:00:00 2001 From: Weblate Date: Sat, 15 Oct 2022 13:27:34 +0000 Subject: [PATCH 26/29] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: l10n-france-14.0/l10n-france-14.0-l10n_fr_fec_oca Translate-URL: https://translation.odoo-community.org/projects/l10n-france-14-0/l10n-france-14-0-l10n_fr_fec_oca/ --- l10n_fr_fec_oca/i18n/fr.po | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/l10n_fr_fec_oca/i18n/fr.po b/l10n_fr_fec_oca/i18n/fr.po index 9b7c817ab..51f078ef8 100644 --- a/l10n_fr_fec_oca/i18n/fr.po +++ b/l10n_fr_fec_oca/i18n/fr.po @@ -271,8 +271,8 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__nonofficial -msgid "Non-official FEC report (posted and unposted entries)" -msgstr "Rapport FEC non-officiel (entrées postées et non-postées)" +msgid "Non-official FEC report (posted and draft entries)" +msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__official @@ -350,6 +350,9 @@ msgstr "" msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" msgstr "" +#~ msgid "Non-official FEC report (posted and unposted entries)" +#~ msgstr "Rapport FEC non-officiel (entrées postées et non-postées)" + #~ msgid "FEC is for French companies only !" #~ msgstr "Le FEC est uniquement pour les sociétés françaises !" From 9c05ab23d4c40aef7554dd8dddfb4470c45e6a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Thu, 15 Dec 2022 22:56:51 +0100 Subject: [PATCH 27/29] l10n_fr_fec_oca: add hook to customize aux fields --- l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 119 ++++++++++--------- 1 file changed, 61 insertions(+), 58 deletions(-) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index c1e8bee96..511292543 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -192,6 +192,66 @@ def _get_siren(self, company): siren = company.siret[:9] return siren + def _get_aux_fields(self, sql_args): + sql_aux_num_base = """ + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID' || rp.id, '') + ELSE replace(rp.ref, '|', '/') + END + """ + sql_aux_lib_base = """ + COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') + """ + if self.partner_option == "types": + sql_args["partner_account_type_ids"] = tuple( + self.partner_account_type_ids.ids + ) + return ( + """ + case when aat.id in %(partner_account_type_ids)s + then """ + + sql_aux_num_base + + """ + else '' + end + as CompAuxNum, + case when aat.id in %(partner_account_type_ids)s + then """ + + sql_aux_lib_base + + """ + else '' + end + as CompAuxLib, + """ + ) + elif self.partner_option == "accounts": + sql_args["partner_account_ids"] = tuple(self.partner_account_ids.ids) + return ( + """ + CASE WHEN aa.id IN %(partner_account_ids)s + THEN """ + + sql_aux_num_base + + """ + ELSE '' + END + AS CompAuxNum, + CASE WHEN aa.id IN %(partner_account_ids)s + THEN """ + + sql_aux_lib_base + + """ + ELSE '' + END + AS CompAuxLib, + """ + ) + else: + return ( + sql_aux_num_base + + "AS CompAuxNum, " + + sql_aux_lib_base + + "AS CompAuxLib," + ) + # flake8: noqa: C901 def generate_fec(self): self.ensure_one() @@ -353,64 +413,7 @@ def generate_fec(self): ): rows_to_write.append(unaffected_earnings_results) - sql_aux_num_base = """ - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID' || rp.id, '') - ELSE replace(rp.ref, '|', '/') - END - """ - sql_aux_lib_base = """ - COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') - """ - if self.partner_option == "types": - aux_fields = ( - """ - CASE WHEN aat.id IN %(partner_account_type_ids)s - THEN """ - + sql_aux_num_base - + """ - ELSE '' - END - AS CompAuxNum, - CASE WHEN aat.id IN %(partner_account_type_ids)s - THEN """ - + sql_aux_lib_base - + """ - ELSE '' - END - AS CompAuxLib, - """ - ) - sql_args["partner_account_type_ids"] = tuple( - self.partner_account_type_ids.ids - ) - elif self.partner_option == "accounts": - aux_fields = ( - """ - CASE WHEN aa.id IN %(partner_account_ids)s - THEN """ - + sql_aux_num_base - + """ - ELSE '' - END - AS CompAuxNum, - CASE WHEN aa.id IN %(partner_account_ids)s - THEN """ - + sql_aux_lib_base - + """ - ELSE '' - END - AS CompAuxLib, - """ - ) - sql_args["partner_account_ids"] = tuple(self.partner_account_ids.ids) - else: - aux_fields = ( - sql_aux_num_base - + "AS CompAuxNum, " - + sql_aux_lib_base - + "AS CompAuxLib," - ) + aux_fields = self._get_aux_fields(sql_args) aux_fields_ini_bal = aux_fields.replace("aa.id IN", "MIN(aa.id) IN").replace( "aat.id IN", "MIN(aat.id) IN" From ce1f10196e2589b2f9de2a9c7f2984f0eecb4941 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 9 Feb 2023 21:24:22 +0000 Subject: [PATCH 28/29] l10n_fr_fec_oca 14.0.1.1.1 --- l10n_fr_fec_oca/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 68949c643..4c1ec76fe 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -6,7 +6,7 @@ { "name": "France - FEC", "category": "Accounting", - "version": "14.0.1.1.0", + "version": "14.0.1.1.1", "license": "LGPL-3", "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", From 41a2eceee70eb69faf7748524ac4b59df87f9a75 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 16 Jun 2023 11:29:07 +0200 Subject: [PATCH 29/29] [MIG] l10n_fr_fec_oca: migration from 14 to 16 Add ir.rule to block user trying to get a FEC generated by another user who would have access to another company. --- l10n_fr_fec_oca/__manifest__.py | 3 +- l10n_fr_fec_oca/i18n/fr.po | 258 +++------------- l10n_fr_fec_oca/i18n/l10n_fr_fec.pot | 290 ------------------ l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot | 188 ++---------- l10n_fr_fec_oca/readme/DESCRIPTION.rst | 9 +- l10n_fr_fec_oca/readme/USAGE.rst | 2 +- l10n_fr_fec_oca/security/ir_rule.xml | 14 + l10n_fr_fec_oca/wizard/account_fr_fec_oca.py | 234 ++++++++------ .../wizard/account_fr_fec_oca_view.xml | 129 ++------ requirements.txt | 1 + .../odoo/addons/l10n_fr_fec_oca | 1 + setup/l10n_fr_fec_oca/setup.py | 6 + 12 files changed, 260 insertions(+), 875 deletions(-) delete mode 100644 l10n_fr_fec_oca/i18n/l10n_fr_fec.pot create mode 100644 l10n_fr_fec_oca/security/ir_rule.xml create mode 120000 setup/l10n_fr_fec_oca/odoo/addons/l10n_fr_fec_oca create mode 100644 setup/l10n_fr_fec_oca/setup.py diff --git a/l10n_fr_fec_oca/__manifest__.py b/l10n_fr_fec_oca/__manifest__.py index 4c1ec76fe..91b46d66b 100644 --- a/l10n_fr_fec_oca/__manifest__.py +++ b/l10n_fr_fec_oca/__manifest__.py @@ -6,7 +6,7 @@ { "name": "France - FEC", "category": "Accounting", - "version": "14.0.1.1.1", + "version": "16.0.1.0.0", "license": "LGPL-3", "summary": "Fichier d'Échange Informatisé (FEC) for France", "author": "Akretion,Odoo Community Association (OCA)", @@ -18,6 +18,7 @@ }, "data": [ "security/ir.model.access.csv", + "security/ir_rule.xml", "wizard/account_fr_fec_oca_view.xml", ], "installable": True, diff --git a/l10n_fr_fec_oca/i18n/fr.po b/l10n_fr_fec_oca/i18n/fr.po index 51f078ef8..ea379dd4d 100644 --- a/l10n_fr_fec_oca/i18n/fr.po +++ b/l10n_fr_fec_oca/i18n/fr.po @@ -1,71 +1,25 @@ -# Translation of OpenERP Server. +# Translation of Odoo Server. # This file contains the translation of the following modules: -# * l10n_fr_fec +# * l10n_fr_fec_oca # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 7.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 13:45+0000\n" -"PO-Revision-Date: 2021-05-14 18:47+0000\n" -"Last-Translator: Yves Le Doeuff \n" +"POT-Creation-Date: 2023-06-16 10:25+0000\n" +"PO-Revision-Date: 2023-06-16 10:37+0000\n" +"Last-Translator: Alexis de Lattre \n" "Language-Team: \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.3.2\n" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 10" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 11" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 12" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 13" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 14" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 15" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 16" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 17" -msgstr "" +"Plural-Forms: \n" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__ascii msgid "ASCII" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_type_ids -msgid "Account Types" -msgstr "Types de comptes" +msgstr "ASCII" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_ids @@ -75,7 +29,7 @@ msgstr "Comptes" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__all msgid "All" -msgstr "Tout" +msgstr "Tous" #. module: l10n_fr_fec_oca #: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form @@ -83,34 +37,9 @@ msgid "Cancel" msgstr "Annuler" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Column" -msgstr "Colonne" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Comment" -msgstr "Commentaire" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompAuxLib" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompAuxNum" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompteLib" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompteNum" -msgstr "" +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__company_id +msgid "Company" +msgstr "Société" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__create_uid @@ -122,50 +51,15 @@ msgstr "Créé par" msgid "Created on" msgstr "Créé le" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Credit" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_range_id msgid "Date Range" msgstr "Période" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "DateLet" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Debit" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__display_name msgid "Display Name" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureDate" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureLet" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureLib" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureNum" -msgstr "" +msgstr "Nom affiché" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__encoding @@ -185,19 +79,14 @@ msgstr "Type d'export" #. module: l10n_fr_fec_oca #: model:ir.actions.act_window,name:l10n_fr_fec_oca.account_fr_fec_oca_action #: model:ir.ui.menu,name:l10n_fr_fec_oca.account_fr_fec_oca_menu -msgid "FEC" -msgstr "" +msgid "FEC (OCA)" +msgstr "FEC (OCA)" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__fec_data msgid "FEC File" msgstr "Fichier FEC" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "FEC File Generation by OCA" -msgstr "Génération Fichier FEC (OCA)" - #. module: l10n_fr_fec_oca #: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca msgid "Ficher Echange Informatise" @@ -208,6 +97,17 @@ msgstr "Fichier Echange Informatise" msgid "Field Delimiter" msgstr "Séparateur de champ" +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,help:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_identifier +msgid "" +"Field on partner used for the column CompAuxNum. If you select 'Reference', " +"make sure all partners used in journal items have a Reference and that this " +"reference is unique." +msgstr "" +"Champ du partenaire utilisé pour la colonne CompAuxNum. Si vous sélectionnez " +"\"Référence\", assurez-vous que tous les partenaires utilisés dans les " +"écritures comptables ont une référence et que cette référence est unique." + #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__filename msgid "Filename" @@ -220,89 +120,66 @@ msgstr "Générer" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__id +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_identifier__id msgid "ID" -msgstr "" +msgstr "ID" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__iso8859_15 msgid "ISO-8859-15" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Idevise" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "JournalCode" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "JournalLib" -msgstr "" +msgstr "ISO-8859-15" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca____last_update msgid "Last Modified on" -msgstr "" +msgstr "Dernière modification le" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Dernière mise à jour par" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__write_date msgid "Last Updated on" -msgstr "" +msgstr "Dernière mise à jour le" #. module: l10n_fr_fec_oca +#. odoo-python #: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 #, python-format msgid "Missing SIRET on company %s." -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Montantdevise" -msgstr "" +msgstr "SIRET manquant sur la société %s." #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__nonofficial msgid "Non-official FEC report (posted and draft entries)" -msgstr "" +msgstr "Rapport FEC non officiel (écritures comptabilisées et brouillons)" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__official msgid "Official FEC report (posted entries only)" -msgstr "Rapport FEC officiel (entrées postées uniquement)" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Options" -msgstr "" +msgstr "Rapport FEC officiel (écritures comptabilisées uniquement)" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_option msgid "Partner Export Option" -msgstr "Option d'export du partenaire" +msgstr "Option d'export pour le partenaire" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "PieceDate" -msgstr "" +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_identifier +msgid "Partner Identifier" +msgstr "Identifiant du partenaire" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "PieceRef" -msgstr "" +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__receivable_payable +msgid "Receivable and Payable Accounts" +msgstr "Comptes client et fournisseur" #. module: l10n_fr_fec_oca -#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__types -msgid "Selected Account Types" -msgstr "Types de comptes sélectionnés" +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_identifier__ref +msgid "Reference" +msgstr "Référence" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__accounts @@ -317,51 +194,16 @@ msgstr "Date de début" #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__delimiter__tab msgid "Tab" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Technical Info" -msgstr "Info technique" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Technical Name" -msgstr "Nom technique" +msgstr "Tabulation" #. module: l10n_fr_fec_oca +#. odoo-python #: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 #, python-format msgid "The start date must be before the end date." -msgstr "" +msgstr "La date de début doit être antérieure à la date de fin." #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__utf-8 msgid "UTF-8" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "ValidDate" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" -msgstr "" - -#~ msgid "Non-official FEC report (posted and unposted entries)" -#~ msgstr "Rapport FEC non-officiel (entrées postées et non-postées)" - -#~ msgid "FEC is for French companies only !" -#~ msgstr "Le FEC est uniquement pour les sociétés françaises !" - -#~ msgid "Missing VAT number for company %s" -#~ msgstr "Numéro de TVA manquant sur la société %s" - -#~ msgid "" -#~ "The encoding of this text file is UTF-8. The structure of file is CSV " -#~ "separated by pipe '|'." -#~ msgstr "" -#~ "Ce fichier texte est encodé en UTF-8. Le format du fichier est CSV avec " -#~ "séparateur '|'." +msgstr "UTF-8" diff --git a/l10n_fr_fec_oca/i18n/l10n_fr_fec.pot b/l10n_fr_fec_oca/i18n/l10n_fr_fec.pot deleted file mode 100644 index 3d41fa5bd..000000000 --- a/l10n_fr_fec_oca/i18n/l10n_fr_fec.pot +++ /dev/null @@ -1,290 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * l10n_fr_fec -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server saas~11.5+e\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-17 13:45+0000\n" -"PO-Revision-Date: 2018-09-17 13:45+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: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 10" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 11" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 12" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 13" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 14" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 15" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 16" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "# 17" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Cancel" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Column" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Comment" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "CompAuxLib" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "CompAuxNum" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "CompteLib" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "CompteNum" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_uid -msgid "Created by" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__create_date -msgid "Created on" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Credit" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "DateLet" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Debit" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__display_name -msgid "Display Name" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "EcritureDate" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "EcritureLet" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "EcritureLib" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "EcritureNum" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_to -msgid "End Date" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__export_type -msgid "Export Type" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.actions.act_window,name:l10n_fr_fec.account_fr_fec_action -#: model:ir.ui.menu,name:l10n_fr_fec.account_fr_fec_menu -msgid "FEC" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__fec_data -msgid "FEC File" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "FEC File Generation" -msgstr "" - -#. module: l10n_fr_fec -#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:117 -#, python-format -msgid "FEC is for French companies only !" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model,name:l10n_fr_fec.model_account_fr_fec -msgid "Ficher Echange Informatise" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__filename -msgid "Filename" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Generate" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__id -msgid "ID" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Idevise" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "JournalCode" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "JournalLib" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec____last_update -msgid "Last Modified on" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_uid -msgid "Last Updated by" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__write_date -msgid "Last Updated on" -msgstr "" - -#. module: l10n_fr_fec -#: code:addons/l10n_fr_fec/wizard/account_fr_fec.py:114 -#, python-format -msgid "Missing VAT number for company %s" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Montantdevise" -msgstr "" - -#. module: l10n_fr_fec -#: selection:account.fr.fec,export_type:0 -msgid "Non-official FEC report (posted and unposted entries)" -msgstr "" - -#. module: l10n_fr_fec -#: selection:account.fr.fec,export_type:0 -msgid "Official FEC report (posted entries only)" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Options" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "PieceDate" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "PieceRef" -msgstr "" - -#. module: l10n_fr_fec -#: model:ir.model.fields,field_description:l10n_fr_fec.field_account_fr_fec__date_from -msgid "Start Date" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Technical Info" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "Technical Name" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "The encoding of this text file is UTF-8. The structure of file is CSV separated by pipe '|'." -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "ValidDate" -msgstr "" - -#. module: l10n_fr_fec -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec.account_fr_fec_view -msgid "We use partner.id" -msgstr "" - diff --git a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot index 20a60ba64..2200b9ef1 100644 --- a/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot +++ b/l10n_fr_fec_oca/i18n/l10n_fr_fec_oca.pot @@ -4,8 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-16 10:25+0000\n" +"PO-Revision-Date: 2023-06-16 10:25+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -13,56 +15,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 10" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 11" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 12" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 13" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 14" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 15" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 16" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "# 17" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__ascii msgid "ASCII" msgstr "" -#. module: l10n_fr_fec_oca -#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_type_ids -msgid "Account Types" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_account_ids msgid "Accounts" @@ -79,33 +36,8 @@ msgid "Cancel" msgstr "" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Column" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Comment" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompAuxLib" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompAuxNum" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompteLib" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "CompteNum" +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__company_id +msgid "Company" msgstr "" #. module: l10n_fr_fec_oca @@ -118,51 +50,16 @@ msgstr "" msgid "Created on" msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Credit" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__date_range_id msgid "Date Range" msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "DateLet" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Debit" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__display_name msgid "Display Name" msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureDate" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureLet" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureLib" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "EcritureNum" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__encoding msgid "Encoding" @@ -181,7 +78,7 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.actions.act_window,name:l10n_fr_fec_oca.account_fr_fec_oca_action #: model:ir.ui.menu,name:l10n_fr_fec_oca.account_fr_fec_oca_menu -msgid "FEC" +msgid "FEC (OCA)" msgstr "" #. module: l10n_fr_fec_oca @@ -189,11 +86,6 @@ msgstr "" msgid "FEC File" msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "FEC File Generation by OCA" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model,name:l10n_fr_fec_oca.model_account_fr_fec_oca msgid "Ficher Echange Informatise" @@ -204,6 +96,14 @@ msgstr "" msgid "Field Delimiter" msgstr "" +#. module: l10n_fr_fec_oca +#: model:ir.model.fields,help:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_identifier +msgid "" +"Field on partner used for the column CompAuxNum. If you select 'Reference', " +"make sure all partners used in journal items have a Reference and that this " +"reference is unique." +msgstr "" + #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__filename msgid "Filename" @@ -216,6 +116,7 @@ msgstr "" #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__id +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_identifier__id msgid "ID" msgstr "" @@ -224,21 +125,6 @@ msgstr "" msgid "ISO-8859-15" msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Idevise" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "JournalCode" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "JournalLib" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca____last_update msgid "Last Modified on" @@ -255,16 +141,12 @@ msgid "Last Updated on" msgstr "" #. module: l10n_fr_fec_oca +#. odoo-python #: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 #, python-format msgid "Missing SIRET on company %s." msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Montantdevise" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__export_type__nonofficial msgid "Non-official FEC report (posted and draft entries)" @@ -275,29 +157,24 @@ msgstr "" msgid "Official FEC report (posted entries only)" msgstr "" -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Options" -msgstr "" - #. module: l10n_fr_fec_oca #: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_option msgid "Partner Export Option" msgstr "" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "PieceDate" +#: model:ir.model.fields,field_description:l10n_fr_fec_oca.field_account_fr_fec_oca__partner_identifier +msgid "Partner Identifier" msgstr "" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "PieceRef" +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__receivable_payable +msgid "Receivable and Payable Accounts" msgstr "" #. module: l10n_fr_fec_oca -#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_option__types -msgid "Selected Account Types" +#: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__partner_identifier__ref +msgid "Reference" msgstr "" #. module: l10n_fr_fec_oca @@ -316,16 +193,7 @@ msgid "Tab" msgstr "" #. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Technical Info" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "Technical Name" -msgstr "" - -#. module: l10n_fr_fec_oca +#. odoo-python #: code:addons/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py:0 #, python-format msgid "The start date must be before the end date." @@ -335,13 +203,3 @@ msgstr "" #: model:ir.model.fields.selection,name:l10n_fr_fec_oca.selection__account_fr_fec_oca__encoding__utf-8 msgid "UTF-8" msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "ValidDate" -msgstr "" - -#. module: l10n_fr_fec_oca -#: model_terms:ir.ui.view,arch_db:l10n_fr_fec_oca.account_fr_fec_oca_form -msgid "We use partner.ref (w/ fallback on 'ID' + partner.id)" -msgstr "" diff --git a/l10n_fr_fec_oca/readme/DESCRIPTION.rst b/l10n_fr_fec_oca/readme/DESCRIPTION.rst index 8cc7d463c..e6838a6e3 100644 --- a/l10n_fr_fec_oca/readme/DESCRIPTION.rst +++ b/l10n_fr_fec_oca/readme/DESCRIPTION.rst @@ -12,6 +12,13 @@ FEC au format texte et non au format XML, car le format texte sera facilement lisible et vérifiable par le comptable en utilisant un tableur. La structure du fichier FEC généré par ce module a été vérifiée avec le logiciel -*Test Compta Demat* version 1_00_06 disponible sur +*Test Compta Demat* version 1_00_10b disponible sur `le site de la direction générale des finances publiques ` en utilisant une base de donnée Odoo réelle. + +Ce module est un fork du module *l10n_fr_fec* des addons officiels. Il ajoute plusieurs options pour la génération du FEC: + +* choix de l'encodage des caractères, +* choix du séparateur de champ, +* choix pour l'export du champ partenaire des lignes comptables, +* choix pour le code de partenaire. diff --git a/l10n_fr_fec_oca/readme/USAGE.rst b/l10n_fr_fec_oca/readme/USAGE.rst index 1e21b58bd..74aff22bb 100644 --- a/l10n_fr_fec_oca/readme/USAGE.rst +++ b/l10n_fr_fec_oca/readme/USAGE.rst @@ -1 +1 @@ -Pour générer le *FEC*, allez dans le menu *Invoicing > Reporting > France > FEC* qui va démarrer l'assistant de génération du FEC. +Pour générer le *FEC*, allez dans le menu *Invoicing > Reporting > France > FEC (OCA)* qui va démarrer l'assistant de génération du FEC. diff --git a/l10n_fr_fec_oca/security/ir_rule.xml b/l10n_fr_fec_oca/security/ir_rule.xml new file mode 100644 index 000000000..67c53b7da --- /dev/null +++ b/l10n_fr_fec_oca/security/ir_rule.xml @@ -0,0 +1,14 @@ + + + + + Multi-company FEC (OCA) + + [('company_id', 'in', company_ids)] + + diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py index 511292543..080c8d4a9 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca.py @@ -17,7 +17,7 @@ import logging from odoo import _, api, fields, models -from odoo.exceptions import UserError +from odoo.exceptions import AccessDenied, UserError from odoo.tools import float_is_zero logger = logging.getLogger(__name__) @@ -35,18 +35,38 @@ class AccountFrFecOca(models.TransientModel): _name = "account.fr.fec.oca" _description = "Ficher Echange Informatise" + _check_company_auto = True - date_range_id = fields.Many2one("date.range", string="Date Range") - date_from = fields.Date(string="Start Date", required=True) - date_to = fields.Date(string="End Date", required=True) + company_id = fields.Many2one( + "res.company", + ondelete="cascade", + required=True, + default=lambda self: self.env.company, + ) + date_range_id = fields.Many2one( + "date.range", + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + ) + date_from = fields.Date( + compute="_compute_dates", + string="Start Date", + required=True, + readonly=False, + store=True, + ) + date_to = fields.Date( + compute="_compute_dates", + string="End Date", + required=True, + readonly=False, + store=True, + ) encoding = fields.Selection( [ ("iso8859_15", "ISO-8859-15"), ("utf-8", "UTF-8"), - # ('cp500', 'EBCDIC'), ("ascii", "ASCII"), ], - string="Encoding", default="iso8859_15", required=True, ) @@ -61,47 +81,49 @@ class AccountFrFecOca(models.TransientModel): ) partner_option = fields.Selection( [ - ("types", "Selected Account Types"), + ("receivable_payable", "Receivable and Payable Accounts"), ("accounts", "Selected Accounts"), ("all", "All"), ], - default="types", + default="receivable_payable", required=True, string="Partner Export Option", ) - partner_account_type_ids = fields.Many2many( - "account.account.type", - string="Account Types", - default=lambda self: self._default_partner_account_type_ids(), - ) partner_account_ids = fields.Many2many( "account.account", string="Accounts", default=lambda self: self._default_partner_account_ids(), + check_company=True, + domain="[('company_id', '=', company_id)]", + ) + partner_identifier = fields.Selection( + [ + ("id", "ID"), + ("ref", "Reference"), + ], + required=True, + default="id", + help="Field on partner used for the column CompAuxNum. If you select " + "'Reference', make sure all partners used in journal items have a Reference " + "and that this reference is unique.", ) fec_data = fields.Binary("FEC File", readonly=True, attachment=True) - filename = fields.Char(string="Filename", size=256, readonly=True) + filename = fields.Char(size=256, readonly=True) export_type = fields.Selection( [ ("official", "Official FEC report (posted entries only)"), ("nonofficial", "Non-official FEC report (posted and draft entries)"), ], - string="Export Type", required=True, default="official", ) - @api.onchange("date_range_id") - def date_range_change(self): - if self.date_range_id: - self.date_from = self.date_range_id.date_start - self.date_to = self.date_range_id.date_end - - @api.model - def _default_partner_account_type_ids(self): - receivable = self.env.ref("account.data_account_type_receivable") - payable = self.env.ref("account.data_account_type_payable") - return receivable + payable + @api.depends("date_range_id") + def _compute_dates(self): + for wiz in self: + if wiz.date_range_id: + wiz.date_from = wiz.date_range_id.date_start + wiz.date_to = wiz.date_range_id.date_end @api.model def _default_partner_account_ids(self): @@ -111,7 +133,7 @@ def _default_partner_account_ids(self): ) return pay + rec - def do_query_unaffected_earnings(self): + def _do_query_unaffected_earnings(self): """Compute the sum of ending balances for all accounts that are of a type that does not bring forward the balance in new fiscal years. This is needed because we have to display only one line for the initial @@ -150,11 +172,10 @@ def do_query_unaffected_earnings(self): account_move_line aml LEFT JOIN account_move am ON am.id = aml.move_id JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id WHERE am.date < %(date_from)s AND am.company_id = %(company_id)s - AND aat.include_initial_balance IS NOT true + AND aa.include_initial_balance IS NOT true AND (aml.debit != 0 OR aml.credit != 0) """ # For official report: only use posted entries @@ -162,7 +183,7 @@ def do_query_unaffected_earnings(self): sql_query += " AND am.state = 'posted' " else: sql_query += " AND am.state IN ('draft', 'posted') " - company = self.env.company + company = self.company_id formatted_date_from = fields.Date.to_string(self.date_from).replace("-", "") date_from = self.date_from formatted_date_year = date_from.year @@ -193,68 +214,72 @@ def _get_siren(self, company): return siren def _get_aux_fields(self, sql_args): - sql_aux_num_base = """ - CASE WHEN rp.ref IS null OR rp.ref = '' - THEN COALESCE('ID' || rp.id, '') - ELSE replace(rp.ref, '|', '/') - END - """ - sql_aux_lib_base = """ - COALESCE(replace(replace(rp.name, '|', '/'), '\t', ''), '') + aux_dict = { + "auxlib": """ + COALESCE(REGEXP_REPLACE(replace(rp.name, '|', '/'), '[\\t\\r\\n]', ' ', 'g'), '') """ - if self.partner_option == "types": - sql_args["partner_account_type_ids"] = tuple( - self.partner_account_type_ids.ids - ) - return ( + } + if self.partner_identifier == "ref": + aux_dict[ + "auxnum" + ] = """ + CASE WHEN rp.ref IS null OR rp.ref = '' + THEN COALESCE('ID' || rp.id, '') + ELSE REGEXP_REPLACE(replace(rp.ref, '|', '/'), '[\\t\\r\\n]', ' ', 'g') + END + """ + else: + aux_dict["auxnum"] = """rp.id::text""" + + if self.partner_option == "receivable_payable": + aux_sql = ( """ - case when aat.id in %(partner_account_type_ids)s - then """ - + sql_aux_num_base - + """ - else '' - end - as CompAuxNum, - case when aat.id in %(partner_account_type_ids)s - then """ - + sql_aux_lib_base - + """ - else '' - end - as CompAuxLib, + CASE WHEN aa.account_type IN ('asset_receivable', 'liability_payable') + THEN %(auxnum)s + ELSE '' + END + AS CompAuxNum, + CASE WHEN aa.account_type IN ('asset_receivable', 'liability_payable') + THEN %(auxlib)s + ELSE '' + END + AS CompAuxLib, """ + % aux_dict ) elif self.partner_option == "accounts": sql_args["partner_account_ids"] = tuple(self.partner_account_ids.ids) - return ( + aux_sql = ( """ - CASE WHEN aa.id IN %(partner_account_ids)s - THEN """ - + sql_aux_num_base - + """ + CASE WHEN aa.id IN %%(partner_account_ids)s + THEN %(auxnum)s ELSE '' END AS CompAuxNum, - CASE WHEN aa.id IN %(partner_account_ids)s - THEN """ - + sql_aux_lib_base - + """ + CASE WHEN aa.id IN %%(partner_account_ids)s + THEN %(auxlib)s ELSE '' END AS CompAuxLib, """ + % aux_dict ) else: - return ( - sql_aux_num_base - + "AS CompAuxNum, " - + sql_aux_lib_base - + "AS CompAuxLib," + aux_sql = ( + """ + %(auxnum)s AS CompAuxNum, %(auxlib)s AS CompAuxLib, + """ + % aux_dict ) + return aux_sql # flake8: noqa: C901 def generate_fec(self): self.ensure_one() + if not ( + self.env.is_admin() or self.env.user.has_group("account.group_account_user") + ): + raise AccessDenied() # We choose to implement the flat file instead of the XML # file for 2 reasons : # 1) the XSD file impose to have the label on the account.move @@ -266,7 +291,7 @@ def generate_fec(self): if self.date_from >= self.date_to: raise UserError(_("The start date must be before the end date.")) - company = self.env.company + company = self.company_id header = [ "JournalCode", # 0 @@ -290,14 +315,20 @@ def generate_fec(self): ] rows_to_write = [header] - unaffected_earnings_xml_ref = self.env.ref("account.data_unaffected_earnings") + unaffected_earnings_account = self.env["account.account"].search( + [ + ("account_type", "=", "equity_unaffected"), + ("company_id", "=", company.id), + ], + limit=1, + ) # used to make sure that we add the unaffected earning initial balance # only once unaffected_earnings_line = True - if unaffected_earnings_xml_ref: + if unaffected_earnings_account: # compute the benefit/loss of last year to add in the # initial balance of the current year earnings account - unaffected_earnings_results = self.do_query_unaffected_earnings() + unaffected_earnings_results = self._do_query_unaffected_earnings() unaffected_earnings_line = False # INITIAL BALANCE other than payable/receivable @@ -334,11 +365,10 @@ def generate_fec(self): account_move_line aml LEFT JOIN account_move am ON am.id = aml.move_id JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id WHERE am.date < %(date_from)s AND am.company_id = %(company_id)s - AND aat.include_initial_balance IS true + AND aa.include_initial_balance IS true AND (aml.debit != 0 OR aml.credit != 0) """ @@ -349,9 +379,9 @@ def generate_fec(self): sql_query += " AND am.state IN ('draft', 'posted') " sql_query += """ - GROUP BY aml.account_id, aat.type + GROUP BY aml.account_id, aa.account_type HAVING round(sum(aml.balance), %(currency_digits)s) != 0 - AND aat.type not in ('receivable', 'payable') + AND aa.account_type not in ('asset_receivable', 'liability_payable') """ formatted_date_from = fields.Date.to_string(self.date_from).replace("-", "") currency_digits = 2 @@ -365,16 +395,13 @@ def generate_fec(self): "currency_digits": currency_digits, } - unaffected_earnings_type_id = self.env.ref( - "account.data_unaffected_earnings" - ).id self._cr.execute(sql_query, sql_args) for row in self._cr.fetchall(): listrow = list(row) account_id = listrow.pop() if not unaffected_earnings_line: account = self.env["account.account"].browse(account_id) - if account.user_type_id.id == unaffected_earnings_type_id: + if account.account_type == "equity_unaffected": # add the benefit/loss of previous fiscal year to # the first unaffected earnings account found. # Alexis note: on a normal accounting DB, we should @@ -411,6 +438,18 @@ def generate_fec(self): or unaffected_earnings_results[12] != "0,00" ) ): + # search an unaffected earnings account + unaffected_earnings_account = self.env["account.account"].search( + [ + ("account_type", "=", "equity_unaffected"), + ("company_id", "=", company.id), + ], + limit=1, + ) + + if unaffected_earnings_account: + unaffected_earnings_results[4] = unaffected_earnings_account.code + unaffected_earnings_results[5] = unaffected_earnings_account.name rows_to_write.append(unaffected_earnings_results) aux_fields = self._get_aux_fields(sql_args) @@ -455,11 +494,10 @@ def generate_fec(self): LEFT JOIN account_move am ON am.id=aml.move_id LEFT JOIN res_partner rp ON rp.id=aml.partner_id JOIN account_account aa ON aa.id = aml.account_id - LEFT JOIN account_account_type aat ON aa.user_type_id = aat.id WHERE am.date < %(date_from)s AND am.company_id = %(company_id)s - AND aat.include_initial_balance IS true + AND aa.include_initial_balance IS true AND (aml.debit != 0 OR aml.credit != 0) """ ) @@ -471,9 +509,9 @@ def generate_fec(self): sql_query += " AND am.state IN ('draft', 'posted') " sql_query += """ - GROUP BY aml.account_id, aat.type, rp.id + GROUP BY aml.account_id, aa.account_type, rp.ref, rp.id HAVING round(sum(aml.balance), %(currency_digits)s) != 0 - AND aat.type in ('receivable', 'payable') + AND aa.account_type in ('asset_receivable', 'liability_payable') """ self._cr.execute(sql_query, sql_args) @@ -486,25 +524,24 @@ def generate_fec(self): sql_query = ( """ SELECT - replace(replace(aj.code, '|', '/'), '\t', '') AS JournalCode, - replace(replace(aj.name, '|', '/'), '\t', '') AS JournalLib, - replace(replace(am.name, '|', '/'), '\t', '') AS EcritureNum, + REGEXP_REPLACE(replace(aj.code, '|', '/'), '[\\t\\r\\n]', ' ', 'g') AS JournalCode, + REGEXP_REPLACE(replace(aj.name, '|', '/'), '[\\t\\r\\n]', ' ', 'g') AS JournalLib, + REGEXP_REPLACE(replace(am.name, '|', '/'), '[\\t\\r\\n]', ' ', 'g') AS EcritureNum, TO_CHAR(am.date, 'YYYYMMDD') AS EcritureDate, aa.code AS CompteNum, - replace(replace(aa.name, '|', '/'), '\t', '') AS CompteLib, + REGEXP_REPLACE(replace(aa.name, '|', '/'), '[\\t\\r\\n]', ' ', 'g') AS CompteLib, """ + aux_fields + """ CASE WHEN am.ref IS null OR am.ref = '' THEN '-' - ELSE replace(replace(am.ref, '|', '/'), '\t', '') + ELSE REGEXP_REPLACE(replace(am.ref, '|', '/'), '[\\t\\r\\n]', ' ', 'g') END AS PieceRef, TO_CHAR(am.date, 'YYYYMMDD') AS PieceDate, CASE WHEN aml.name IS NULL OR aml.name = '' THEN '/' - WHEN aml.name SIMILAR TO '[\t|\\s|\n]*' THEN '/' - ELSE replace(replace(replace(replace( - aml.name, '|', '/'), '\t', ''), '\n', ''), '\r', '') + WHEN aml.name SIMILAR TO '[\\t|\\s|\\n]*' THEN '/' + ELSE REGEXP_REPLACE(replace(aml.name, '|', '/'), '[\\t\\n\\r]', ' ', 'g') END AS EcritureLib, replace( CASE WHEN aml.debit = 0 @@ -527,13 +564,13 @@ def generate_fec(self): END AS DateLet, TO_CHAR(am.date, 'YYYYMMDD') AS ValidDate, CASE - WHEN aml.amount_currency IS NULL OR aml.amount_currency = 0 + WHEN aml.currency_id IS NULL OR aml.currency_id = aml.company_currency_id OR aml.amount_currency IS NULL OR aml.amount_currency = 0 THEN '' ELSE replace(to_char( aml.amount_currency, '000000000000000D99'), '.', ',') END AS Montantdevise, CASE - WHEN aml.currency_id IS NULL + WHEN aml.currency_id IS NULL OR aml.currency_id = aml.company_currency_id OR aml.amount_currency IS NULL OR aml.amount_currency = 0 THEN '' ELSE rc.name END AS Idevise @@ -543,7 +580,6 @@ def generate_fec(self): LEFT JOIN res_partner rp ON rp.id=aml.partner_id JOIN account_journal aj ON aj.id = am.journal_id JOIN account_account aa ON aa.id = aml.account_id - JOIN account_account_type aat ON aat.id = aa.user_type_id LEFT JOIN res_currency rc ON rc.id = aml.currency_id LEFT JOIN account_full_reconcile rec ON rec.id = aml.full_reconcile_id @@ -583,7 +619,7 @@ def generate_fec(self): { "fec_data": base64.encodebytes(fecvalue), # Filename = FECYYYYMMDD where YYYMMDD is the closing date - "filename": "{}FEC{}{}.txt".format(siren, end_date, suffix), + "filename": "%sFEC%s%s.txt" % (siren, end_date, suffix), } ) diff --git a/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml b/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml index 2da35cbfe..200267218 100644 --- a/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml +++ b/l10n_fr_fec_oca/wizard/account_fr_fec_oca_view.xml @@ -6,115 +6,24 @@ account.fr.fec.oca.form account.fr.fec.oca -
      - - - - - - - - - - - - - - - - -
JournalLib - # 1# 1
EcritureNum
EcritureDate - # 3# 3
CompteNum
CompAuxNum # 6We use partner.idWe use partner.ref (w/ fallback on 'ID' + partner.id)
CompAuxLib
CompAuxNum # 6We use partner.ref (w/ fallback on 'ID' + partner.id)We use partner.ref (w/ fallback on 'ID' + partner.id)
CompAuxLib
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Technical NameColumnComment
JournalCode# 0
JournalLib# 1
EcritureNum# 2
EcritureDate# 3
CompteNum# 4
CompteLib# 5
CompAuxNum# 6We use partner.ref (w/ fallback on 'ID' + partner.id)
CompAuxLib# 7
PieceRef# 8
PieceDate# 9
EcritureLib# 10
Debit# 11
Credit# 12
EcritureLet# 13
DateLet# 14
ValidDate# 15
Montantdevise# 16
Idevise# 17
-
-
-
+ + + + + + + + + + + + + +