Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
8254 Visualizações

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








Avatar
Cancelar
Melhor resposta

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),
        }


Avatar
Cancelar
Autor

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

Autor

_rec_name = 'code' doesnt work for me

could you share your name search and name get functions?

Publicações relacionadas Respostas Visualizações Atividade
0
jan. 21
2936
2
fev. 25
5628
1
dez. 24
1297
1
nov. 22
15810
3
ago. 22
12738