我想在统计视图中使用tag_ids
字段。
我正在使用这种类型的查询
SELECT min(pol.id) AS id,
po.date_order::date AS date,
pol.product_id AS product_id,
pp.product_tmpl_id AS product_tmpl_id,
po.company_id AS company_id,
pt.product_brand_id AS product_brand_id,
pt.categ_id AS categ_id,
array_agg(p_tag.name) AS tag_id,
'Point of Sale' AS origin,
sum(pol.qty) AS qty
FROM pos_order_line pol
LEFT JOIN pos_order po ON po.id = pol.order_id
LEFT JOIN product_product pp ON pp.id = pol.product_id
LEFT JOIN product_template pt ON pt.id = pp.product_tmpl_id
LEFT JOIN product_product_tag_rel pp_rel ON pp_rel.product_id=pp.product_tmpl_id
LEFT JOIN product_tag p_tag ON p_tag.id=pp_rel.tag_id
LEFT JOIN product_brand pb ON pb.id=pt.product_brand_id
WHERE po.state IN ('paid', 'done', 'invoiced')
GROUP BY po.date_order, pol.product_id, pp.product_tmpl_id,
po.company_id,pt.product_brand_id,pt.categ_id
我不知道如何将tag_id
值传递给many2many
字段并设置其过滤器?这个查询给了我想要的结果,Buti不知道如何在statistical view
上显示它(分析视图)
有人请告诉我,我会非常感激