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)
Thanks
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
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)
Thanks
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:
    sale_order_line.product_id.name_get()[0][1]
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
The default name of a model can be specified by
name (default), _rec_name orname_getIf 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.
Awesome !! overriding function name_get is working for me !!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ| Related Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
|---|---|---|---|---|
|  | 2 ก.ย. 17  | 4959 | ||
|  | 3 พ.ย. 24  | 31272 | ||
| 
            
                why can't i find my model "id" ?
            
            
                    แก้ไขแล้ว
            
         |  | 1 เม.ย. 23  | 4486 | |
|  | 1 ธ.ค. 21  | 3393 | ||
|  | 0 ธ.ค. 21  | 2968 |