- iban_example = iban_country in _ref_iban and _ref_iban[iban_country] + ' \nWhere A = Account number, B = National bank code, S = Branch code, C = account No, N = branch No, K = National check digits....' or ''
- return _('The IBAN does not seems to be correct. You should have entered something like this %s'), (iban_example)
- return _('The IBAN is invalid, It should begin with the country code'), ()
-
- def name_get(self, cr, uid, ids, context=None):
- res = []
- to_check_ids = []
- for id in self.browse(cr, uid, ids):
- if id.state=='iban':
- res.append((id.id,id.iban))
- else:
- to_check_ids.append(id.id)
- res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context)
- return res
-
- def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- #overwrite the search method in order to search not only on bank type == basic account number but also on type == iban
- res = super(res_partner_bank,self).search(cr, uid, args, offset, limit, order, context=context, count=count)
- if filter(lambda x:x[0]=='acc_number' ,args):
- #get the value of the search
- iban_value = filter(lambda x:x[0]=='acc_number' ,args)[0][2]
- #get the other arguments of the search
- args1 = filter(lambda x:x[0]!='acc_number' ,args)
- #add the new criterion
- args1 += [('iban','ilike',iban_value)]
- #append the results to the older search
- res += super(res_partner_bank,self).search(cr, uid, args1, offset, limit,
- order, context=context, count=count)
- return res
+ if iban_country in _ref_iban:
+ return _('The IBAN does not seem to be correct. You should have entered something like this %s'), \
+ ('%s \nWhere B = National bank code, S = Branch code,'\
+ ' C = Account No, K = Check digit' % _ref_iban[iban_country])
+ return _('This IBAN does not pass the validation check, please verify it'), ()
+ return _('The IBAN is invalid, it should begin with the country code'), ()
+
+ def _check_bank(self, cr, uid, ids, context=None):
+ for partner_bank in self.browse(cr, uid, ids, context=context):
+ if partner_bank.state == 'iban' and not partner_bank.bank.bic:
+ return False
+ return True