Odoo Help


How to get "record name" (name_get) from a browse_record?

Clément THOMAS
on 3/26/13, 1:04 PM 5,470 views

From a browse_record (and not from the pool with name_get function), how to know it default name ?

for example :

sale_order_line.product_id._default_name (it don't works)



Mohammad Alhashash

--Mohammad Alhashash--
| 5 5 8
Giza, Egypt
--Mohammad Alhashash--


Mohammad Alhashash
On 3/26/13, 3:10 PM

You can call any object method directly from a browse_record instance, no need to reach the pool. Method parameters cr, uid and context will be passed automatically. To get the display name for your example:


Note that name_get returns a list of pairs: [(id,name),...]

If you really need to have the value as a field! you can create a function field that uses name_get() to get the value.

Thanks Mohammad

Clément THOMAS
on 3/27/13, 11:30 AM

Andreas Brueckl

--Andreas Brueckl--

| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 3/26/13, 1:47 PM

The default name of a model can be specified by

  • field name (default),
  • field specified in _rec_name or
  • function name_get

If you want to have a generic way to always get the default name of an object you have to use name_get function. The browse_record does not provide a field like _default_name.

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

1 follower(s)


Asked: 3/26/13, 1:04 PM
Seen: 5470 times
Last updated: 1/15/18, 2:21 AM