From 409970c188adaf79bc45c7e29b3b2e111c2c7775 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 26 Apr 2018 13:22:20 +0200 Subject: [PATCH] [FIX] payment: Error to get the default country for a partner When there was no company_id in the context and the company with id=1 didn't exist it generated an error. opw:1838932 --- addons/payment/models/payment_acquirer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 992049d074e..1e1eaa8e230 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -331,7 +331,9 @@ class PaymentTransaction(osv.Model): return [(language.code, language.name) for language in languages] def _default_partner_country_id(self, cr, uid, context=None): - comp = self.pool['res.company'].browse(cr, uid, context.get('company_id', 1), context=context) + Company = self.pool['res.company'] + company_id = Company.search(cr, uid, [], limit=1, order='id', context=context) + comp = Company.browse(cr, uid, context.get('company_id', company_id), context=context) return comp.country_id.id _columns = {