[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
This commit is contained in:
Somesh Khare(OpenERP) 2012-11-02 10:45:16 +05:30 committed by Mayur Maheshwari (OpenERP)
parent b006809773
commit 803bd10eb9
1 changed files with 4 additions and 2 deletions

View File

@ -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'), \