Merge branch 'hotfix'
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 7ffd424..5392e72 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.8'
+__version__ = '10.1.9'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 9e3fa71..776bacf 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -676,30 +676,17 @@
 			function(d) { return flt(d.amount) }));
 
 		if(frm.doc.party) {
-			var party_amount = frm.doc.payment_type=="Receive" ?
-				frm.doc.paid_amount : frm.doc.received_amount;
-			var company_currency = frm.doc.company? frappe.get_doc(":Company", frm.doc.company).default_currency: "";
-
-			if (frm.doc.party_account_currency == company_currency) {
-				if(frm.doc.payment_type == "Receive" && frm.doc.total_allocated_amount <= party_amount + total_deductions) {
-					unallocated_amount = party_amount - (frm.doc.total_allocated_amount - total_deductions);
-				} else if (frm.doc.payment_type == "Pay" && frm.doc.total_allocated_amount <= party_amount - total_deductions) {
-					unallocated_amount = party_amount - (frm.doc.total_allocated_amount + total_deductions);
-				}
-			} else {
-				if(frm.doc.payment_type == "Receive"
-					&& frm.doc.base_total_allocated_amount <= frm.doc.base_received_amount + total_deductions
-					&& frm.doc.total_allocated_amount < frm.doc.paid_amount) {
-						unallocated_amount = (frm.doc.base_received_amount + total_deductions
-							- frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
-				} else if (frm.doc.payment_type == "Pay"
-					&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
-					&& frm.doc.total_allocated_amount < frm.doc.received_amount) {
-						unallocated_amount = (frm.doc.base_paid_amount - (total_deductions
-							+ frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate;
-				}
+			if(frm.doc.payment_type == "Receive"
+				&& frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions
+				&& frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) {
+					unallocated_amount = (frm.doc.base_received_amount + total_deductions
+						- frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
+			} else if (frm.doc.payment_type == "Pay"
+				&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
+				&& frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) {
+					unallocated_amount = (frm.doc.base_paid_amount - (total_deductions
+						+ frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate;
 			}
-			
 		}
 		frm.set_value("unallocated_amount", unallocated_amount);
 		frm.trigger("set_difference_amount");
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 7dfa5c8..eafdac3 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -292,30 +292,18 @@
 
 	def set_unallocated_amount(self):
 		self.unallocated_amount = 0
-
 		if self.party:
 			total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
-
-			if self.party_account_currency == self.company_currency:
-				if self.payment_type == "Receive" \
-					and self.total_allocated_amount <= self.paid_amount + total_deductions:
-						self.unallocated_amount = self.paid_amount - \
-							(self.total_allocated_amount - total_deductions)
-				elif self.payment_type == "Pay" \
-					and self.total_allocated_amount <= self.received_amount - total_deductions:
-						self.unallocated_amount = self.received_amount - \
-							(self.total_allocated_amount + total_deductions)
-			else:
-				if self.payment_type == "Receive" \
-					and self.base_total_allocated_amount <= self.base_received_amount + total_deductions \
-					and self.total_allocated_amount < self.paid_amount:
-						self.unallocated_amount = (self.base_received_amount + total_deductions - 
-							self.base_total_allocated_amount) / self.source_exchange_rate
-				elif self.payment_type == "Pay" \
-					and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) \
-					and self.total_allocated_amount < self.received_amount:
-						self.unallocated_amount = (self.base_paid_amount - (total_deductions + 
-							self.base_total_allocated_amount)) / self.target_exchange_rate
+			if self.payment_type == "Receive" \
+				and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
+				and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
+					self.unallocated_amount = (self.base_received_amount + total_deductions - 
+						self.base_total_allocated_amount) / self.source_exchange_rate
+			elif self.payment_type == "Pay" \
+				and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) \
+				and self.total_allocated_amount < self.received_amount + (total_deductions / self.target_exchange_rate):
+					self.unallocated_amount = (self.base_paid_amount - (total_deductions + 
+						self.base_total_allocated_amount)) / self.target_exchange_rate
 
 	def set_difference_amount(self):
 		base_unallocated_amount = flt(self.unallocated_amount) * (flt(self.source_exchange_rate)
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index e00f075..2bd1447 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -687,12 +687,12 @@
    "in_standard_filter": 0,
    "label": "Customer's Purchase Order",
    "length": 0,
-   "no_copy": 0,
+   "no_copy": 1,
    "permlevel": 0,
    "precision": "",
    "print_hide": 1,
    "print_hide_if_no_value": 0,
-   "read_only": 1,
+   "read_only": 0,
    "remember_last_selected_value": 0,
    "report_hide": 0,
    "reqd": 0,
@@ -4683,7 +4683,7 @@
  "istable": 0,
  "max_attachments": 0,
  "menu_index": 0,
- "modified": "2018-01-12 15:19:54.711885",
+ "modified": "2018-03-13 15:19:54.711885",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Sales Invoice",
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index a3a889b..7fc0f67 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -4,12 +4,11 @@
 from __future__ import unicode_literals
 
 import frappe
-import datetime
 from frappe import _, msgprint, scrub
 from frappe.defaults import get_user_permissions
 from frappe.model.utils import get_fetch_values
-from frappe.utils import (add_days, getdate, formatdate, get_first_day, date_diff,
-                          add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
+from frappe.utils import (add_days, getdate, formatdate, date_diff,
+	add_years, get_timestamp, nowdate, flt, add_months, get_last_day)
 from frappe.contacts.doctype.address.address import (get_address_display,
 	get_default_address, get_company_address)
 from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
@@ -141,10 +140,7 @@
 		price_list = get_default_price_list(party)
 
 	if not price_list:
-		if party.doctype == "Customer":
-			price_list = frappe.db.get_single_value('Selling Settings', 'selling_price_list')
-		else:
-			price_list = frappe.db.get_single_value('Buying Settings', 'buying_price_list')
+		price_list = given_price_list
 
 	if price_list:
 		out.price_list_currency = frappe.db.get_value("Price List", price_list, "currency")
diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
index d4a02fb..7288bca 100644
--- a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
+++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json
@@ -17,7 +17,7 @@
    "collapsible": 0, 
    "columns": 2, 
    "fieldname": "main_item_code", 
-   "fieldtype": "Data", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -30,6 +30,7 @@
    "no_copy": 0, 
    "oldfieldname": "main_item_code", 
    "oldfieldtype": "Data", 
+   "options": "Item", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -39,6 +40,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -48,7 +50,7 @@
    "collapsible": 0, 
    "columns": 2, 
    "fieldname": "rm_item_code", 
-   "fieldtype": "Data", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -61,6 +63,7 @@
    "no_copy": 0, 
    "oldfieldname": "rm_item_code", 
    "oldfieldtype": "Data", 
+   "options": "Item", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -70,6 +73,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -101,6 +105,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -133,6 +138,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -165,6 +171,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -194,6 +201,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -225,6 +233,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -256,6 +265,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -287,6 +297,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -319,6 +330,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -350,6 +362,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -363,7 +376,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-01-05 14:47:15.400785", 
+ "modified": "2018-03-13 12:37:57.150914", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order Item Supplied", 
diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
index 85130a1..e8ec062 100644
--- a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
+++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
  "beta": 0, 
@@ -11,12 +12,13 @@
  "engine": "InnoDB", 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
    "fieldname": "main_item_code", 
-   "fieldtype": "Data", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -29,6 +31,7 @@
    "no_copy": 0, 
    "oldfieldname": "main_item_code", 
    "oldfieldtype": "Data", 
+   "options": "Item", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -38,15 +41,17 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
    "fieldname": "rm_item_code", 
-   "fieldtype": "Data", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -59,6 +64,7 @@
    "no_copy": 0, 
    "oldfieldname": "rm_item_code", 
    "oldfieldtype": "Data", 
+   "options": "Item", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -68,9 +74,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -99,10 +107,12 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0, 
    "width": "300px"
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -129,9 +139,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -157,9 +169,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -184,9 +198,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -214,9 +230,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -244,9 +262,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -275,9 +295,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -306,9 +328,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -337,9 +361,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -367,9 +393,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -397,9 +425,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -427,9 +457,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -457,20 +489,21 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
+ "has_web_view": 0, 
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "idx": 1, 
  "image_view": 0, 
  "in_create": 0, 
- "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-02-17 16:43:21.668443", 
+ "modified": "2018-03-13 12:38:40.807453", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Receipt Item Supplied", 
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 6b18b82..ad32ab5 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -38,6 +38,7 @@
 		self.validate_max_discount()
 		self.validate_selling_price()
 		self.set_qty_as_per_stock_uom()
+		self.set_po_nos()
 		check_active_sales_items(self)
 
 	def set_missing_values(self, for_validate=False):
@@ -326,9 +327,16 @@
 							"actual_qty": -1*flt(d.qty),
 							"incoming_rate": return_rate
 						}))
-
 		self.make_sl_entries(sl_entries)
 
+	def set_po_nos(self):
+		if self.doctype in ("Delivery Note", "Sales Invoice"):
+			ref_fieldname = "against_sales_order" if self.doctype == "Delivery Note" else "sales_order"
+			sales_orders = list(set([d.get(ref_fieldname) for d in self.items]))
+			if sales_orders:
+				po_nos = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', sales_orders)})
+				self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
+
 def check_active_sales_items(obj):
 	for d in obj.get("items"):
 		if d.item_code:
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 2f41307..9e30939 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -5,7 +5,7 @@
 import frappe
 import json
 import frappe.utils
-from frappe.utils import cstr, flt, getdate, comma_and, cint, nowdate, add_days
+from frappe.utils import cstr, flt, getdate, comma_and, cint
 from frappe import _
 from frappe.model.utils import get_fetch_values
 from frappe.model.mapper import get_mapped_doc
@@ -477,13 +477,9 @@
 @frappe.whitelist()
 def make_delivery_note(source_name, target_doc=None):
 	def set_missing_values(source, target):
-		so = [d.against_sales_order for d in target.items]
-		if so:
-			po_no_list = frappe.get_all('Sales Order', 'po_no', filters = {'name': ('in', so)})
-			target.po_no = ', '.join(d.po_no for d in po_no_list if d.po_no)
-
 		target.ignore_pricing_rule = 1
 		target.run_method("set_missing_values")
+		target.run_method("set_po_nos")
 		target.run_method("calculate_taxes_and_totals")
 
 		# set company address
@@ -544,6 +540,7 @@
 		target.ignore_pricing_rule = 1
 		target.flags.ignore_permissions = True
 		target.run_method("set_missing_values")
+		target.run_method("set_po_nos")
 		target.run_method("calculate_taxes_and_totals")
 
 		# set company address
diff --git a/erpnext/stock/doctype/batch/batch.json b/erpnext/stock/doctype/batch/batch.json
index b17e106..2fb4b12 100644
--- a/erpnext/stock/doctype/batch/batch.json
+++ b/erpnext/stock/doctype/batch/batch.json
@@ -3,7 +3,7 @@
  "allow_guest_to_view": 0,
  "allow_import": 1,
  "allow_rename": 0,
- "autoname": "",
+ "autoname": "field:batch_id",
  "beta": 0,
  "creation": "2013-03-05 14:50:38",
  "custom": 0,
@@ -27,7 +27,7 @@
    "ignore_xss_filter": 0,
    "in_filter": 0,
    "in_global_search": 0,
-   "in_list_view": 0,
+   "in_list_view": 1,
    "in_standard_filter": 0,
    "label": "Batch ID",
    "length": 0,
@@ -58,7 +58,7 @@
    "ignore_xss_filter": 0,
    "in_filter": 0,
    "in_global_search": 0,
-   "in_list_view": 0,
+   "in_list_view": 1,
    "in_standard_filter": 1,
    "label": "Item",
    "length": 0,
@@ -425,7 +425,7 @@
  "issingle": 0,
  "istable": 0,
  "max_attachments": 5,
- "modified": "2017-05-21 21:00:11.096038",
+ "modified": "2018-03-12 16:37:20.144750",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Batch",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index f126b58..9c1373b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -493,7 +493,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
+   "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
@@ -508,14 +508,14 @@
    "in_standard_filter": 0, 
    "label": "Customer's Purchase Order No", 
    "length": 0, 
-   "no_copy": 0, 
+   "no_copy": 1, 
    "oldfieldname": "po_no", 
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
-   "read_only": 1, 
+   "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -3701,7 +3701,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2018-01-12 15:27:44.471335", 
+ "modified": "2018-03-13 15:35:02.234116", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 65f384f..07c105c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -387,6 +387,7 @@
 		target.is_pos = 0
 		target.ignore_pricing_rule = 1
 		target.run_method("set_missing_values")
+		target.run_method("set_po_nos")
 
 		if len(target.get("items")) == 0:
 			frappe.throw(_("All these items have already been invoiced"))