Merge pull request #3350 from anandpdoshi/anand-may-26

Fixes in shopping cart and website route rules
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 2dde685..9a2da96 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -85,9 +85,9 @@
 			existing_shipping_charge = self.get("taxes", filters=shipping_charge)
 			if existing_shipping_charge:
 				# take the last record found
-				existing_shipping_charge[-1].rate = shipping_amount
+				existing_shipping_charge[-1].tax_amount = shipping_amount
 			else:
-				shipping_charge["rate"] = shipping_amount
+				shipping_charge["tax_amount"] = shipping_amount
 				shipping_charge["description"] = shipping_rule.label
 				self.append("taxes", shipping_charge)
 
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 54e2d03..c471007 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -34,13 +34,13 @@
 
 website_route_rules = [
 	{"from_route": "/orders", "to_route": "Sales Order"},
-	{"from_route": "/orders/<name>", "to_route": "print", "defaults": {"doctype": "Sales Order"}},
+	{"from_route": "/orders/<path:name>", "to_route": "print", "defaults": {"doctype": "Sales Order"}},
 	{"from_route": "/invoices", "to_route": "Sales Invoice"},
-	{"from_route": "/invoices/<name>", "to_route": "print", "defaults": {"doctype": "Sales Invoice"}},
+	{"from_route": "/invoices/<path:name>", "to_route": "print", "defaults": {"doctype": "Sales Invoice"}},
 	{"from_route": "/shipments", "to_route": "Delivery Note"},
-	{"from_route": "/shipments/<name>", "to_route": "print", "defaults": {"doctype": "Delivery Note"}},
+	{"from_route": "/shipments/<path:name>", "to_route": "print", "defaults": {"doctype": "Delivery Note"}},
 	{"from_route": "/issues", "to_route": "Issue"},
-	{"from_route": "/issues/<name>", "to_route": "print", "defaults": {"doctype": "Issue"}},
+	{"from_route": "/issues/<path:name>", "to_route": "print", "defaults": {"doctype": "Issue"}},
 	{"from_route": "/addresses", "to_route": "Address"},
 ]
 
diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
index 5bac1c5..f7aa70f 100644
--- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
@@ -72,7 +72,7 @@
 	target_details = {}
 
 	for d in frappe.db.sql("""select md.name, mdp.month, mdp.percentage_allocation
-		from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` mdp
+		from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
 		where mdp.parent=md.name and md.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
 			target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
 
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
index 1ad344a..5fba1ff 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
@@ -130,6 +130,9 @@
 
 	def get_price_list(self, billing_territory):
 		price_list = self.get_name_from_territory(billing_territory, "price_lists", "selling_price_list")
+		if not (price_list and price_list[0]):
+			price_list = self.get_name_from_territory(self.default_territory, "price_lists", "selling_price_list")
+
 		return price_list and price_list[0] or None
 
 	def get_tax_master(self, billing_territory):