Odoo provides a simple qweb syntax for accessing model data field values inside reports:
where o is the Odoo model the report is connected to and fieldname the name of the corresponding field of this model.
When you want to access a field from another connected model you can simply append a “.” (point) to enter the next deeper level of model data, e.g.:
It is possible to nest an unlimited number of connected fields to reach any data you want.
Example 1: let’s say you have a picking list and want to show the description for each product. The right way to implement this in your report is:
Explanation: product_id gives you the id of the connected product.product model record. This record includes another id called product_tmpl_id to connected to the given product.templatemodel record. Inside this product.template record you finally find the product’s description field.
Example 2: let’s say you have an invoice for a partner who uses a different address than its company. But you want to use the company address on this invoice.
Explanation: partner_id gives you the many2one connection to the customer of this invoice.parent_id leads to the master company of this customer. street is now the address of the master company and not the address of the invoice’s customer.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!