简体   繁体   中英

How can I debug odoo 9 in eclipse? [Linux]

I have eclipse Neon in Linux Ubuntu 16.04

When I run a odoo server, it works everything fine in port 8069

But, when I debug the same odoo server, (now, the port is 8072) it appears to freeze in a infinite loop. In the browser doesn't appear anything (Waiting for localhost...), and the log shows this:

...
25138 INFO mydb openerp.modules.loading: 81 modules loaded in 0.73s, 0 queries
25138 INFO mydb openerp.modules.loading: Modules loaded.
25138 INFO mydb openerp.addons.base.ir.ir_http: Generating routing map
192.168.1.31 - - [2016-09-12 12:14:51] "GET / HTTP/1.1" 200 24082 21.358104
25138 INFO mydb openerp.addons.bus.models.bus: Bus.loop listen imbus on db postgres

This is my odoo9-server.conf (renamed openerp-server.conf):

[options]
admin_passwd = myAdminPass
db_host = False
db_port = False
db_user = myUserName
db_password = myDatabasePass
addons_path = /etc/odoo/server/addons,/etc/odoo/server/addons_extra
logfile = None
xmlrpc_port = 8069
log_level = debug

Is there something wrong?

To debug your odoo+python code in eclipse, start eclipse in debug perspective and follow the given steps:

1: Stop your Odoo 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 Odoo Server resides) from your workspace.

3.2: Write location of 'openerp-server' or 'odoo.py' under "Main Module".

Ex: ${workspace_loc:odoo/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 odoo and right click on "openerp-server" or odoo.py 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 break-point.

7: Now start your module's form from 'gtk' or 'web-client' and execution will stop when execution will reach to break-point.

8: Now enjoy by debugging your code by pressing "F5, F6, F7" and you can see value of your variables.

Source: https://stackoverflow.com/a/12298831/1312904

To invoke pdb, add this line

import pdb; pdb.set_trace() import pdb; pdb.set_trace() anywhere you want to set a breakpoint

and then start your odoo with the --debug flag set, something along the lines of

./odoo.py --addons=addons,myaddons --debug

and then when you execute an action on the server that hits the point where you invoked pdb , the execution will immediately stop and you'll have a pdb prompt that you can use to debug

Finally I got the solution.

In the Debug Configurations, I changed the content of Main Module and I wrote this:

${workspace_loc:my_project/openerp-gevent}

The important part is the

Now, the debug works fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM