跳至内容
菜单
此问题已终结
1 回复
8384 查看

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








形象
丢弃
最佳答案

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

编写者

_rec_name = 'code' doesnt work for me

could you share your name search and name get functions?

相关帖文 回复 查看 活动
0
1月 21
3025
2
2月 25
5899
1
12月 24
1450
1
11月 22
15962
3
8月 22
12984