コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
8275 ビュー

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
2948
2
2月 25
5671
1
12月 24
1307
1
11月 22
15829
3
8月 22
12780