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 From 81c87b71d6cb7caad7230b9cca8545155d917214 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 10 Aug 2023 11:01:05 +0700 Subject: fix format price email template --- indoteknik_custom/views/mail_template_po.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/views/mail_template_po.xml b/indoteknik_custom/views/mail_template_po.xml index 77c21837..410520b3 100644 --- a/indoteknik_custom/views/mail_template_po.xml +++ b/indoteknik_custom/views/mail_template_po.xml @@ -54,10 +54,10 @@ % if line.price_vendor != 0 and line.price_unit != line.price_vendor - % endif + % endif % endfor Silahkan periksa dan lakukan koreksi jika diperlukan.

-- cgit v1.2.3 From ddc94ab173b4bf01de9dfa900f951eed56fe77b6 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 10 Aug 2023 11:26:29 +0700 Subject: Update website user cart mail template --- indoteknik_api/models/product_product.py | 4 +- indoteknik_custom/models/website_user_cart.py | 12 ++- indoteknik_custom/views/website_user_cart.xml | 145 ++++++++++++++------------ 3 files changed, 86 insertions(+), 75 deletions(-) diff --git a/indoteknik_api/models/product_product.py b/indoteknik_api/models/product_product.py index ff7c6498..a2d2f8a2 100644 --- a/indoteknik_api/models/product_product.py +++ b/indoteknik_api/models/product_product.py @@ -55,8 +55,8 @@ class ProductProduct(models.Model): product_promotions = program_line.get_active_promotions(self.id) return True if len(product_promotions) > 0 else False - def calculate_website_price(self): - pricelist = self.env.user_pricelist + def calculate_website_price(self, pricelist=False): + pricelist = pricelist or self.env.user_pricelist config = self.env['ir.config_parameter'] product_pricelist_tier1 = int(config.get_param('product.pricelist.tier1')) diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py index 13bad358..bf7016f8 100644 --- a/indoteknik_custom/models/website_user_cart.py +++ b/indoteknik_custom/models/website_user_cart.py @@ -14,12 +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') + user_other_carts = fields.One2many('website.user.cart', 'id', 'Other Products', compute='_compute_user_other_carts') - def _compute_other_carts(self): + def _compute_user_other_carts(self): for record in self: others = self.search([('user_id', '=', record.user_id.id)]) - record.other_carts = others + record.user_other_carts = others def get_product(self): user_data = { @@ -94,4 +94,8 @@ class WebsiteUserCart(models.Model): 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 + template.send_mail(int(id), force_send=True) + + def format_currency(self, number): + number = int(number) + return "{:,}".format(number).replace(',', '.') \ 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 a6456cf2..f43c9f63 100755 --- a/indoteknik_custom/views/website_user_cart.xml +++ b/indoteknik_custom/views/website_user_cart.xml @@ -70,79 +70,86 @@ sales@indoteknik.com ${object.user_id.login | safe} -
- - - - + + +
- - - - - + + + + + +
- - - - +
- -
+ - -
+ + + + + - - - - + + + + - - -
+ + + + - - - -
+ +
-
-
-
- - + + + +
Halo ${object.user_id.name},
+
+
+
+ + - - - - - + + + + + - - + + - - - - - - -
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 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:
+ % set base_url = object.env['ir.config_parameter'].get_param('web.base.url') + % for cart in object.user_other_carts: + % set user_pricelist = cart.user_id.partner_id.property_product_pricelist + % set product_price = cart.product_id.calculate_website_price(pricelist=user_pricelist) + % set product_template_id = cart.product_id.product_tmpl_id.id + % set subtotal = product_price['price_discount'] * cart.qty + + + + + + + + +
+ ${cart.product_id.name} + +
${cart.product_id.name}
+ % if product_price['discount_percentage'] != 0: +
Rp${cart.format_currency(product_price['price'])} (${'%d' % product_price['discount_percentage']}%)
+ % endif +
Rp${cart.format_currency(product_price['price_discount'])} x ${'%d pcs' % cart.qty}
+
Rp${cart.format_currency(subtotal)}
+
+
+ % endfor +
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.
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
-
-
-
-
- +
Hormat kami,
PT. Indoteknik Dotcom Gemilang
sales@indoteknik.com
+
+
+
+ + -- cgit v1.2.3 From 659268250145b51e8700bc01871ae3bba34f76f3 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 10 Aug 2023 12:01:11 +0700 Subject: Update sort voucher by can apply on get voucher api --- indoteknik_api/controllers/api_v1/voucher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/voucher.py b/indoteknik_api/controllers/api_v1/voucher.py index 3a2c798e..0b769ee7 100644 --- a/indoteknik_api/controllers/api_v1/voucher.py +++ b/indoteknik_api/controllers/api_v1/voucher.py @@ -75,5 +75,7 @@ class Voucher(controller.Controller): voucher['has_flashsale_products'] = has_flashsale_products voucher['discount_voucher'] = discount_voucher voucher['difference_to_apply'] = difference_to_apply + + sorted_vouchers = sorted(vouchers, key=lambda x: x['can_apply'], reverse=True) - return self.response(vouchers) + return self.response(sorted_vouchers) -- cgit v1.2.3