I would like to display time series data with Odoo graph view. The graph should look something like this (some example graph i found on the internet):
Graph X-axis should be date field sorted ASC
Graph Y-axis should be selectable field (price or qty_in_stock)
I need to display values of all products (multiple lines in the same graph)
Model fields (new record for selected products created daily)
date = fields.Date(default=lambda self: fields.Date.today(), required=True)
product_template_id = fields.Many2one(comodel_name="product.template", required=True)
price = fields.Float(digits="Product Price", required=True, group_operator=False )
qty_in_stock = fields.Integer(required=True, group_operator=False)
I have created tree view and graph view for this model. Views are opened with default group_by on product and records are sorted date ASC. Also default filter is used to display only records created in the last X days (X set dynamically in fields_view_get()
). I used group_operator=False on price and qty fields to disable sum in tree view, but unfortunately i found out that then I got no data from fields with group_operator=False in graph view so I removed it.
Graph view xml
<record id="vendor_connector_tracked_data_graph_view" model="ir.ui.view">
<field name="name">product.template.tracked.data.graph.view</field>
<field name="model">vendor.connector.tracked.data</field>
<field name="arch" type="xml">
<graph string="Tracked Data Records" type="line">
<field name="date" interval="day" type="row/>
<field name="qty_in_stock" type="measure"/>
<field name="price" type="measure"/>
</graph>
</field>
</record>
Graph view result (without group_operator=False). I tried setting col and row and nothing helped.
Graph view result (with group_operator=False)
Graph X axis is always wrong (whether with or without data due to group_operator=False parameter).
I am more than happy to provide aditional information about my problem.