odoo / docker

Other
933 stars 1.52k forks source link

Problem creating new database with Odoo 16 with Docker and Enterprise Addons #509

Closed LucaWebDev closed 1 week ago

LucaWebDev commented 1 week ago

Description: I'm trying to install Odoo version 16 using Docker and include the Enterprise addons. However, some of the Enterprise packages aren't being added correctly. Here are the steps I followed to create the Docker setup:

Steps Taken: Created odoo.conf Configuration File:

~/odoo/odooConfigFile/odoo.conf
[options]
addons_path = /mnt/extra-addons,/mnt/enterprise-addons
; admin_passwd = admin
; csv_internal_sep = ,
; db_maxconn = 64
; db_name = False
; db_template = template1
; dbfilter = .*
; debug_mode = False
; email_from = False
; limit_memory_hard = 2684354560
; limit_memory_soft = 2147483648
; limit_request = 8192
; limit_time_cpu = 60
; limit_time_real = 120
; list_db = True
; log_db = False
; log_handler = [':INFO']
; log_level = info
; logfile = None
; longpolling_port = 8072
; max_cron_threads = 2
; osv_memory_age_limit = 1.0
; osv_memory_count_limit = False
; smtp_password = False
; smtp_port = 25
; smtp_server = localhost
; smtp_ssl = False
; smtp_user = False
; workers = 0
; xmlrpc = True
; xmlrpc_interface =
; xmlrpc_port = 8069
; xmlrpcs = True
; xmlrpcs_interface =
; xmlrpcs_port = 8071

Created Docker Volumes:

docker volume create odoo-data
docker volume create data-odoo-db

Cloned Enterprise Repository: To my ubuntu folder ~/odoo/odooAddons/odoo16/addons/enterprise/

Started PostgreSQL Container:

docker run -d \
-v data-odoo-db:/var/lib/postgresql/data \
-e POSTGRES_USER=odoo \
-e POSTGRES_PASSWORD=odoo \
-e POSTGRES_DB=postgres \
--name db postgres:15

Started Odoo Container:

docker run -v ~/odoo/odooConfigFile:/etc/odoo \
-v odoo-data:/var/lib/odoo \
-v ~/odoo/odooAddons/odoo16/addons/custom:/mnt/extra-addons \
-v ~/odoo/odooAddons/odoo16/addons/enterprise:/mnt/enterprise-addons \
-v ~/odoo/odooAddons/odoo16/addons/oca:/mnt/oca-addons \
-d -p 8069:8069 \
--name odoo \
--link db:db \
-t odoo:16

~/odoo/odooAddons/odoo16/addons/custom is empty folder ~/odoo/odooAddons/odoo16/addons/oca:/mnt/oca-addons contains some OCA packages

Encountered Errors: I'm facing the following errors during the Odoo startup process for first database creation :

2024-07-08 11:31:30 2024-07-08 09:31:30,322 1 INFO abcdef odoo.modules.loading: loading web_editor/security/ir.model.access.csv 
2024-07-08 11:31:30 2024-07-08 09:31:30,342 1 INFO abcdef odoo.modules.loading: loading web_editor/data/editor_assets.xml 
2024-07-08 11:31:30 2024-07-08 09:31:30,351 1 INFO abcdef odoo.modules.loading: loading web_editor/views/editor.xml 
2024-07-08 11:31:30 2024-07-08 09:31:30,398 1 INFO abcdef odoo.modules.loading: loading web_editor/views/snippets.xml 
2024-07-08 11:31:30 2024-07-08 09:31:30,490 1 INFO abcdef odoo.modules.loading: Module web_editor loaded in 1.20s, 829 queries (+829 other) 
2024-07-08 11:31:30 2024-07-08 09:31:30,490 1 INFO abcdef odoo.modules.loading: Loading module web_enterprise (14/17) 
2024-07-08 11:31:30 2024-07-08 09:31:30,501 1 WARNING abcdef odoo.modules.loading: Transient module states were reset 
2024-07-08 11:31:30 2024-07-08 09:31:30,503 1 ERROR abcdef odoo.modules.registry: Failed to load registry 
2024-07-08 11:31:30 Traceback (most recent call last):
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 90, in new
2024-07-08 11:31:30     odoo.modules.load_modules(registry, force_demo, status, update_module)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 488, in load_modules
2024-07-08 11:31:30     processed_modules += load_marked_modules(cr, graph,
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 372, in load_marked_modules
2024-07-08 11:31:30     loaded, processed = load_module_graph(
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 197, in load_module_graph
2024-07-08 11:31:30     model_names = registry.load(cr, package)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 247, in load
2024-07-08 11:31:30     model = cls._build_model(self, cr)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/models.py", line 622, in _build_model
2024-07-08 11:31:30     raise TypeError("Model %r does not exist in registry." % name)
2024-07-08 11:31:30 TypeError: Model 'res.users.settings' does not exist in registry.
2024-07-08 11:31:30 2024-07-08 09:31:30,506 1 ERROR abcdef odoo.service.db: CREATE DATABASE failed: 
2024-07-08 11:31:30 Traceback (most recent call last):
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/service/db.py", line 65, in _initialize_db
2024-07-08 11:31:30     registry = odoo.modules.registry.Registry.new(db_name, demo, None, update_module=True)
2024-07-08 11:31:30   File "<decorator-gen-16>", line 2, in new
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 87, in locked
2024-07-08 11:31:30     return func(inst, *args, **kwargs)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 90, in new
2024-07-08 11:31:30     odoo.modules.load_modules(registry, force_demo, status, update_module)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 488, in load_modules
2024-07-08 11:31:30     processed_modules += load_marked_modules(cr, graph,
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 372, in load_marked_modules
2024-07-08 11:31:30     loaded, processed = load_module_graph(
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 197, in load_module_graph
2024-07-08 11:31:30     model_names = registry.load(cr, package)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 247, in load
2024-07-08 11:31:30     model = cls._build_model(self, cr)
2024-07-08 11:31:30   File "/usr/lib/python3/dist-packages/odoo/models.py", line 622, in _build_model
2024-07-08 11:31:30     raise TypeError("Model %r does not exist in registry." % name)
2024-07-08 11:31:30 TypeError: Model 'res.users.settings' does not exist in registry.
2024-07-08 11:31:30 2024-07-08 09:31:30,522 1 INFO abcdef odoo.modules.loading: loading 1 modules...
2024-07-08 11:31:30 2024-07-08 09:31:30,533 1 INFO abcdef odoo.modules.loading: 1 modules loaded in 0.01s, 0 queries (+0 extra)

This error occurs when I try to add the OCA modules that I download separately into ubuntu folder from git.
What is wrong with this configuration?

amh-mw commented 1 week ago

ERROR abcdef odoo.service.db: CREATE DATABASE failed:

This makes me think that the modules could be a red herring and your problem is one of container linkage or database permissions.

Alternately, I would consider that addons_path setting is non-recursive, and OCA modules are in many repositories, so you can't just drop them into /mnt/extra-addons side by side without updating addons_path for each.

LucaWebDev commented 1 week ago

Hello, thank you for your help. Before opening the issue, I managed to get the container working with Odoo Enterprise, but without the OCA modules. The OCA modules were cloned from GitHub and have versions matching Odoo. However, the OCA installation seems to have some issues. I am continuing to look for solutions.

LucaWebDev commented 1 week ago

I just solved the problem. You need to create an entry in the odoo.conf file for each /mnt/oca/ and for each /~/odoo/odooAddons/odoo16/addons/oca/. Additionally, you should also add the modules from ~/odoo/odooAddons/odoo16/odoo/addons and ~/odoo/odooAddons/odoo16/odoo/odoo/addons.

So, the configuration file ~/odoo/odooConfigFile/odoo.conf should look like this:

[options]
addons_path = /mnt/odoo/addons, /mnt/odoo/odoo/addons, /mnt/enterprise-addons, /mnt/addons/oca/<module1>, /mnt/addons/oca/<module2>

and the command should be like this:

docker run -v ~/odoo/odooConfigFile:/etc/odoo \
-v odoo-data:/var/lib/odoo \
-v ~/odoo/odooAddons/odoo16/odoo/addons:/mnt/odoo/addons \
-v ~/odoo/odooAddons/odoo16/odoo/odoo/addons:/mnt/odoo/odoo/addons \
-v ~/odoo/odooAddons/odoo16/addons/enterprise:/mnt/enterprise-addons \
-v ~/odoo/odooAddons/odoo16/addons/oca/<module1>:/mnt/addons/oca/<module1> \
-v ~/odoo/odooAddons/odoo16/addons/oca/<module2>:/mnt/addons/oca/<module2> \
-d -p 8069:8069 \
--name odoo \
--link db:db \
-t odoo:16

Thanks for the suggestion @amh-mw

amh-mw commented 1 week ago

Thanks for the suggestion @amh-mw

Glad you were able to solve the problem. Would you kindly close this issue?