I have 50cr+ records in a custom table and display using Qweb reports template.
Its loading faster for less than 1cr records but taking time for larger data.
I applied index, vacuum in database and loading faster inside PgAdmin tool.
Date stored in Custom table "ls_hq_stock_attribute_view". We are trying to get data with Date filter.
Can anyone please clarify, How the QWeb reports working and connect with Database?
Is the python function query all records from the table?
Python Code:
if self.company_id.company_registry == 'HQ':
search_fields = [('stock_date','=',self.start_date)]
else:
search_fields = [('stock_date','=',self.start_date),('loccode','=',self.company_id.company_registry)]
action = self.env.ref('ls_pos_reports.ls_hq_stock_attribute_view').read()[0]
action.update({'domain':search_fields})
return action
XML View:
<record id="ls_hq_stock_attribute_view"
model="ir.actions.act_window">
<field name="name">Stock Attribute</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ls.hq.stock.attribute.view</field>
<field name="view_mode">tree,pivot,graph</field>
<field name="target">current</field>
</record>
<record model="ir.ui.view" id="ls_hq_stock_attribute_tree">
<field name="name">LS HQ Stock Attribute Tree</field>
<field name="model">ls.hq.stock.attribute.view</field>
<field name="arch" type="xml">
<tree string="Stock Attribute" edit="false" create="false" delete="false" export_xlsx="false" class="mytree">
<field name="stock_date" optional="show" />
<field name="loccode" optional="show" />
<field name="name" optional="show" />
<field name="dept" optional="show" />
<field name="category" optional="show" />
<field name="subcategory" optional="show" />
</tree>
</field>
</record>