From 7a23a18a45fbd38fabc33f4e1a74d9f31e86cd60 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 6 Oct 2023 14:11:15 +0700 Subject: Fix get flash sale price on sync to solr --- indoteknik_custom/models/solr/product_product.py | 2 +- indoteknik_custom/models/solr/product_template.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 20a68b47..31a0026d 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -84,7 +84,7 @@ class ProductProduct(models.Model): price_excl_after_disc = variant._get_website_price_after_disc_and_tax() tax = variant._get_website_tax() discount = variant._get_website_disc(0) - flashsale_data = variant._get_flashsale_price() + flashsale_data = variant.with_context(price_for="web")._get_flashsale_price() price_excl_v2 = variant._v2_get_website_price_exclude_tax() price_excl_after_disc_v2 = variant._v2_get_website_price_after_disc_and_tax() diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 30c3b3c5..d7439bcb 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -103,7 +103,7 @@ class ProductTemplate(models.Model): tier_data = {} for variant in template.product_variant_ids: - variant_flashsale = variant._get_flashsale_price() + variant_flashsale = variant.with_context(price_for="web")._get_flashsale_price() variant_flashsale_price = variant_flashsale.get('flashsale_price', 0) flashsale_data_price = flashsale_data.get('flashsale_price', 0) -- cgit v1.2.3