summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-08-01 10:20:17 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-08-01 10:20:17 +0700
commite4db1dffb90b6c611358fcaeeefacad89c82b676 (patch)
tree59aff26b72e57306ad02be9cd3be5d1d21b935ac
parent18d87d85c18e8c628ce238032a2b49db8662df62 (diff)
fix error email reminder checkout
-rw-r--r--indoteknik_custom/models/website_user_cart.py8
-rwxr-xr-xindoteknik_custom/views/website_user_cart.xml85
2 files changed, 47 insertions, 46 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index dd3f87e6..ad97a029 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -131,13 +131,13 @@ class WebsiteUserCart(models.Model):
return result
def action_mail_reminder_to_checkout(self):
- user_ids = self.search([]).mapped('user_id')
+ # user_ids = self.search([]).mapped('user_id')
- # user_ids = [1102]
+ user_ids = [1102]
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), ('is_reminder', '=', False)], order='create_date desc', limit=1)
- carts_to_remind = self.search([('user_id', '=', user.id)])
+ carts_to_remind = self.search([('user_id', '=', user)])
if latest_cart and not latest_cart.is_reminder:
for cart in carts_to_remind:
check = cart.check_product_flashsale(cart.product_id.id)
diff --git a/indoteknik_custom/views/website_user_cart.xml b/indoteknik_custom/views/website_user_cart.xml
index 28868d98..36f0b164 100755
--- a/indoteknik_custom/views/website_user_cart.xml
+++ b/indoteknik_custom/views/website_user_cart.xml
@@ -71,7 +71,7 @@
<field name="subject">Yuk, Checkout barang dikeranjang Kamu pakai Voucher Indoteknik</field>
<field name="email_from">noreply@indoteknik.com</field>
<field name="reply_to">sales@indoteknik.com</field>
- <field name="email_to">${object.user_id.partner_id.email | safe}</field>
+ <field name="email_to">${object.user_id.login | safe}</field>
<field name="body_html" type="html">
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Inter, Helvetica, Verdana, Arial,sans-serif; line-height: 24px; color: #454748; width: 100%; border-collapse:separate;">
<tr><td align="center">
@@ -92,7 +92,7 @@
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0; margin: 16px 0px 16px 0px;" />
</td>
</tr>
- </table>
+ </table>
</td>
</tr>
<!-- CONTENT -->
@@ -140,24 +140,23 @@
<tr>
% if cart.program_line_id:
% set promo, free_product = cart.get_data_promo(cart.program_line_id.id)
- % if promo:
% set weight = cart.get_weight_product(cart.program_line_id.id)
% set harga_coret = cart.get_price_coret(cart.program_line_id.id)
- % set subtotal = promo[0].program_line_id.price * cart.qty
+ % set subtotal = cart.program_line_id.price * cart.qty
<td style="border: 1px solid #dddddd; padding: 8px;">
<div class="container text-center">
<div style="display: flex; gap: 20px; align-items: center; margin-top: 8px;">
<div class="col-3">
- <img src="${base_url}api/image/promotion.program/image/${promo[0].program_line_id.program_id.id}" alt="${promo[0].program_line_id.program_id.name}" width="120" height="120" style="object-fit: fill; object-position: center;"/>
+ <img src="${base_url}api/image/promotion.program/image/${cart.program_line_id.program_id.id}" alt="${cart.program_line_id.program_id.name}" width="120" height="120" style="object-fit: fill; object-position: center;"/>
</div>
<div class="col-6" style="margin-top: 0.7rem; padding-left: 1.5rem;">
- <div style="font-weight: 600; margin-bottom: 8px;">${promo[0].program_line_id.name}</div>
+ <div style="font-weight: 600; margin-bottom: 8px;">${cart.program_line_id.name}</div>
<div style="display: flex; gap: 20px; align-items: center; margin-bottom: 8px;">
<div style="color: grey; text-decoration: line-through; margin-right: 20px;">
Rp ${cart.format_currency(harga_coret)}
</div>
<div style="color: red; font-weight: bold;">
- Rp ${cart.format_currency(promo[0].program_line_id.price)}
+ Rp ${cart.format_currency(cart.program_line_id.price)}
</div>
</div>
<div style="color: grey;">
@@ -170,49 +169,51 @@
</div>
</div>
<div style="display: block; gap: 16px; justify-content: center; margin-left: 2rem;">
- % for data in promo:
- <div class="container text-center">
- <div style="display: flex; gap: 20px; align-items: center; margin-top: 8px;">
- <div class="col-3">
- <img src="${base_url}api/image/product.template/image_512/${data.product_id.product_tmpl_id.id}" alt="${data.product_id.name}" width="120" height="120" style="object-fit: fill; object-position: center;"/>
- </div>
- <div class="col-6" style="margin-top: 0.7rem; padding-left: 1.5rem;">
- <div style="font-weight: 400; margin-bottom: 8px;">${data.product_id.name}</div>
- <div style="color: grey;">
- ${data.product_id.default_code} | Berat barang: ${data.product_id.weight} Kg
+ % if promo:
+ % for data in promo:
+ <div class="container text-center">
+ <div style="display: flex; gap: 20px; align-items: center; margin-top: 8px;">
+ <div class="col-3">
+ <img src="${base_url}api/image/product.template/image_512/${data.product_id.product_tmpl_id.id}" alt="${data.product_id.name}" width="120" height="120" style="object-fit: fill; object-position: center;"/>
+ </div>
+ <div class="col-6" style="margin-top: 0.7rem; padding-left: 1.5rem;">
+ <div style="font-weight: 400; margin-bottom: 8px;">${data.product_id.name}</div>
+ <div style="color: grey;">
+ ${data.product_id.default_code} | Berat barang: ${data.product_id.weight} Kg
+ </div>
+ </div>
+ <div class="col-3" style="padding-left: 13rem;">
+ <button type="button" class="btn btn-outline-secondary" style="margin-top: 2.5rem;">${data.qty}</button>
</div>
- </div>
- <div class="col-3" style="padding-left: 13rem;">
- <button type="button" class="btn btn-outline-secondary" style="margin-top: 2.5rem;">${data.qty}</button>
</div>
</div>
- </div>
- % endfor
- % for free in free_product:
- <div class="container text-center">
- <div style="display: flex; gap: 20px; align-items: center; margin-top: 8px;">
- <div class="col-3">
- <img src="${base_url}api/image/product.template/image_512/${free.product_id.product_tmpl_id.id}" alt="${free.product_id.name}" width="120" height="120" style="object-fit: fill; object-position: center;"/>
- </div>
- <div class="col-6" style="margin-top: 0.7rem; padding-left: 1.5rem;">
- <div style="font-weight: 400; margin-bottom: 8px;">${free.product_id.name}</div>
- <div style="color: grey;">
- ${free.product_id.default_code} | Berat barang: ${free.product_id.weight} Kg
+ % endfor
+ % elif free_product:
+ % for free in free_product:
+ <div class="container text-center">
+ <div style="display: flex; gap: 20px; align-items: center; margin-top: 8px;">
+ <div class="col-3">
+ <img src="${base_url}api/image/product.template/image_512/${free.product_id.product_tmpl_id.id}" alt="${free.product_id.name}" width="120" height="120" style="object-fit: fill; object-position: center;"/>
+ </div>
+ <div class="col-6" style="margin-top: 0.7rem; padding-left: 1.5rem;">
+ <div style="font-weight: 400; margin-bottom: 8px;">${free.product_id.name}</div>
+ <div style="color: grey;">
+ ${free.product_id.default_code} | Berat barang: ${free.product_id.weight} Kg
+ </div>
+ </div>
+ <div class="col-3" style="padding-left: 13rem;">
+ <button type="button" class="btn btn-outline-secondary" style="margin-top: 2.5rem;">${free.qty}</button>
</div>
- </div>
- <div class="col-3" style="padding-left: 13rem;">
- <button type="button" class="btn btn-outline-secondary" style="margin-top: 2.5rem;">${free.qty}</button>
</div>
</div>
- </div>
- % endfor
+ % endfor
</div>
</td>
- % else:
- <td colspan="4" style="border: 1px solid #dddddd; padding: 8px; text-align: center;">
- No promotion available for this product.
- </td>
- % endif
+ % else:
+ <td colspan="4" style="border: 1px solid #dddddd; padding: 8px; text-align: center;">
+ No promotion available for this product.
+ </td>
+ % endif
% elif flashsale['is_flashsale'] == True:
<td style="border: 1px solid #dddddd; padding: 8px;">