hi ! i am using a sql query to get data into a new module and following is the code
_name = 'purchase.comp'
_auto = False
name = fields.Char(string = 'Purchase Order')
origin = fields.Char(string ='Purchase Agreement')
date_order = fields.Datetime('Order Date', index=True, copy=False)
state = fields.Selection([
('sent', 'RFQ Sent'),
('to approve', 'To Approve'),
('purchase', 'Purchase Order'),
], string='Status', readonly=True, index=True, copy=False, default='draft', track_visibility='onchange')
product_id = fields.Char(string='Product')
product_qty = fields.Float(string='Quantity')
price_unit = fields.Float(string='Unit Price')
price_subtotal = fields.Monetary(string='Subtotal', store=True)
vendor = fields.Char(string='Vendor')
currency_id = fields.Char('Currency')
""" Event Question main report """
self._cr.execute(""" CREATE VIEW purchase_comp AS (
b.id as id,
a.name as "name",
a.origin as "origin",
a.date_order as "date_order",
a.state as "state",
b.name as "product_id",
b.product_qty as "product_qty",
b.price_unit as "price_unit",
b.price_subtotal as "price_subtotal",
c.display_name as "vendor",
d.name as "currency_id"
FROM public.purchase_order as a
public.purchase_order_line as b
on a.id = b.order_id
public.res_partner as c
on a.partner_id = c.id
public.res_currency as d
on d.id = b.currency_id
WHERE a.origin != ''
order by a.name
Now i am trying to fetch its qweb report too but i am unable to get the report of a complete tree view as i have nothing to loop thorugh.Can someone please explain what approach should i use here.