2
votes

I'm using Odoo 9.

I want to add a new field to my model, and also add that field to my model's form view. Everything goes fine if I do it in two steps :

  • add the field to the model
  • restart the Odoo server
  • ask Odoo to update my module (1)
  • add the field to my form view
  • ask Odoo to update my module again (2)

At step (1) the field gets created in the database table, and only at step (2) the view is modified to use the new field.

Problem occurs when I want to update the module on another database. I always have a "500 Internal Server Error" and when I look at the log it says that my new field (used by the view) does not exist (because in Odoo's perpective, the module is not updated yet).

That's not much of a problem since I can stop the server and issue this command:

odoo.py -d <name_of_database> -u <name_of_module>

This will update the module in my other database without the need to access the module's page in Odoo. Then I restart the Odoo service and it works like a charm.

THIS IS WHERE THE PROBLEM BEGINS :

My final client runs Odoo on a Window server. I know how to start / stop / restart the Odoo service, but that will not let me update my module. I'd like to issue the same command using odoo.py but I didn't find where and how to do that.

My question is :

  • Looking at the way I update my module in two steps, do you think I'm doing it the right way, or is there a better way ?
  • Could someone point me to a tutorial about advanced use of Odoo in a Windows environment, as I didn't find anything ?

Many thanks for your help :-)

1

1 Answers

0
votes

For Odoo start/stop/update you can do the same commands in Windows as you can in Linux.

  1. Start a command prompt.
  2. Ensure your PATH env includes the python runtime. (set PATH=%PATH%;...)
  3. Find the odoo.py, then execute it:

    odoo.py -d test -u mymodule

I have to include the odoo .conf file on the command line:

odoo.py -c server.conf -d test -u mymodule

You can see what command options are available using: odoo.py --help

You should not have to update your modules with two restarts. But I know that can occur. That usually means your dependencies are not correct, so the view gets used before the field has been added to database.

For Windows installs I use buke's GreenOdoo on github https://github.com/buke/GreenOdoo. Though that is for version 8, you can updated it to odoo9, See https://github.com/buke/GreenOdoo/issues/35.