summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--calculate_price_after_disc.ktr4
1 files changed, 2 insertions, 2 deletions
diff --git a/calculate_price_after_disc.ktr b/calculate_price_after_disc.ktr
index 4b477a3..6e1688a 100644
--- a/calculate_price_after_disc.ktr
+++ b/calculate_price_after_disc.ktr
@@ -626,7 +626,7 @@ coalesce((
join product p2 on p2.product_id = ppd.product_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
+ order by ppd.count_brand_vendor desc, ppd.count_trx_po desc, ppd.count_trx_po_vendor desc
limit 1
),0) as purchase_price,
coalesce((
@@ -637,7 +637,7 @@ coalesce((
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
+ order by ppd.count_brand_vendor desc, 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,