Skip to Content
Menu
This question has been flagged
2 Replies
3791 Views


I created a custom module and it worked alright. However, I'm unable to update it using docker command  .

 l do not want to go the  odoo web interface go to app update the list check the app upgrade the app .

any command or any docker configuration will be welcomed

Thank you 


here is my docker-compose.yml

version: '3.1'

services: 

​odoo17: 

​build: 

​context: ./odoo/ 

​image: odoo:17 

​container_name: odoo_fab17 

​command: -- --dev=reload 

​depends_on: - db 

​ports: - "8099:8069" 

​volumes: 

​- odoo-web-data:/var/lib/odoo

​ - ./odoo/addons:/mnt/extra-addons:rw 

​- ./odoo/entreprise:/mnt/entreprise

​adminer: 

​image: adminer 

​restart: always 

​ports: - 8080:8080 

​db: 

​image: postgres:15.0 

​container_name: fab_odoo_17 

​environment: 

​- POSTGRES_DB=postgres 

​- POSTGRES_PASSWORD=odoo 

​- POSTGRES_USER=odoo 

​- PGDATA=/var/lib/postgresql/data/pgdata 

​volumes: 

​- odoo-db-data:/var/lib/postgresql/data/pgdata

volumes: 

​odoo-web-data:

​ odoo-db-data:

Avatar
Discard
Best Answer

To update and upgrade an Odoo custom module using Docker and avoid using the web interface, you can achieve it by running the necessary commands directly on the Odoo container using docker exec. Here's a step-by-step guide:

1. Updating the Module with Docker

Use the following steps to update your custom module:

Step 1: Locate the Module

Make sure your custom module is located in the directory specified in your docker-compose.yml under:

- ./odoo/addons:/mnt/extra-addons:rw

Ensure the module's updated files are saved in this folder.

Step 2: Run the Upgrade Command

To update the module, use the docker exec command to access the Odoo container and run the -u flag to upgrade the module.

Here’s the command:

docker exec -it odoo_fab17 odoo --dev=reload -d <database_name> -u <module_name>
  • Replace <database_name> with the name of your database.
  • Replace <module_name> with the technical name of your module.

For example:

docker exec -it odoo_fab17 odoo --dev=reload -d my_db -u my_custom_module

2. Automating Module Updates with docker-compose

If you want the custom module to automatically update when you rebuild or restart your containers, you can add the upgrade command to your docker-compose.yml.

Modify docker-compose.yml

Update the command section in your Odoo service:

command: >
  -- --dev=reload
  -d <database_name>
  -u <module_name>

Example:

command: >
  -- --dev=reload
  -d my_db
  -u my_custom_module

Whenever you restart your containers, the module will automatically be upgraded.

3. Restart the Odoo Container

After making changes to your module or docker-compose.yml, restart your containers:

docker-compose down
docker-compose up -d

This ensures the latest module files are loaded and the upgrade command is executed.

4. Rebuilding Assets (Optional)

If your module includes JavaScript or CSS changes, you may need to rebuild Odoo assets. Run the following command:

docker exec -it odoo_fab17 odoo --dev=reload -d <database_name> -u <module_name> --load=web.assets_backend

5. Verifying the Update

  1. After running the command or restarting the container, log in to Odoo.
  2. Check if the custom module has been updated with the latest changes.

6. Debugging Tips

If the module does not update or errors occur:

  • Check the Odoo logs for issues:
    docker logs odoo_fab17
    
  • Ensure the custom module is correctly located in the addons folder.
  • Verify the module's manifest file (__manifest__.py) for any syntax issues.

This process avoids using the Odoo web interface and allows you to manage custom module updates directly from the command line using Docker. Let me know if you have further questions or encounter issues!

Avatar
Discard
Best Answer

Hello BITITI Fabrone

Here's how you can update your custom module using Docker Compose:

  1. Update your docker-compose.yml file:
    • Your Odoo service is named odoo17 based on your configuration. Ensure that the custom module path ./odoo/addons is correctly mounted inside the container at /mnt/extra-addons.
  2. Run the command to update the module:
    • You can update your custom module without using the web interface by running the following command:
    docker-compose run --rm odoo17 odoo -u  -d  --stop-after-init
    
    • Replace with the technical name of your custom module and with your Odoo database name.
  3. Rebuild the Docker image (optional):
    • If you've made any changes to your Docker configuration or want to ensure everything is up to date, you can rebuild the Docker image by running:
    docker-compose build
    
  4. Restart your services (optional):
    • After rebuilding, bring the services back up by running:
    docker-compose up -d
    

This process updates your custom module and ensures your Docker containers are correctly configured and running. Let me know if it helps :)

Avatar
Discard
Related Posts Replies Views Activity
0
May 24
744
0
Mar 25
469
1
Dec 24
956
1
Jul 24
1059
7
Jul 24
21606