Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7068 มุมมอง

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!

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 23
2369
1
เม.ย. 23
11493
1
มิ.ย. 22
2736
ERROR: Field does not exist แก้ไขแล้ว
2
ส.ค. 20
9210
1
พ.ย. 19
5782