diff --git a/product/ERP5/Document/BankAccount.py b/product/ERP5/Document/BankAccount.py
index 6a7db6b6bfe1a17a6b57a0e21d811a528a6b31c2..4486e63b7f3110ea0153443efbb0d7814bcbbc06 100755
--- a/product/ERP5/Document/BankAccount.py
+++ b/product/ERP5/Document/BankAccount.py
@@ -38,11 +38,14 @@ import string
 
 class BankAccount(Folder, Coordinate):
     """
-    A bank account number holds a collection of numbers and codes (ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
+      A bank account number holds a collection of numbers and codes
+        (ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
 
-    A Bank Account is owned by a Person or an Organisation. A Bank Account contain Agents with Agent Privileges used by the owner to delegate the management of the bank account to trusted third-party Persons.
+      A Bank Account is owned by a Person or an Organisation. A Bank Account
+        contain Agents with Agent Privileges used by the owner to delegate the
+        management of the bank account to trusted third-party Persons.
 
-    BankAccount inherits from Base and from the mix-in Coordinate.
+      BankAccount inherits from Base and from the mix-in Coordinate.
     """
 
     meta_type = 'ERP5 BankAccount'
@@ -128,10 +131,10 @@ class BankAccount(Folder, Coordinate):
         branch = self.getBranch()
         ban    = self.getBankAccountNumber()
         key    = self.getBbanKey()
-        if bank   == None: bank       = ''
-        if branch == None: branch     = ''
-        if ban    == None: account_id = ''
-        if key    == None: key        = ''
+        if bank   == None: bank   = ''
+        if branch == None: branch = ''
+        if ban    == None: ban    = ''
+        if key    == None: key    = ''
         return (bank + branch + ban + key).upper()
 
 
@@ -144,10 +147,10 @@ class BankAccount(Folder, Coordinate):
         branch = self.getBranch()
         ban    = self.getBankAccountNumber()
         key    = self.getBbanKey()
-        if bank   == None: bank       = ''
-        if branch == None: branch     = ''
-        if ban    == None: account_id = ''
-        if key    == None: key        = ''
+        if bank   == None: bank   = ''
+        if branch == None: branch = ''
+        if ban    == None: ban    = ''
+        if key    == None: key    = ''
         return sep.join([bank, branch, ban, key]).upper()
 
 
@@ -170,10 +173,12 @@ class BankAccount(Folder, Coordinate):
         if bank   == None: bank   = ''
         if branch == None: branch = ''
         if ban    == None: ban    = ''
+        if len(bank + branch + ban) == 0:
+          return ''
 
         bank   += ('0' * (5 - len(bank)))
         branch += ('0' * (5 - len(branch)))
 
         s = (bank + branch + ban).upper()
         key = str(97 - ((transcode(s) * 100) % 97))
-        return key.zfill(2)
+        return key.zfill(2)
\ No newline at end of file