mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
fix: validate IBAN only if it exists
This commit is contained in:
@@ -21,8 +21,6 @@ class BankAccount(Document):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_company()
|
self.validate_company()
|
||||||
|
|
||||||
if self.iban:
|
|
||||||
self.validate_iban()
|
self.validate_iban()
|
||||||
|
|
||||||
def validate_company(self):
|
def validate_company(self):
|
||||||
@@ -33,6 +31,10 @@ class BankAccount(Document):
|
|||||||
'''
|
'''
|
||||||
Algorithm: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN
|
Algorithm: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN
|
||||||
'''
|
'''
|
||||||
|
# IBAN field is optional
|
||||||
|
if not self.iban:
|
||||||
|
return
|
||||||
|
|
||||||
def encode_char(c):
|
def encode_char(c):
|
||||||
# Position in the alphabet (A=1, B=2, ...) plus nine
|
# Position in the alphabet (A=1, B=2, ...) plus nine
|
||||||
return str(9 + ord(c) - 64)
|
return str(9 + ord(c) - 64)
|
||||||
|
|||||||
Reference in New Issue
Block a user