Browse Source

pre-fix ZIP with state code (if state assigned + code exists)

There are some countries (notably US + Canada) where the ZIP is
customarily prefixed with the two-letter state code.

Fixes: SYS#3625
for/master
Harald Welte 5 years ago
parent
commit
59dd4bde17
  1. 7
      models/dp_delivery_carrier.py

7
models/dp_delivery_carrier.py

@ -54,10 +54,15 @@ class DPDeliveryCarrier(models.Model):
street2 = None
if partner.street2:
street2 = partner.street2
# Countries like the US have state codes preceeding the ZIP
if partner.state_id and partner.state_id.code:
zipcode = "%s %s" % (partner.state_id.code, partner.zip)
else:
zipcode = partner.zip
addr = im.build_addr(street = street,
house = house,
additional = street2,
zipcode = partner.zip,
zipcode = zipcode,
city = partner.city,
country = country)
if partner.is_company:

Loading…
Cancel
Save