Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

Any idea how to have remote debug Odoo/OpenERP from PyCharm?

By
jagbir
on 11/22/14, 9:35 AM 2,039 views

Can someone please give idea on how to connect Odoo/OpenERP from PyCharm?

1

Solanki Shamji

--Solanki Shamji--
1293
| 5 2 6
Baroda, India
--Solanki Shamji--

Hello!

Solanki Shamji
On 5/20/15, 3:41 AM

Hello,

May be this will helpful to you.

Go to pycharm inbuilt terminal and login via ssh in that remote odoo server.

Thanks.

Shamji.


0
Fabian
On 1/29/16, 4:56 AM

This maybe helps you:

http://bloopark.de/blog/the-bloopark-times-1/post/setup-odoo-development-on-os-x-with-pycharm-109



0
queeryme
On 1/28/16, 4:43 AM

I have solved remote debugging to my remote ubuntu server by doing the following:

On your remote server, run: pip install cython pydevd

IMPORTANT: Make sure that your computer is visible to server's IP by pinging your computer's IP

On your computer, configure a Python Remote Debug in run configurations.

Set Local Host Name: The IP of your computer. Yes, that computer with the pycharm installed.

Set the Port: 7999. Actually, any port will do as long as its above 1000.

Make sure to check the box, SINGLE INSTANCE ONLY


On File>Settings>Execution>Deployment, create an SFTP Server Connection.

Set the SFTP host to the server's IP. set the root path to the installation directory of your odoo server. In my case, its located at /opt/odoo

Set the username and password.

On the mappings tab,

Set the Local Path to your project's directory root

Set the deployment path to "\" or backslash.

Set the web path to "/" or forwardslash.

Test the SFTP connection.


On the server, open the file /opt/odoo/openerp-server (It's a python file without the extension)

Add these statements after the "import openerp"

import pydevd

pydevd.settrace('YOUR COMPUTER IP', port=7999, stdoutToServer=True,stderrToServer=True)


TODO EVERYTIME YOU MODIFY YOUR CODE AND DEBUG THAT

Now to start the debug, add a breakpoint in your code.

Run the remote debug to start listening from the server.

Restart the openerp instance you got running in your server. In my case, I force restart the init.d/odoo-server file:

/etc/init.d/odoo-server restart

If successful, pycharm will light up in the menu bar and ask you to set the path mappings. Just click the autodetect and press Save forever.

Notice that if you visit the odoo server website, it just won't load. Actually, pycharm sets a "virtual" breakpoint after the settrace command you have provided so you have to press the play button thing at the debug(or F8)

Viola! Now it works and any breakpoint you set will stop odoo from executing and let you analyze everything.

Test it by adding a breakpoint in your code and try to run that code. Try the @api.onchange ones since they are more predictable to run.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

4 follower(s)

Stats

Asked: 11/22/14, 9:35 AM
Seen: 2039 times
Last updated: 8/8/16, 10:03 PM