跳至內容
選單
此問題已被標幟
2 回覆
7684 瀏覽次數

If I add "partner_shipping_id" to my Sale.Order TreeView, it will automatically show the name of the Delivery Address. I want to show the "city" or "place" of a Delivery Address rather than the name. How can I specify I want to show another field than the name of this Address?

I don't mind having to add a field e.g. "x_city" to the sale.order table, but how can I set this field to automatically store "partner_shipping_id.city" values? That way I can add x_city to my TreeView, and show it in my List View.

Is there a better way to do this? How?

頭像
捨棄
最佳答案

You can use related field to display City.

'shipping_city': fields.related('partner_shipping_id', 'city', string='City', type='char')
頭像
捨棄
最佳答案

You can use related field to display City.

Try this,

'shipping_city' : fields.related('partner_shipping_id','city', type='char', string='City', readonly=True),

Fields type in OpenERP.

頭像
捨棄
作者

Hey Ghanshyam, this worked like a charm. Thanks for your perfect feedback.

作者

I can't sort on this field though. Is this normal? May need to look into a different way to do this, because not being able to sort on location is a bit vague.

相關帖文 回覆 瀏覽次數 活動
Sticky Field 已解決
1
11月 19
3849
0
1月 25
1
3
11月 20
14968
2
5月 19
21246
3
7月 24
23123