diff options
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 9 | ||||
| -rw-r--r-- | indoteknik_custom/models/website_user_cart.py | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 82cb0432..72fb4dea 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -319,4 +319,11 @@ class ProductProduct(models.Model): def unlink(self): if self._name == 'product.product': - raise UserError('Maaf anda tidak bisa delete product')
\ No newline at end of file + raise UserError('Maaf anda tidak bisa delete product') + + def _get_active_flash_sale(self): + pricelist = self.env['product.pricelist'].search([ + ('is_flash_sale', '=', True), + ('item_ids.product_id', '=', self.id) + ], limit=1) + return pricelist
\ No newline at end of file diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py index 4d85e64d..9b82aa93 100644 --- a/indoteknik_custom/models/website_user_cart.py +++ b/indoteknik_custom/models/website_user_cart.py @@ -27,6 +27,8 @@ class WebsiteUserCart(models.Model): product['selected'] = self.is_selected product['program'] = None product['can_buy'] = True + product_flashsale = self.product_id._get_active_flash_sale() + product['has_flashsale'] = True if len(product_flashsale) > 0 else False if self.program_line_id: product['program'] = self.program_line_id.res_format_cart(user=user_data, quantity=self.qty) |
