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
=== added directory 'account_statement_repository'
=== added file 'account_statement_repository/__init__.py'
--- account_statement_repository/__init__.py 1970-01-01 00:00:00 +0000
+++ account_statement_repository/__init__.py 2013-07-11 00:32:27 +0000
@@ -0,0 +1,26 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# account_statement_repository for OpenERP
5# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
6# @author Benoît GUILLOT <benoit.guillot@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23import file_document
24import abstract_task
25import file_repository
26import statement
027
=== added file 'account_statement_repository/__openerp__.py'
--- account_statement_repository/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_statement_repository/__openerp__.py 2013-07-11 00:32:27 +0000
@@ -0,0 +1,47 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# account_statement_repository for OpenERP
5# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
6# @author Benoît GUILLOT <benoit.guillot@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23
24{
25 'name': 'account_statement_repository',
26 'version': '0.1',
27 'category': 'Generic Modules/Others',
28 'license': 'AGPL-3',
29 'description': """
30 This module use tasks created with the module file_repository to import automaticaly account statements.
31 The module file_repository is in the project : https://code.launchpad.net/file-exchange
32 """,
33 'author': 'Akretion',
34 'website': 'http://www.akretion.com/',
35 'depends': ['file_repository',
36 'account_statement_base_import',
37 ],
38 'init_xml': [],
39 'update_xml': [
40 'file_document_view.xml',
41 'file_repository_view.xml',
42 'statement_view.xml',
43 ],
44 'demo_xml': [],
45 'installable': True,
46 'active': False,
47}
048
=== added file 'account_statement_repository/abstract_task.py'
--- account_statement_repository/abstract_task.py 1970-01-01 00:00:00 +0000
+++ account_statement_repository/abstract_task.py 2013-07-11 00:32:27 +0000
@@ -0,0 +1,33 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# account_statement_repository for OpenERP
5# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
6# @author Benoît GUILLOT <benoit.guillot@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23from openerp.osv import orm
24
25
26class automatic_task(orm.Model):
27 _inherit = "automatic.task"
28
29 def get_task_type(self, cr, uid, context=None):
30 res = super(automatic_task, self).get_task_type(cr, uid, context=context)
31 res.append(('bank_statement', 'Bank Statement Import'))
32 return res
33
034
=== added file 'account_statement_repository/file_document.py'
--- account_statement_repository/file_document.py 1970-01-01 00:00:00 +0000
+++ account_statement_repository/file_document.py 2013-07-11 00:32:27 +0000
@@ -0,0 +1,58 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# account_statement_repository for OpenERP
5# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
6# @author Benoît GUILLOT <benoit.guillot@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23from openerp.osv import fields, orm
24import os
25
26
27class file_document(orm.Model):
28 _inherit = "file.document"
29
30 def get_file_document_type(self, cr, uid, context=None):
31 res = super(file_document, self).get_file_document_type(cr, uid, context=context)
32 res.append(('bank_statement', 'Bank Statement Import'))
33 return res
34
35 _columns = {
36 'statement_profile_id': fields.many2one('account.statement.profile',
37 string='Account Statement Profile')
38 }
39
40 def _run(self, cr, uid, filedocument, context=None):
41 if context is None:
42 context = {}
43 super(file_document, self)._run(cr, uid, filedocument, context=context)
44 acc_profile_obj = self.pool['account.statement.profile']
45 attach_obj = self.pool['ir.attachment']
46 if filedocument.file_type == 'bank_statement':
47 (shortname, ftype) = os.path.splitext(filedocument.datas_fname)
48 ctx = context.copy()
49 ctx['default_file_id'] = filedocument.id
50 acc_profile_obj.statement_import(
51 cr,
52 uid,
53 False,
54 filedocument.statement_profile_id.id,
55 filedocument.datas,
56 ftype.replace('.', ''),
57 context=ctx,
58 )
059
=== added file 'account_statement_repository/file_document_view.xml'
--- account_statement_repository/file_document_view.xml 1970-01-01 00:00:00 +0000
+++ account_statement_repository/file_document_view.xml 2013-07-11 00:32:27 +0000
@@ -0,0 +1,24 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!-- INHERITED VIEW FOR THE OBJECT : file_document -->
6
7 <record id="file_document_view_form" model="ir.ui.view">
8 <field name="name">bank_statement_repository.file_document.view_form</field>
9 <field name="model">file.document</field>
10 <field name="inherit_id" ref="file_repository.file_document_view_form" />
11 <field name="type">form</field>
12 <field name="arch" type="xml">
13 <data>
14 <field name="file_type" position="after">
15 <field name="statement_profile_id"
16 attrs="{'invisible':[('file_type', '!=', 'bank_statement')],
17 'required':[('file_type', '=', 'bank_statement')]}"/>
18 </field>
19 </data>
20 </field>
21 </record>
22
23 </data>
24</openerp>
025
=== added file 'account_statement_repository/file_repository.py'
--- account_statement_repository/file_repository.py 1970-01-01 00:00:00 +0000
+++ account_statement_repository/file_repository.py 2013-07-11 00:32:27 +0000
@@ -0,0 +1,43 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# account_statement_repository for OpenERP
5# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
6# @author Benoît GUILLOT <benoit.guillot@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23from openerp.osv import fields, orm
24
25
26class repository_task(orm.Model):
27 _inherit = "repository.task"
28
29 _columns = {
30 'statement_profile_id': fields.many2one('account.statement.profile',
31 string='Account Statement Profile')
32 }
33
34 def prepare_document_vals(self, cr, uid, task, file_name, datas, context=None):
35 vals = super(repository_task, self).prepare_document_vals(cr, uid,
36 task,
37 file_name,
38 datas,
39 context=context)
40 if task.type == 'bank_statement':
41 vals.update({'file_type': task.type,
42 'statement_profile_id': task.statement_profile_id.id})
43 return vals
044
=== added file 'account_statement_repository/file_repository_view.xml'
--- account_statement_repository/file_repository_view.xml 1970-01-01 00:00:00 +0000
+++ account_statement_repository/file_repository_view.xml 2013-07-11 00:32:27 +0000
@@ -0,0 +1,24 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!-- INHERITED VIEW FOR THE OBJECT : repository_task -->
6
7 <record id="view_repository_task_form" model="ir.ui.view">
8 <field name="name">bank_statement_repository.repository_task.view_form</field>
9 <field name="model">repository.task</field>
10 <field name="inherit_id" ref="file_repository.view_repository_task_form" />
11 <field name="type">form</field>
12 <field name="arch" type="xml">
13 <data>
14 <field name="active" position="after">
15 <field name="statement_profile_id"
16 attrs="{'invisible':[('type', '!=', 'bank_statement')],
17 'required':[('type', '=', 'bank_statement')]}"/>
18 </field>
19 </data>
20 </field>
21 </record>
22
23 </data>
24</openerp>
025
=== added file 'account_statement_repository/statement.py'
--- account_statement_repository/statement.py 1970-01-01 00:00:00 +0000
+++ account_statement_repository/statement.py 2013-07-11 00:32:27 +0000
@@ -0,0 +1,40 @@
1# -*- coding: utf-8 -*-
2###############################################################################
3#
4# account_statement_repository for OpenERP
5# Copyright (C) 2013 Akretion (http://www.akretion.com). All Rights Reserved
6# @author Benoît GUILLOT <benoit.guillot@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22
23from openerp.osv import fields, orm
24
25class account_bank_statement(orm.Model):
26 _inherit = "account.bank.statement"
27
28 _columns = {
29 'file_id': fields.many2one('file.document', string='File Document')
30 }
31
32class AccountStatementProfil(orm.Model):
33 _inherit = "account.statement.profile"
34
35 def _attach_file_stream(self, cr, uid, statement_id, file_stream, ftype, context=None):
36 if context.get('default_file_id'):
37 return True
38 else:
39 return super(account_bank_statement, self)._attach_file_stream(cr,
40 uid, statement_id, file_stream, ftype, context=context)
041
=== added file 'account_statement_repository/statement_view.xml'
--- account_statement_repository/statement_view.xml 1970-01-01 00:00:00 +0000
+++ account_statement_repository/statement_view.xml 2013-07-11 00:32:27 +0000
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!-- INHERITED VIEW FOR THE OBJECT : file_document -->
6
7 <record id="view_bank_statement_form" model="ir.ui.view">
8 <field name="name">bank_statement_repository.account.bank.statement</field>
9 <field name="model">account.bank.statement</field>
10 <field name="inherit_id" ref="account_statement_ext.view_treasury_statement_form"/>
11 <field name="type">form</field>
12 <field name="arch" type="xml">
13 <field name="profile_id" position="after">
14 <field name="file_id"
15 attrs="{'invisible':[('file_id', '=', False)]}"/>
16 </field>
17 </field>
18 </record>
19
20 </data>
21</openerp>

Subscribers

People subscribed via source and target branches