summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-07-29 14:54:39 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-07-29 14:54:39 +0700
commitcec124ff1de94761e4394620eb471b2246f23940 (patch)
tree285daa952ccd6912e24f3389abbf16813a3836fe
parentdb137681fedf653e02f593884d2cbc270af752d5 (diff)
test email reminder checkout
-rw-r--r--indoteknik_custom/models/website_user_cart.py22
-rwxr-xr-xindoteknik_custom/views/website_user_cart.xml6
2 files changed, 23 insertions, 5 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index 7143f4ef..a361b4e1 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -134,7 +134,7 @@ class WebsiteUserCart(models.Model):
# user_ids = self.search([]).mapped('user_id')
user_ids = [101]
- for user in user_ids:
+ for user in user_ids:
latest_cart = self.search([('user_id', '=', user), ('is_reminder', '=', False)], order='create_date desc', limit=1)
carts_to_remind = self.search([('user_id', '=', user)])
@@ -217,6 +217,26 @@ class WebsiteUserCart(models.Model):
return real_weight
+ def get_price_coret(self, program_line_id):
+ program_line_product = self.env['promotion.product'].search([
+ ('program_line_id', '=', program_line_id)
+ ])
+
+ program_free_product = self.env['promotion.free_product'].search([
+ ('program_line_id', '=', program_line_id)
+ ])
+
+ price_coret = 0.0
+ for product in program_line_product:
+ price = self.get_price_website(product.product_id.id)
+ price_coret += price['price'] * product.qty
+
+ for product in program_free_product:
+ price = self.get_price_website(product.product_id.id)
+ price_coret += price['price'] * product.qty
+
+ return price_coret
+
def get_price_website(self, product_id):
price_website = self.env['product.pricelist.item'].search([('product_id', '=', product_id), ('pricelist_id', '=', 17022)], limit=1)
diff --git a/indoteknik_custom/views/website_user_cart.xml b/indoteknik_custom/views/website_user_cart.xml
index 64a7eff7..97e8cf02 100755
--- a/indoteknik_custom/views/website_user_cart.xml
+++ b/indoteknik_custom/views/website_user_cart.xml
@@ -141,6 +141,7 @@
% 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
<td style="border: 1px solid #dddddd; padding: 8px;">
<div class="container text-center">
@@ -152,7 +153,7 @@
<div style="font-weight: 600; margin-bottom: 8px;">${promo[0].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(promo[0].program_line_id.price)}
+ Rp ${cart.format_currency(harga_coret)}
</div>
<div style="color: red; font-weight: bold;">
Rp ${cart.format_currency(promo[0].program_line_id.price)}
@@ -223,9 +224,6 @@
<div class="col-6">
<div style="font-weight: 600; margin-bottom: 8px;">${cart.product_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(product_price['price'])}
- </div>
<div style="color: red; font-weight: bold;">
Rp${cart.format_currency(product_price['price'])}
</div>