summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/website_user_cart.py
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-10-25 08:47:36 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-10-25 08:47:36 +0700
commit9fa80c62cdffec5b91aaf2a2899d70d0f507c2e4 (patch)
tree93ae8d82f774345f650bc8d072dea759c6e33363 /indoteknik_custom/models/website_user_cart.py
parenta21c5fe37529b2d2259d3b86d8e98730b2bc8513 (diff)
parenta7be93f4825967807f12e6bfbebcf090af8500fa (diff)
Merge branch 'production' into iman/switch-account
# Conflicts: # indoteknik_api/controllers/api_v1/user.py # indoteknik_custom/models/user_company_request.py
Diffstat (limited to 'indoteknik_custom/models/website_user_cart.py')
-rw-r--r--indoteknik_custom/models/website_user_cart.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index 169f4a6b..26e217cb 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -173,13 +173,12 @@ class WebsiteUserCart(models.Model):
}
return result
- def action_mail_reminder_to_checkout(self, limit=10):
- user_ids = self.search([]).mapped('user_id')[:limit]
+ def action_mail_reminder_to_checkout(self, limit=200):
+ user_ids = self.search([('is_reminder', '=', False)]).mapped('user_id')[:limit]
for user in user_ids:
- latest_cart = self.search([('user_id', '=', user.id), ('is_reminder', '=', False)], order='create_date desc', limit=1)
+ latest_cart = self.search([('user_id', '=', user.id)], order='create_date desc', limit=1)
- # Proses semua keranjang untuk user tersebut
carts_to_remind = self.search([('user_id', '=', user.id)])
if latest_cart and not latest_cart.is_reminder:
@@ -191,11 +190,9 @@ class WebsiteUserCart(models.Model):
cart.is_selected = False
cart.is_reminder = True
- # Mengirim email pengingat untuk keranjang terbaru
template = self.env.ref('indoteknik_custom.mail_template_user_cart_reminder_to_checkout')
template.send_mail(latest_cart.id, force_send=True)
-
def calculate_discount(self, user_id):
carts = self.search([('user_id', '=', user_id)])
voucher = self.env['voucher'].browse(146)