Merge lp:~openerp-dev/openobject-addons/7.0-opw-596039-rha into lp:openobject-addons/7.0

Proposed by Rifakat Husen (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 9351
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-596039-rha
Merge into: lp:openobject-addons/7.0
Diff against target: 17 lines (+5/-2)
1 file modified
l10n_be_coda/l10n_be_coda.py (+5/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-596039-rha
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Disapprove
Naresh(OpenERP) (community) Approve
Houssine (community) reviewed and tested Approve
Review via email: mp+179162@code.launchpad.net

Description of the change

Incorrect search over iban account for a partner while importing the coda file. Coda file contains iban account
without spaces and in database iban accounts are saved with space in between so comparing coda file account(without space) with the iban account saved in db(with space) will always not be same and leads creation of the unneccessary bank account.

Fix: search ibank account after removing space.

To post a comment you must log in.
Revision history for this message
Houssine (houssine-bakkali) wrote :

reviewed and tested. thanks for the fix

review: Approve (reviewed and tested)
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

LGTM

review: Approve
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello,

Why doing it only for create and not for write ? If we want a matching space-insensitive, do it in the search on account number, not for this very specific case in l10n_be_coda.

review: Disapprove

Unmerged revisions

9351. By Rifakat Husen (OpenERP)

[FIX] l10n_be_coda: improper serach on iban account that leads to extra bank account creation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_be_coda/l10n_be_coda.py'
2--- l10n_be_coda/l10n_be_coda.py 2012-12-20 15:35:10 +0000
3+++ l10n_be_coda/l10n_be_coda.py 2013-08-08 11:27:12 +0000
4@@ -41,8 +41,11 @@
5 and the account number does not exist in the database
6 """
7 if 'partner_id' in data and data['partner_id'] and 'coda_account_number' in data and data['coda_account_number']:
8- acc_number_ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', data['coda_account_number'])])
9- if len(acc_number_ids) == 0:
10+ cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (data['coda_account_number'],))
11+ acc_number_ids = [id[0] for id in cr.fetchall()]
12+ # Filter bank accounts which are not allowed
13+ acc_number_ids = self.pool.get('res.partner.bank').search(cr, uid, [('id', 'in', acc_number_ids)])
14+ if not acc_number_ids:
15 try:
16 type_model, type_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'bank_normal')
17 type_id = self.pool.get('res.partner.bank.type').browse(cr, uid, type_id, context=context)