From 7b4f47e43d6485bb7822f1eb21497e68ab782ab1 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 9 Aug 2023 15:29:16 +0700 Subject: Add field other carts, mail template, and cron on website user cart --- indoteknik_custom/models/website_user_cart.py | 12 +++- indoteknik_custom/views/website_user_cart.xml | 97 +++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py index 9b82aa93..13bad358 100644 --- a/indoteknik_custom/models/website_user_cart.py +++ b/indoteknik_custom/models/website_user_cart.py @@ -14,6 +14,12 @@ class WebsiteUserCart(models.Model): ('add_to_cart', 'Add To Cart'), ('buy', 'Buy') ], 'Source', default='add_to_cart') + other_carts = fields.One2many('website.user.cart', 'id', 'Other Products', compute='_compute_other_carts') + + def _compute_other_carts(self): + for record in self: + others = self.search([('user_id', '=', record.user_id.id)]) + record.other_carts = others def get_product(self): user_data = { @@ -84,4 +90,8 @@ class WebsiteUserCart(models.Model): 'has_product_without_weight': any(not product.get('weight') or product.get('weight') == 0 for product in products), 'products': products } - return result \ No newline at end of file + return result + + def action_mail_reminder_to_checkout(self, id): + template = self.env.ref('indoteknik_custom.mail_template_user_cart_reminder_to_checkout') + template.send_mail(int(id), force_send=True) \ No newline at end of file diff --git a/indoteknik_custom/views/website_user_cart.xml b/indoteknik_custom/views/website_user_cart.xml index f942cdda..a6456cf2 100755 --- a/indoteknik_custom/views/website_user_cart.xml +++ b/indoteknik_custom/views/website_user_cart.xml @@ -49,5 +49,102 @@ sequence="1" action="website_user_cart_action" /> + + + User Cart: Reminder to checkout + 1 + days + -1 + + + model.action_mail_reminder_to_checkout() + code + 75 + False + + + + User Cart: Reminder to checkout + + Hello ${object.user_id.name} + sales@indoteknik.com + ${object.user_id.login | safe} + +
+ + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + +
Halo ${object.user_id.name},
Kami harap Anda dalam keadaan baik. Kami ingin mengingatkan Anda bahwa Anda memiliki beberapa produk yang masih ada di keranjang belanja Anda di situs kami, tetapi belum selesai untuk proses checkout.
Jika Anda masih tertarik dengan produk-produk tersebut, jangan ragu untuk segera melanjutkan proses pembayaran. Ini adalah kesempatan Anda untuk mendapatkan barang-barang yang Anda inginkan sebelum kehabisan stok.
Berikut adalah daftar produk yang masih ada di keranjang belanja Anda:
+ + + + + +
+ Nama Produk +
Kami juga ingin memberitahu Anda bahwa kami menyediakan layanan pelanggan yang siap membantu jika Anda memiliki pertanyaan atau memerlukan bantuan dalam proses pembayaran. Jangan ragu untuk menghubungi kami melalui email ini atau nomor layanan pelanggan kami yang tertera di situs.
Terima kasih atas perhatian Anda dan kesempatan untuk melayani Anda. Kami berharap dapat segera melihat Anda menyelesaikan pembelian Anda.
Hormat kami,
PT. Indoteknik Dotcom Gemilang
sales@indoteknik.com
+
+
+
+
+
+
+
+ \ No newline at end of file -- cgit v1.2.3