跳至内容
菜单
此问题已终结
4363 查看

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.

 

形象
丢弃
相关帖文 回复 查看 活动
0
5月 24
1801
1
7月 21
2751
0
4月 16
4305
1
5月 15
3961
2
3月 15
4818