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

Hallo everybody, please be kind and let me know, how to link a custom field from two tables/models, for example a new field from res.partner in sales.order

my case, I add a new field, family_name, in res.partner and then I want to call that field in sales.order. I did, many2one relationship in model sales.oder. but, it doesn't show the value.

Please show me how it works and wish you have a good Karma. Thanks In advance

الصورة الرمزية
إهمال
أفضل إجابة

For that you can use fields.related in sale.order.

Try this:

' partner_family_name': fields.related('partner_id', ' family_name', type='char', string='Partner Family Name', readonly=True, store=True),

fields.related is a field that points to some data inside another field of the current record.

Example:

_columns = { 'partner_id': fields.many2one('res.partner', 'Partner'), 'partner_name': fields.related('partner_id', 'name', type='char', string='Partner Name'), }

Here Related Field you can find more about fields.related.

الصورة الرمزية
إهمال
الكاتب

Hi Sudhir thank you so much for your respond. I'm not programmer. I do customizing in the Web platform. So I add a new field x_family_name which is custom field. How do I do that in the Setting? hope you can help me. Thank you!

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يونيو 23
2264
1
أبريل 23
11335
1
يونيو 22
2576
2
أغسطس 20
9045
1
نوفمبر 19
5619