summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/website_user_cart.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-11-10 13:40:58 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-11-10 13:40:58 +0700
commit2aee5a44abbe36961dfe23cc3d656aa48e11e0f9 (patch)
tree8ec2b6552aaef4e14539aa52ed796552e24180d6 /indoteknik_custom/models/website_user_cart.py
parent6a87e59e7220bdfa78e98b23003ccc4ef41bd0ce (diff)
parentb4e74170aeaf00937f78e5af9047218ddb17516c (diff)
Merge branch 'production' into change/feature/promotion-program
Diffstat (limited to 'indoteknik_custom/models/website_user_cart.py')
-rw-r--r--indoteknik_custom/models/website_user_cart.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py
index 47a695fe..bbc14c88 100644
--- a/indoteknik_custom/models/website_user_cart.py
+++ b/indoteknik_custom/models/website_user_cart.py
@@ -55,11 +55,15 @@ class WebsiteUserCart(models.Model):
def get_product_by_user(self, user_id, selected=False, source=False):
user_id = int(user_id)
- source = source if source else 'add_to_cart'
+
+ if source == 'buy':
+ source = ['buy']
+ else:
+ source = ['add_to_cart', 'buy']
parameters = [
('user_id', '=', user_id),
- ('source', '=', source)
+ ('source', 'in', source)
]
if selected:
@@ -91,6 +95,7 @@ class WebsiteUserCart(models.Model):
tax = round(subtotal * 0.11)
grand_total = subtotal + tax
total_weight = sum(x['weight'] * x['quantity'] for x in products)
+ total_weight = round(total_weight, 2)
result = {
'total_purchase': total_purchase,
'total_discount': total_discount,