[FIX] payment: render acquirer form values even if partner is missing

When no `partner_id` was passed to `render()` and the acquirer
had a fees computation method, (e.g. Paypal), it would crash.
Could happen when coming through the /website_payment/pay
controller, for instance.
This commit is contained in:
Olivier Dony
2016-06-13 19:21:02 +02:00
parent c95e46eedb
commit 0f5f960c60
+1 -1
View File
@@ -251,7 +251,7 @@ class PaymentAcquirer(osv.Model):
# compute fees
fees_method_name = '%s_compute_fees' % acquirer.provider
if hasattr(self, fees_method_name):
fees = getattr(self, fees_method_name)(cr, uid, id, values['amount'], values['currency_id'], values['partner_country_id'], context=None)
fees = getattr(self, fees_method_name)(cr, uid, id, values['amount'], values['currency_id'], values.get('partner_country_id'), context=None)
values['fees'] = float_round(fees, 2)
# call <name>_form_generate_values to update the tx dict with acqurier specific values