콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5787 화면

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 ?

아바타
취소
작성자 베스트 답변

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.

아바타
취소