diff options
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 |
