Merge lp:~akretion-team/openerp-french-localization/account-balance-ebp-csv-export-70 into lp:openerp-french-localization/7.0

Proposed by Alexis de Lattre
Status: Rejected
Rejected by: Sébastien BEAU - http://www.akretion.com
Proposed branch: lp:~akretion-team/openerp-french-localization/account-balance-ebp-csv-export-70
Merge into: lp:openerp-french-localization/7.0
Diff against target: 335 lines (+288/-0)
9 files modified
account_balance_ebp_csv_export/__init__.py (+24/-0)
account_balance_ebp_csv_export/__openerp__.py (+45/-0)
account_balance_ebp_csv_export/report/__init__.py (+23/-0)
account_balance_ebp_csv_export/report/report.xml (+35/-0)
account_balance_ebp_csv_export/report/trial_balance_ebp_csv.csv (+11/-0)
account_balance_ebp_csv_export/report/trial_balance_ebp_csv.py (+64/-0)
account_balance_ebp_csv_export/wizard/__init__.py (+23/-0)
account_balance_ebp_csv_export/wizard/trial_balance_wizard.py (+36/-0)
account_balance_ebp_csv_export/wizard/trial_balance_wizard_view.xml (+27/-0)
To merge this branch: bzr merge lp:~akretion-team/openerp-french-localization/account-balance-ebp-csv-export-70
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com Disapprove
Review via email: mp+237331@code.launchpad.net

Description of the change

Add module account_balance_ebp_csv_export

This module has been successully used by Akretion France (and 2 other companies) to transfer the end-of-fiscal-year balance to Teledec.fr in order to establish and tele-transmit the Liasse fiscale ! So, with this module, we can do a Liasse fiscale with OpenERP (and a Liasse fiscale software) in a fully automated way.

To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi Alexis

Are you sure report_aeroo depends is necessary in this module ?

Regards

Christophe.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I would prefer not to depend on report_aeroo... but I have quite a lot of experience of aeroo, that's why I developped it with aeroo.

Which alternative would you suggest to generate the CSV ? Use a reporting engine or not ?

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Ok, aeroo is used to generate the CSV file

Why not simply use Mako or Jinja2 to generate CSV file ?

Regards,

Revision history for this message
David BEAL (ak) (davidbeal) wrote :

Personnaly I don't have aeroo install on my PC

I really prefer small dependency like Mako or Jinja2 than aeroo

my 2 cents

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

By the way, I will probably not have the time to update the module in order to remove the dependency on report_aeroo. So, if some of you is ready to do the work, you will be more than welcomed !

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

line 326: the "or" doesn't feel right. Are you sure about that?

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :
review: Disapprove

Unmerged revisions

2. By Alexis de Lattre

Better module description
Update name of XMLID

1. By Alexis de Lattre

Add module account_balance_ebp_csv_export.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_balance_ebp_csv_export'
2=== added file 'account_balance_ebp_csv_export/__init__.py'
3--- account_balance_ebp_csv_export/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_balance_ebp_csv_export/__init__.py 2014-10-06 19:37:40 +0000
5@@ -0,0 +1,24 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# Account Balance EBP CSV export module for OpenERP
10+# Copyright (C) 2014 Akretion (http://www.akretion.com)
11+# @author Alexis de Lattre <alexis.delattre@akretion.com>
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+from . import report
29+from . import wizard
30
31=== added file 'account_balance_ebp_csv_export/__openerp__.py'
32--- account_balance_ebp_csv_export/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ account_balance_ebp_csv_export/__openerp__.py 2014-10-06 19:37:40 +0000
34@@ -0,0 +1,45 @@
35+# -*- encoding: utf-8 -*-
36+##############################################################################
37+#
38+# Account Balance EBP CSV export module for OpenERP
39+# Copyright (C) 2014 Akretion (http://www.akretion.com)
40+# @author Alexis de Lattre <alexis.delattre@akretion.com>
41+#
42+# This program is free software: you can redistribute it and/or modify
43+# it under the terms of the GNU Affero General Public License as
44+# published by the Free Software Foundation, either version 3 of the
45+# License, or (at your option) any later version.
46+#
47+# This program is distributed in the hope that it will be useful,
48+# but WITHOUT ANY WARRANTY; without even the implied warranty of
49+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+# GNU Affero General Public License for more details.
51+#
52+# You should have received a copy of the GNU Affero General Public License
53+# along with this program. If not, see <http://www.gnu.org/licenses/>.
54+#
55+##############################################################################
56+
57+
58+{
59+ 'name': 'Account Balance EBP CSV export',
60+ 'version': '0.1',
61+ 'category': 'Accounting & Finance',
62+ 'license': 'AGPL-3',
63+ 'description': """
64+Account Balance EBP CSV export
65+==============================
66+
67+This module adds a button *EBP csv File* next to the *Print* button on the Trial Balance wizard. The aim is to export the trial balance to software dedicated to the *Liasse fiscale* (French fiscal declaration) that accept CSV files from the popular EBP accounting software. This file has been tested with Teledec (https://www.teledec.fr/), which is a SaaS solution for the *Liasse fiscale* with support for EDI transmission.
68+
69+This module has been developped by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
70+ """,
71+ 'author': 'Akretion',
72+ 'website': 'http://www.akretion.com',
73+ 'depends': ['report_aeroo', 'account_financial_report_webkit'],
74+ 'data': [
75+ 'report/report.xml',
76+ 'wizard/trial_balance_wizard_view.xml'
77+ ],
78+ 'installable': True,
79+}
80
81=== added directory 'account_balance_ebp_csv_export/report'
82=== added file 'account_balance_ebp_csv_export/report/__init__.py'
83--- account_balance_ebp_csv_export/report/__init__.py 1970-01-01 00:00:00 +0000
84+++ account_balance_ebp_csv_export/report/__init__.py 2014-10-06 19:37:40 +0000
85@@ -0,0 +1,23 @@
86+# -*- encoding: utf-8 -*-
87+##############################################################################
88+#
89+# Account Trial Balance CSV module for OpenERP
90+# Copyright (C) 2014 Akretion (http://www.akretion.com)
91+# @author Alexis de Lattre <alexis.delattre@akretion.com>
92+#
93+# This program is free software: you can redistribute it and/or modify
94+# it under the terms of the GNU Affero General Public License as
95+# published by the Free Software Foundation, either version 3 of the
96+# License, or (at your option) any later version.
97+#
98+# This program is distributed in the hope that it will be useful,
99+# but WITHOUT ANY WARRANTY; without even the implied warranty of
100+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
101+# GNU Affero General Public License for more details.
102+#
103+# You should have received a copy of the GNU Affero General Public License
104+# along with this program. If not, see <http://www.gnu.org/licenses/>.
105+#
106+##############################################################################
107+
108+from . import trial_balance_ebp_csv
109
110=== added file 'account_balance_ebp_csv_export/report/report.xml'
111--- account_balance_ebp_csv_export/report/report.xml 1970-01-01 00:00:00 +0000
112+++ account_balance_ebp_csv_export/report/report.xml 2014-10-06 19:37:40 +0000
113@@ -0,0 +1,35 @@
114+<?xml version="1.0" encoding="utf-8"?>
115+
116+<!--
117+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
118+ @author: Alexis de Lattre <alexis.delattre@akretion.com>
119+ The licence is in the file __openerp__.py
120+-->
121+
122+<openerp>
123+<data>
124+
125+<record id="account_report_trial_balance_ebp_csv" model="ir.actions.report.xml">
126+ <field name="name">Trial Balance EBP CSV</field>
127+ <field name="report_name">account.report.trial.balance.ebp.csv</field>
128+ <field name="report_type">aeroo</field>
129+ <field name="in_format">genshi-raw</field>
130+ <field name="out_format" ref="report_aeroo.report_mimetypes_raw"/>
131+ <field name="charset">utf_8</field>
132+ <field name="fallback_false" eval="0"/>
133+ <field name="process_sep" eval="0"/>
134+ <field name="attachment_use" eval="0"/>
135+ <field name="styles_mode">default</field>
136+ <field name="rml" eval="0"/>
137+ <field name="parser_state">loc</field>
138+ <field name="parser_loc">account_balance_ebp_csv_export/report/trial_balance_ebp_csv.py</field>
139+ <field name="groups_id" eval="[(6,0,[])]"/>
140+ <field name="multi" eval="0"/>
141+ <field name="auto" eval="0"/>
142+ <field name="header" eval="0"/>
143+ <field name="model">account.account</field>
144+ <field name="report_rml">account_balance_ebp_csv_export/report/trial_balance_ebp_csv.csv</field>
145+</record>
146+
147+</data>
148+</openerp>
149
150=== added file 'account_balance_ebp_csv_export/report/trial_balance_ebp_csv.csv'
151--- account_balance_ebp_csv_export/report/trial_balance_ebp_csv.csv 1970-01-01 00:00:00 +0000
152+++ account_balance_ebp_csv_export/report/trial_balance_ebp_csv.csv 2014-10-06 19:37:40 +0000
153@@ -0,0 +1,11 @@
154+"Compte.Numero","Compte.Intitule","Balance.SldCptNDebit","Balance.SldCptNCredit","Balance.SldCptNSoldeD","Balance.SldCptNSoldeC"
155+{% for current_account in objects %}\
156+{% if current_account.to_display and current_account.type != 'view' %}\
157+\
158+"${current_account.code}",\
159+"${current_account.name}",\
160+${'%.2f' % current_account.debit},\
161+${'%.2f' % current_account.credit},\
162+${(current_account.credit - current_account.debit) >= 0 and ('0.00,%.2f' % (current_account.credit - current_account.debit)) or ('%.2f,0.00' % (current_account.debit - current_account.credit))}
163+{% end %}\
164+{% end %}
165
166=== added file 'account_balance_ebp_csv_export/report/trial_balance_ebp_csv.py'
167--- account_balance_ebp_csv_export/report/trial_balance_ebp_csv.py 1970-01-01 00:00:00 +0000
168+++ account_balance_ebp_csv_export/report/trial_balance_ebp_csv.py 2014-10-06 19:37:40 +0000
169@@ -0,0 +1,64 @@
170+# -*- encoding: utf-8 -*-
171+##############################################################################
172+#
173+# Author: Guewen Baconnier
174+# Copyright Camptocamp SA 2011
175+#
176+# This program is free software: you can redistribute it and/or modify
177+# it under the terms of the GNU Affero General Public License as
178+# published by the Free Software Foundation, either version 3 of the
179+# License, or (at your option) any later version.
180+#
181+# This program is distributed in the hope that it will be useful,
182+# but WITHOUT ANY WARRANTY; without even the implied warranty of
183+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184+# GNU Affero General Public License for more details.
185+#
186+# You should have received a copy of the GNU Affero General Public License
187+# along with this program. If not, see <http://www.gnu.org/licenses/>.
188+#
189+##############################################################################
190+
191+
192+from openerp.report import report_sxw
193+from openerp.tools.translate import _
194+import pooler
195+from datetime import datetime
196+
197+from account_financial_report_webkit.report.common_balance_reports\
198+ import CommonBalanceReportHeaderWebkit
199+
200+
201+def sign(number):
202+ return cmp(number, 0)
203+
204+
205+class Parser(report_sxw.rml_parse, CommonBalanceReportHeaderWebkit):
206+
207+ def __init__(self, cursor, uid, name, context):
208+ super(Parser, self).__init__(cursor, uid, name, context=context)
209+ self.pool = pooler.get_pool(self.cr.dbname)
210+ self.cursor = self.cr
211+
212+ self.localcontext.update({
213+ 'cr': cursor,
214+ 'uid': uid,
215+ 'report_name': _('Trial Balance'),
216+ 'display_account': self._get_display_account,
217+ 'display_account_raw': self._get_display_account_raw,
218+ 'filter_form': self._get_filter,
219+ 'target_move': self._get_target_move,
220+ 'display_target_move': self._get_display_target_move,
221+ 'accounts': self._get_accounts_br,
222+ 'date_time':
223+ self.formatLang(str(datetime.today()), date_time=True),
224+ })
225+
226+ def set_context(self, objects, data, ids, report_type=None):
227+ """Populate a ledger_lines attribute on each browse record that """
228+ """will be used by mako template"""
229+ objects, new_ids, context_report_values = self.compute_balance_data(
230+ data)
231+ self.localcontext.update(context_report_values)
232+ return super(Parser, self).set_context(
233+ objects, data, new_ids, report_type=report_type)
234
235=== added directory 'account_balance_ebp_csv_export/wizard'
236=== added file 'account_balance_ebp_csv_export/wizard/__init__.py'
237--- account_balance_ebp_csv_export/wizard/__init__.py 1970-01-01 00:00:00 +0000
238+++ account_balance_ebp_csv_export/wizard/__init__.py 2014-10-06 19:37:40 +0000
239@@ -0,0 +1,23 @@
240+# -*- encoding: utf-8 -*-
241+##############################################################################
242+#
243+# Account Balance EBP CSV export module for OpenERP
244+# Copyright (C) 2014 Akretion (http://www.akretion.com)
245+# @author Alexis de Lattre <alexis.delattre@akretion.com>
246+#
247+# This program is free software: you can redistribute it and/or modify
248+# it under the terms of the GNU Affero General Public License as
249+# published by the Free Software Foundation, either version 3 of the
250+# License, or (at your option) any later version.
251+#
252+# This program is distributed in the hope that it will be useful,
253+# but WITHOUT ANY WARRANTY; without even the implied warranty of
254+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
255+# GNU Affero General Public License for more details.
256+#
257+# You should have received a copy of the GNU Affero General Public License
258+# along with this program. If not, see <http://www.gnu.org/licenses/>.
259+#
260+##############################################################################
261+
262+from . import trial_balance_wizard
263
264=== added file 'account_balance_ebp_csv_export/wizard/trial_balance_wizard.py'
265--- account_balance_ebp_csv_export/wizard/trial_balance_wizard.py 1970-01-01 00:00:00 +0000
266+++ account_balance_ebp_csv_export/wizard/trial_balance_wizard.py 2014-10-06 19:37:40 +0000
267@@ -0,0 +1,36 @@
268+# -*- encoding: utf-8 -*-
269+##############################################################################
270+#
271+# Account Balance EBP CSV export module for OpenERP
272+# Copyright (C) 2014 Akretion (http://www.akretion.com)
273+# @author Alexis de Lattre <alexis.delattre@akretion.com>
274+#
275+# This program is free software: you can redistribute it and/or modify
276+# it under the terms of the GNU Affero General Public License as
277+# published by the Free Software Foundation, either version 3 of the
278+# License, or (at your option) any later version.
279+#
280+# This program is distributed in the hope that it will be useful,
281+# but WITHOUT ANY WARRANTY; without even the implied warranty of
282+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
283+# GNU Affero General Public License for more details.
284+#
285+# You should have received a copy of the GNU Affero General Public License
286+# along with this program. If not, see <http://www.gnu.org/licenses/>.
287+#
288+##############################################################################
289+
290+from openerp.osv import orm
291+
292+
293+class AccountTrialBalanceWizard(orm.TransientModel):
294+ _inherit = "trial.balance.webkit"
295+
296+ def _print_report(self, cursor, uid, ids, data, context=None):
297+ if context is None:
298+ context = {}
299+ res = super(AccountTrialBalanceWizard, self)._print_report(
300+ cursor, uid, ids, data, context=context)
301+ if context.get('export_type') == 'ebp-csv':
302+ res['report_name'] = 'account.report.trial.balance.ebp.csv'
303+ return res
304
305=== added file 'account_balance_ebp_csv_export/wizard/trial_balance_wizard_view.xml'
306--- account_balance_ebp_csv_export/wizard/trial_balance_wizard_view.xml 1970-01-01 00:00:00 +0000
307+++ account_balance_ebp_csv_export/wizard/trial_balance_wizard_view.xml 2014-10-06 19:37:40 +0000
308@@ -0,0 +1,27 @@
309+<?xml version="1.0" encoding="utf-8"?>
310+
311+<!--
312+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
313+ @author: Alexis de Lattre <alexis.delattre@akretion.com>
314+ The licence is in the file __openerp__.py
315+-->
316+
317+<openerp>
318+<data>
319+
320+<record id="account_trial_balance_view_webkit" model="ir.ui.view">
321+ <field name="name">trial.balance.ebp.csv.export</field>
322+ <field name="model">trial.balance.webkit</field>
323+ <field name="inherit_id" ref="account_financial_report_webkit.account_trial_balance_view_webkit" />
324+ <field name="arch" type="xml">
325+ <button name="check_report" position="after">
326+ or
327+ <button name="check_report"
328+ string="EBP csv File" type="object"
329+ context="{'export_type': 'ebp-csv'}"/>
330+ </button>
331+ </field>
332+</record>
333+
334+</data>
335+</openerp>

Subscribers

People subscribed via source and target branches