[FIX] service: initialize_db: correctly set country

When we are creating a database with a country code from the database manager,
the country is not set in the company, so when we install the accounting app, there
is no chart of account installed by default. We have this bug because
we are trying to put a country id in a field that should receive a
'res.country' record.

To fix this bug, we change the call of function read_search by a search
that will return a recordset.

Bug introduced in rev https://github.com/odoo/odoo/commit/1b59643d4b96195edcdbe1b1168a11a3b6d85483
This commit is contained in:
Pierre Masereel
2016-09-09 15:39:40 +02:00
parent a5125cd1c4
commit 08ebf2cf61
+1 -1
View File
@@ -56,7 +56,7 @@ def _initialize_db(id, db_name, demo, lang, user_password, login='admin', countr
modules.update_translations(lang)
if country_code:
countries = env['res.country'].search_read([('code', 'ilike', country_code)], fields=['id'])
countries = env['res.country'].search([('code', 'ilike', country_code)])
if countries:
env['res.company'].browse(1).country_id = countries[0]