Odoo Help


How the display custom field value instead of name in many2one Odoo 8

on 11/4/16, 7:19 AM 916 views

I have custom field named as 'code'  in res.partner

        class cust_partner

         _inherit = 'res.partner'

         _columns = { 'code': fields.char('Code', index=True), }

Customized name_get , name_search methods to get code instead of Customer name

it works only in Search and display name in field

In my custom class

        class test_order(osv.Model):
        _inherit = 'test_order'_columns = {   'customer_code': fields.many2one('res.partner', 'Code', ondelete='restrict',required=False),}

My expected output is in test_order class i need to display value of  'code' instead of name in field customer_code (after save in form view )

Please anyone help me to resolve this

On 11/4/16, 7:26 AM

Use name_get() and name_search() method
or use "_rec_name = 'code'"

class cust_partner
_inherit = 'res.partner'
_rec_name = 'code'
_columns = {
       'code': fields.char('Code', index=True),

yes used name_get , name_search it works only in field list , search value not after save

I need to display the code value in Form View (i.e) after save

on 11/4/16, 7:34 AM

_rec_name = 'code' doesnt work for me

on 11/4/16, 9:06 AM

could you share your name search and name get functions?

on 11/4/16, 11:15 PM

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: 11/4/16, 7:19 AM
Seen: 916 times
Last updated: 11/4/16, 7:46 AM