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

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
6月 23
2301
1
4月 23
11358
1
6月 22
2613
2
8月 20
9081
1
11月 19
5640