summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/product_template.py
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_custom/models/product_template.py
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_custom/models/product_template.py')
-rwxr-xr-xindoteknik_custom/models/product_template.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py
index acd592ab..82cb0432 100755
--- a/indoteknik_custom/models/product_template.py
+++ b/indoteknik_custom/models/product_template.py
@@ -154,15 +154,13 @@ class ProductTemplate(models.Model):
else:
template.have_promotion_program = False
- def _get_flash_sale_remaining_time(self):
+ def _get_active_flash_sale(self):
variant_ids = [x.id for x in self.product_variant_ids]
pricelist = self.env['product.pricelist'].search([
('is_flash_sale', '=', True),
('item_ids.product_id', 'in', variant_ids)
- ])
- if not pricelist:
- return 0
- return pricelist._remaining_time_in_second()
+ ], limit=1)
+ return pricelist
@api.model
def _calculate_rating_product(self, limit=1000, expiry_days=30, ids=False):