From f0f30aa566c0e49b03fd86f86bbcd80d6c7383ce Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 3 Aug 2023 09:37:08 +0700 Subject: Fix get active flashsale on variant --- indoteknik_custom/models/product_template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 72fb4dea..bc54b703 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -322,8 +322,11 @@ class ProductProduct(models.Model): raise UserError('Maaf anda tidak bisa delete product') def _get_active_flash_sale(self): + current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') pricelist = self.env['product.pricelist'].search([ ('is_flash_sale', '=', True), - ('item_ids.product_id', '=', self.id) + ('item_ids.product_id', '=', self.id), + ('start_date', '<=', current_time), + ('end_date', '>=', current_time) ], limit=1) return pricelist \ No newline at end of file -- cgit v1.2.3