summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/models/authorize_request.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-01-25 15:41:45 +0100
committerChristophe Simonis <chs@odoo.com>2018-01-25 15:41:45 +0100
commitcb50970f3f88c5e5e4f0608c6d07e66eb4698eb9 (patch)
treefae668c499403db72b172b3c8802b869b1040ae7 /addons/payment_authorize/models/authorize_request.py
parentffaca543c47adf5d0286ff8e9eeb99b193948679 (diff)
parenteefe879a37aba221bda84adfd880fb7876955920 (diff)
[MERGE] forward port branch 11.0 up to eefe879a37a
Diffstat (limited to 'addons/payment_authorize/models/authorize_request.py')
-rw-r--r--addons/payment_authorize/models/authorize_request.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py
index 18c535aedcd..af710b280ba 100644
--- a/addons/payment_authorize/models/authorize_request.py
+++ b/addons/payment_authorize/models/authorize_request.py
@@ -154,6 +154,11 @@ class AuthorizeAPI():
etree.SubElement(payment_profile, "customerType").text = 'business' if partner.is_company else 'individual'
billTo = etree.SubElement(payment_profile, "billTo")
etree.SubElement(billTo, "address").text = (partner.street or '' + (partner.street2 if partner.street2 else '')) or None
+
+ missing_fields = [partner._fields[field].string for field in ['city', 'country_id', 'zip'] if not partner[field]]
+ if missing_fields:
+ raise ValidationError({'missing_fields': missing_fields})
+
etree.SubElement(billTo, "city").text = partner.city
etree.SubElement(billTo, "state").text = partner.state_id.name or None
etree.SubElement(billTo, "zip").text = partner.zip