Odoo Help


how to display a field (for test )

samir Guesmi
on 5/31/13, 1:11 PM 3,151 views

hi all ,

i want to display , the content of fields ,

like PHP for exemple : or Js : alert(variable);



Brett Lehrer

--Brett Lehrer--

| 5 5 8
Milwaukee, United States
--Brett Lehrer--
Director of IT and open source enthusiast.
Brett Lehrer
On 5/31/13, 3:53 PM

There are a few ways, none of them all that great.

If you're looking for the value of a field that has been written to the database, use something like pgAdmin. Navigate to the table and show the records or write up an SQL line. The web client URL will have the id # and model name in it when you're viewing a particular record.

The quick, dumb way to check a value in the middle of a function is to put a print line in the code when you want to see its value. The value is printed to the console (or log file if you're using that instead). You need to stop the server and restart it whenever you change the python code, so it can recompile python bytecode with your change in it:

sale_rec = self.pool['sale.order'].browse(cr, uid, some_sale_id, context)
print sale_rec.partner_id.name

# Output in console:
# Test Co.

Probably the best way to do this is for a lot of thorough testing to run OpenERP in debug mode in Eclipse with PyDev. Just insert a breakpoint anywhere in the python code and hover over a variable to see its value. The OpenERP client will just sit in the loading state and wait to be sent data. To set that up (assuming Ubuntu 12.04, make your own adjustments where needed):

1) Install Eclipse

sudo apt-get install eclipse

2) Install PyDev. Open Eclipse and go to 'Help' -> 'Install New Software...'. Click Add... in the upper right corner. Set the name to pydev and the location to http://pydev.org/updates. Check the PyDev box that comes up in the list and click Finish.

3) Check Python Interpreter. In Eclipse, go to 'Window' -> 'Preferences' -> 'PyDev' -> 'Interpreter - Python'. Make sure the Python interpreter is listed. It should be named /usr/bin/python and located in /usr/bin/python2.7 if it's not there.

4) Create a PyDev project for OpenERP. In Eclipse, go to 'File' -> 'New' -> 'PyDev Project'. The name can be whatever you want, but make sure to uncheck Use default for the project contents. Replace the directory with the folder containing all of your OpenERP code (server, addons, web modules, anything else), and click Finish.

5) Open PyDev Workspace. Go to 'Window' -> 'Open Perspective' -> 'Other...', and select PyDev.

6) Start the Server. In the package explorer, navigate to the openerp-server file, right click and go to 'Run As' -> '1 Python Run'. After that runs, go back and edit the run configuration. Switch to the Arguments tab and add your command line arguments, e.g.:

-c server.conf

OpenERP as of 7.0 also has built-in Python debugging, but I'm not a huge fan of debugging in a terminal.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 5/31/13, 1:11 PM
Seen: 3151 times
Last updated: 3/16/15, 8:10 AM