From 21afe49d4bc8324491b7f12441fe438bf1a3adee Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 13 Feb 2024 09:30:17 +0700 Subject: update pricelist compute with vendor name --- calculate_price_after_disc.ktr | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/calculate_price_after_disc.ktr b/calculate_price_after_disc.ktr index 1633db0..4b477a3 100644 --- a/calculate_price_after_disc.ktr +++ b/calculate_price_after_disc.ktr @@ -629,6 +629,17 @@ coalesce(( order by ppd.count_trx_po desc, ppd.count_trx_po_vendor desc limit 1 ),0) as purchase_price, +coalesce(( + select + rp.name as vendor + from purchase_pricelist_dw ppd + join product p2 on p2.product_id = ppd.product_id + join res_partner rp on rp.id = ppd.vendor_id + where ppd.product_id = p.product_id + and (system_last_update >= (now() - '365 days'::interval) or human_last_update >= (now() - '365 days'::interval) or p2.qty_available > 0) + order by ppd.count_trx_po desc, ppd.count_trx_po_vendor desc + limit 1 +),'-') as vendor, (select group1 from price_group_dw pgd where id = 2) as markup_std1, (select group2 from price_group_dw pgd where id = 2) as markup_std2, (select group3 from price_group_dw pgd where id = 2) as markup_std3, @@ -801,6 +812,29 @@ left join brand b on b.id = p.brand_id Asia/Bangkok N + + String + normal + vendor + 2147483647 + -1 + Table input + vendor + + . + , + + none + N + Y + 0 + N + N + N + en_US + Asia/Bangkok + N + BigNumber normal @@ -4646,6 +4680,11 @@ left join brand b on b.id = p.brand_id purchase_price Y + + vendor + vendor + Y + -- cgit v1.2.3