Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-opw-574522-port-mma into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-574522-port-mma/+merge/132647

Hello,

[Fix] : base_iban module: invalid literal Error when trying to save the Bank 
Accounts details without Account Number and BIC code

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: Value Error: invalid literal for int() with base 10: ''

   This branch fixes this issue.
   Code is forward port from 6.1

Thanks,
Mayur

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-574522-port-mma/+merge/132647
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-opw-574522-port-mma.
=== 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-11-02 05:18:20 +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