Odoo Help


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

Tobias Frankl
on 2/8/15, 9:53 AM 3,438 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

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.


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

1 follower(s)


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