This question has been flagged
1 Reply
3784 Views

Is it possible to display the delivery address in the project task form? I want to use this field on the printed report. Or can I use this field in the report editor without adding the field in the form?

I want to display partner_shipping_id.name from the sale.order table. The default partner_shipping_id from res.partner is not always correct. The project_task table does not have a sale_order_id, but does have a sale_line_id. This sale_line_id is linked to the id field of the tabel sale_order_line, but this table does not contain the partner_shipping_id.

How can I add the partner_shipping_id to the sale_order_line table, or what is the best solution to display the partner_shipping_id field (from sale.order) in the project.task table/form/print? (either is fine, as I can then use it in the report designer)

Avatar
Discard
Best Answer

Since the sale order line is linked to its sale order via the order_id field, you can do:

o.sale_line_id.order_id.partner_shipping_id
Avatar
Discard
Author

That sounds logical but when I use [[ o.sale_line_id.order_id.partner_shipping_id ]] or [[ o.sale_line_id.order_id.partner_shipping_id.name ]] it just shows up blank. I am using this in a custom report, I edited the .sxw file overwrote the .rml file and deinstalled the module. Updated module list and reinstalled, and the places where I added these fields it shows nothing.

Author

[[ o.sale_line_id.order_id.partner_shipping_id.street ]] [[ o.sale_line_id.order_id.partner_shipping_id.city]] and [[ o.sale_line_id.order_id.partner_shipping_id.zip]] don't work either sadly

Author

Do I need to import sale.order or res.parter in the __init__.py of my module? Right now it's just importing the report.

of course, partner_shipping_id refers to an object. you'll need to specify the correct field you want to display. on v7 i think there's a field that sum up all the address infos at once, but i cannot remember the field name.

Author

How do I specify the correct field if not like: [[ o.sale_line_id.order_id.partner_shipping_id.street ]] ? What do I add after the partner_shipping_id to refer to street, city or zip? I don't mind them being in three separate fields, I can just add the code after each other to display it on one line. Unless I can not specify these single fields?

that should work. i suggest to inspect and check the address via pdb

Author

Oddly only [[ display_address(o.sale_line_id.order_id.partner_shipping_id) ]] seemed to work, but thanks for your feedback and pushing me in the right direction. Couldn't have done it without you, appreciate you taking the time. :)

display_address is what i couldn't remember :) nice you made it