Odoo Help

0

Sale.order TreeView: how to add fields like "partner_shipping_id.city"?

By
Rebel
on 6/12/13, 6:36 AM 2,357 views

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?

2

Ghanshyam Prajapati

--Ghanshyam Prajapati--

1415
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
Ghanshyam Prajapati
On 6/12/13, 9:34 AM

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.

Rebel
on 6/12/13, 12:23 PM

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.

Rebel
on 6/14/13, 11:39 AM
1

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11236
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
On 6/12/13, 9:31 AM

You can use related field to display City.

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 6/12/13, 6:36 AM
Seen: 2357 times
Last updated: 3/16/15, 8:10 AM