Merge lp:~camptocamp/openerp-french-localization/6.1-add-nonofficial-export-mdh into lp:openerp-french-localization/6.1

Proposed by Matthieu Dietrich @ camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openerp-french-localization/6.1-add-nonofficial-export-mdh
Merge into: lp:openerp-french-localization/6.1
Diff against target: 105 lines (+46/-1)
4 files modified
l10n_fr_fec/i18n/fr.po (+14/-0)
l10n_fr_fec/i18n/l10n_fr_fec.pot (+14/-0)
l10n_fr_fec/wizard/fec.py (+17/-1)
l10n_fr_fec/wizard/fec_view.xml (+1/-0)
To merge this branch: bzr merge lp:~camptocamp/openerp-french-localization/6.1-add-nonofficial-export-mdh
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+253948@code.launchpad.net

Commit message

[ADD] non-official version of the export, with unposted entries

Description of the change

This PR is to add a new option to the FEC wizard, "non-official", which creates a similar FEC file but with unposted entries. The goal is to allow exporting to other financial software which can use the FEC format.

The file is also renamed to mark that it is not the official report.

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

lgtm / :+1:

can you

review: Approve (code review, no test)

Unmerged revisions

6. By Matthieu Dietrich @ camptocamp

[ADD] non-official version of the export, with unposted entries

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_fr_fec/i18n/fr.po'
--- l10n_fr_fec/i18n/fr.po 2014-03-25 17:10:43 +0000
+++ l10n_fr_fec/i18n/fr.po 2015-03-24 10:50:39 +0000
@@ -110,3 +110,17 @@
110msgid "FEC is for French companies only !"110msgid "FEC is for French companies only !"
111msgstr "Le FEC est uniquement pour les sociétés françaises !"111msgstr "Le FEC est uniquement pour les sociétés françaises !"
112112
113#. module: l10n_fr_fec
114#: selection:account.fr.fec,export_type:0
115msgid "Official FEC report (posted entries only)"
116msgstr "Rapport FEC officiel (entrées postées uniquement)"
117
118#. module: l10n_fr_fec
119#: selection:account.fr.fec,export_type:0
120msgid "Non-official FEC report (posted and unposted entries)"
121msgstr "Rapport FEC non-officiel (entrées postées et non-postées)"
122
123#. module: l10n_fr_fec
124#: field:account.fr.fec,export_type:0
125msgid "Export Type"
126msgstr "Type d'export"
113127
=== modified file 'l10n_fr_fec/i18n/l10n_fr_fec.pot'
--- l10n_fr_fec/i18n/l10n_fr_fec.pot 2014-03-25 17:10:43 +0000
+++ l10n_fr_fec/i18n/l10n_fr_fec.pot 2015-03-24 10:50:39 +0000
@@ -110,3 +110,17 @@
110msgid "FEC is for French companies only !"110msgid "FEC is for French companies only !"
111msgstr ""111msgstr ""
112112
113#. module: l10n_fr_fec
114#: selection:account.fr.fec,export_type:0
115msgid "Official FEC report (posted entries only)"
116msgstr ""
117
118#. module: l10n_fr_fec
119#: selection:account.fr.fec,export_type:0
120msgid "Non-official FEC report (posted and unposted entries)"
121msgstr ""
122
123#. module: l10n_fr_fec
124#: field:account.fr.fec,export_type:0
125msgid "Export Type"
126msgstr ""
113127
=== modified file 'l10n_fr_fec/wizard/fec.py'
--- l10n_fr_fec/wizard/fec.py 2014-11-28 15:36:24 +0000
+++ l10n_fr_fec/wizard/fec.py 2015-03-24 10:50:39 +0000
@@ -43,11 +43,16 @@
43 ('draft', 'Draft'),43 ('draft', 'Draft'),
44 ('done', 'Done'),44 ('done', 'Done'),
45 ], 'State'),45 ], 'State'),
46 'export_type': fields.selection([
47 ('official', 'Official FEC report (posted entries only)'),
48 ('nonofficial', 'Non-official FEC report (posted and unposted entries)'),
49 ], 'Export Type', required=True),
46 }50 }
4751
48 _defaults = {52 _defaults = {
49 'state': 'draft',53 'state': 'draft',
50 'type': 'is_ir_bic',54 'type': 'is_ir_bic',
55 'export_type': 'official',
51 }56 }
5257
53 def generate_fec(self, cr, uid, ids, context=None):58 def generate_fec(self, cr, uid, ids, context=None):
@@ -119,9 +124,17 @@
119 LEFT JOIN res_currency rc ON rc.id = aml.currency_id124 LEFT JOIN res_currency rc ON rc.id = aml.currency_id
120 WHERE125 WHERE
121 am.period_id IN %s126 am.period_id IN %s
122 AND am.state = 'posted'
123 AND am.company_id = %s127 AND am.company_id = %s
124 AND NOT (aml.credit = 0.0 AND aml.debit = 0.0)128 AND NOT (aml.credit = 0.0 AND aml.debit = 0.0)
129 '''
130
131 # For official report: only use posted entries
132 if cur_wiz.export_type == "official":
133 sql_query += '''
134 AND am.state = 'posted'
135 '''
136
137 sql_query += '''
125 ORDER BY138 ORDER BY
126 am.date,139 am.date,
127 CASE aj.type WHEN 'situation' THEN 1 ELSE 2 END,140 CASE aj.type WHEN 'situation' THEN 1 ELSE 2 END,
@@ -169,6 +182,9 @@
169 _("FEC is for French companies only !"))182 _("FEC is for French companies only !"))
170 siren = company.vat.replace(' ','')[4:13]183 siren = company.vat.replace(' ','')[4:13]
171 fy_end_date = cur_wiz.fiscalyear_id.date_stop.replace('-', '')184 fy_end_date = cur_wiz.fiscalyear_id.date_stop.replace('-', '')
185 # Append "-NONOFFICIAL" to the file name
186 if cur_wiz.export_type == "nonofficial":
187 fy_end_date += "-NONOFFICIAL"
172 fecvalue = fecfile.getvalue()188 fecvalue = fecfile.getvalue()
173 self.write(cr, uid, ids, {189 self.write(cr, uid, ids, {
174 'state': 'done',190 'state': 'done',
175191
=== modified file 'l10n_fr_fec/wizard/fec_view.xml'
--- l10n_fr_fec/wizard/fec_view.xml 2014-03-26 15:00:07 +0000
+++ l10n_fr_fec/wizard/fec_view.xml 2015-03-24 10:50:39 +0000
@@ -16,6 +16,7 @@
16 <group states="draft" col="2">16 <group states="draft" col="2">
17 <field name="fiscalyear_id" />17 <field name="fiscalyear_id" />
18 <field name="type"/>18 <field name="type"/>
19 <field name="export_type"/>
19 </group>20 </group>
20 <newline/>21 <newline/>
21 <group states="done" col="2">22 <group states="done" col="2">

Subscribers

People subscribed via source and target branches