[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
This commit is contained in:
Goffin Simon
2018-04-26 15:14:26 +02:00
parent c9e7433c23
commit 409970c188
+3 -1
View File
@@ -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 = {