Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
You can use rec_name for retrieving a single value. But if u want to display more than one field means go for name_get method
def name_get(self, cr, uid, ids, context=None): res =  for obj in self.browse(cr, uid, ids, context=context): var = obj.name +"Email("+obj.email+")" res.append((obj.id, var)) return res
Use the above method in your parent class and simply call that class on your manytoone relational field.
Syntax of name_get orm method
name_get(cr, user, ids, context=None) Parameters: cr -- database cursor user (integer) -- current user id ids -- list of ids context (dictionary) -- context arguments, like lang, time zone Returns: tuples with the text representation of requested objects for to-many relationships
Check many2one relation table "name" column is available. It shows "name" column value in many2one selection or add the below code in python file
rec_name = "fieldname"
Here after its shows rec_name field value shows in many2one selection.
using browse ORM method you can access all other fields.
def meth_name(self, cr, uid, ids, context=None): table_obj = self.pool.get('table.name') for val in table_obj.browse(cr, uid, ids, context=context): field1_value = val.column1 field2_value = val.column2 return field1_value
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 4/15/14, 10:10 AM|
|Seen: 1532 times|
|Last updated: 3/16/15, 8:10 AM|