Skip to Content
Menu
This question has been flagged
3 Replies
11665 Views

Hello,

Using Odoo 12 in docker container.

I'm working on a custom module and wonder what really needs to be refresh to apply our changes.

I noticed that when editing models.py, I needed first to `docker-compose down ; docker-compose up` then go to Applications and update my module here.

When editing xml files, I just need to update my module in the Applications section of Odoo.

First, is that right ? Could you explain why it's so (for example, why do I need to take down/up the container when working on models.py) ? 

Finally, is there a faster way to update our code (command line, tools that would watch for changes, ...) ?

Thank you

Avatar
Discard
Best Answer

You (only) have to restart the service to reload python. Python code is loaded into memory as soon as the server (or rather python execution) starts.

Updating XML structures requires an app-update for Odoo to rebuild the views. This is a very complex process with all the levels of inheritance. So they don't do this every time.

I've made myself a command-line action to call the standard update (from command line) + check the exit code. If good, restart the service.

python3 ./odoo-community/odoo-bin -c ./odoo.conf -d odoo -u "all" --workers=0 --no-http --i18n-overwrite --without-demo=WITHOUT_DEMO --stop-after-init
  • -u "all" - Update ALL modules. You can also use a specific module (much faster!)

  • ​--no-http  - So you can run this in the background, as it doesn't start another frontend.

  • --i18n-overwrite - Reload the translations.

  • --without-demo=WITHOUT_DEMO - Don't load Demo data.

  • --stop-after-init - Exit once done.


Avatar
Discard
Best Answer

Hello,

what is the command when  using odoo 15 in docker ?

I didn't find Odoo-community and odoo-bin in Odoo 15.

Thank you

Avatar
Discard
Author Best Answer

Oh, thank you !

Avatar
Discard