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 %}
{{ d.description }}
{{ d.get_formatted("base_tax_amount") }}
+{% endif %} {% endfor %}
{{ _("Grand Total") }}
diff --git a/erpnext/templates/includes/product_list.js b/erpnext/templates/includes/product_list.js index 7f63c170f8..2f9d978eb1 100644 --- a/erpnext/templates/includes/product_list.js +++ b/erpnext/templates/includes/product_list.js @@ -39,10 +39,10 @@ window.render_product_list = function(data) { if(data.length < 10) { if(!table) { $(".more-btn") - .replaceWith("
No products found.
"); + .replaceWith("
{{ _("No products found.") }}
"); } else { $(".more-btn") - .replaceWith("
Nothing more to show.
"); + .replaceWith("
{{ _("Nothing more to show.") }}
"); } } else { $(".more-btn").toggle(true) diff --git a/erpnext/templates/includes/product_page.js b/erpnext/templates/includes/product_page.js index e61ead176a..3905959928 100644 --- a/erpnext/templates/includes/product_page.js +++ b/erpnext/templates/includes/product_page.js @@ -15,18 +15,18 @@ frappe.ready(function() { $(".item-cart").toggleClass("hide", (!!!r.message.price || !!!r.message.in_stock)); if(r.message && r.message.price) { $(".item-price") - .html(r.message.price.formatted_price + " per " + r.message.uom); + .html(r.message.price.formatted_price + " {{ _("per") }} " + r.message.uom); if(r.message.in_stock==0) { - $(".item-stock").html("
Not in stock
"); + $(".item-stock").html("
{{ _("Not in stock") }}
"); } else if(r.message.in_stock==1) { - var qty_display = "In stock"; + var qty_display = "{{ _("In stock") }}"; if (r.message.show_stock_qty) { - qty_display = "Available ("+r.message.stock_qty+ " in stock)"; + qty_display += " ("+r.message.stock_qty+")"; } $(".item-stock").html("
\ - "+__(qty_display)+"
"); + "+qty_display+"
"); } if(r.message.qty) {