summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/website_user_cart.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-09-11 13:18:02 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-09-11 13:18:02 +0700
commit1694e042acb29b476815d29f54f2ec95d37883be (patch)
treed502c76d333cc4c0602e01a98eeb7fb7f0461c01 /indoteknik_custom/models/website_user_cart.py
parent02c2304b242245250177fec6ab3c911d9acba781 (diff)
parent9a630354c1d00e218595db9b2e8cd0b7df9ed97c (diff)
Merge branch 'feature/voucher-group' into production
Diffstat (limited to 'indoteknik_custom/models/website_user_cart.py')
-rw-r--r--indoteknik_custom/models/website_user_cart.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index bf7016f8..b3695ba1 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -71,7 +71,17 @@ class WebsiteUserCart(models.Model):
subtotal = total_purchase - total_discount
discount_voucher = 0
if voucher:
- discount_voucher = voucher.calculate_discount(subtotal)
+ order_line = []
+ for product in products:
+ order_line.append({
+ 'product_id': self.env['product.product'].browse(product['id']),
+ 'price': product['price']['price'],
+ 'discount': product['price']['discount_percentage'],
+ 'qty': product['quantity'],
+ 'subtotal': product['subtotal']
+ })
+ voucher_info = voucher.apply(order_line)
+ discount_voucher = voucher_info['discount']['all']
subtotal -= discount_voucher
tax = round(subtotal * 0.11)
grand_total = subtotal + tax