strip all leading + trailing spaces from address elements

Related: OS#5414
This commit is contained in:
Harald Welte 2021-04-18 10:13:18 +02:00
parent 9437a7c005
commit d6ab23e8a1
1 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,4 @@
from six import string_types
from openerp import api, fields, models
import logging
from openerp.exceptions import Warning
@ -64,6 +65,11 @@ def build_sc_addr(partner):
if 'phone' in addr and len(addr['phone']) > 15:
addr['phone'] = ''.join(c for c in addr['phone'] if c.isdigit())
# strip all leading or trailing spaces, see SYS#5414
for k in addr:
if isinstance(addr[k], string_types):
addr[k] = addr[k].strip()
return addr
class SCDeliveryCarrier(models.Model):