Merge lp:~akretion-team/banking-addons/bank-statement-reconcile-70-multi-statement into lp:banking-addons/bank-statement-reconcile-70

Proposed by Sébastien BEAU - http://www.akretion.com
Status: Superseded
Proposed branch: lp:~akretion-team/banking-addons/bank-statement-reconcile-70-multi-statement
Merge into: lp:banking-addons/bank-statement-reconcile-70
Diff against target: 59 lines (+14/-4) (has conflicts)
2 files modified
account_statement_base_import/statement.py (+12/-2)
account_statement_base_import/wizard/import_statement.py (+2/-2)
Text conflict in account_statement_base_import/statement.py
To merge this branch: bzr merge lp:~akretion-team/banking-addons/bank-statement-reconcile-70-multi-statement
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp Needs Resubmitting
Guewen Baconnier @ Camptocamp Needs Information
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Sébastien BEAU - http://www.akretion.com no test, code review Approve
Nicolas Bessi - Camptocamp Pending
Frederic Clementi - Camptocamp Pending
Review via email: mp+197761@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-07.

Description of the change

Hi,
In some case like the CFONB norme (French norme) many bank statement can be extracted from the same file.
So I need to change the signature in order to always work with a list of id, than in my can I am able to inherit everything and process all of my bank statement (http://bazaar.launchpad.net/~akretion-team/+junk/account_statement_cfonb/view/head:/account_statement_cfonb/statement.py)

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Thanks for the contribs !

My opinion on that one is that I prefer letting this method "def statement_import" as it is. His purpose is to import one single statement.

Why not simply adding a new method called "def multi_statement_import" that call the first one for each instance ?

This way, you reduce the risk of breaking others work by returning a dict instead of a int/long.

For this reason, I mark it as need fixing.

Regards,

Joël

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

Ok it's ok for me. We will propose a new solution using def multi_statement_import

104. By Florian da Costa

[FIX] Permit to handle multi statement with other module whithout changing the function import_statement

105. By Florian da Costa

[FIX] Call multi_statement_import in importation wizard

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

LGTM. It's ok for me. We do not change anymore the original API.

review: Approve (no test, code review)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Thanks for the changes, that looks good now !

Regards,

Joël

review: Approve (code review, no tests)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Why do you pass the context in the parser?

    result_row_list = parser.parse(file_stream, context=context)

review: Needs Information
Revision history for this message
Florian da Costa (florian-dacosta) wrote :
106. By Florian da Costa

[FIX] Fix file type when calling the statement_import function

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

There are conflicts please resubmit

review: Needs Resubmitting

Unmerged revisions

106. By Florian da Costa

[FIX] Fix file type when calling the statement_import function

105. By Florian da Costa

[FIX] Call multi_statement_import in importation wizard

104. By Florian da Costa

[FIX] Permit to handle multi statement with other module whithout changing the function import_statement

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

[IMP] give the possibility to return various bank statement. Indeed in some special case a file can containe various bank statement, like CFONB file which are the french standard for bank statement

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_statement_base_import/statement.py'
2--- account_statement_base_import/statement.py 2014-01-21 16:46:36 +0000
3+++ account_statement_base_import/statement.py 2014-02-12 09:42:23 +0000
4@@ -126,6 +126,7 @@
5 values['type'] = 'general'
6 return values
7
8+<<<<<<< TREE
9 def prepare_statement_vals(self, cr, uid, profile_id, result_row_list, parser, context):
10 """
11 Hook to build the values of the statement from the parser and
12@@ -135,6 +136,16 @@
13 vals.update(parser.get_st_vals())
14 return vals
15
16+=======
17+
18+ def multi_statement_import(self, cr, uid, ids, profile_id, file_stream,
19+ ftype="csv", context=None):
20+ statement_id = self.statement_import(cr, uid, ids, profile_id, file_stream,
21+ ftype=ftype, context=context)
22+ return [statement_id]
23+
24+
25+>>>>>>> MERGE-SOURCE
26 def statement_import(self, cr, uid, ids, profile_id, file_stream, ftype="csv", context=None):
27 """
28 Create a bank statement with the given profile and parser. It will fullfill the bank statement
29@@ -154,9 +165,8 @@
30 raise osv.except_osv(_("No Profile!"),
31 _("You must provide a valid profile to import a bank statement!"))
32 prof = prof_obj.browse(cr, uid, profile_id, context=context)
33-
34 parser = new_bank_statement_parser(prof.import_type, ftype=ftype)
35- result_row_list = parser.parse(file_stream)
36+ result_row_list = parser.parse(file_stream, context=context)
37 # Check all key are present in account.bank.statement.line!!
38 if not result_row_list:
39 raise osv.except_osv(_("Nothing to import"),
40
41=== modified file 'account_statement_base_import/wizard/import_statement.py'
42--- account_statement_base_import/wizard/import_statement.py 2013-12-04 14:10:49 +0000
43+++ account_statement_base_import/wizard/import_statement.py 2014-02-12 09:42:23 +0000
44@@ -99,7 +99,7 @@
45 ftype = self._check_extension(importer.file_name)
46 context['file_name'] = importer.file_name
47 sid = self.pool.get(
48- 'account.statement.profile').statement_import(
49+ 'account.statement.profile').multi_statement_import(
50 cr,
51 uid,
52 False,
53@@ -112,5 +112,5 @@
54 action_obj = self.pool.get('ir.actions.act_window')
55 action_id = model_obj.get_object_reference(cr, uid, 'account', 'action_bank_statement_tree')[1]
56 res = action_obj.read(cr, uid, action_id)
57- res['domain'] = res['domain'][:-1] + ",('id', '=', %d)]" % sid
58+ res['domain'] = res['domain'][:-1] + ",('id', 'in', %s)]" % sid
59 return res

Subscribers

People subscribed via source and target branches