summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/product_pricelist.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py
index 0d4247c8..6e88517c 100644
--- a/indoteknik_api/models/product_pricelist.py
+++ b/indoteknik_api/models/product_pricelist.py
@@ -95,6 +95,20 @@ class ProductPricelist(models.Model):
], limit=1, order='start_date asc')
return pricelist
+ def get_is_show_program_flash_sale(self):
+ """
+ Check whether have active flash sale in range of date
+ @return: returns pricelist: object
+ """
+ current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+ pricelist = self.search([
+ ('is_flash_sale', '=', True),
+ ('is_show_program', '=', True),
+ ('start_date', '<=', current_time),
+ ('end_date', '>=', current_time)
+ ], order='start_date asc')
+ return pricelist
+
def is_flash_sale_product(self, product_id: int):
"""
Check whether product is flash sale.