While creating pivot report i got issue here is the my code
@api.model
def init(self):
tools.drop_view_if_exists(self.env.cr, 'sale_last_sale_report')
self.env.cr.execute("""
SELECT
ROW_NUMBER() OVER() AS id,
res_partner.commercial_partner_id AS partner_id
FROM sale_order_line
INNER JOIN sale_order
ON (sale_order_line.order_id = sale_order.id)
INNER JOIN product_product
ON (sale_order_line.product_id = product_product.id)
GROUP BY
res_partner.commercial_partner_id
""")
Here is the field
partner_id = fields.Many2one('res.partner', 'Partner', readonly=True)
Here is the pivot view in xml
<record id="view_sale_last_sale_report_pivot" model="ir.ui.view">
<field name="name">sale.last.sale.report.pivot</field>
<field name="model">sale.last.sale.report</field>
<field name="arch" type="xml">
<pivot string="Sale Analysis" disable_linking="True">
<field name="partner_id" type="row"/>
</pivot>
</field>
</record>
I want to show partner while run code it's giving me
error missing FROM-clause entry for table res_partner How can i fix that