Programming and making modifications to the openERP code on Windows

It’s possible?

Well yes. It’s possible. Although all the openerp Gurus recommend a Linux environment to program in Python, it can also be done on Windows. This mini guide is for beginners who don’t know where to start. Those of you who have been in this for a while, you can ignore the post.

What tools do you need?

Basically a good text editor. Ultraedit32 (paid), editplus (free) or notepad2 (free) are recommended.

The files to modify in any module are only the .py

All modules (take one from any server/addons they basically have the following files) –> The components that the module has are indicated, whether they are wizards, reports or other submodules. File required in all modules –> Module signature and its dependencies with other modules. File required in all modules –> The classes, fields, objects that are part of the module are defined.

FOLDERS inside a module:

  • Wizard: Actions –> They are shown in the form of a button with a drawing of little wheels, to the right of each module. They are not required in all modules. An action button or Wizard, are for example in the client’s file “Create accounts”, “Sending e-mails”.. etc. If we wanted to add a new action, we must add another Wizard to the module and the associated code corresponding to the process that we want to execute.
  • Reports: Reports –> They are shown when pressing the print button in each object. It is not a required folder in all modules, it is only required if we want to associate a report with an object.
  • i18n –> Translations folder. It is also not required in all modules.

The steps to run and debug the modifications made in Windows are as follows:

  1. To modify an existing module, modify the corresponding .py file
  2. To add a new module, the simplest thing is to copy an existing folder with a new name and make the changes on it.
  3. Once the changes have been made, in openERP –> Administration/modules/update
  4. Stop and start the server
    1. Start/all programs/openERP/server/stop
    2. Start/all programs/openERP/server/start
  5. If everything goes well, we should see the expected changes in the corresponding module. If not, if the app crashes, we can’t get into the modified module, or some other problem, we possibly have a syntax error.
  6. To verify this, open the file C:\Program Files\OpenERP\Client \ openerp-client.exe.log

All the errors that occur during the execution of the program are saved in the Client’s log. When you open it, be careful with the lines, they are very long. Scroll to the right and it will give you the error, the file and the line in which it occurs.

Example. Don’t be scared… The error is marked in Red. You will see that it is a syntax error and it gives you exactly where it occurs.

Traceback (most recent call last):
File “widget\view\form_gtk\parser.pyo”, line 117, in button_clicked
File “rpc.pyo”, line 186, in rpc_exec_auth
File “common\common.pyo”, line 338, in error
File “rpc.pyo”, line 148, in rpc_exec_auth_try
File “rpc.pyo”, line 112, in exec_auth
File “rpc.pyo”, line 118, in execute
File “tiny_socket.pyo”, line 80, in myreceive
tiny_socket.Myexception: (“, ‘Traceback (most recent call last):\n File “netsvc.pyo”, line 231, in dispatch\n File “netsvc.pyo”, line 74, in __call__\n File “service\ \web_services.pyo”, line 479, in execute\n File “service\\security.pyo”, line 48, in check\n File “pooler.pyo”, line 76, in get_db\n File “pooler.pyo” , line 40, in get_db_and_pool\n File “addons\\__init__.pyo”, line 704, in load_modules\n File “addons\\__init__.pyo”, line 573, in load_module_graph\n File “addons\\__init__.pyo ”, line 373, in register_class\n File “C:\\Program Files\\OpenERP AllInOne\\Server\\addons\\esale_osc\\”, line 3, in <module>\n  File “C:\\Program Files\\OpenERP AllInOne\\Server\\addons\\esale_osc\\”, line 362\n \’product_id\’:,\n ^\nSyntaxError: invalid syntax\n ‘)
I hope you have served!

Leave a Comment

Your email address will not be published.