changeset 8330e903dc01 in modules/web_shop_vue_storefront:default
details:
https://hg.tryton.org/modules/web_shop_vue_storefront?cmd=changeset&node=8330e903dc01
description:
Remove forbidden chars from vsf
issue10683
review344641002
diffstat:
party.py | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diffs (45 lines):
diff -r cc74298c92eb -r 8330e903dc01 party.py
--- a/party.py Sun Aug 29 17:49:40 2021 +0200
+++ b/party.py Thu Sep 02 23:16:10 2021 +0200
@@ -16,6 +16,16 @@
from .web import split_name, join_name
+def remove_forbidden_chars(value):
+ from trytond.model.fields import Char
+ if value is None:
+ return value
+ for c in Char.forbidden_chars:
+ if c in value:
+ value = value.replace(c, ' ')
+ return value.strip()
+
+
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
@@ -62,12 +72,13 @@
Subdivision = pool.get('country.subdivision')
ContactMechanism = pool.get('party.contact_mechanism')
- name = join_name(data['firstname'], data['lastname'])
+ name = remove_forbidden_chars(
+ join_name(data['firstname'], data['lastname']))
party = for_party or self.party
if name != party.name:
self.party_name = name
self.street = '\n'.join(map(str, data['street']))
- self.city = data['city']
+ self.city = remove_forbidden_chars(data['city'])
if data['country_id']:
try:
self.country, = Country.search([
@@ -90,7 +101,7 @@
self.subdivision, = subdivisions
if data.get('telephone'):
- value = data['telephone']
+ value = remove_forbidden_chars(data['telephone'])
if phonenumbers:
try:
phonenumber = phonenumbers.parse(