mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
fix: validate IBAN only if it exists
This commit is contained in:
@@ -21,9 +21,7 @@ class BankAccount(Document):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_company()
|
self.validate_company()
|
||||||
|
self.validate_iban()
|
||||||
if self.iban:
|
|
||||||
self.validate_iban()
|
|
||||||
|
|
||||||
def validate_company(self):
|
def validate_company(self):
|
||||||
if self.is_company_account and not self.company:
|
if self.is_company_account and not self.company:
|
||||||
@@ -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