diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-31 16:31:42 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-07-31 16:31:42 +0700 |
| commit | f785e7605f4d0151a0f48e3d871b996c40e51351 (patch) | |
| tree | 937bc48e019bb7963126cfaa52f31c8a343e52bd /indoteknik_custom/models/product_template.py | |
| parent | 1563299905b3e0cf97129739c0ee0a6269ce4bc8 (diff) | |
Add flash sale tag on model, view, api response
Diffstat (limited to 'indoteknik_custom/models/product_template.py')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 24264366..0b9b1945 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): |
