wip
This commit is contained in:
parent
38c01e014b
commit
5ee20f8291
|
|
@ -7,6 +7,9 @@ variables:
|
||||||
services:
|
services:
|
||||||
- docker:18.09-dind
|
- docker:18.09-dind
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- docker info
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- linting
|
- linting
|
||||||
- tests
|
- tests
|
||||||
|
|
|
||||||
|
|
@ -50,28 +50,31 @@ def install_from_csv(ctx, database):
|
||||||
)
|
)
|
||||||
odoo_instance = OdooInstance(ctx, database)
|
odoo_instance = OdooInstance(ctx, database)
|
||||||
|
|
||||||
|
default_country_code = ctx.obj["config"].get(
|
||||||
|
"default_country_code", False
|
||||||
|
)
|
||||||
if "account" in module_names:
|
if "account" in module_names:
|
||||||
# Then, set correct country to the company of the current user
|
# Then, set correct country to the company of the current user
|
||||||
# Otherwise, due to poor design of Odoo, when installing account
|
# Otherwise, due to poor design of Odoo, when installing account
|
||||||
# the US localization will be installed.
|
# the US localization will be installed.
|
||||||
# (l10n_us + l10n_generic_coa)
|
# (l10n_us + l10n_generic_coa)
|
||||||
country_code = ctx.obj["config"].get("default_country_code", "US")
|
|
||||||
countries = odoo_instance.browse_by_search(
|
countries = odoo_instance.browse_by_search(
|
||||||
"res.country",
|
"res.country",
|
||||||
[("code", "=", country_code)],
|
[("code", "=", default_country_code)],
|
||||||
)
|
)
|
||||||
if len(countries) != 1:
|
if len(countries) != 1:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Unable to find a country, based on the code %s."
|
"Unable to find a country, based on the code %s."
|
||||||
" countries found : %s "
|
" countries found : %s "
|
||||||
% (
|
% (
|
||||||
country_code,
|
default_country_code,
|
||||||
", ".join([x.name for x in countries]),
|
", ".join([x.name for x in countries]),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
logger.info(
|
logger.info(
|
||||||
"Configuring country of the main company with %s"
|
"Configuring country of the main company with #%d - %s"
|
||||||
% (countries[0].name)
|
% (countries[0].id, countries[0].name)
|
||||||
)
|
)
|
||||||
odoo_instance.env.user.company_id.country_id = countries[0].id
|
odoo_instance.env.user.company_id.country_id = countries[0].id
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user