تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
8256 أدوات العرض

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
يناير 21
2937
2
فبراير 25
5628
1
ديسمبر 24
1297
1
نوفمبر 22
15811
3
أغسطس 22
12740