I try to query into report, it's working...
class customer_report(models.Model):
_name = "customer.report"
_description = "Orders Statistics"
_auto = False
name = fields.Many2one('res.partner', readonly=True)
p_id = fields.Many2one('preorder.config','PreOrder Ref')
tot_product = fields.Integer('# of Unique Product')
tot_piece = fields.Integer('# of Piece')
def init(self, cr):
"""Initialize the sql view for the event registration """
tools.drop_view_if_exists(cr, 'customer_report')
# TOFIX this request won't select events that have no registration
cr.execute(""" CREATE VIEW customer_report AS (
select
poc.id::varchar || '/' || coalesce(poc.id::varchar,'') AS id,
poui.customer AS p_id,
poui.partner_id AS name,
count(pl.product_id) AS tot_product,
count(poc.id) AS tot_piece
from
preorder_config poc
left join preorder_user_input poui on (poui.preorder_id = poc.id)
left join preorder_product_rel ppr on (ppr.preorder_id = poc.id)
left join preorder_user_input_product_line pl on (pl.user_input_id = poui.id)
group by
poc.id, poui.preorder_id, poui.partner_id
)
""")
Can You post your code ?