Hi Friends,
Im using openerp v6.1.I had wrote code to compute refund for invoices.But i do have problem in this functionality.Here i have given my code for solution:
select min(ai.id) as id,
min(ai.partner_id) as partner_id,
sum(ail.quantity) as qty,
min(ai.account_id) as account_id,
min(pa.id) as address_id,
sum(ail.uom_total) as name_qty,
min(ai.number) as number from account_invoice ai
left join account_invoice_line ail on(ail.invoice_id = ai.id)
left join res_partner rs on(ai.partner_id = rs.id)
left join product_product pp on (ail.product_id = pp.id)
left join product_template pt on (pp.product_tmpl_id = pt.id)
where ai.type = 'out_invoice' and ai.state in ('paid','open') and pt.name like '%Test Template %' and ai.partner_id = 514 and ai.date_invoice >= '2015-01-01' and ai.date_invoice <= '2015-05-31' group by ai.partner_id
If we get result as like below:
[(12142, 514, 1.0, 1200.0, 11, 895, 1.0, u'U/14-15/0372')]
Here we one single record becoz of group by partner_id (invoice_id as 12142).But i need all ids of invoices which is grouped by partner.How could i achieve this guys.Please help me in this situation.Thanks in advance.