diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-03 09:37:08 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-03 09:37:08 +0700 |
| commit | f0f30aa566c0e49b03fd86f86bbcd80d6c7383ce (patch) | |
| tree | d14b5798152f861add407d978f87eb0418bda906 | |
| parent | 0cdfe713ecec45544caf6fb15c6e1a1c8e515141 (diff) | |
Fix get active flashsale on variant
| -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 |
