From 7aa1b7b0c7e2375c0ec0c4e7cfa4106ba2dc0ccf Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 30 Jul 2024 14:03:25 +0700 Subject: testing email reminder checkout --- indoteknik_custom/models/website_user_cart.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py index c6fa2bf7..5905cba7 100644 --- a/indoteknik_custom/models/website_user_cart.py +++ b/indoteknik_custom/models/website_user_cart.py @@ -133,15 +133,18 @@ class WebsiteUserCart(models.Model): def action_mail_reminder_to_checkout(self): # user_ids = self.search([]).mapped('user_id') - user_ids = [1102] + user_ids = [101] for user in user_ids: latest_cart = self.search([('user_id', '=', user), ('is_reminder', '=', False)], order='create_date desc', limit=1) carts_to_remind = self.search([('user_id', '=', user)]) if latest_cart and not latest_cart.is_reminder: for cart in carts_to_remind: - if not cart.program_line_id and not 'BOM' in cart.product_id.default_code: + check = cart.check_product_flashsale(cart.product_id.id) + if not cart.program_line_id and cart.product_id.default_code and not 'BOM' in cart.product_id.default_code and check['is_flashsale'] == False: cart.is_selected = True + if cart.program_line_id or not check['is_flashsale'] or cart.product_id.default_code and not 'BOM' in cart.product_id.default_code: + cart.is_selected = False cart.is_reminder = True template = self.env.ref('indoteknik_custom.mail_template_user_cart_reminder_to_checkout') template.send_mail(latest_cart.id, force_send=True) -- cgit v1.2.3