summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-11-13 11:30:42 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-11-13 11:30:42 +0700
commit83877ef7d16f26e42a754448e7c7d4f2ba5396d8 (patch)
treef596b62250f858fc3eda86e1cacda0ef09c9ed54
parent023cc6da6736c9bdd1d9e9c2ed137a6ee3ee047d (diff)
fix wrong po qty
-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)