Merge lp:~akretion-team/banking-addons/bank-statement-reconcile-61-repository into lp:banking-addons/bank-statement-reconcile-61

Proposed by Benoit Guillot - http://www.akretion.com
Status: Rejected
Rejected by: Sébastien BEAU - http://www.akretion.com
Proposed branch: lp:~akretion-team/banking-addons/bank-statement-reconcile-61-repository
Merge into: lp:banking-addons/bank-statement-reconcile-61
Diff against target: 361 lines (+316/-0)
9 files modified
account_statement_repository/__init__.py (+26/-0)
account_statement_repository/__openerp__.py (+47/-0)
account_statement_repository/abstract_task.py (+33/-0)
account_statement_repository/file_document.py (+58/-0)
account_statement_repository/file_document_view.xml (+24/-0)
account_statement_repository/file_repository.py (+43/-0)
account_statement_repository/file_repository_view.xml (+24/-0)
account_statement_repository/statement.py (+40/-0)
account_statement_repository/statement_view.xml (+21/-0)
To merge this branch: bzr merge lp:~akretion-team/banking-addons/bank-statement-reconcile-61-repository
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp Needs Information
Nicolas Bessi - Camptocamp Pending
Guewen Baconnier @ Camptocamp Pending
Sébastien BEAU - http://www.akretion.com Pending
Review via email: mp+172366@code.launchpad.net

Description of the change

This merge proposal adds a module to import bank statement automaticaly from a repository (ftp, sftp, ...)
This module uses a generic module : file_repository from the project : https://code.launchpad.net/file-exchange

Thanks

To post a comment you must log in.
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

It's ok for me. Already in production :)

83. By Sébastien BEAU - http://www.akretion.com

[FIX] fix the file name use datas_fname instead of name

84. By Sébastien BEAU - http://www.akretion.com

[IMP] when importing a bank statement from a repository the file in not anymore attached but the file document is linked to the bank statement

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Benoit !

First, thank you very much for this MP and contribution. Your code seems ok for me. It's a very useful one. But I have a problem with the dependencies here.

Firstly, I don't want to merge a module in community addons if it depends on module that are not in the communtiy addons. Here, your rely on module in a branch called http://bazaar.launchpad.net/~akretion-team/file-exchange taht belong to Akretion team... Moreover: file_repository depends on 'file_autotask_rel' that depends on file_document and abstract_automatic_task and file_document that depends also on abstract_automatic_task.

Here I don't even find the abstract_automatic_task module in that branch.

So if I'm in favor of including this module in that project, I cannot accept that much dependencies on it that are not part of the communtiy addons. Community addons must rely only on other community one to ensure a proper quality.

For those reasons, I must refuse your proposal unless you remove the dependencies or include all of them in community addons.

I hope you understand our point of view here.

Regards,

Joël

review: Disapprove (c)
Revision history for this message
Benoit Guillot - http://www.akretion.com (benoit-guillot-z) wrote :

Hello Joël,

Thanks for your review.

About the branch file-exchange, it is because I didn't know exactly where to propose those modules. Indeed they are abstract so they can't take part of the different branches I found here : https://doc.openerp.com/v7.0/contribute/02_working_in_teams/

The modules are used for the exchange of files so they can be used in accounting with the bank statements, in logistic with a logistician, for the edi files of a carrier ...

I am totaly agreed for including the modules of the branch file-exchange in the community addons, this is their purpose !

We should discuss to decide if it's better to create a new branch or to include them in an existing one.

About the module abstract_automatic_task, it's in the branch : https://code.launchpad.net/~extra-addons-commiter/openobject-extension/oerp6.1-stable.
This branch is maintained by the extra-addons-commiter, so is it the same problem ?

Thanks again for your reply and explanations, hope we will find a way to include this module, it's very cool for the import of the bank statements !

Regards,

Benoît

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

Hi Joel, It's ok for us and we are fully agree to push all of our wrk in Community branch so the question is : "where we should include this module?". I think we need a specific projet right?
Regarding the abstract_automatic_task it's in openobject-extension, maybe we can also push this branch in the community one?

What do you think?

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

The right place to discuss of that should be in the community list I think, it will maybe ends with a new community project, or maybe we'll find an already existing project for them.

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Any updates here ?

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Nice module! I share Joel's opinion about the dependencies though.

If they were mine, I'd propose them to server-env-tools.

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

It seems that we're in the process of porting the file_exchange stuff in coordination with Akretion team. We also adding a module to import the statement lines using the generic connector (will allow importing thousands of records).

I see 2 possibilities here:

 * Or Akretion sumbmit a MP for file_exchange
 * Or we reject this MP

Thanks,

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

Hi,
First we will push in the community project 'file-exchange' on 7 version and make some improvement/change in order to respect the OCA standard.
Then if we have the time we will also clean up the version 6.1 and for a review to the community.

So for now we can reject the merge and focus on 7 version.

Unmerged revisions

84. By Sébastien BEAU - http://www.akretion.com

[IMP] when importing a bank statement from a repository the file in not anymore attached but the file document is linked to the bank statement

83. By Sébastien BEAU - http://www.akretion.com

[FIX] fix the file name use datas_fname instead of name

82. By Benoit Guillot - http://www.akretion.com

[ADD] add module to import account bank statement from a repository

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_statement_repository'
2=== added file 'account_statement_repository/__init__.py'
3--- account_statement_repository/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_statement_repository/__init__.py 2013-07-11 00:32:27 +0000
5@@ -0,0 +1,26 @@
6+# -*- coding: utf-8 -*-
7+###############################################################################
8+#
9+# account_statement_repository for OpenERP
10+# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
11+# @author Benoît GUILLOT <benoit.guillot@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+import file_document
29+import abstract_task
30+import file_repository
31+import statement
32
33=== added file 'account_statement_repository/__openerp__.py'
34--- account_statement_repository/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ account_statement_repository/__openerp__.py 2013-07-11 00:32:27 +0000
36@@ -0,0 +1,47 @@
37+# -*- coding: utf-8 -*-
38+###############################################################################
39+#
40+# account_statement_repository for OpenERP
41+# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
42+# @author Benoît GUILLOT <benoit.guillot@akretion.com>
43+#
44+# This program is free software: you can redistribute it and/or modify
45+# it under the terms of the GNU Affero General Public License as
46+# published by the Free Software Foundation, either version 3 of the
47+# License, or (at your option) any later version.
48+#
49+# This program is distributed in the hope that it will be useful,
50+# but WITHOUT ANY WARRANTY; without even the implied warranty of
51+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52+# GNU Affero General Public License for more details.
53+#
54+# You should have received a copy of the GNU Affero General Public License
55+# along with this program. If not, see <http://www.gnu.org/licenses/>.
56+#
57+###############################################################################
58+
59+
60+{
61+ 'name': 'account_statement_repository',
62+ 'version': '0.1',
63+ 'category': 'Generic Modules/Others',
64+ 'license': 'AGPL-3',
65+ 'description': """
66+ This module use tasks created with the module file_repository to import automaticaly account statements.
67+ The module file_repository is in the project : https://code.launchpad.net/file-exchange
68+ """,
69+ 'author': 'Akretion',
70+ 'website': 'http://www.akretion.com/',
71+ 'depends': ['file_repository',
72+ 'account_statement_base_import',
73+ ],
74+ 'init_xml': [],
75+ 'update_xml': [
76+ 'file_document_view.xml',
77+ 'file_repository_view.xml',
78+ 'statement_view.xml',
79+ ],
80+ 'demo_xml': [],
81+ 'installable': True,
82+ 'active': False,
83+}
84
85=== added file 'account_statement_repository/abstract_task.py'
86--- account_statement_repository/abstract_task.py 1970-01-01 00:00:00 +0000
87+++ account_statement_repository/abstract_task.py 2013-07-11 00:32:27 +0000
88@@ -0,0 +1,33 @@
89+# -*- coding: utf-8 -*-
90+###############################################################################
91+#
92+# account_statement_repository for OpenERP
93+# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
94+# @author Benoît GUILLOT <benoit.guillot@akretion.com>
95+#
96+# This program is free software: you can redistribute it and/or modify
97+# it under the terms of the GNU Affero General Public License as
98+# published by the Free Software Foundation, either version 3 of the
99+# License, or (at your option) any later version.
100+#
101+# This program is distributed in the hope that it will be useful,
102+# but WITHOUT ANY WARRANTY; without even the implied warranty of
103+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
104+# GNU Affero General Public License for more details.
105+#
106+# You should have received a copy of the GNU Affero General Public License
107+# along with this program. If not, see <http://www.gnu.org/licenses/>.
108+#
109+###############################################################################
110+
111+from openerp.osv import orm
112+
113+
114+class automatic_task(orm.Model):
115+ _inherit = "automatic.task"
116+
117+ def get_task_type(self, cr, uid, context=None):
118+ res = super(automatic_task, self).get_task_type(cr, uid, context=context)
119+ res.append(('bank_statement', 'Bank Statement Import'))
120+ return res
121+
122
123=== added file 'account_statement_repository/file_document.py'
124--- account_statement_repository/file_document.py 1970-01-01 00:00:00 +0000
125+++ account_statement_repository/file_document.py 2013-07-11 00:32:27 +0000
126@@ -0,0 +1,58 @@
127+# -*- coding: utf-8 -*-
128+###############################################################################
129+#
130+# account_statement_repository for OpenERP
131+# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
132+# @author Benoît GUILLOT <benoit.guillot@akretion.com>
133+#
134+# This program is free software: you can redistribute it and/or modify
135+# it under the terms of the GNU Affero General Public License as
136+# published by the Free Software Foundation, either version 3 of the
137+# License, or (at your option) any later version.
138+#
139+# This program is distributed in the hope that it will be useful,
140+# but WITHOUT ANY WARRANTY; without even the implied warranty of
141+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142+# GNU Affero General Public License for more details.
143+#
144+# You should have received a copy of the GNU Affero General Public License
145+# along with this program. If not, see <http://www.gnu.org/licenses/>.
146+#
147+###############################################################################
148+
149+from openerp.osv import fields, orm
150+import os
151+
152+
153+class file_document(orm.Model):
154+ _inherit = "file.document"
155+
156+ def get_file_document_type(self, cr, uid, context=None):
157+ res = super(file_document, self).get_file_document_type(cr, uid, context=context)
158+ res.append(('bank_statement', 'Bank Statement Import'))
159+ return res
160+
161+ _columns = {
162+ 'statement_profile_id': fields.many2one('account.statement.profile',
163+ string='Account Statement Profile')
164+ }
165+
166+ def _run(self, cr, uid, filedocument, context=None):
167+ if context is None:
168+ context = {}
169+ super(file_document, self)._run(cr, uid, filedocument, context=context)
170+ acc_profile_obj = self.pool['account.statement.profile']
171+ attach_obj = self.pool['ir.attachment']
172+ if filedocument.file_type == 'bank_statement':
173+ (shortname, ftype) = os.path.splitext(filedocument.datas_fname)
174+ ctx = context.copy()
175+ ctx['default_file_id'] = filedocument.id
176+ acc_profile_obj.statement_import(
177+ cr,
178+ uid,
179+ False,
180+ filedocument.statement_profile_id.id,
181+ filedocument.datas,
182+ ftype.replace('.', ''),
183+ context=ctx,
184+ )
185
186=== added file 'account_statement_repository/file_document_view.xml'
187--- account_statement_repository/file_document_view.xml 1970-01-01 00:00:00 +0000
188+++ account_statement_repository/file_document_view.xml 2013-07-11 00:32:27 +0000
189@@ -0,0 +1,24 @@
190+<?xml version="1.0" encoding="utf-8"?>
191+<openerp>
192+ <data>
193+
194+ <!-- INHERITED VIEW FOR THE OBJECT : file_document -->
195+
196+ <record id="file_document_view_form" model="ir.ui.view">
197+ <field name="name">bank_statement_repository.file_document.view_form</field>
198+ <field name="model">file.document</field>
199+ <field name="inherit_id" ref="file_repository.file_document_view_form" />
200+ <field name="type">form</field>
201+ <field name="arch" type="xml">
202+ <data>
203+ <field name="file_type" position="after">
204+ <field name="statement_profile_id"
205+ attrs="{'invisible':[('file_type', '!=', 'bank_statement')],
206+ 'required':[('file_type', '=', 'bank_statement')]}"/>
207+ </field>
208+ </data>
209+ </field>
210+ </record>
211+
212+ </data>
213+</openerp>
214
215=== added file 'account_statement_repository/file_repository.py'
216--- account_statement_repository/file_repository.py 1970-01-01 00:00:00 +0000
217+++ account_statement_repository/file_repository.py 2013-07-11 00:32:27 +0000
218@@ -0,0 +1,43 @@
219+# -*- coding: utf-8 -*-
220+###############################################################################
221+#
222+# account_statement_repository for OpenERP
223+# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
224+# @author Benoît GUILLOT <benoit.guillot@akretion.com>
225+#
226+# This program is free software: you can redistribute it and/or modify
227+# it under the terms of the GNU Affero General Public License as
228+# published by the Free Software Foundation, either version 3 of the
229+# License, or (at your option) any later version.
230+#
231+# This program is distributed in the hope that it will be useful,
232+# but WITHOUT ANY WARRANTY; without even the implied warranty of
233+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
234+# GNU Affero General Public License for more details.
235+#
236+# You should have received a copy of the GNU Affero General Public License
237+# along with this program. If not, see <http://www.gnu.org/licenses/>.
238+#
239+###############################################################################
240+
241+from openerp.osv import fields, orm
242+
243+
244+class repository_task(orm.Model):
245+ _inherit = "repository.task"
246+
247+ _columns = {
248+ 'statement_profile_id': fields.many2one('account.statement.profile',
249+ string='Account Statement Profile')
250+ }
251+
252+ def prepare_document_vals(self, cr, uid, task, file_name, datas, context=None):
253+ vals = super(repository_task, self).prepare_document_vals(cr, uid,
254+ task,
255+ file_name,
256+ datas,
257+ context=context)
258+ if task.type == 'bank_statement':
259+ vals.update({'file_type': task.type,
260+ 'statement_profile_id': task.statement_profile_id.id})
261+ return vals
262
263=== added file 'account_statement_repository/file_repository_view.xml'
264--- account_statement_repository/file_repository_view.xml 1970-01-01 00:00:00 +0000
265+++ account_statement_repository/file_repository_view.xml 2013-07-11 00:32:27 +0000
266@@ -0,0 +1,24 @@
267+<?xml version="1.0" encoding="utf-8"?>
268+<openerp>
269+ <data>
270+
271+ <!-- INHERITED VIEW FOR THE OBJECT : repository_task -->
272+
273+ <record id="view_repository_task_form" model="ir.ui.view">
274+ <field name="name">bank_statement_repository.repository_task.view_form</field>
275+ <field name="model">repository.task</field>
276+ <field name="inherit_id" ref="file_repository.view_repository_task_form" />
277+ <field name="type">form</field>
278+ <field name="arch" type="xml">
279+ <data>
280+ <field name="active" position="after">
281+ <field name="statement_profile_id"
282+ attrs="{'invisible':[('type', '!=', 'bank_statement')],
283+ 'required':[('type', '=', 'bank_statement')]}"/>
284+ </field>
285+ </data>
286+ </field>
287+ </record>
288+
289+ </data>
290+</openerp>
291
292=== added file 'account_statement_repository/statement.py'
293--- account_statement_repository/statement.py 1970-01-01 00:00:00 +0000
294+++ account_statement_repository/statement.py 2013-07-11 00:32:27 +0000
295@@ -0,0 +1,40 @@
296+# -*- coding: utf-8 -*-
297+###############################################################################
298+#
299+# account_statement_repository for OpenERP
300+# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
301+# @author Benoît GUILLOT <benoit.guillot@akretion.com>
302+#
303+# This program is free software: you can redistribute it and/or modify
304+# it under the terms of the GNU Affero General Public License as
305+# published by the Free Software Foundation, either version 3 of the
306+# License, or (at your option) any later version.
307+#
308+# This program is distributed in the hope that it will be useful,
309+# but WITHOUT ANY WARRANTY; without even the implied warranty of
310+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
311+# GNU Affero General Public License for more details.
312+#
313+# You should have received a copy of the GNU Affero General Public License
314+# along with this program. If not, see <http://www.gnu.org/licenses/>.
315+#
316+###############################################################################
317+
318+from openerp.osv import fields, orm
319+
320+class account_bank_statement(orm.Model):
321+ _inherit = "account.bank.statement"
322+
323+ _columns = {
324+ 'file_id': fields.many2one('file.document', string='File Document')
325+ }
326+
327+class AccountStatementProfil(orm.Model):
328+ _inherit = "account.statement.profile"
329+
330+ def _attach_file_stream(self, cr, uid, statement_id, file_stream, ftype, context=None):
331+ if context.get('default_file_id'):
332+ return True
333+ else:
334+ return super(account_bank_statement, self)._attach_file_stream(cr,
335+ uid, statement_id, file_stream, ftype, context=context)
336
337=== added file 'account_statement_repository/statement_view.xml'
338--- account_statement_repository/statement_view.xml 1970-01-01 00:00:00 +0000
339+++ account_statement_repository/statement_view.xml 2013-07-11 00:32:27 +0000
340@@ -0,0 +1,21 @@
341+<?xml version="1.0" encoding="utf-8"?>
342+<openerp>
343+ <data>
344+
345+ <!-- INHERITED VIEW FOR THE OBJECT : file_document -->
346+
347+ <record id="view_bank_statement_form" model="ir.ui.view">
348+ <field name="name">bank_statement_repository.account.bank.statement</field>
349+ <field name="model">account.bank.statement</field>
350+ <field name="inherit_id" ref="account_statement_ext.view_treasury_statement_form"/>
351+ <field name="type">form</field>
352+ <field name="arch" type="xml">
353+ <field name="profile_id" position="after">
354+ <field name="file_id"
355+ attrs="{'invisible':[('file_id', '=', False)]}"/>
356+ </field>
357+ </field>
358+ </record>
359+
360+ </data>
361+</openerp>

Subscribers

People subscribed via source and target branches