Odoo Help


This community 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.


Graph View with data from multiple tables - example, how-to? [solved]

Tobias Frankl
on 2/8/15, 9:53 AM 1,749 views


Started by copying from odoo/odoo/addons/event/report/report_event_registration.py and edited step by step to my models.

Its amazing what views of the data you can achive easily with odoo.


I have a table X with a many2one relation to table Y. Then there is a one2many relation from table Y to table Z.

I would like to show data from table Z on the graph view called from table X. Somebody could point to a code snippet please?


There is a slideshow which says that a graph view over multiple tables is possible with a posgresql-view in which the needed data is collected:


I found an old description, but the synthax changed a lot I think:


Could somebody please point at a newer example to start understanding with?

Some good file in th odoo code serves as well - I have no luck surfing around in the code.



| 5 3 6
Jakarta, Indonesia
On 2/11/15, 6:31 AM

@Tobias, the sample link that you have provided still holds.  I believe you only need to change the fields definition if you want to inherit from models.Model (new API).  But using it as is, is still possible.  The extra stuff in the presentation are additional stuff avaiable in v8 when you define your dashboard/graph view.  The link between the example and the presentation is at page 15 of the presentation.  The example provides the "custom model with a Postgres view, to link the various models with the data."  Checkout the odoo/odoo/addons/event/report/report_event_registration.py for a similiar definition (Postgres view) in new API.

Jordan Vrtanoski
On 2/11/15, 5:42 AM

You can create the fileds from table "Z" in the table "X" as a "related" fields. You can also decide to store the related field in the table "X" to allow faster access to the data.

See the example of the related field that is relevant for v6 and v7 https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/field_type/

Note that the way the related fields are defined and handled is changed in v8 as explained here https://www.odoo.com/documentation/8.0/reference/orm.html

Your Answer

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!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 2/8/15, 9:53 AM
Seen: 1749 times
Last updated: 3/16/15, 8:10 AM