summaryrefslogtreecommitdiff
path: root/calculate_price_after_disc.ktr
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-02-13 09:30:17 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-02-13 09:30:17 +0700
commit21afe49d4bc8324491b7f12441fe438bf1a3adee (patch)
treee516bb8112a38d6190b6680877b49c587dbce935 /calculate_price_after_disc.ktr
parent801cf21cec82b9b7efdacfd75192b661b36e4690 (diff)
update pricelist compute with vendor name
Diffstat (limited to 'calculate_price_after_disc.ktr')
-rw-r--r--calculate_price_after_disc.ktr39
1 files changed, 39 insertions, 0 deletions
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,
@@ -802,6 +813,29 @@ left join brand b on b.id = p.brand_id</sql>
<lenient_string_to_number>N</lenient_string_to_number>
</value-meta>
<value-meta>
+ <type>String</type>
+ <storagetype>normal</storagetype>
+ <name>vendor</name>
+ <length>2147483647</length>
+ <precision>-1</precision>
+ <origin>Table input</origin>
+ <comments>vendor</comments>
+ <conversion_Mask/>
+ <decimal_symbol>.</decimal_symbol>
+ <grouping_symbol>,</grouping_symbol>
+ <currency_symbol/>
+ <trim_type>none</trim_type>
+ <case_insensitive>N</case_insensitive>
+ <collator_disabled>Y</collator_disabled>
+ <collator_strength>0</collator_strength>
+ <sort_descending>N</sort_descending>
+ <output_padding>N</output_padding>
+ <date_format_lenient>N</date_format_lenient>
+ <date_format_locale>en_US</date_format_locale>
+ <date_format_timezone>Asia/Bangkok</date_format_timezone>
+ <lenient_string_to_number>N</lenient_string_to_number>
+ </value-meta>
+ <value-meta>
<type>BigNumber</type>
<storagetype>normal</storagetype>
<name>markup_std1</name>
@@ -4646,6 +4680,11 @@ left join brand b on b.id = p.brand_id</sql>
<rename>purchase_price</rename>
<update>Y</update>
</value>
+ <value>
+ <name>vendor</name>
+ <rename>vendor</rename>
+ <update>Y</update>
+ </value>
</lookup>
<attributes/>
<cluster_schema/>