Merge pull request #6415 from rmehta/hotfix

[minor] bring back old grid style in material request
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 5bb93cb..bdfd222 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.0.33'
+__version__ = '7.0.44'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/asset/asset.js b/erpnext/accounts/doctype/asset/asset.js
index 38be263..8ff4b83 100644
--- a/erpnext/accounts/doctype/asset/asset.js
+++ b/erpnext/accounts/doctype/asset/asset.js
@@ -18,7 +18,8 @@
 		frm.set_query("warehouse", function() {
 			return {
 				"filters": {
-					"company": frm.doc.company
+					"company": frm.doc.company,
+					"is_group": 0
 				}
 			};
 		});
@@ -232,7 +233,10 @@
 				"options": "Warehouse",
 				"get_query": function () {
 					return {
-						filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
+						filters: [
+							["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+							["Warehouse", "is_group", "=", 0]
+						]
 					}
 				}, 
 				"reqd": 1 
diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py
index b28aaa9..da73218 100644
--- a/erpnext/accounts/doctype/asset/asset.py
+++ b/erpnext/accounts/doctype/asset/asset.py
@@ -80,7 +80,7 @@
 				frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
 						
 		if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
-			frappe.throw(_("Next Depreciation Date must be on or after today"))
+			frappe.msgprint(_("Next Depreciation Date is entered as past date"))
 			
 		if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life) 
 			and not self.next_depreciation_date):
diff --git a/erpnext/accounts/doctype/asset_movement/asset_movement.js b/erpnext/accounts/doctype/asset_movement/asset_movement.js
index 680eedc..808f01a 100644
--- a/erpnext/accounts/doctype/asset_movement/asset_movement.js
+++ b/erpnext/accounts/doctype/asset_movement/asset_movement.js
@@ -7,7 +7,10 @@
 		
 		frm.set_query("target_warehouse", function() {
 			return {
-				filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
+				filters: [
+					["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+					["Warehouse", "is_group", "=", 0]
+				]
 			}
 		})
 
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index a6cc8ba..752ecda 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -43,7 +43,7 @@
 		</span>
 		<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
 			position: absolute;">
-			{{doc.party}}
+			{{doc.party_name}}
 		</span>
 		<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
 			position: absolute; display: block; width: %(amt_in_word_width)scm;
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 4578f30..695a721 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -226,6 +226,12 @@
 
 	party: function(frm) {
 		if(frm.doc.payment_type && frm.doc.party_type && frm.doc.party) {
+			if(!frm.doc.posting_date) {
+				frappe.msgprint(__("Please select Posting Date before selecting Party"))
+				frm.set_value("party", "");
+				return ;
+			}
+			
 			frm.set_party_account_based_on_party = true;
 
 			return frappe.call({
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.json b/erpnext/accounts/doctype/payment_entry/payment_entry.json
index 4e99293..2057d07 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.json
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.json
@@ -15,6 +15,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "type_of_payment", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -40,6 +41,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -66,13 +68,14 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "payment_type", 
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "label": "Payment Type", 
    "length": 0, 
    "no_copy": 0, 
@@ -92,6 +95,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:in_list([\"Receive\", \"Pay\"], doc.payment_type)", 
    "fieldname": "party_type", 
    "fieldtype": "Select", 
@@ -119,6 +123,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:in_list([\"Receive\", \"Pay\"], doc.payment_type) && doc.party_type", 
    "fieldname": "party", 
    "fieldtype": "Dynamic Link", 
@@ -146,6 +151,33 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "party_name", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Party Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_5", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -170,6 +202,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Today", 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
@@ -196,6 +229,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -222,6 +256,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "mode_of_payment", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -248,6 +283,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "fieldname": "payment_accounts_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -273,6 +309,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "party", 
    "fieldname": "party_balance", 
    "fieldtype": "Currency", 
@@ -299,6 +336,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(in_list([\"Internal Transfer\", \"Pay\"], doc.payment_type) || doc.party)", 
    "fieldname": "paid_from", 
    "fieldtype": "Link", 
@@ -326,6 +364,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "paid_from", 
    "fieldname": "paid_from_account_currency", 
    "fieldtype": "Link", 
@@ -353,6 +392,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "paid_from", 
    "fieldname": "paid_from_account_balance", 
    "fieldtype": "Currency", 
@@ -380,6 +420,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_18", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -404,6 +445,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(in_list([\"Internal Transfer\", \"Receive\"], doc.payment_type) || doc.party)", 
    "fieldname": "paid_to", 
    "fieldtype": "Link", 
@@ -431,6 +473,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "paid_to", 
    "fieldname": "paid_to_account_currency", 
    "fieldtype": "Link", 
@@ -458,6 +501,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "paid_to", 
    "fieldname": "paid_to_account_balance", 
    "fieldtype": "Currency", 
@@ -486,6 +530,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_to && doc.paid_from)", 
    "fieldname": "payment_amounts_section", 
    "fieldtype": "Section Break", 
@@ -512,6 +557,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "paid_amount", 
    "fieldtype": "Currency", 
@@ -539,6 +585,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "source_exchange_rate", 
    "fieldtype": "Float", 
@@ -565,6 +612,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "base_paid_amount", 
    "fieldtype": "Currency", 
@@ -592,6 +640,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_21", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -616,6 +665,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "received_amount", 
    "fieldtype": "Currency", 
@@ -643,6 +693,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "target_exchange_rate", 
    "fieldtype": "Float", 
@@ -669,6 +720,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "base_received_amount", 
    "fieldtype": "Currency", 
@@ -697,6 +749,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "references", 
+   "columns": 0, 
    "depends_on": "eval:(doc.party && doc.paid_from && doc.paid_to && doc.paid_amount && doc.received_amount)", 
    "fieldname": "section_break_14", 
    "fieldtype": "Section Break", 
@@ -723,6 +776,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "references", 
    "fieldtype": "Table", 
@@ -750,6 +804,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "section_break_34", 
    "fieldtype": "Section Break", 
@@ -776,6 +831,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_amount && doc.received_amount && doc.references)", 
    "fieldname": "total_allocated_amount", 
    "fieldtype": "Currency", 
@@ -802,6 +858,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "base_total_allocated_amount", 
    "fieldtype": "Currency", 
@@ -829,6 +886,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "set_exchange_gain_loss", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -854,6 +912,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_36", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -878,6 +937,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_amount && doc.received_amount && doc.references)", 
    "fieldname": "unallocated_amount", 
    "fieldtype": "Currency", 
@@ -904,6 +964,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_amount && doc.received_amount)", 
    "fieldname": "difference_amount", 
    "fieldtype": "Currency", 
@@ -931,6 +992,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "difference_amount", 
    "fieldname": "write_off_difference_amount", 
    "fieldtype": "Button", 
@@ -958,6 +1020,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "deductions", 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_amount && doc.received_amount)", 
    "fieldname": "deductions_or_loss_section", 
    "fieldtype": "Section Break", 
@@ -984,6 +1047,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "deductions", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1010,6 +1074,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "transaction_references", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1035,6 +1100,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_from && doc.paid_to)", 
    "fieldname": "reference_no", 
    "fieldtype": "Data", 
@@ -1061,6 +1127,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_23", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1085,6 +1152,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_from && doc.paid_to)", 
    "fieldname": "reference_date", 
    "fieldtype": "Date", 
@@ -1111,6 +1179,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.docstatus==1", 
    "fieldname": "clearance_date", 
    "fieldtype": "Date", 
@@ -1138,6 +1207,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "", 
+   "columns": 0, 
    "depends_on": "eval:(doc.paid_from && doc.paid_to && doc.paid_amount && doc.received_amount)", 
    "fieldname": "section_break_12", 
    "fieldtype": "Section Break", 
@@ -1164,6 +1234,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "project", 
    "fieldtype": "Link", 
@@ -1191,6 +1262,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "remarks", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -1216,6 +1288,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_16", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1240,6 +1313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "letter_head", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1266,6 +1340,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "print_heading", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1292,6 +1367,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1317,6 +1393,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "title", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -1349,8 +1426,8 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-07-11 08:06:33.121527", 
- "modified_by": "NuranVerkleij@example.com", 
+ "modified": "2016-09-05 11:06:18.183458", 
+ "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Entry", 
  "name_case": "", 
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index c5cf092..179a321 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -73,6 +73,9 @@
 				
 			if not self.party:
 				frappe.throw(_("Party is mandatory"))
+				
+			self.party_name = frappe.db.get_value(self.party_type, self.party, 
+				self.party_type.lower() + "_name")
 		
 		if self.party:
 			if not self.party_balance:
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry_list.js b/erpnext/accounts/doctype/payment_entry/payment_entry_list.js
deleted file mode 100644
index 81230d0..0000000
--- a/erpnext/accounts/doctype/payment_entry/payment_entry_list.js
+++ /dev/null
@@ -1,6 +0,0 @@
-frappe.listview_settings['Payment Entry'] = {
-	add_fields: ["payment_type"],
-	get_indicator: function(doc) {
-		return [__(doc.payment_type), (doc.docstatus==0 ? 'red' : 'blue'), 'status=' + doc.payment_type]
-	}
-}
diff --git a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
index 6441748..4dd08b6 100644
--- a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
+++ b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.json
@@ -171,7 +171,7 @@
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
-   "in_list_view": 0, 
+   "in_list_view": 1, 
    "label": "Allocated", 
    "length": 0, 
    "no_copy": 0, 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index c51231e..ccdd87f 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -340,14 +340,20 @@
 		$.each(["warehouse", "rejected_warehouse"], function(i, field) {
 			frm.set_query(field, "items", function() {
 				return {
-					filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
+					filters: [
+						["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+						["Warehouse", "is_group", "=", 0]
+					]
 				}
 			})
 		})
 
 		frm.set_query("supplier_warehouse", function() {
 			return {
-				filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
+				filters: [
+					["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+					["Warehouse", "is_group", "=", 0]
+				]
 			}
 		})
 	},
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 38cef31..adc30e2 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -302,6 +302,9 @@
 				asset.save()
 
 	def make_gl_entries(self, repost_future_gle=True):
+		if not self.grand_total:
+			return
+		
 		self.auto_accounting_for_stock = \
 			cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 599e9b1..5336b54 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -23,7 +23,8 @@
 		frappe.msgprint('<a href="#List/POS Profile">'
 			+ _("Welcome to POS: Create your POS Profile") + '</a>');
 
-	update_pos_profile_data(doc, pos_profile)
+	company_data = get_company_data(doc.company)
+	update_pos_profile_data(doc, pos_profile, company_data)
 	update_multi_mode_option(doc, pos_profile)
 	default_print_format = pos_profile.get('print_format') or "Point of Sale"
 	print_template = frappe.db.get_value('Print Format', default_print_format, 'html')
@@ -32,7 +33,7 @@
 		'doc': doc,
 		'default_customer': pos_profile.get('customer'),
 		'items': get_items(doc, pos_profile),
-		'customers': get_customers(pos_profile, doc),
+		'customers': get_customers(pos_profile, doc, company_data.default_currency),
 		'pricing_rules': get_pricing_rules(doc),
 		'print_template': print_template,
 		'meta': {
@@ -42,8 +43,10 @@
 		}
 	}
 
-def update_pos_profile_data(doc, pos_profile):
-	company_data = frappe.db.get_value('Company', doc.company, '*', as_dict=1)
+def get_company_data(company):
+	return frappe.get_all('Company', fields = ["*"], filters= {'name': company})[0]
+
+def update_pos_profile_data(doc, pos_profile, company_data):
 	doc.campaign = pos_profile.get('campaign')
 
 	doc.write_off_account = pos_profile.get('write_off_account') or \
@@ -148,14 +151,14 @@
 
 	return serial_no_list
 
-def get_customers(pos_profile, doc):
+def get_customers(pos_profile, doc, company_currency):
 	filters = {'disabled': 0}
 	customer_list = []
 	customers = frappe.get_all("Customer", fields=["*"], filters = filters)
 
 	for customer in customers:
 		customer_currency = get_party_account_currency('Customer', customer.name, doc.company) or doc.currency
-		if customer_currency == doc.currency:
+		if customer_currency == doc.currency or customer_currency == company_currency:
 			customer_list.append(customer)
 	return customer_list
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index a2e930c..562eaaa 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -16,6 +16,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "customer_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -41,6 +42,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "{customer_name}", 
    "fieldname": "title", 
    "fieldtype": "Data", 
@@ -67,6 +69,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -94,6 +97,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -121,6 +125,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "customer", 
    "fieldname": "customer_name", 
    "fieldtype": "Data", 
@@ -148,6 +153,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "is_pos", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -174,6 +180,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_return", 
    "fieldname": "is_return", 
    "fieldtype": "Check", 
@@ -200,6 +207,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "offline_pos_name", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -225,6 +233,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -249,6 +258,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Today", 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
@@ -276,6 +286,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "due_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -302,33 +313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "mode_of_payment", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Mode of Payment", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "mode_of_payment", 
-   "oldfieldtype": "Select", 
-   "options": "Mode of Payment", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -356,6 +341,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -383,6 +369,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_return", 
    "fieldname": "return_against", 
    "fieldtype": "Link", 
@@ -410,6 +397,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "address_and_contact", 
    "fieldtype": "Section Break", 
@@ -436,6 +424,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "customer_address", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -461,6 +450,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "address_display", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -485,6 +475,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_person", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -510,6 +501,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_display", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -534,6 +526,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_mobile", 
    "fieldtype": "Small Text", 
    "hidden": 1, 
@@ -558,6 +551,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "contact_email", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -583,6 +577,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "col_break4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -607,6 +602,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "shipping_address_name", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -633,6 +629,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "shipping_address", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -658,6 +655,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "customer_group", 
    "fieldtype": "Link", 
@@ -684,6 +682,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "territory", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -710,6 +709,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "depends_on": "customer", 
    "fieldname": "currency_and_price_list", 
    "fieldtype": "Section Break", 
@@ -736,6 +736,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "currency", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -763,6 +764,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "Rate at which Customer Currency is converted to customer's base currency", 
    "fieldname": "conversion_rate", 
    "fieldtype": "Float", 
@@ -791,6 +793,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -815,6 +818,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "selling_price_list", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -842,6 +846,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "price_list_currency", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -867,6 +872,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "Rate at which Price list currency is converted to customer's base currency", 
    "fieldname": "plc_conversion_rate", 
    "fieldtype": "Float", 
@@ -893,6 +899,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "ignore_pricing_rule", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -917,6 +924,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "items_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -943,6 +951,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "update_stock", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -969,6 +978,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "items", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -996,6 +1006,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "packing_list", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1021,6 +1032,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "packed_items", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1046,6 +1058,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "product_bundle_help", 
    "fieldtype": "HTML", 
    "hidden": 0, 
@@ -1071,6 +1084,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "eval:doc.total_billing_amount > 0", 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "time_sheet_list", 
    "fieldtype": "Section Break", 
@@ -1097,6 +1111,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "timesheets", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1123,6 +1138,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "0", 
    "fieldname": "total_billing_amount", 
    "fieldtype": "Currency", 
@@ -1149,6 +1165,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_30", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1172,6 +1189,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1198,6 +1216,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_net_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1225,6 +1244,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_32", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1248,6 +1268,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "net_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1273,6 +1294,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1299,6 +1321,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1325,6 +1348,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes_and_charges", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1352,6 +1376,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_38", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1375,6 +1400,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "shipping_rule", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1401,6 +1427,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_40", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1424,6 +1451,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "taxes", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -1451,6 +1479,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "other_charges_calculation", 
    "fieldtype": "HTML", 
    "hidden": 0, 
@@ -1476,6 +1505,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_43", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1499,6 +1529,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_total_taxes_and_charges", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1526,6 +1557,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_47", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1550,6 +1582,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_taxes_and_charges", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1576,6 +1609,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "discount_amount", 
+   "columns": 0, 
    "fieldname": "section_break_49", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1601,6 +1635,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Grand Total", 
    "fieldname": "apply_discount_on", 
    "fieldtype": "Select", 
@@ -1628,6 +1663,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_discount_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1654,6 +1690,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_51", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1677,6 +1714,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "additional_discount_percentage", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -1702,6 +1740,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "discount_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1727,6 +1766,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "totals", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -1753,6 +1793,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_grand_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1780,6 +1821,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1807,6 +1849,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "In Words will be visible once you save the Sales Invoice.", 
    "fieldname": "base_in_words", 
    "fieldtype": "Data", 
@@ -1834,6 +1877,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break5", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -1859,6 +1903,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "grand_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1886,6 +1931,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "rounded_total", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1913,6 +1959,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "in_words", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -1939,6 +1986,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_advance", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1966,6 +2014,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "outstanding_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1994,6 +2043,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "advances", 
+   "columns": 0, 
    "fieldname": "advances_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2020,6 +2070,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "get_advances", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -2046,6 +2097,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "advances", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -2074,6 +2126,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
+   "columns": 0, 
    "depends_on": "eval:doc.is_pos===1||(doc.advances && doc.advances.length>0)", 
    "fieldname": "payments_section", 
    "fieldtype": "Section Break", 
@@ -2100,6 +2153,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_pos", 
    "fieldname": "cash_bank_account", 
    "fieldtype": "Link", 
@@ -2128,6 +2182,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "payments", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -2154,6 +2209,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_84", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2178,6 +2234,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_paid_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2204,6 +2261,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_86", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2228,6 +2286,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_pos", 
    "fieldname": "paid_amount", 
    "fieldtype": "Currency", 
@@ -2256,6 +2315,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_88", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2280,6 +2340,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_change_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2306,6 +2367,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_90", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2330,6 +2392,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "change_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2356,6 +2419,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "account_for_change_amount", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2383,6 +2447,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "write_off_amount", 
+   "columns": 0, 
    "depends_on": "grand_total", 
    "fieldname": "column_break4", 
    "fieldtype": "Section Break", 
@@ -2409,6 +2474,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "write_off_amount", 
    "fieldtype": "Currency", 
@@ -2435,6 +2501,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "base_write_off_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -2461,6 +2528,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_pos", 
    "fieldname": "write_off_outstanding_amount_automatically", 
    "fieldtype": "Check", 
@@ -2486,6 +2554,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "column_break_74", 
    "fieldtype": "Column Break", 
@@ -2511,6 +2580,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "write_off_account", 
    "fieldtype": "Link", 
@@ -2537,6 +2607,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "write_off_cost_center", 
    "fieldtype": "Link", 
@@ -2564,6 +2635,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "terms", 
+   "columns": 0, 
    "fieldname": "terms_section_break", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2590,6 +2662,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "tc_name", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2617,6 +2690,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "terms", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -2643,6 +2717,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "fieldname": "edit_printing_settings", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2668,6 +2743,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "letter_head", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2695,6 +2771,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "language", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -2720,6 +2797,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_84", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2744,6 +2822,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "select_print_heading", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2771,6 +2850,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "depends_on": "customer", 
    "fieldname": "more_information", 
    "fieldtype": "Section Break", 
@@ -2797,6 +2877,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "project", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -2824,6 +2905,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "col_break23", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -2848,6 +2930,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.source == 'Campaign'", 
    "fieldname": "campaign", 
    "fieldtype": "Link", 
@@ -2876,6 +2959,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "source", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -2903,6 +2987,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 1, 
+   "columns": 0, 
    "fieldname": "more_info", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -2929,6 +3014,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "description": "", 
    "fieldname": "debit_to", 
    "fieldtype": "Link", 
@@ -2957,6 +3043,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "party_account_currency", 
    "fieldtype": "Link", 
    "hidden": 1, 
@@ -2983,6 +3070,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "No", 
    "description": "", 
    "fieldname": "is_opening", 
@@ -3012,6 +3100,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "c_form_applicable", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -3037,6 +3126,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "c_form_no", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -3062,6 +3152,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break8", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3086,6 +3177,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "posting_time", 
    "fieldtype": "Time", 
    "hidden": 0, 
@@ -3112,6 +3204,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "remarks", 
    "fieldtype": "Small Text", 
    "hidden": 0, 
@@ -3139,6 +3232,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "sales_partner", 
+   "columns": 0, 
    "fieldname": "sales_team_section_break", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -3165,6 +3259,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "sales_partner", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -3192,6 +3287,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break10", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3217,6 +3313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "commission_rate", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -3243,6 +3340,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_commission", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -3271,6 +3369,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "sales_team", 
+   "columns": 0, 
    "fieldname": "section_break2", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -3295,6 +3394,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "sales_team", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -3323,6 +3423,7 @@
    "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "is_recurring", 
+   "columns": 0, 
    "depends_on": "eval:doc.docstatus<2", 
    "fieldname": "recurring_invoice", 
    "fieldtype": "Section Break", 
@@ -3349,6 +3450,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break11", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3374,6 +3476,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.docstatus<2", 
    "description": "", 
    "fieldname": "is_recurring", 
@@ -3400,6 +3503,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "recurring_id", 
@@ -3427,6 +3531,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "recurring_type", 
@@ -3454,6 +3559,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "repeat_on_day_of_month", 
@@ -3480,6 +3586,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "end_date", 
@@ -3506,6 +3613,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "fieldname": "submit_on_creation", 
    "fieldtype": "Check", 
@@ -3532,6 +3640,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "notify_by_email", 
@@ -3559,6 +3668,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", 
    "description": "", 
    "fieldname": "notification_email_address", 
@@ -3586,6 +3696,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name", 
    "fieldname": "recurring_print_format", 
    "fieldtype": "Link", 
@@ -3613,6 +3724,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break12", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -3638,6 +3750,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "from_date", 
@@ -3664,6 +3777,7 @@
    "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "to_date", 
@@ -3690,6 +3804,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "is_recurring", 
    "description": "", 
    "fieldname": "next_date", 
@@ -3716,6 +3831,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "against_income_account", 
    "fieldtype": "Small Text", 
    "hidden": 1, 
@@ -3751,7 +3867,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-08-17 15:12:39.357372", 
+ "modified": "2016-08-31 15:47:32.064861", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index b28911e..2b64d17 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -89,6 +89,8 @@
 		set_account_for_mode_of_payment(self)
 
 	def on_submit(self):
+		self.validate_pos_paid_amount()
+
 		if not self.recurring_id:
 			frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
 			 	self.company, self.base_grand_total, self)
@@ -121,6 +123,10 @@
 
 		self.update_time_sheet(self.name)
 
+	def validate_pos_paid_amount(self):
+		if len(self.payments) == 0 and self.is_pos:
+			frappe.throw(_("At least one mode of payment is required for POS invoice."))
+
 	def before_cancel(self):
 		self.update_time_sheet(None)
 
@@ -248,7 +254,7 @@
 		from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
 		pos = get_pos_profile(self.company)
 
-		if not self.get('payments'):
+		if not self.get('payments') and not for_validate:
 			pos_profile = frappe.get_doc('POS Profile', pos.name) if pos else None
 			update_multi_mode_option(self, pos_profile)
 
@@ -485,6 +491,8 @@
 				throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
 
 	def make_gl_entries(self, repost_future_gle=True):
+		if not self.grand_total:
+			return
 		gl_entries = self.get_gl_entries()
 
 		if gl_entries:
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 5947bde..f3ee7d0 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -614,6 +614,7 @@
 		this.child.batch_no = this.item_batch_no[this.child.item_code];
 		this.child.serial_no = (this.item_serial_no[this.child.item_code]
 			? this.item_serial_no[this.child.item_code][0] : '');
+		this.child.item_tax_rate = this.items[0].taxes;
 	},
 
 	update_paid_amount_status: function(update_paid_amount){
@@ -775,6 +776,7 @@
 			this.update_invoice()
 		}else{
 			this.name = $.now();
+			this.frm.doc.offline_pos_name = this.name;
 			this.frm.doc.posting_date = frappe.datetime.get_today();
 			this.frm.doc.posting_time = frappe.datetime.now_time();
 			invoice_data[this.name] = this.frm.doc
diff --git a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
index a4f8fa6..f2e65d3 100644
--- a/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
+++ b/erpnext/accounts/print_format/payment_receipt_voucher/payment_receipt_voucher.html
@@ -2,7 +2,7 @@
 <div class="page-break">
     {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
         and doc.set("select_print_heading", _("Payment Receipt Note")) -%}{%- endif -%}
-    {{ add_header(0, 1, doc, letter_head, no_letterhead) }}
+    {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
 
     {%- for label, value in (
         (_("Received On"), frappe.utils.formatdate(doc.voucher_date)),
diff --git a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
index 605c032..773f7fc 100644
--- a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
+++ b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
@@ -6,9 +6,9 @@
  "docstatus": 0, 
  "doctype": "Print Format", 
  "font": "Default", 
- "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{  __(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>", 
+ "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{  __(\"POS No : \") }}{{offline_pos_name}}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>", 
  "idx": 0, 
- "modified": "2016-08-11 07:23:04.530676", 
+ "modified": "2016-09-05 08:28:42.308782", 
  "modified_by": "Administrator", 
  "name": "Point of Sale", 
  "owner": "Administrator", 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
index 712d35b..75c3e8c 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html
@@ -1,5 +1,5 @@
 <div style="margin-bottom: 7px;" class="text-center">
-	{%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %}
+	{%= frappe.boot.letter_heads[frappe.get_doc(":Company", filters.company).default_letter_head || frappe.defaults.get_default("letter_head")] %}
 </div>
 <h2 class="text-center">{%= __(report.report_name) %}</h2>
 <h4 class="text-center">{%= filters.customer || filters.supplier %} </h4>
diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html
index 84cad16..6959e5d 100644
--- a/erpnext/accounts/report/financial_statements.html
+++ b/erpnext/accounts/report/financial_statements.html
@@ -13,7 +13,9 @@
 		height: 37px;
 	}
 </style>
-
+<div style="margin-bottom: 7px;" class="text-center">
+	{%= frappe.boot.letter_heads[frappe.get_doc(":Company", filters.company).default_letter_head || frappe.defaults.get_default("letter_head")] %}
+</div>
 <h2 class="text-center">{%= __(report.report_name) %}</h2>
 <h4 class="text-center">{%= filters.company %}</h3>
 <h4 class="text-center">{%= filters.fiscal_year %}</h3>
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html
index f22e721..7552eed 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.html
+++ b/erpnext/accounts/report/general_ledger/general_ledger.html
@@ -1,5 +1,5 @@
 <div style="margin-bottom: 7px;" class="text-center">
-	{%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")] %}
+	{%= frappe.boot.letter_heads[filters.letter_head || frappe.get_doc(":Company", filters.company).default_letter_head || frappe.defaults.get_default("letter_head")] %}
 </div>
 <h2 class="text-center">{%= __("Statement of Account") %}</h2>
 <h4 class="text-center">{%= (filters.party || filters.account) && ((filters.party || filters.account) + ", ")  || "" %} {%= filters.company %}</h4>
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 432d09a..8927da7 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -662,7 +662,7 @@
 			.format(order_doctype, order_condition))
 
 	reference_condition = " and (" + " or ".join(conditions) + ")" if conditions else ""
-
+	
 	journal_entries = frappe.db.sql("""
 		select
 			"Journal Entry" as reference_type, t1.name as reference_name,
@@ -674,8 +674,7 @@
 			t1.name = t2.parent and t2.account = %s
 			and t2.party_type = %s and t2.party = %s
 			and t2.is_advance = 'Yes' and t1.docstatus = 1
-			and {1} > 0
-			and (ifnull(t2.reference_name, '')='' {2})
+			and {1} > 0 {2}
 		order by t1.posting_date""".format(amount_field, dr_or_cr, reference_condition),
 		[party_account, party_type, party] + order_list, as_dict=1)
 
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 0debe4a..6da496b 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -17,7 +17,8 @@
 				if isinstance(f[1], basestring) and f[1][0] == '!':
 					flt.append([doctype, f[0], '!=', f[1][1:]])
 				else:
-					flt.append([doctype, f[0], '=', f[1]])
+					value = frappe.db.escape(f[1]) if isinstance(f[1], basestring) else f[1]
+					flt.append([doctype, f[0], '=', value])
 
 		query = DatabaseQuery(doctype)
 		query.filters = flt
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 30e21ce..d8b5e2e 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -441,12 +441,15 @@
 			paid_amount = self.doc.paid_amount \
 				if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
 
+			change_amount = self.doc.change_amount \
+				if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
+
 			self.calculate_write_off_amount()
 			self.calculate_change_amount()
 
 			self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
-				flt(self.doc.change_amount), self.doc.precision("outstanding_amount"))
-					
+				flt(change_amount), self.doc.precision("outstanding_amount"))
+
 		elif self.doc.doctype == "Purchase Invoice":
 			self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
 		
@@ -462,12 +465,13 @@
 
 	def calculate_change_amount(self):
 		self.doc.change_amount = 0.0
+		self.doc.base_change_amount = 0.0
 		if self.doc.paid_amount > self.doc.grand_total:
 			self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total + 
 				self.doc.write_off_amount, self.doc.precision("change_amount"))
 
-		self.doc.base_change_amount = flt(self.doc.change_amount * self.doc.conversion_rate, 
-			self.doc.precision("base_change_amount"))
+			self.doc.base_change_amount = flt(self.doc.base_paid_amount - self.doc.base_grand_total +
+				self.doc.base_write_off_amount, self.doc.precision("base_change_amount"))
 
 	def calculate_write_off_amount(self):
 		if flt(self.doc.change_amount) > 0:
diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py
index 2298c3f..080d749 100644
--- a/erpnext/controllers/trends.py
+++ b/erpnext/controllers/trends.py
@@ -39,6 +39,7 @@
 		frappe.throw(_("'Based On' and 'Group By' can not be same"))
 
 def get_data(filters, conditions):
+	
 	data = []
 	inc, cond= '',''
 	query_details =  conditions["based_on_select"] + conditions["period_wise_select"]
@@ -49,6 +50,9 @@
 
 	if conditions["based_on_select"] in ["t1.project,", "t2.project,"]:
 		cond = 'and '+ conditions["based_on_select"][:-1] +' IS Not NULL'
+	
+	if conditions.get('trans') in ['Sales Order', 'Purchase Order']:
+		cond += "and t1.status != 'Closed'"
 
 	year_start_date, year_end_date = frappe.db.get_value("Fiscal Year",
 		filters.get('fiscal_year'), ["year_start_date", "year_end_date"])
@@ -85,10 +89,10 @@
 			#to get distinct value of col specified by group_by in filter
 			row = frappe.db.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s
 						where t2.parent = t1.name and t1.company = %s and %s between %s and %s
-						and t1.docstatus = 1 and %s = %s %s
+						and t1.docstatus = 1 and %s = %s %s %s
 					""" %
 					(sel_col,  conditions["trans"],  conditions["trans"], conditions["addl_tables"],
-						"%s", posting_date, "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
+						"%s", posting_date, "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond"), cond),
 					(filters.get("company"), year_start_date, year_end_date, data1[d][0]), as_list=1)
 
 			for i in range(len(row)):
@@ -97,11 +101,11 @@
 				#get data for group_by filter
 				row1 = frappe.db.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s
 							where t2.parent = t1.name and t1.company = %s and %s between %s and %s
-							and t1.docstatus = 1 and %s = %s and %s = %s %s
+							and t1.docstatus = 1 and %s = %s and %s = %s %s %s
 						""" %
 						(sel_col, conditions["period_wise_select"], conditions["trans"],
 							conditions["trans"], conditions["addl_tables"], "%s", posting_date, "%s","%s", sel_col,
-							"%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
+							"%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond"), cond),
 						(filters.get("company"), year_start_date, year_end_date, row[i][0],
 							data1[d][0]), as_list=1)
 
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
index 4cbccaf..5f82967 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -58,7 +58,7 @@
 			if no_email_sp:
 				frappe.msgprint(
 					frappe._("Setting Events to {0}, since the Employee attached to the below Sales Persons does not have a User ID{1}").format(
-						self.owner, "<br>"+no_email_sp.join("<br>")
+						self.owner, "<br>" + "<br>".join(no_email_sp)
 				))
 
 			scheduled_date = frappe.db.sql("""select scheduled_date from
@@ -187,14 +187,17 @@
 			if not sr_details:
 				frappe.throw(_("Serial No {0} not found").format(serial_no))
 
-			if sr_details.warranty_expiry_date and sr_details.warranty_expiry_date>=amc_start_date:
-				throw(_("Serial No {0} is under warranty upto {1}").format(serial_no, sr_details.warranty_expiry_date))
+			if sr_details.warranty_expiry_date \
+				and getdate(sr_details.warranty_expiry_date) >= getdate(amc_start_date):
+				throw(_("Serial No {0} is under warranty upto {1}")
+					.format(serial_no, sr_details.warranty_expiry_date))
 
-			if sr_details.amc_expiry_date and sr_details.amc_expiry_date >= amc_start_date:
-				throw(_("Serial No {0} is under maintenance contract upto {1}").format(serial_no, sr_details.amc_start_date))
+			if sr_details.amc_expiry_date and getdate(sr_details.amc_expiry_date) >= getdate(amc_start_date):
+				throw(_("Serial No {0} is under maintenance contract upto {1}")
+					.format(serial_no, sr_details.amc_start_date))
 
 			if not sr_details.warehouse and sr_details.delivery_date and \
-				sr_details.delivery_date >= amc_start_date:
+				getdate(sr_details.delivery_date) >= getdate(amc_start_date):
 					throw(_("Maintenance start date can not be before delivery date for Serial No {0}")
 						.format(serial_no))
 
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 9b97bd1..d0e0d86 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -174,7 +174,8 @@
 		var company_filter = function(doc) {
 			return {
 				filters: {
-					'company': frm.doc.company
+					'company': frm.doc.company,
+					'is_group': 0
 				}
 			}
 		}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 76a2409..69904ae 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -9,7 +9,7 @@
 erpnext.patches.v4_0.global_defaults_to_system_settings
 erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
 execute:frappe.reload_doc('stock', 'doctype', 'warehouse')
-execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29
+execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31
 execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
 execute:frappe.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
 execute:frappe.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
@@ -276,6 +276,7 @@
 execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True)
 erpnext.patches.v7_0.update_mins_to_first_response
 erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
+erpnext.patches.v7_0.migrate_mode_of_payments_v6_to_v7
 erpnext.patches.v7_0.system_settings_setup_complete
 erpnext.patches.v7_0.set_naming_series_for_timesheet #2016-07-27
 execute:frappe.reload_doc('projects', 'doctype', 'project')
@@ -311,4 +312,9 @@
 erpnext.patches.v7_0.set_portal_settings
 erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice
 erpnext.patches.v7_0.fix_duplicate_icons
-erpnext.patches.v7_0.repost_gle_for_pos_sales_return
\ No newline at end of file
+erpnext.patches.v7_0.repost_gle_for_pos_sales_return
+erpnext.patches.v7_0.update_missing_employee_in_timesheet
+erpnext.patches.v7_0.update_status_for_timesheet
+erpnext.patches.v7_0.set_party_name_in_payment_entry
+execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
+erpnext.patches.v7_0.update_mode_of_payment_type
diff --git a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
index d00980f..52433a5 100644
--- a/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
+++ b/erpnext/patches/v7_0/convert_timelog_to_timesheet.py
@@ -4,8 +4,10 @@
 
 def execute():
 	frappe.reload_doc('projects', 'doctype', 'timesheet')
+	if not frappe.db.table_exists("Time Log"):
+		return
 
-	for data in frappe.get_all('Time Log', fields=["*"], filters = [["docstatus", "<", "2"]]):
+	for data in frappe.db.sql("select * from `tabTime Log` where docstatus < 2", as_dict=1):
 		if data.task:
 			company = frappe.db.get_value("Task", data.task, "company")
 		elif data.production_order:
@@ -16,15 +18,17 @@
 		time_sheet = make_timesheet(data.production_order)
 		args = get_timelog_data(data)
 		add_timesheet_detail(time_sheet, args)
+		time_sheet.employee = data.employee
 		time_sheet.note = data.note
 		time_sheet.company = company
-		
+
 		time_sheet.set_status()
+		time_sheet.set_dates()
 		time_sheet.update_cost()
 		time_sheet.calculate_total_amounts()
 		time_sheet.flags.ignore_validate = True
 		time_sheet.save(ignore_permissions=True)
-		
+
 		# To ignore validate_mandatory_fields function
 		if data.docstatus == 1:
 			time_sheet.db_set("docstatus", 1)
@@ -32,7 +36,6 @@
 				d.db_set("docstatus", 1)
 			time_sheet.update_production_order(time_sheet.name)
 			time_sheet.update_task_and_project()
-			
 
 def get_timelog_data(data):
 	return {
diff --git a/erpnext/patches/v7_0/create_warehouse_nestedset.py b/erpnext/patches/v7_0/create_warehouse_nestedset.py
index af39cc8..8190fd7 100644
--- a/erpnext/patches/v7_0/create_warehouse_nestedset.py
+++ b/erpnext/patches/v7_0/create_warehouse_nestedset.py
@@ -1,3 +1,5 @@
+
+from __future__ import unicode_literals
 import frappe
 from frappe import _
 from frappe.utils import cint
diff --git a/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
new file mode 100644
index 0000000..e0e3f70
--- /dev/null
+++ b/erpnext/patches/v7_0/migrate_mode_of_payments_v6_to_v7.py
@@ -0,0 +1,38 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_timesheet')
+	frappe.reload_doc('accounts', 'doctype', 'sales_invoice_payment')
+	frappe.reload_doc('accounts', 'doctype', 'mode_of_payment')
+
+	count = 0
+	for data in frappe.db.sql("""select name, mode_of_payment, cash_bank_account, paid_amount, company 
+		from `tabSales Invoice` si
+		where si.is_pos = 1 and si.docstatus < 2 
+		and si.cash_bank_account is not null and si.cash_bank_account != ''
+		and not exists(select name from `tabSales Invoice Payment` where parent=si.name)""", as_dict=1):
+		
+		if not data.mode_of_payment and not frappe.db.exists("Mode of Payment", "Cash"):
+			mop = frappe.new_doc("Mode of Payment")
+			mop.mode_of_payment = "Cash"
+			mop.type = "Cash"
+			mop.save()
+		
+		si_doc = frappe.get_doc('Sales Invoice', data.name)
+		row = si_doc.append('payments', {
+			'mode_of_payment': data.mode_of_payment or 'Cash',
+			'account': data.cash_bank_account,
+			'type': frappe.db.get_value('Mode of Payment', data.mode_of_payment, 'type') or 'Cash',
+			'amount': data.paid_amount
+		})
+		row.db_update()
+		
+		si_doc.set_paid_amount()
+		si_doc.db_set("paid_amount", si_doc.paid_amount, update_modified = False)
+		si_doc.db_set("base_paid_amount", si_doc.base_paid_amount, update_modified = False)
+		
+		count +=1
+		
+		if count % 200 == 0:
+			frappe.db.commit()
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py b/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py
index 695c552..7f3b755 100644
--- a/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py
+++ b/erpnext/patches/v7_0/move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet.py
@@ -9,6 +9,6 @@
 		ts = si_doc.append('timesheets',{})
 		ts.time_sheet = time_sheet.name
 		ts.billing_amount = time_sheet.total_billing_amount
-		si_doc.update_time_sheet(time_sheet.sales_invoice)
-		si_doc.flags.ignore_validate_update_after_submit = True
-		si_doc.save()
\ No newline at end of file
+		ts.db_update()
+		si_doc.calculate_billing_amount_from_timesheet()
+		si_doc.db_set("total_billing_amount", si_doc.total_billing_amount, update_modified = False)
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/remove_doctypes_and_reports.py b/erpnext/patches/v7_0/remove_doctypes_and_reports.py
index 978c363..0a302b1 100644
--- a/erpnext/patches/v7_0/remove_doctypes_and_reports.py
+++ b/erpnext/patches/v7_0/remove_doctypes_and_reports.py
@@ -1,9 +1,10 @@
 import frappe
 
 def execute():
-	for doctype in ['Time Log Batch', 'Time Log Batch Detail', 'Time Log']:
-		frappe.delete_doc('DocType', doctype)
-		
+	if frappe.db.table_exists("Time Log"):
+		frappe.db.sql("""delete from `tabDocType`
+			where name in('Time Log Batch', 'Time Log Batch Detail', 'Time Log')""")
+
 	report = "Daily Time Log Summary"
 	if frappe.db.exists("Report", report):
 		frappe.delete_doc('Report', report)
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/set_party_name_in_payment_entry.py b/erpnext/patches/v7_0/set_party_name_in_payment_entry.py
new file mode 100644
index 0000000..bbdcf5c
--- /dev/null
+++ b/erpnext/patches/v7_0/set_party_name_in_payment_entry.py
@@ -0,0 +1,20 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+import frappe
+
+def execute():
+	customers = frappe._dict(frappe.db.sql("select name, customer_name from tabCustomer"))
+	suppliers = frappe._dict(frappe.db.sql("select name, supplier_name from tabSupplier"))
+	
+	frappe.reload_doc('accounts', 'doctype', 'payment_entry')
+	
+	pe_list = frappe.db.sql("""select name, party_type, party from `tabPayment Entry` 
+		where party is not null and party != ''""", as_dict=1)
+	for pe in pe_list:
+		party_name = customers.get(pe.party) if pe.party_type=="Customer" else suppliers.get(pe.party)
+		
+		frappe.db.set_value("Payment Entry", pe.name, "party_name", party_name, update_modified=False)
+	
diff --git a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py
index a067e71..9622490 100644
--- a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py
+++ b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py
@@ -9,7 +9,8 @@
 		return
 
 	for expense_claim_type in frappe.get_all("Expense Claim Type", fields=["name", "default_account"]):
-		if expense_claim_type.default_account:
+		if expense_claim_type.default_account \
+				and frappe.db.exists("Account", expense_claim_type.default_account):
 			doc = frappe.get_doc("Expense Claim Type", expense_claim_type.name)
 			doc.append("accounts", {
 				"company": frappe.db.get_value("Account", expense_claim_type.default_account, "company"),
diff --git a/erpnext/patches/v7_0/update_missing_employee_in_timesheet.py b/erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
new file mode 100644
index 0000000..54d492b
--- /dev/null
+++ b/erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
@@ -0,0 +1,20 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	if frappe.db.table_exists("Time Log") and "employee" in frappe.db.get_table_columns("Time Log"):
+		timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name,
+				tl.modified as modified, tl.modified_by as modified_by, tl.creation as creation, tl.owner as owner
+			from 
+				`tabTimesheet` ts, `tabTimesheet Detail` tsd, `tabTime Log` tl
+			where 
+				tsd.parent = ts.name and tl.from_time = tsd.from_time and tl.to_time = tsd.to_time 
+				and tl.hours = tsd.hours and tl.billing_rate = tsd.billing_rate and tsd.idx=1 
+				and tl.docstatus < 2 and (ts.employee = '' or ts.employee is null)""", as_dict=1)
+		
+		for data in timesheet:
+			ts_doc = frappe.get_doc('Timesheet', data.name)
+			if len(ts_doc.time_logs) == 1:
+				frappe.db.sql(""" update `tabTimesheet` set creation = %(creation)s,
+					owner = %(owner)s, modified = %(modified)s, modified_by = %(modified_by)s,
+					employee = %(employee)s where name = %(name)s""", data)
diff --git a/erpnext/patches/v7_0/update_mode_of_payment_type.py b/erpnext/patches/v7_0/update_mode_of_payment_type.py
new file mode 100644
index 0000000..9292a1b
--- /dev/null
+++ b/erpnext/patches/v7_0/update_mode_of_payment_type.py
@@ -0,0 +1,29 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import flt
+
+def execute():
+	frappe.reload_doc('accounts', 'doctype', 'mode_of_payment')
+
+	frappe.db.sql(""" update `tabMode of Payment` set type = 'Cash' where (type is null or type = '') and name = 'Cash'""")
+
+	for data in frappe.db.sql("""select name from `tabSales Invoice` where is_pos=1 and docstatus<2 and
+		(ifnull(paid_amount, 0) - ifnull(change_amount, 0)) > ifnull(grand_total, 0) and modified > '2016-05-01'""", as_dict=1):
+		if data.name:
+			si_doc = frappe.get_doc("Sales Invoice", data.name)
+			remove_payment = []
+			mode_of_payment = [d.mode_of_payment for d in si_doc.payments if flt(d.amount) > 0]
+			if mode_of_payment != set(mode_of_payment):
+				for payment_data in si_doc.payments:
+					if payment_data.idx != 1 and payment_data.amount == si_doc.grand_total:
+						remove_payment.append(payment_data)
+						frappe.db.sql(""" delete from `tabSales Invoice Payment` 
+							where name = %(name)s""", {'name': payment_data.name})
+
+			if len(remove_payment) > 0:
+				for d in remove_payment:
+					si_doc.remove(d)
+
+				si_doc.set_paid_amount()
+				si_doc.db_set("paid_amount", si_doc.paid_amount, update_modified = False)
+				si_doc.db_set("base_paid_amount", si_doc.base_paid_amount, update_modified = False)
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/update_status_for_timesheet.py b/erpnext/patches/v7_0/update_status_for_timesheet.py
new file mode 100644
index 0000000..117c40c
--- /dev/null
+++ b/erpnext/patches/v7_0/update_status_for_timesheet.py
@@ -0,0 +1,11 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	frappe.db.sql("""update 
+		`tabTimesheet` as ts,
+		(
+			select min(from_time)as from_time, max(to_time) as to_time, parent from `tabTimesheet Detail` group by parent
+		) as tsd
+		set ts.status = 'Submitted', ts.start_date = tsd.from_time, ts.end_date = tsd.to_time 
+		where tsd.parent = ts.name and ts.status = 'Draft' and ts.docstatus =1""")
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index 16d71d8..3dd5513 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -16,6 +16,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "naming_series", 
    "fieldtype": "Select", 
    "hidden": 0, 
@@ -41,6 +42,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -67,6 +69,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "description": "", 
    "fieldname": "sales_invoice", 
@@ -94,6 +97,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_3", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -117,6 +121,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "fieldname": "salary_slip", 
    "fieldtype": "Link", 
@@ -144,6 +149,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "Draft", 
    "fieldname": "status", 
    "fieldtype": "Select", 
@@ -171,7 +177,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
-   "depends_on": "eval:!doc.production_order", 
+   "columns": 0, 
+   "depends_on": "eval:!doc.production_order || doc.docstatus == 1", 
    "fieldname": "employee_detail", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -197,6 +204,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "", 
    "description": "List of employee which has \"Salary Slip Based on Timesheet\" is enabled in salary structure.", 
    "fieldname": "employee", 
@@ -225,6 +233,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "depends_on": "employee", 
    "fieldname": "employee_name", 
    "fieldtype": "Data", 
@@ -252,6 +261,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "user", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -278,6 +288,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_9", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -302,6 +313,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "start_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -327,6 +339,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "end_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -353,6 +366,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "collapsible_depends_on": "", 
+   "columns": 0, 
    "depends_on": "production_order", 
    "fieldname": "production_detail", 
    "fieldtype": "Section Break", 
@@ -379,6 +393,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "production_order", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -405,6 +420,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_5", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -428,6 +444,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "time_logs", 
    "fieldtype": "Table", 
    "hidden": 0, 
@@ -453,6 +470,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_8", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -477,6 +495,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "0", 
    "description": "", 
    "fieldname": "total_hours", 
@@ -503,6 +522,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "column_break_10", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -527,6 +547,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "default": "0", 
    "depends_on": "", 
    "description": "", 
@@ -555,6 +576,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "total_costing_amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -580,6 +602,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "section_break_18", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -604,6 +627,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "note", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -629,6 +653,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amended_from", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -662,7 +687,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-08-01 08:54:31.840829", 
+ "modified": "2016-09-01 11:33:38.110421", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet", 
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 0379f90..a30a21b 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -8,6 +8,7 @@
 
 import json
 from datetime import timedelta
+from erpnext.controllers.queries import get_match_cond
 from frappe.utils import flt, time_diff_in_hours, get_datetime, getdate, cint, get_datetime_str
 from frappe.model.document import Document
 from frappe.model.mapper import get_mapped_doc
@@ -20,12 +21,17 @@
 
 class Timesheet(Document):
 	def validate(self):
+		self.set_employee_name()
 		self.set_status()
 		self.validate_dates()
 		self.validate_time_logs()
 		self.update_cost()
 		self.calculate_total_amounts()
 
+	def set_employee_name(self):
+		if self.employee and not self.employee_name:
+			self.employee_name = frappe.db.get_value('Employee', self.employee, 'employee_name')
+
 	def calculate_total_amounts(self):
 		self.total_hours = 0.0
 		self.total_billing_amount = 0.0
@@ -305,7 +311,8 @@
 	return frappe.db.sql("""select `tabTimesheet Detail`.name as name, `tabTimesheet Detail`.parent as parent,
 		from_time, hours, activity_type, project, to_time from `tabTimesheet Detail`, 
 		`tabTimesheet` where `tabTimesheet Detail`.parent = `tabTimesheet`.name and 
-		(from_time between %(start)s and %(end)s) {conditions}""".format(conditions=conditions),
+		(from_time between %(start)s and %(end)s) {conditions}
+		{match_cond}""".format(conditions=conditions, match_cond = get_match_cond('Timesheet')),
 		{
 			"start": start,
 			"end": end
diff --git a/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py b/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
index ab0b4a1..cc854a4 100644
--- a/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
+++ b/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
@@ -12,8 +12,9 @@
 		filters["from_time"] = "00:00:00"
 		filters["to_time"] = "24:00:00"
 
-	columns = [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("From Datetime") + "::140",
-		_("To Datetime") + "::140", _("Hours") + "::70", _("Activity Type") + "::120", _("Task") + ":Link/Task:150",
+	columns = [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("Employee Name") + "::150", 
+		_("From Datetime") + "::140", _("To Datetime") + "::140", _("Hours") + "::70", 
+		_("Activity Type") + "::120", _("Task") + ":Link/Task:150",
 		_("Project") + ":Link/Project:120", _("Status") + "::70"]
 		
 	conditions = "ts.docstatus = 1"
@@ -27,7 +28,8 @@
 	return columns, data
 
 def get_data(conditions, filters):
-	time_sheet = frappe.db.sql(""" select ts.name, ts.employee, tsd.from_time, tsd.to_time, tsd.hours,
+	time_sheet = frappe.db.sql(""" select ts.name, ts.employee, ts.employee_name, 
+		tsd.from_time, tsd.to_time, tsd.hours,
 		tsd.activity_type, tsd.task, tsd.project, ts.status from `tabTimesheet Detail` tsd, 
 		`tabTimesheet` ts where ts.name = tsd.parent and %s order by ts.name"""%(conditions), filters, as_list=1)
 
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 06c2b3b..2149f6d 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -72,7 +72,7 @@
 	},
 
 	validate_conversion_rate: function() {
-		this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
+		this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, (cur_frm) ? precision("conversion_rate") : 9);
 		var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate",
 			this.frm.doc.name);
 		var company_currency = this.frm.doc.currency || this.get_company_currency();
@@ -572,8 +572,11 @@
 			var paid_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
 				this.frm.doc.paid_amount : this.frm.doc.base_paid_amount;
 
-			this.frm.doc.outstanding_amount =  flt(total_amount_to_pay - flt(paid_amount) + 
-				flt(this.frm.doc.change_amount), precision("outstanding_amount"));
+			var change_amount = (this.frm.doc.party_account_currency == this.frm.doc.currency) ?
+				this.frm.doc.change_amount : this.frm.doc.base_change_amount;
+
+			this.frm.doc.outstanding_amount =  flt(total_amount_to_pay - flt(paid_amount) +
+				flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate), precision("outstanding_amount"));
 
 		} else if(this.frm.doc.doctype == "Purchase Invoice") {
 			this.frm.doc.outstanding_amount = flt(total_amount_to_pay, precision("outstanding_amount"));
@@ -585,8 +588,9 @@
 		payment_status = true;
 		if(this.frm.doc.is_pos && (update_paid_amount===undefined || update_paid_amount)){
 			$.each(this.frm.doc['payments'] || [], function(index, data){
-				if(data.type == "Cash" && payment_status) {
-					data.amount = total_amount_to_pay;
+				if(data.type == "Cash" && payment_status && total_amount_to_pay > 0) {
+					data.base_amount = flt(total_amount_to_pay, precision("base_amount"));
+					data.amount = flt(total_amount_to_pay / me.frm.doc.conversion_rate, precision("amount"));
 					payment_status = false;
 				}else if(me.frm.doc.paid_amount){
 					data.amount = 0.0;
@@ -599,7 +603,7 @@
 		var me = this;
 		var paid_amount = base_paid_amount = 0.0;
 		$.each(this.frm.doc['payments'] || [], function(index, data){
-			data.base_amount = flt(data.amount * me.frm.doc.conversion_rate);
+			data.base_amount = flt(data.amount * me.frm.doc.conversion_rate, precision("base_amount"));
 			paid_amount += data.amount;
 			base_paid_amount += data.base_amount;
 		})
@@ -611,12 +615,11 @@
 	calculate_change_amount: function(){
 		this.frm.doc.change_amount = 0.0;
 		if(this.frm.doc.paid_amount > this.frm.doc.grand_total && !this.frm.doc.is_return){
-			this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total + 
+			this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - this.frm.doc.grand_total +
 				this.frm.doc.write_off_amount, precision("change_amount"));
+			this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount - this.frm.doc.base_grand_total +
+				this.frm.doc.base_write_off_amount, precision("base_change_amount"));
 		}
-
-		this.frm.doc.base_change_amount = flt(this.frm.doc.change_amount * this.frm.doc.conversion_rate,
-			precision("base_change_amount"));
 	},
 
 	calculate_write_off_amount: function(){
diff --git a/erpnext/public/js/payment/payment_details.html b/erpnext/public/js/payment/payment_details.html
index 596f139..3e63944 100644
--- a/erpnext/public/js/payment/payment_details.html
+++ b/erpnext/public/js/payment/payment_details.html
@@ -2,7 +2,7 @@
     <div class="col-xs-6" style="padding:20px">{{mode_of_payment}}</div>
 	<div class="col-xs-6">
 		<div class="input-group">
-			<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{{format_number(amount, 2)}}">
+			<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{%= format_currency(amount, currency) %}">
 			<span class="input-group-btn">
 				<button type="button" class="btn btn-default clr" idx="{{idx}}" style="border:1px solid #d1d8dd">C</button>
 			</span>
diff --git a/erpnext/public/js/payment/payments.js b/erpnext/public/js/payment/payments.js
index 23db61f..438ad79 100644
--- a/erpnext/public/js/payment/payments.js
+++ b/erpnext/public/js/payment/payments.js
@@ -84,8 +84,8 @@
 		this.payment_val = 0.0
 		if(this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0){
 			//When user first time click on row
-			this.payment_val = flt(this.frm.doc.outstanding_amount)
-			this.selected_mode.val(format_number(this.payment_val, 2));
+			this.payment_val = flt(this.frm.doc.outstanding_amount / this.frm.doc.conversion_rate, precision("outstanding_amount"))
+			this.selected_mode.val(format_currency(this.payment_val, this.frm.doc.currency));
 			this.update_payment_amount()
 		}else if(flt(this.selected_mode.val()) > 0){
 			//If user click on existing row which has value
@@ -137,14 +137,14 @@
 		var me = this;
 		$(this.$body).find('.pos-keyboard-key').click(function(){
 			me.payment_val += $(this).text();
-			me.selected_mode.val(format_number(me.payment_val, 2))
+			me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
 			me.idx = me.selected_mode.attr("idx")
 			me.update_paid_amount()
 		})
 		
 		$(this.$body).find('.delete-btn').click(function(){
 			me.payment_val =  cstr(flt(me.selected_mode.val())).slice(0, -1);
-			me.selected_mode.val(format_number(me.payment_val, 2));
+			me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency));
 			me.idx = me.selected_mode.attr("idx")
 			me.update_paid_amount();
 		})
@@ -155,7 +155,7 @@
 		var me = this;
 		this.selected_mode.change(function(){
 			me.payment_val =  flt($(this).val()) || 0.0;
-			me.selected_mode.val(format_number(me.payment_val, 2))
+			me.selected_mode.val(format_currency(me.payment_val, me.frm.doc.currency))
 			me.idx = me.selected_mode.attr("idx")
 			me.update_payment_amount()
 		})
@@ -199,8 +199,8 @@
 			if(me.idx == 'change_amount'){
 				me.change_amount(value)
 			} else{
-				if(value == 0 && update_write_off) {
-					value = me.frm.doc.outstanding_amount;
+				if(flt(value) == 0 && update_write_off && me.frm.doc.outstanding_amount > 0) {
+					value = flt(me.frm.doc.outstanding_amount / me.frm.doc.conversion_rate, precision(me.idx));
 				}
 				me.write_off_amount(value)
 			}
@@ -224,10 +224,10 @@
 
 	show_amounts: function(){
 		var me = this;
-		$(this.$body).find(".write_off_amount").val(format_number(this.frm.doc.write_off_amount, precision("write_off_amount")));
+		$(this.$body).find(".write_off_amount").val(format_currency(this.frm.doc.write_off_amount, this.frm.doc.currency));
 		$(this.$body).find('.paid_amount').text(format_currency(this.frm.doc.paid_amount, this.frm.doc.currency));
-		$(this.$body).find('.change_amount').val(format_number(this.frm.doc.change_amount, precision("change_amount")))
-		$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, this.frm.doc.currency))
+		$(this.$body).find('.change_amount').val(format_currency(this.frm.doc.change_amount, this.frm.doc.currency))
+		$(this.$body).find('.outstanding_amount').text(format_currency(this.frm.doc.outstanding_amount, frappe.get_doc(":Company", this.frm.doc.company).default_currency))
 		this.update_invoice();
 	}
 })
\ No newline at end of file
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index 46d4034..c55c7cb 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -20,7 +20,13 @@
 		frm.trigger("set_root_readonly");
 		frm.add_custom_button(__("Item Group Tree"), function() {
 			frappe.set_route("Tree", "Item Group");
-		}, "icon-sitemap");
+		});
+
+		if(!frm.is_new()) {
+			frm.add_custom_button(__("Items"), function() {
+				frappe.set_route("List", "Item", {"item_group": frm.doc.name});
+			});
+		}
 	},
 
 	set_root_readonly: function(frm) {
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 5375db0..12899cd 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -60,13 +60,15 @@
 
 	def get_context(self, context):
 		context.show_search=True
+		context.page_length = 6
 		context.search_link = '/product_search'
 
 		start = int(frappe.form_dict.start or 0)
 		if start < 0:
 			start = 0
 		context.update({
-			"items": get_product_list_for_group(product_group = self.name, start=start, limit=24, search=frappe.form_dict.get("search")),
+			"items": get_product_list_for_group(product_group = self.name, start=start,
+				limit=context.page_length, search=frappe.form_dict.get("search")),
 			"parent_groups": get_parent_item_groups(self.name),
 			"title": self.name,
 			"products_as_list": cint(frappe.db.get_single_value('Website Settings', 'products_as_list'))
diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py
index 991114d..58a2c79 100644
--- a/erpnext/startup/notifications.py
+++ b/erpnext/startup/notifications.py
@@ -22,12 +22,21 @@
 				"docstatus": ("<", 2)
 			},
 			"Journal Entry": {"docstatus": 0},
-			"Sales Invoice": { "outstanding_amount": (">", 0), "docstatus": ("<", 2) },
-			"Purchase Invoice": {"docstatus": 0},
+			"Sales Invoice": {
+				"outstanding_amount": (">", 0), 
+				"docstatus": ("<", 2) 
+			},
+			"Purchase Invoice": {
+				"outstanding_amount": (">", 0), 
+				"docstatus": ("<", 2)
+			},
 			"Leave Application": {"status": "Open"},
 			"Expense Claim": {"approval_status": "Draft"},
 			"Job Applicant": {"status": "Open"},
-			"Delivery Note": {"docstatus": 0},
+			"Delivery Note": {
+				"status": ("not in", ("Completed", "Closed")),
+				"docstatus": ("<", 2)
+			},
 			"Stock Entry": {"docstatus": 0},
 			"Material Request": {
 				"docstatus": ("<", 2),
@@ -40,7 +49,10 @@
 				"status": ("not in", ("Completed", "Closed")),
 				"docstatus": ("<", 2)
 			},
-			"Purchase Receipt": {"docstatus": 0},
+			"Purchase Receipt": {
+				"status": ("not in", ("Completed", "Closed")),
+				"docstatus": ("<", 2)
+			},
 			"Production Order": { "status": ("in", ("Draft", "Not Started", "In Process")) },
 			"BOM": {"docstatus": 0},
 			"Timesheet": {"status": "Draft"}
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index b546df4..454fc70 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -455,16 +455,18 @@
 
 	def cant_change(self):
 		if not self.get("__islocal"):
-			vals = frappe.db.get_value("Item", self.name, ["has_serial_no", "is_stock_item",
-				"valuation_method", "has_batch_no", "is_fixed_asset"], as_dict=True)
+			to_check = ("has_serial_no", "is_stock_item",
+				"valuation_method", "has_batch_no", "is_fixed_asset")
 
-			if vals and ((self.is_stock_item != vals.is_stock_item) or
-				vals.has_serial_no != self.has_serial_no or
-				vals.has_batch_no != self.has_batch_no or
-				cstr(vals.valuation_method) != cstr(self.valuation_method)):
-					if self.check_if_linked_document_exists():
-						frappe.throw(_("As there are existing transactions for this item, \
-							you can not change the values of 'Has Serial No', 'Has Batch No', 'Is Stock Item' and 'Valuation Method'"))
+			vals = frappe.db.get_value("Item", self.name, to_check, as_dict=True)
+
+			if vals:
+				for key in to_check:
+					if self.get(key) != vals.get(key):
+						if not self.check_if_linked_document_exists():
+							break # no linked document, allowed
+						else:
+							frappe.throw(_("As there are existing transactions for this item, you can not change the value of {0}").format(frappe.bold(self.meta.get_label(key))))
 
 			if vals and not self.is_fixed_asset and self.is_fixed_asset != vals.is_fixed_asset:
 				asset = frappe.db.get_all("Asset", filters={"item_code": self.name, "docstatus": 1}, limit=1)
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 792f269..d477189 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -25,14 +25,20 @@
 		$.each(["warehouse", "rejected_warehouse"], function(i, field) {
 			frm.set_query(field, "items", function() {
 				return {
-					filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
+					filters: [
+						["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+						["Warehouse", "is_group", "=", 0]
+					]
 				}
 			})
 		})
 
 		frm.set_query("supplier_warehouse", function() {
 			return {
-				filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
+				filters: [
+					["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
+					["Warehouse", "is_group", "=", 0]
+				]
 			}
 		})
 	}
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 6c2a14b..a9d978a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -40,14 +40,6 @@
 					}
 				}
 			}
-			this.frm.set_query("difference_account", function() {
-				return {
-					"filters": {
-						"company": me.frm.doc.company,
-						"is_group": 0
-					}
-				};
-			});
 		}
 
 		this.frm.get_field('items').grid.editable_fields = [
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index b5efc90..0ab80c2 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -847,33 +847,6 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 0, 
-   "description": "", 
-   "fieldname": "difference_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Difference Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
    "collapsible": 1, 
    "collapsible_depends_on": "total_additional_costs", 
    "fieldname": "additional_costs_section", 
@@ -1431,7 +1404,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-07 06:40:03.284036", 
+ "modified": "2016-09-08 06:40:03.284036", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Entry", 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index e35f3d2..b1f8c9c 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -71,9 +71,6 @@
 		if self.purpose not in valid_purposes:
 			frappe.throw(_("Purpose must be one of {0}").format(comma_or(valid_purposes)))
 
-		if self.purpose in ("Manufacture", "Repack") and not self.difference_account:
-			self.difference_account = frappe.db.get_value("Company", self.company, "default_expense_account")
-
 	def set_transfer_qty(self):
 		for item in self.get("items"):
 			if not flt(item.qty):
@@ -97,9 +94,6 @@
 					if f in ["stock_uom", "conversion_factor"] or not item.get(f):
 						item.set(f, item_details.get(f))
 
-			if self.difference_account and not item.expense_account:
-				item.expense_account = self.difference_account
-
 			if not item.transfer_qty and item.qty:
 				item.transfer_qty = item.qty * item.conversion_factor
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
index b75eeea..cb3bb7b 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
@@ -57,8 +57,6 @@
 	s.purchase_receipt_no = args.purchase_receipt_no
 	s.delivery_note_no = args.delivery_note_no
 	s.sales_invoice_no = args.sales_invoice_no
-	if args.difference_account:
-		s.difference_account = args.difference_account
 	if not args.cost_center:
 		args.cost_center = frappe.get_value('Company', s.company, 'cost_center')
 
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index b9926d6..674143d 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -31,10 +31,10 @@
 		</div>
 		<div class="text-center item-group-nav-buttons">
 			{% if frappe.form_dict.start|int > 0 %}
-			<a class="btn btn-default" href="{{ pathname }}?start={{ frappe.form_dict.start|int - 24 }}">Prev</a>
+			<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int - page_length }}">Prev</a>
 			{% endif %}
-			{% if items|length == 24 %}
-			<a class="btn btn-default" href="{{ pathname }}?start={{ frappe.form_dict.start|int + 24 }}">Next</a>
+			{% if items|length == page_length %}
+			<a class="btn btn-default" href="/{{ pathname }}?start={{ frappe.form_dict.start|int + page_length }}">Next</a>
 			{% endif %}
 		</div>
 		{% else %}
diff --git a/erpnext/templates/includes/rfq.js b/erpnext/templates/includes/rfq.js
index 3e9c261..c63226c 100644
--- a/erpnext/templates/includes/rfq.js
+++ b/erpnext/templates/includes/rfq.js
@@ -30,9 +30,10 @@
 		var me = this;
 		$('.rfq-items').on("change", ".rfq-qty", function(){
 			me.idx = parseFloat($(this).attr('data-idx'));
-			me.qty = parseFloat($(this).val());
+			me.qty = parseFloat($(this).val()) || 0;
 			me.rate = parseFloat($(repl('.rfq-rate[data-idx=%(idx)s]',{'idx': me.idx})).val());
 			me.update_qty_rate();
+			$(this).val(format_number(me.qty, 2));
 		})
 	},
 
@@ -40,9 +41,10 @@
 		var me = this;
 		$(".rfq-items").on("change", ".rfq-rate", function(){
 			me.idx = parseFloat($(this).attr('data-idx'));
-			me.rate = parseFloat($(this).val());
+			me.rate = parseFloat($(this).val()) || 0;
 			me.qty = parseFloat($(repl('.rfq-qty[data-idx=%(idx)s]',{'idx': me.idx})).val());
 			me.update_qty_rate();
+			$(this).val(format_number(me.rate, 2));
 		})
 	},
 
diff --git a/erpnext/templates/includes/rfq/rfq_items.html b/erpnext/templates/includes/rfq/rfq_items.html
index 1e99a76..cb77f7e 100644
--- a/erpnext/templates/includes/rfq/rfq_items.html
+++ b/erpnext/templates/includes/rfq/rfq_items.html
@@ -3,26 +3,26 @@
 {% for d in doc.items %}
 <div class="rfq-item">
 	<div class="row">
-		<div class="col-sm-6 col-xs-6" style="margin-bottom: 10px;margin-top: 5px;">
+		<div class="col-sm-5 col-xs-12" style="margin-bottom: 10px;margin-top: 5px;">
 			{{ item_name_and_description(d, doc) }}
 		</div>
 		<!-- <div class="col-sm-2 col-xs-2" style="margin-bottom: 10px;">
 			<textarea type="text" style="margin-top: 5px;" class="input-with-feedback form-control rfq-offer_detail" ></textarea>
 		</div> -->
-		<div class="col-sm-2 col-xs-2 text-right">
-				<input type="number" class="form-control text-right rfq-qty" style="margin-top: 5px; max-width: 70px;display: inline-block"
+		<div class="col-sm-2 col-xs-4 text-right">
+				<input type="text" class="form-control text-right rfq-qty" style="margin-top: 5px;display: inline-block"
 				value = "{{ d.get_formatted('qty') }}"
 				data-idx="{{ d.idx }}">
 				<p class="text-muted small" style="margin-top: 10px;">
-					{{_("UOM") + ": "+ d.uom}}
+					{{_("UOM") + ":"+ d.uom}}
 				</p>
 		</div>
-		<div class="col-sm-2 col-xs-2 text-right">
-			{{doc.currency_symbol}}	<input type="number" class="form-control text-right rfq-rate"
-				style="margin-top: 5px; max-width: 70px;display: inline-block" value="0.00"
+		<div class="col-sm-2 col-xs-4 text-right">
+			<input type="text" class="form-control text-right rfq-rate"
+				style="margin-top: 5px;display: inline-block" value="0.00"
 				data-idx="{{ d.idx }}">
 		</div>
-        <div class="col-sm-2 col-xs-2 text-right" style="padding-top: 9px;">
+        <div class="col-sm-3 col-xs-4 text-right" style="padding-top: 9px;">
            {{doc.currency_symbol}} <span class="rfq-amount" data-idx="{{ d.idx }}">0.00</span>
         </div>
 		</div>
diff --git a/erpnext/templates/pages/rfq.html b/erpnext/templates/pages/rfq.html
index 5729e89..b151987 100644
--- a/erpnext/templates/pages/rfq.html
+++ b/erpnext/templates/pages/rfq.html
@@ -33,16 +33,16 @@
 	<div id="order-container">
 			<div id="rfq-items">
 				<div class="row cart-item-header">
-					<div class="col-sm-6 col-xs-6">
+					<div class="col-sm-5 col-xs-12">
 						Items
 					</div>
-					<div class="col-sm-2 col-xs-2 text-right">
+					<div class="col-sm-2 col-xs-4 text-right">
 						Qty
 					</div>
-					<div class="col-sm-2 col-xs-2 text-right">
+					<div class="col-sm-2 col-xs-4 text-right">
 						Rate
 					</div>
-					<div class="col-sm-2 col-xs-2 text-right">
+					<div class="col-sm-3 col-xs-4 text-right">
 						Amount
 					</div>
 				</div>
@@ -55,8 +55,8 @@
 		</div>
         {% if doc.items %}
 		<div class="row grand-total-row">
-			<div class="col-xs-10 text-right">{{ _("Grand Total") }}</div>
-			<div class="col-xs-2 text-right">
+			<div class="col-xs-9 text-right">{{ _("Grand Total") }}</div>
+			<div class="col-xs-3 text-right">
 			{{doc.currency_symbol}}  <span class="tax-grand-total">0.0</span>
 			</div>
 		</div>