diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-04 10:56:31 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-04 10:56:31 +0700 |
| commit | dd0ee7ad460b0cfdbd863e9befc5408b88f81e1e (patch) | |
| tree | 64938e97d6115212ab106111a371aeb391fd341b | |
| parent | d306603f418fe4d616226b8755e52f9dcdfdbbc9 (diff) | |
Update flash sale tag on sync solr
| -rw-r--r-- | indoteknik_api/models/product_product.py | 3 | ||||
| -rw-r--r-- | indoteknik_custom/models/apache_solr.py | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index fb485bae..ff7c6498 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -250,6 +250,7 @@ class ProductProduct(models.Model): active_flash_sale = self.env['product.pricelist'].get_active_flash_sale() flashsale_id = 0 flashsale_name = '' + flashsale_tag = '' # loop pricelist items base_price = discount = price_flashsale = 0 for pricelist in active_flash_sale: @@ -261,6 +262,7 @@ class ProductProduct(models.Model): for item in pricelist_items: flashsale_id = pricelist.id flashsale_name = pricelist.name + flashsale_tag = pricelist.flashsale_tag base_price = self._get_website_price_exclude_tax() if item.price_discount > 0: discount = item.price_discount @@ -272,6 +274,7 @@ class ProductProduct(models.Model): data = { 'flashsale_id': flashsale_id, 'flashsale_name': flashsale_name, + 'flashsale_tag': flashsale_tag, 'flashsale_base_price': base_price, 'flashsale_discount': discount, 'flashsale_price': price_flashsale diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py index 6211dfc4..086fb6d0 100644 --- a/indoteknik_custom/models/apache_solr.py +++ b/indoteknik_custom/models/apache_solr.py @@ -150,6 +150,7 @@ class ApacheSolr(models.Model): 'search_rank_i': template.search_rank, 'search_rank_weekly_i': template.search_rank_weekly, 'flashsale_id_i': flashsale_data['flashsale_id'] or 0, + 'flashsale_tag_s': flashsale_data['flashsale_tag'] or '', 'flashsale_name_s': flashsale_data['flashsale_name'] or '', 'flashsale_base_price_f': flashsale_data['flashsale_base_price'] or 0, 'flashsale_discount_f': flashsale_data['flashsale_discount'] or 0, |
