Odoo Help


Odoo 8+: how to restart server when python has been changed?

Kasper Souren
on 9/16/14, 8:04 AM 10,760 views

Python is a nice language. But it's annoying to have to restart the server for every little code change when developing. I've worked with Meteor which even reloads pages on the clients, that's really amazing, will take a long time before Odoo will get there. Now the first step to get a nicer dev experience would have some optional way to restart the server whenever a file has been updated.

Related questions:

From 2012: http://stackoverflow.com/questions/12597164/force-python-interpreter-to-reload-a-code-module

From 2013: https://www.odoo.com/forum/help-1/question/must-you-really-restart-openerp-all-the-time-to-develop-a-module-30394

Is there a good solution for Odoo 8 to restart the server when Python code in a module has been changed?

Restart the server.

on 9/29/14, 8:01 AM



| 6 5 7
Tbilisi, Georgia
On 9/29/14, 5:32 AM



I do not think that odoo should include automatic restarting, as it is NOT necessary on production server. instead you can adapt your development tools. How you'll make it, depends on your favorite development tool. If you're using some IDE, most probably there will be possibility to add a shortcut to the IDE for server restart, even make it automatically restarted upon file save... so take a closer look of your favorite development tool. You do not specified what tools you're using for editing code, but if you're using vim, there is how. else you can set up similar behavior in other tools that you're using.

For me restarting of openerp is just 2 keystrokes and I do not find it annoying. I hit F5 for restart it, then I hit Enter to return to editing in VIM. After F5 keystroke I can either wait 2 seconds if I want to see feedback of restart command (success/failure) or hit Enter immediately to continue editing. 

For have such a possibility in Vim, I've set shortcut for F5 key by adding following line to VIM's config file:

map  <F5>  :!  service openerp restart   <CR>

-where 'map' is VIM's command that adds mapping, '<F5>' - stands for F5 keystroke, ':!' - means "calling external command", 
'service openerp restart' - is an actual command that restarts openerp server from command-line. it may differ from OS to OS and from openerp version to version. for v8 it may be  'service odoo restart', for v7 it may same as above or 'service openerp-server restart' or something else. You can adapt this command according your environment and you've to check in command line if the command actually restarts openerp in your system before putting it in Vim's configfile. and finally <CR> at the end, stends for Enter keystroke (Carriage Return), it avoids necessity of hitting Enter for invoke restart command. You can even add another <CR> for second Enter keystroke, that'll return you to editing  without necessity to  hit Enter after F5, i.e. you'll restart openerp just in 1 keystroke (by pressing F5)

map  <F5>  :!  service openerp restart   <CR> <CR>

- but in this case you'll miss posibility to get feedback of command, as sometimes restart fails, I prefer to have only one <CR> and hit Enter either in 2 seconds for waiting feedback from restart command or hit Enter imediately after F5 and continue editing, according my needs for the moment.



AFAIK it's not too complicated make some actions upon file save in Eclipse.
So IF you're using Eclipse you can accomplish exactly what you want quite easily, i.e. restart openerp on file save. You have to do just few steps for set up it as needed and then eclipse will restart openerp on every file save for you.

on 9/29/14, 6:03 AM
juan delgado
On 9/29/14, 2:04 AM

hi friend you have a solution now, i have the same problem, my change not take a effect

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 9/16/14, 8:04 AM
Seen: 10760 times
Last updated: 3/16/15, 8:10 AM