[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:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user