summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2018-08-01 11:03:46 +0200
committerLucas Perais (lpe) <lpe@odoo.com>2018-08-01 14:40:39 +0200
commite17bc4eb37cfcf2deb262a1f97e9d62e3ca683f4 (patch)
treebbe78800b18ab720001c287e6f75c59fe8757434
parent17e50b745d15a668959de2b6416e7301a104f6bf (diff)
[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
-rw-r--r--odoo/service/db.py5
1 files changed, 4 insertions, 1 deletions
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}