From 803bd10eb95e4d5e8ab20e5eb4fe0ab4d6cee72e Mon Sep 17 00:00:00 2001 From: "Somesh Khare(OpenERP)" <> Date: Fri, 2 Nov 2012 10:45:16 +0530 Subject: [PATCH] [FIX]base_iban: invalid literal Error when trying to save the Bank Accounts details without Account Number and BIC code bzr revid: mma@tinyerp.com-20121102051516-99b3vc97xxhcqn30 --- addons/base_iban/base_iban.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index c29647a1176..ff492a8d34b 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -99,6 +99,8 @@ class res_partner_bank(osv.osv): @param iban: IBAN as string @return: True if IBAN is valid, False otherwise """ + if not iban: + return False iban = _format_iban(iban).lower() if iban[:2] in _ref_iban and len(iban) != len(_format_iban(_ref_iban[iban[:2]])): return False @@ -128,9 +130,9 @@ class res_partner_bank(osv.osv): def _construct_constraint_msg(self, cr, uid, ids, context=None): def default_iban_check(iban_cn): - return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase + return iban_cn and iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase - iban_country = self.browse(cr, uid, ids)[0].acc_number[:2].lower() + iban_country = self.browse(cr, uid, ids)[0].acc_number and self.browse(cr, uid, ids)[0].acc_number[:2].lower() if default_iban_check(iban_country): if iban_country in _ref_iban: return _('The IBAN does not seem to be correct. You should have entered something like this %s'), \