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 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models') 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) -- cgit v1.2.3