summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-07-31 09:33:19 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-07-31 09:33:19 +0000
commit61bbb1b7164378a31522312ca3a076d6d35141d3 (patch)
tree792601c9fdae3daa45d290dd0de150a4e3c79fe3 /indoteknik_api/models
parentbf45239720a7eaa49557087fdfd523611b048a7c (diff)
parentf785e7605f4d0151a0f48e3d871b996c40e51351 (diff)
Merged in feature/voucher-cart (pull request #78)
Add flash sale tag on model, view, api response
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/product_template.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/indoteknik_api/models/product_template.py b/indoteknik_api/models/product_template.py
index b01e957b..fb77769f 100644
--- a/indoteknik_api/models/product_template.py
+++ b/indoteknik_api/models/product_template.py
@@ -70,9 +70,12 @@ class ProductTemplate(models.Model):
for variant in variants:
if variant["price"]["price_discount"] < lowest_price["price_discount"]:
lowest_price = variant['price']
-
+ template_pricelist = product_template._get_active_flash_sale()
data_with_detail = {
- 'flash_sale_remaining_time': product_template._get_flash_sale_remaining_time(),
+ 'flash_sale': {
+ 'remaining_time': template_pricelist._remaining_time_in_second() if template_pricelist else 0,
+ 'tag': template_pricelist.flashsale_tag if template_pricelist else None
+ },
'lowest_price': lowest_price,
'image': self.env['ir.attachment'].api_image('product.template', 'image_512', product_template.id),
'display_name': product_template.display_name,