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

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.

Related Posts ตอบกลับ มุมมอง กิจกรรม
Sticky Field แก้ไขแล้ว
1
พ.ย. 19
3879
0
ม.ค. 25
1
auto incrementing on new field แก้ไขแล้ว
3
พ.ย. 20
15005
sorting on field - how to set it up? แก้ไขแล้ว
2
พ.ค. 19
21272
3
ก.ค. 24
23180