[fix] typo, item group route to have parent only for non root

This commit is contained in:
Rushabh Mehta 2017-06-20 14:05:36 +05:30
parent 958b06b129
commit 17e6bb83eb
2 changed files with 6 additions and 5 deletions

View File

@ -36,7 +36,7 @@ $.extend(shopping_cart, {
}, },
update_cart: function(opts) { update_cart: function(opts) {
if(fraappe.session.user==="Guest") { if(frappe.session.user==="Guest") {
if(localStorage) { if(localStorage) {
localStorage.setItem("last_visited", window.location.pathname); localStorage.setItem("last_visited", window.location.pathname);
} }

View File

@ -37,10 +37,11 @@ class ItemGroup(NestedSet, WebsiteGenerator):
if not self.route: if not self.route:
self.route = '' self.route = ''
if self.parent_item_group: if self.parent_item_group:
parent_route = frappe.get_doc('Item Group', self.parent_item_group).route parent_item_group = frappe.get_doc('Item Group', self.parent_item_group)
if parent_route: # make parent route only if not root
self.route = parent_route + '/' if parent_item_group.parent_item_group and parent_item_group.route:
self.route = parent_item_group.route + '/'
self.route += self.scrub(self.item_group_name) self.route += self.scrub(self.item_group_name)