summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--collect_fulfillment.ktr3
1 files changed, 2 insertions, 1 deletions
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</sql>
<schema_name/>
</partitioning>
<connection>erp indoteknik production (localhost)</connection>
- <sql>select posm.sale_line_id as sale_order_line_id, posm.product_id, sum(posm.qty_po) as po_qty
+ <sql>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)