diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js index 2c56b026b9..01a899c0ec 100644 --- a/erpnext/public/js/shopping_cart.js +++ b/erpnext/public/js/shopping_cart.js @@ -6,7 +6,7 @@ frappe.provide("erpnext.shopping_cart"); var shopping_cart = erpnext.shopping_cart; frappe.ready(function() { - var full_name = frappe.session.user_fullname; + var full_name = frappe.session && frappe.session.user_fullname; // update user if(full_name) { $('.navbar li[data-label="User"] a') @@ -35,9 +35,8 @@ $.extend(shopping_cart, { }); }, - update_cart: function(opts) { - var full_name = frappe.session.user_fullname; - if(!full_name || full_name==="Guest") { + update_cart: function(opts) { + if(fraappe.session.user==="Guest") { if(localStorage) { localStorage.setItem("last_visited", window.location.pathname); } diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 98404a44ae..59a36debd3 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -100,7 +100,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non or name like %(search)s)""" search = "%" + cstr(search) + "%" - query += """order by weightage desc, modified desc limit %s, %s""" % (start, limit) + query += """order by weightage desc, item_name, modified desc limit %s, %s""" % (start, limit) data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index e73734e63a..5c7d825b80 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -75,9 +75,15 @@ def place_order(): def update_cart(item_code, qty, with_items=False): quotation = _get_cart_quotation() + empty_card = False qty = flt(qty) if qty == 0: - quotation.set("items", quotation.get("items", {"item_code": ["!=", item_code]})) + quotation_items = quotation.get("items", {"item_code": ["!=", item_code]}) + if quotation_items: + quotation.set("items", quotation_items) + else: + empty_card = True + else: quotation_items = quotation.get("items", {"item_code": item_code}) if not quotation_items: @@ -92,7 +98,11 @@ def update_cart(item_code, qty, with_items=False): apply_cart_settings(quotation=quotation) quotation.flags.ignore_permissions = True - quotation.save() + if not empty_card: + quotation.save() + else: + quotation.delete() + quotation = None set_cart_count(quotation) diff --git a/erpnext/templates/includes/order/order_taxes.html b/erpnext/templates/includes/order/order_taxes.html index 24ae088c75..471576f4f5 100644 --- a/erpnext/templates/includes/order/order_taxes.html +++ b/erpnext/templates/includes/order/order_taxes.html @@ -6,11 +6,13 @@ {% endif %} {% for d in doc.taxes %} +{% if d.base_tax_amount > 0 %}