summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/website_user_cart.py
diff options
context:
space:
mode:
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,