From aac8f9730ec7d6f9066eb96bcb945e6e27ef057a Mon Sep 17 00:00:00 2001 From: mreficent Date: Fri, 9 Feb 2018 09:53:57 +0100 Subject: [PATCH] [FIX] base: on_change_country() on res.company should return an ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the return value was sometimes an int and sometimes a browse record. Was PR #22810. Courtesy of Miquel Raïch (Eficent) --- addons/account/models/chart_template.py | 2 +- odoo/addons/base/res/res_company.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index ffae12f070c..7bb0718c6d7 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -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: diff --git a/odoo/addons/base/res/res_company.py b/odoo/addons/base/res/res_company.py index 81d0ac2a8e0..3a0ad5a1a14 100644 --- a/odoo/addons/base/res/res_company.py +++ b/odoo/addons/base/res/res_company.py @@ -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):