mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_banking: moved check on SEPA countries from iban.__init__ to
iban.valid to ease tests
This commit is contained in:
@@ -277,12 +277,8 @@ class IBAN(str):
|
|||||||
Sanity check: don't offer extensions unless the base is sound.
|
Sanity check: don't offer extensions unless the base is sound.
|
||||||
'''
|
'''
|
||||||
super(IBAN, self).__init__()
|
super(IBAN, self).__init__()
|
||||||
# Rearrange position of country code and check digits
|
|
||||||
if self.countrycode not in self.countries:
|
if self.countrycode not in self.countries:
|
||||||
self.BBAN_format = self.unknown_BBAN_format
|
self.BBAN_format = self.unknown_BBAN_format
|
||||||
raise Warning, \
|
|
||||||
'Don\'t know how to format BBAN for country %s' % \
|
|
||||||
self.countrycode
|
|
||||||
else:
|
else:
|
||||||
self.BBAN_format = self.BBAN_formats[self.countrycode]
|
self.BBAN_format = self.BBAN_formats[self.countrycode]
|
||||||
|
|
||||||
@@ -326,7 +322,8 @@ class IBAN(str):
|
|||||||
Check if the string + check digits deliver a valid checksum
|
Check if the string + check digits deliver a valid checksum
|
||||||
'''
|
'''
|
||||||
_buffer = self[4:] + self[:4]
|
_buffer = self[4:] + self[:4]
|
||||||
return int(base36_to_base10str(_buffer)) % 97 == 1
|
return self.countrycode in self.countries and \
|
||||||
|
int(base36_to_base10str(_buffer)) % 97 == 1
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import pooler
|
|||||||
import base64
|
import base64
|
||||||
from datetime import datetime, date, timedelta
|
from datetime import datetime, date, timedelta
|
||||||
from account_banking import sepa
|
from account_banking import sepa
|
||||||
#from osv import osv
|
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
#import pdb; pdb.set_trace()
|
#import pdb; pdb.set_trace()
|
||||||
import clieop
|
import clieop
|
||||||
@@ -298,6 +297,7 @@ def _create_clieop(self, cursor, uid, data, context):
|
|||||||
kwargs['messages'] = [line.communication2]
|
kwargs['messages'] = [line.communication2]
|
||||||
other_account_nr = line.bank_id.acc_number
|
other_account_nr = line.bank_id.acc_number
|
||||||
iban = sepa.IBAN(other_account_nr)
|
iban = sepa.IBAN(other_account_nr)
|
||||||
|
# Is this an IBAN account?
|
||||||
if iban.valid:
|
if iban.valid:
|
||||||
if iban.countrycode != 'NL':
|
if iban.countrycode != 'NL':
|
||||||
raise wizard.except_wizard(
|
raise wizard.except_wizard(
|
||||||
|
|||||||
Reference in New Issue
Block a user