Marc Lebrun
Marc Lebrun

Reputation: 45

Odoo on Windows, can't add new field to model

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 :

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 :

Many thanks for your help :-)

Upvotes: 2

Views: 780

Answers (1)

John5000
John5000

Reputation: 108

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.

Upvotes: 0

Related Questions