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