Commit 9da864a6 authored by Kevin Deldycke's avatar Kevin Deldycke

Bug in Bank Account Numbers generation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3308 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3576f9ee
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment