This question has been flagged
2 Replies
8133 Views

Solved:

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.

Setup:

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:

http://de.slideshare.net/openobject/business-intelligence-35790564

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

http://blog.instant-erp.com/2010/09/advanced-modeling-reporting-from.html

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.

Avatar
Discard
Best Answer

@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.

Avatar
Discard
Best Answer

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

Avatar
Discard