[FIX] base: on_change_country() on res.company should return an ID

Previously, the return value was sometimes an int and sometimes a browse record.
Was PR #22810. Courtesy of Miquel Raïch (Eficent)
This commit is contained in:
mreficent
2018-02-09 09:53:57 +01:00
committed by qdp-odoo
parent 1b5ecbb047
commit aac8f9730e
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -715,7 +715,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
if company_id:
company = self.env['res.company'].browse(company_id)
currency_id = company.on_change_country(company.country_id.id)['value']['currency_id']
res.update({'currency_id': currency_id.id})
res.update({'currency_id': currency_id})
chart_templates = account_chart_template.search([('visible', '=', True)])
if chart_templates:
+2 -2
View File
@@ -258,8 +258,8 @@ class Company(models.Model):
self.ensure_one()
currency_id = self._get_user_currency()
if country_id:
currency_id = self.env['res.country'].browse(country_id).currency_id.id
return {'value': {'currency_id': currency_id}}
currency_id = self.env['res.country'].browse(country_id).currency_id
return {'value': {'currency_id': currency_id.id}}
@api.onchange('country_id')
def _onchange_country_id_wrapper(self):