summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-07-30 14:03:25 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-07-30 14:03:25 +0700
commit7aa1b7b0c7e2375c0ec0c4e7cfa4106ba2dc0ccf (patch)
tree43a2025167e53a1c68feeaa641cfc8ef287210d7
parent2bb2591a61f62d941899d440e6ef75af1a792d79 (diff)
testing email reminder checkout
-rw-r--r--indoteknik_custom/models/website_user_cart.py7
1 files 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)