Set the Python Interpreter

From System Preferences > PyDev > Interpreter – Python

Set the python interpreter to the python executable program that is used on your system: <path>/python.exe, /usr/bin/python, or /opt/local/bin/python.

On Linux/Mac, you can use the command line: which python to find the full path of python executable.

Once setup, the existing module on your system will be listed on the System PYTHONPATH box.

Image001 

Click Apply.

Click OK.

Import OpenERP Source Code into Project

From File à Import à select Existing Folder as a New Project.

Image003 

Click Next.

Select the OpenERP root folder.

 Image003

Click Finish.

The project will appear at the PyDev Package Explorer. Make sure it’s set to PyDev Project.

Right-click on the OpenERP project à PyDev à Set as PyDev Project.

 Image007

Run or Debug openerp-server file

From PyDev Package Explorer, right click on the opener-server file below the Project the you want to Run or Debug.

Image009 

Then click Python Run.

OpenERP will run on Aptana/Eclipse.

 

Image013 

Click Stop button to stop OpenERP.

Once run, the Aptana will generate what’s called by Debug Configuration ie all configurations that are needed to run the openerp-server from inside the Aptana environment.

Modify Debug Configuration

If you need, you can modify the debug configuration provided, for example to add command parameter on openerp-server.

Click on Arguments tab and add the additional parameters to run opener-server, for example:

  • -c opener-server.conf to set the running configuration of OpenERP
  • –update=yourmodule to update your module on openerp
  • –addon_path=youraddons, to set the addon paths
  • etc

 Image015

You can directly debug OpenERP from here by clicking the Debug button.

 Image017

And make sure the OpenERP logs show the correct configurations after you setup the debug configuration parameters.

Setup Break Point and Debug

Go to the source code file that you want to debug, right click on the line number and click Add Breakpoint.

Image019 

Debug OpenERP as described above.

Open your browser and go to OpenERP URL as usual (localhost:8069) and login to the database that has the module you want to debug.

If the breakpoint is hit, then Aptana will activate the debug prespective.

 Image021

Click Yes.

Now we can see all information that we need to do the debugging:

 Image023

Step one line by pressing Step Over (F6) key.

Step into function by pressing Step Into (F5) key

Terminate debugging by pressing Terminate button.

Continue running the program by Resume button.

 

 

Contact Us if you need more assistance on how to Debug OpenERP in Eclipse/Aptana Studio.

 

Debugging OpenERP with Aptana or Eclipse with PyDev
Tagged on: