Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

how to display a field (for test )

Subscribe

Get notified when there's activity on this post

This question has been flagged
1 Reply
9315 Views
Avatar
Samir GUESMI

hi all ,

i want to display , the content of fields ,

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

thks

0
Avatar
Discard
Avatar
Brett Lehrer
Best Answer

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.

1
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now