Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. query = """
  2. SELECT pt.name as product,sl.price_unit as price,sum(sl.qty_invoiced) as quantity from sale_order_line sl
  3. JOIN sale_order so ON so.id = sl.order_id
  4. JOIN product_product pp ON pp.id = sl.product_id
  5. JOIN product_template pt ON pt.id = pp.product_tmpl_id
  6. WHERE so.date_order >='"""+str(obj.start_date)+"""'
  7. and so.date_order <= '"""+str(obj.end_date)+"""'
  8. and so.partner_id ="""+str(obj.customer_id.id)+"""
  9. and sl.invoice_status = 'invoiced'
  10. """
  11. if obj.product_id:
  12. query +=""" and sl.product_id in """+str(obj.product_id.ids)
  13. query += """GROUP BY product,price"""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement