Merge branch 'hotfix' into address_not_set_from_api
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 7c26e1d..d6bb2d7 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '10.1.69'
+__version__ = '10.1.72'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.py b/erpnext/hr/doctype/employee_advance/employee_advance.py
index 29aae05..c90e5db 100644
--- a/erpnext/hr/doctype/employee_advance/employee_advance.py
+++ b/erpnext/hr/doctype/employee_advance/employee_advance.py
@@ -58,10 +58,9 @@
 			select sum(ifnull(allocated_amount, 0))
 			from `tabExpense Claim Advance`
 			where employee_advance = %s and docstatus=1 and allocated_amount > 0
-		""", self.name)[0][0]
+		""", self.name)[0][0] or 0
 
-		if claimed_amount:
-			frappe.db.set_value("Employee Advance", self.name, "claimed_amount", claimed_amount)
+		frappe.db.set_value("Employee Advance", self.name, "claimed_amount", claimed_amount)
 
 @frappe.whitelist()
 def make_bank_entry(dt, dn):
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 6c7a252..bc6f99d 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -506,4 +506,5 @@
 erpnext.patches.v10_0.set_discount_amount
 erpnext.patches.v10_0.recalculate_gross_margin_for_project
 erpnext.patches.v10_0.delete_hub_documents
-erpnext.patches.v10_0.update_user_image_in_employee
\ No newline at end of file
+erpnext.patches.v10_0.update_user_image_in_employee
+erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items
\ No newline at end of file
diff --git a/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py b/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py
new file mode 100644
index 0000000..68c06ef
--- /dev/null
+++ b/erpnext/patches/v10_0/repost_gle_for_purchase_receipts_with_rejected_items.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe, erpnext
+
+def execute():
+	for company in frappe.get_all("Company"):
+		if not erpnext.is_perpetual_inventory_enabled(company.name):
+			continue
+
+		acc_frozen_upto = frappe.db.get_value("Accounts Settings", None, "acc_frozen_upto") or "1900-01-01"
+		pr_with_rejected_warehouse = frappe.db.sql("""
+			select pr.name
+			from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
+			where pr.name = pr_item.parent
+				and pr.posting_date > %s
+				and pr.docstatus=1
+				and pr.company = %s
+				and pr_item.rejected_qty > 0
+		""", (acc_frozen_upto, company.name), as_dict=1)
+
+		for d in pr_with_rejected_warehouse:
+			doc = frappe.get_doc("Purchase Receipt", d.name)
+
+			doc.docstatus = 2
+			doc.make_gl_entries_on_cancel(repost_future_gle=False)
+
+
+			# update gl entries for submit state of PR
+			doc.docstatus = 1
+			doc.make_gl_entries(repost_future_gle=False)
diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css
index 460efbf..c55e422 100644
--- a/erpnext/public/css/erpnext.css
+++ b/erpnext/public/css/erpnext.css
@@ -346,6 +346,11 @@
 body[data-route="pos"] .collapse-btn {
   cursor: pointer;
 }
+@media (max-width: 767px) {
+  body[data-route="pos"] .page-actions {
+    max-width: 110px;
+  }
+}
 .price-info {
   position: absolute;
   left: 0;
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index f318c04..dfff74a 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -95,7 +95,7 @@
 
 		if not value:
 			import requests
-			api_url = "https://frankfurter.erpnext.org/{0}".format(transaction_date)
+			api_url = "https://frankfurter.app/{0}".format(transaction_date)
 			response = requests.get(api_url, params={
 				"base": from_currency,
 				"symbols": to_currency
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 80dc4e1..2c56a97 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -182,7 +182,8 @@
 				if warehouse_account.get(d.warehouse):
 					stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
 						{"voucher_type": "Purchase Receipt", "voucher_no": self.name,
-						"voucher_detail_no": d.name}, "stock_value_difference")
+						"voucher_detail_no": d.name, "warehouse": d.warehouse}, "stock_value_difference")
+
 					if not stock_value_diff:
 						continue
 					gl_entries.append(self.get_gl_dict({