Sunday, 15 July 2012

Debug OpenERP+python code in eclipse

Follow the given steps to debug your OpenERP+python code in eclipse:

1: Stop your openERP running server by pressing "ctr+c".

2: In eclipse go to Menu "Run/Debug Configurations". In configuration window under "Python Run", create new debug configuration(Double click on 'Python Run').

3: After creating new debug configuration follow the given steps: 

    3.1: In "Main" tab under "Project", select the "server" project or folder (in which Openerp Server resides) from your  workspace. 

    3.2: Write location of 'openerp-server' under "Main Module".
 Ex: ${workspace_loc:server/openerp-server}.

    3.3: In "Arguments" tab under "Program Arguments", click on button "Variables" and new window will appear. 
    3.4: Then create new "Variable" by clicking on "Edit Variables" button and new window will appear.
    3.5: Press on "New" button and give your addons path as value. Ex: --addons ../addons,../your_module_path
    3.6: Press Ok in all the opened windows and then "Apply".

4: Now into "PyDev Package Explorer" view go to 6.1/server and right click on "openerp-server" file, Select 'Debug As --> Python Run'.

5: Now in "Console" you can see your server has been started.

6: Now open your .py file which you want to debug and set a breakpoint.

7: Now start your module's form from 'gtk' or 'web-client' and execution will stop when execution will reach to breakpoint.
8: Now debug your code by pressing "F5, F6, F7" and you can see value of your variables.

See Video:


  1. Need to debug_mode = False in conf file also before these steps.?

  2. Does this steps work on openerp 7.0?

  3. Yes. It works with any version of OpenERP.

    1. Thanks, well I guess my problem is how to setup workspace. step 3.1 and 3.2 is where I'm lost

      step 3 says In "Main" tab under "Project", select the "server" project or folder (in which Openerp Server resides) from your workspace.

      However, when I try browse to the folder where my server is. I can't get there. my server is on /opt/openerp/openerp7

      If I can select the server project. I will be set and done.
      the question is how do I set the server project in the first place?
      thank you in advance

    2. I am stuck here as well :/

    3. It can use Openerp on windows sersion ?

  4. Ooh, I found out where I was getting it wrong. thanks.

    1. Alec, can you describe shortly how did you create project with openerp code and openerp-server?

      Thank you.

    2. Yeah, describe it please...

    3. I am stuck here as well :/