From cec124ff1de94761e4394620eb471b2246f23940 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 29 Jul 2024 14:54:39 +0700 Subject: test email reminder checkout --- indoteknik_custom/models/website_user_cart.py | 22 +++++++++++++++++++++- indoteknik_custom/views/website_user_cart.xml | 6 ++---- 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
@@ -152,7 +153,7 @@
${promo[0].program_line_id.name}
- Rp ${cart.format_currency(promo[0].program_line_id.price)} + Rp ${cart.format_currency(harga_coret)}
Rp ${cart.format_currency(promo[0].program_line_id.price)} @@ -223,9 +224,6 @@
${cart.product_id.name}
-
- Rp${cart.format_currency(product_price['price'])} -
Rp${cart.format_currency(product_price['price'])}
-- cgit v1.2.3