4

Odoo service is started by systemctl start odoo. I am usin Centos. When I want to update my changed *.py code I used to do like this:

1. systemctl stop odoo
Then I update my module and database by useing this:
2. ./odoo.py -c openerp-server.conf -u <my_module_name> -d <database_name>
3. stop service by ctrl + c
4. systemctl start odoo

But it's realy long and uncomfortable way to update changes.

Is there a shorter way to do the same operations in shorter way?

fueggit
  • 859
  • 1
  • 22
  • 44

2 Answers2

3

Odoo with Service

You can make changes like this:

  1. Stop the server: systemctl stop odoo
  2. Start the server: systemctl start odoo. Here the .py are updated
  3. If you also need to update xml or some translations you can press the Update button on the Odoo interface, on the module description form.

Note: There are modules to reload specific xml views. If you are interested in it I can take a look to check if I find one.

Odoo without Service

If you are developing on your local computer, you don´t need to use systemctl. Just run Odoo directly with odoo.py and you can see the changes immediately:

./odoo.py -c openerp-server.conf -u <my_module_name> -d <database_name>

Autoreload Python Files

There is another option to reload python files when they have changed. Check this other answer:

Normally if you change your python code means, you need to restart the server in order to apply the new changes.

--auto-reload parameter is enabled means, you don't need to restart the server. It enables auto-reloading of python files and xml files without having to restart the server. It required pyinotify. It is a Python module for monitoring filesystems changes.

Just add --auto-reload in your configuration file. By default the value will be "false". You don't need to pass any extra arguments. --auto-reload is enough. If everything setup and works properly you will get

openerp.service.server: Watching addons folder /opt/odoo/v8.0/addons
openerp.service.server: AutoReload watcher running in the server log. Don't forget to install pyinotify package.

But in odoo 10 just add --dev=reload paramter

--dev=DEV_MODE      Enable developer mode. Param: List of options
                    separated by comma. Options : all,
                    [pudb|wdb|ipdb|pdb], reload, qweb, werkzeug, xml
ChesuCR
  • 9,352
  • 5
  • 51
  • 114
  • so for example: I change my_module_a and my_module_b.In openerp-server.conf I don't have any database filter and I am using 3 databases. So when I run systemctl start odoo, in all 3 databases .py will be updated? Hope you understand my question. – fueggit Mar 19 '18 at 10:37
  • As I understand after service restart (systemctl start odoo) .py are automatically updated depend on filtered database on odoo-service.conf file? – fueggit Mar 19 '18 at 10:39
  • Yes, if you update the python files, all the databases of the same instance are going to be updated. If you want to update the xml files you need to do it manually in every database you want – ChesuCR Mar 19 '18 at 10:40
0
Failed to stop odoo.service: Access denied. See system logs and 'systemctl status odoo.service' for details.

Initially, I got this error. Then tried with su and got this.

Failed to stop odoo.service: Unit odoo.service not loaded.

My concern is how to identify the perfect file through which I can restart the Odoo services post new module installation.