Odoo Help


How to override name_get method of stock.picking [SOLVED]

Yassine TEIMI
on 12/12/14, 6:58 AM 1,078 views

I have a many2one field into "stock.picking", i want to override the name_get so as to get another field, and not the name field of stock.picking, I'm enable to find name_get method for stock_picking so as to override it ? What is the risks of this and how to do it carefully ?

Yassine TEIMI
On 12/12/14, 9:08 AM

First of all, stock.picking did not overrided the name_get method, it uses the name_get of the orm, so I overrided it myself by doing : 

    def name_get(self, cr, uid, ids, context=None):
        if not ids:
            return []
        if context is None: context = {}
        return [(r['id'], (str( r['num_bl']) or '')) for r in self.read(cr, uid, ids, ['num_bl'], context, load='_classic_write')]

where num_bl is the field that you want to replace the name field with.

Knowing that the purpose of it it's change the field to display. There is a lot of overrides, as much as there are a lot of customization with overrides.

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: 12/12/14, 6:58 AM
Seen: 1078 times
Last updated: 3/16/15, 8:10 AM