Somesh Khare(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-574522-skh into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574522-skh/+merge/104881

Hello Sir,

[Fix] : base_iban module: invalid literal Error when trying to save the Bank 
Accounts details without Account Number and BIC code (Case: Ref 574522).

Steps to reproduce:
--> Installed module base_iban and l10n_fr_rib
--> Open menu Sales/Configuration/Address Book/Bank Accounts
--> Select "Bank Account Type" = IBAN Account
--> And fill other necessary info and try to "SAVE"
--> Error Occurred as: ValueError: invalid literal for int() with base 10: ''

This branch fixes this issue.

Kindly review the branch and please share your views on it.

Thanks,
Somesh Khare
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574522-skh/+merge/104881
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-574522-skh.
=== modified file 'base_iban/base_iban.py'
--- base_iban/base_iban.py	2012-02-01 11:05:07 +0000
+++ base_iban/base_iban.py	2012-05-07 09:46:18 +0000
@@ -99,6 +99,8 @@
             @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 @@
     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'), \

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to