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