From dbf44a968016c5cd9836686e75224c805f9d104f Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 12 Jul 2016 15:47:45 +0200 Subject: [PATCH] [FIX] payment_paypal: country and state code required for paypal As explained in: -https://developer.paypal.com/docs/classic/api/country_codes/ -https://developer.paypal.com/docs/classic/api/state_codes/ The country and state code is required to create a paypal transaction. But in some cases, the complete name of the state/province is required. For example, for India, sometimes the complete name of the state is required. Check the list of those state/province in the documentation. Hint: form_preprocess_values opw:682872 --- addons/payment_paypal/models/paypal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/payment_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py index fa9c4e7a660..d66b55add50 100644 --- a/addons/payment_paypal/models/paypal.py +++ b/addons/payment_paypal/models/paypal.py @@ -119,8 +119,8 @@ class AcquirerPaypal(osv.Model): 'currency_code': tx_values['currency'] and tx_values['currency'].name or '', 'address1': partner_values['address'], 'city': partner_values['city'], - 'country': partner_values['country'] and partner_values['country'].name or '', - 'state': partner_values['state'] and partner_values['state'].name or '', + 'country': partner_values['country'] and partner_values['country'].code or '', + 'state': partner_values['state'] and (partner_values['state'].code or partner_values['state'].name) or '', 'email': partner_values['email'], 'zip': partner_values['zip'], 'first_name': partner_values['first_name'],