mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Ensure that the address is supplied for transactions. Strip invalid accented characters.
This commit is contained in:
@@ -230,6 +230,9 @@ class banking_export_hsbc_wizard(osv.osv_memory):
|
||||
if means is None:
|
||||
raise osv.except_osv('Error', "Invalid payment type mode for HSBC '%s'" % line.order_id.mode.type.name)
|
||||
|
||||
if not line.info_partner:
|
||||
raise osv.except_osv('Error', "No default address for transaction '%s'" % line.name)
|
||||
|
||||
try:
|
||||
return paymul.Transaction(
|
||||
amount=Decimal(str(line.amount_currency)),
|
||||
|
||||
@@ -23,6 +23,10 @@ from account_banking import sepa
|
||||
from decimal import Decimal
|
||||
import datetime
|
||||
import re
|
||||
import unicodedata
|
||||
|
||||
def strip_accents(string):
|
||||
return unicodedata.normalize('NFKD', unicode(string)).encode('ASCII', 'ignore')
|
||||
|
||||
def split_account_holder(holder):
|
||||
holder_parts = holder.split("\n")
|
||||
@@ -79,7 +83,7 @@ class LogicalSection(object):
|
||||
segments = self.segments()
|
||||
|
||||
def format_segment(segment):
|
||||
return '+'.join([':'.join([str(y) for y in x]) for x in segment]) + "'"
|
||||
return '+'.join([':'.join([str(strip_accents(y)) for y in x]) for x in segment]) + "'"
|
||||
|
||||
return "\n".join([format_segment(s) for s in segments])
|
||||
|
||||
@@ -574,3 +578,4 @@ class Transaction(LogicalSection, HasCurrency):
|
||||
segments.append(nad_segment)
|
||||
|
||||
return segments
|
||||
|
||||
|
||||
Reference in New Issue
Block a user