Merge lp:~pedro.baeza/banking-addons/bank-statement-reconcile-70-import_imp into lp:banking-addons/bank-statement-reconcile-70

Proposed by Pedro Manuel Baeza
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp
Approved revision: 110
Merged at revision: 127
Proposed branch: lp:~pedro.baeza/banking-addons/bank-statement-reconcile-70-import_imp
Merge into: lp:banking-addons/bank-statement-reconcile-70
Diff against target: 52 lines (+5/-16)
2 files modified
account_statement_base_import/statement.py (+5/-5)
account_statement_ofx_import/statement.py (+0/-11)
To merge this branch: bzr merge lp:~pedro.baeza/banking-addons/bank-statement-reconcile-70-import_imp
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Christophe Combelles (community) Approve
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+200022@code.launchpad.net

Description of the change

Improved system to inherit selection of the different import types, because as it was, you have to redefine the field on each extension module, due to OpenERP doesn't allow direct inheritance on selection methods.

Now, the selection method calls another private method that can be inherited without problems.

To post a comment you must log in.
109. By Pedro Manuel Baeza

[IMP] account_statement_base_import: Inheritable method with public name.

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

Nice, thanks

review: Approve
Revision history for this message
Christophe Combelles (ccomb) wrote :

It looks like a good idea, but it is broken :

return get_import_type selection(cr, uid, context=context)

review: Needs Fixing
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Cristophe, now it's working. Sorry for the mistake.

Regards.

Revision history for this message
Christophe Combelles (ccomb) wrote :

*sigh*

review: Disapprove
110. By Pedro Manuel Baeza

[FIX] account_statement_base_import: self reference calling method.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Please don't disapprove it, because that action is only used when the entire MP can't be merged. This only needed fixing that it's already done.

Regards.

Revision history for this message
Christophe Combelles (ccomb) wrote :

I've tried with only one filter module, and it allows to have it appear in the list.
Didn't have time to try with 2 filter modules though.
Renaming the selection field function is clever as it avoid to change all the filter modules around.
However there is no added unit test :'( This should be proposed in another MP maybe.

review: Approve
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

On each module that adds a selection type, you only have to make this:

        selection = super(AccountStatementProfil, self).get_import_type_selection(cr, uid, context=context)
        selection.append(('-', _('-')))

What is not assured is the order of the appended values.

Regards.

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

LGTM, thanks !

review: Approve (code review, no tests)

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-02-21 18:29:07 +0000
3+++ account_statement_base_import/statement.py 2014-02-24 22:45:51 +0000
4@@ -32,11 +32,12 @@
5 _inherit = "account.statement.profile"
6
7 def get_import_type_selection(self, cr, uid, context=None):
8- """
9- Has to be inherited to add parser
10- """
11+ """This is the method to be inherited for adding the parser"""
12 return [('generic_csvxls_so', 'Generic .csv/.xls based on SO Name')]
13
14+ def _get_import_type_selection(self, cr, uid, context=None):
15+ return self.get_import_type_selection(cr, uid, context=context)
16+
17 _columns = {
18 'launch_import_completion': fields.boolean(
19 "Launch completion after import",
20@@ -46,12 +47,11 @@
21 # we remove deprecated as it floods logs in standard/warning level sob...
22 'rec_log': fields.text('log', readonly=True), # Deprecated
23 'import_type': fields.selection(
24- get_import_type_selection,
25+ _get_import_type_selection,
26 'Type of import',
27 required=True,
28 help="Choose here the method by which you want to import bank"
29 "statement for this profile."),
30-
31 }
32
33 def _write_extra_statement_lines(
34
35=== modified file 'account_statement_ofx_import/statement.py'
36--- account_statement_ofx_import/statement.py 2013-11-04 12:22:39 +0000
37+++ account_statement_ofx_import/statement.py 2014-02-24 22:45:51 +0000
38@@ -33,14 +33,3 @@
39 context=context)
40 selection.append(('ofx_so', _('OFX - Open Financial Exchange')))
41 return selection
42-
43- _columns = {
44- 'import_type': fields.selection(
45- get_import_type_selection,
46- 'Type of import',
47- required=True,
48- help="Choose here the method by which you want to import bank"
49- "statement for this profile."),
50-
51- }
52-

Subscribers

People subscribed via source and target branches