Skip to content

Commit 2a4318b

Browse files
authored
Respect the countries key from the manifest for auto installing modules in Odoo 17.0+ (#22)
1 parent 08e26bc commit 2a4318b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/doblib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "0.19.4"
1+
VERSION = "0.19.5"

src/doblib/module.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def check_auto_install(self, db_name):
115115
states = frozenset(("installed", "to install", "to upgrade"))
116116

117117
with self.env(db_name, False) as env:
118+
countries = env["res.company"].search([]).mapped("country_id")
119+
118120
domain = [("state", "=", "uninstalled"), ("auto_install", "=", True)]
119121
modules = env["ir.module.module"].search(domain)
120122
auto_install = {module: module.dependencies_id for module in modules}
@@ -124,6 +126,13 @@ def check_auto_install(self, db_name):
124126
while new_module:
125127
new_module = False
126128
for module, dependencies in auto_install.items():
129+
if (
130+
"country_ids" in module._fields
131+
and module.country_ids
132+
and not (module.country_ids & countries)
133+
):
134+
continue
135+
127136
if all(
128137
dep.state in states or dep.depend_id in to_install
129138
for dep in dependencies

0 commit comments

Comments
 (0)