From e17bc4eb37cfcf2deb262a1f97e9d62e3ca683f4 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 1 Aug 2018 11:03:46 +0200 Subject: [PATCH] [FIX] base: set currency on a new db Open the web/database/manager and create a db with a country set. The country of the first company will be set to the country set on the form Before this commit, the currency was not set, eventhough it is a field on res.country After this commit, we also set the currency of the first company opw 1869435 closes #26097 --- odoo/service/db.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/odoo/service/db.py b/odoo/service/db.py index a90365c7201..2696905c170 100644 --- a/odoo/service/db.py +++ b/odoo/service/db.py @@ -58,7 +58,10 @@ def _initialize_db(id, db_name, demo, lang, user_password, login='admin', countr if country_code: countries = env['res.country'].search([('code', 'ilike', country_code)]) if countries: - env['res.company'].browse(1).country_id = countries[0] + comp_local = {'country_id': countries[0].id} + if countries[0].currency_id: + comp_local['currency_id'] = countries[0].currency_id.id + env['res.company'].browse(1).write(comp_local) # update admin's password and lang and login values = {'password': user_password, 'lang': lang}