From 83877ef7d16f26e42a754448e7c7d4f2ba5396d8 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 13 Nov 2024 11:30:42 +0700 Subject: fix wrong po qty --- collect_fulfillment.ktr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'collect_fulfillment.ktr') diff --git a/collect_fulfillment.ktr b/collect_fulfillment.ktr index 6197a8d..07d0223 100644 --- a/collect_fulfillment.ktr +++ b/collect_fulfillment.ktr @@ -834,9 +834,10 @@ order by sm.sale_line_id, sml.product_id erp indoteknik production (localhost) - select posm.sale_line_id as sale_order_line_id, posm.product_id, sum(posm.qty_po) as po_qty + select posm.sale_line_id as sale_order_line_id, posm.product_id, sum(pol.product_uom_qty) as po_qty from purchase_order_sales_match posm join purchase_order po on po.id = posm.purchase_order_id +join purchase_order_line pol on (pol.order_id = po.id and pol.product_id = posm.product_id) where 1=1 and po.state in ('done', 'purchase') and posm.write_date >= (now() - '180 days'::interval) -- cgit v1.2.3