Merge pull request #3303 from rmehta/letter-head-in-stock-entry

[enhancement] letter head in stock entry #3291
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 7d2298f..721b475 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '5.0.5'
+__version__ = '5.0.6'
diff --git a/erpnext/accounts/doctype/pos_profile/__init__.py b/erpnext/accounts/doctype/pos_profile/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile/__init__.py
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
similarity index 93%
rename from erpnext/accounts/doctype/pos_setting/pos_setting.js
rename to erpnext/accounts/doctype/pos_profile/pos_profile.js
index db5fec1..83643fe 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.ui.form.on("POS Setting", "onload", function(frm) {
+frappe.ui.form.on("POS Profile", "onload", function(frm) {
 	frm.set_query("selling_price_list", function() {
 		return { filter: { selling: 1 } };
 	});
 
 	frm.call({
-		method: "erpnext.accounts.doctype.pos_setting.pos_setting.get_series",
+		method: "erpnext.accounts.doctype.pos_profile.pos_profile.get_series",
 		callback: function(r) {
 			if(!r.exc) {
 				set_field_options("naming_series", r.message);
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
new file mode 100644
index 0000000..ad224f1
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -0,0 +1,263 @@
+{
+ "allow_rename": 0, 
+ "autoname": "hash", 
+ "creation": "2013-05-24 12:15:51", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "fields": [
+  {
+   "fieldname": "user", 
+   "fieldtype": "Link", 
+   "in_list_view": 1, 
+   "label": "User", 
+   "oldfieldname": "user", 
+   "oldfieldtype": "Link", 
+   "options": "User", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
+   "description": "", 
+   "fieldname": "territory", 
+   "fieldtype": "Link", 
+   "in_list_view": 1, 
+   "label": "Territory", 
+   "oldfieldname": "territory", 
+   "oldfieldtype": "Link", 
+   "options": "Territory", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "in_list_view": 1, 
+   "label": "Series", 
+   "no_copy": 1, 
+   "oldfieldname": "naming_series", 
+   "oldfieldtype": "Select", 
+   "options": "[Select]", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "currency", 
+   "fieldtype": "Link", 
+   "in_list_view": 0, 
+   "label": "Currency", 
+   "oldfieldname": "currency", 
+   "oldfieldtype": "Select", 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "selling_price_list", 
+   "fieldtype": "Link", 
+   "label": "Price List", 
+   "oldfieldname": "price_list_name", 
+   "oldfieldtype": "Select", 
+   "options": "Price List", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "in_list_view": 1, 
+   "label": "Company", 
+   "oldfieldname": "company", 
+   "oldfieldtype": "Link", 
+   "options": "Company", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "column_break0", 
+   "fieldtype": "Column Break", 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
+   "default": "1", 
+   "description": "Create Stock Ledger Entries when you submit a Sales Invoice", 
+   "fieldname": "update_stock", 
+   "fieldtype": "Check", 
+   "label": "Update Stock", 
+   "permlevel": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "customer", 
+   "fieldtype": "Link", 
+   "in_list_view": 0, 
+   "label": "Customer", 
+   "oldfieldname": "customer_account", 
+   "oldfieldtype": "Link", 
+   "options": "Customer", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "cash_bank_account", 
+   "fieldtype": "Link", 
+   "label": "Cash/Bank Account", 
+   "oldfieldname": "cash_bank_account", 
+   "oldfieldtype": "Link", 
+   "options": "Account", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "income_account", 
+   "fieldtype": "Link", 
+   "label": "Income Account", 
+   "oldfieldname": "income_account", 
+   "oldfieldtype": "Link", 
+   "options": "Account", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)", 
+   "fieldname": "expense_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "label": "Expense Account", 
+   "options": "Account", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "warehouse", 
+   "fieldtype": "Link", 
+   "label": "Warehouse", 
+   "oldfieldname": "warehouse", 
+   "oldfieldtype": "Link", 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 0
+  }, 
+  {
+   "fieldname": "cost_center", 
+   "fieldtype": "Link", 
+   "label": "Cost Center", 
+   "oldfieldname": "cost_center", 
+   "oldfieldtype": "Link", 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "read_only": 0, 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "taxes_and_charges", 
+   "fieldtype": "Link", 
+   "label": "Taxes and Charges", 
+   "oldfieldname": "charge", 
+   "oldfieldtype": "Link", 
+   "options": "Sales Taxes and Charges Template", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
+   "fieldname": "write_off_account", 
+   "fieldtype": "Link", 
+   "label": "Write Off Account", 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "reqd": 1
+  }, 
+  {
+   "fieldname": "write_off_cost_center", 
+   "fieldtype": "Link", 
+   "label": "Write Off Cost Center", 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "precision": "", 
+   "reqd": 1
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "label": "Letter Head", 
+   "oldfieldname": "letter_head", 
+   "oldfieldtype": "Select", 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "read_only": 0
+  }, 
+  {
+   "fieldname": "tc_name", 
+   "fieldtype": "Link", 
+   "label": "Terms and Conditions", 
+   "oldfieldname": "tc_name", 
+   "oldfieldtype": "Link", 
+   "options": "Terms and Conditions", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "in_filter": 0, 
+   "label": "Print Heading", 
+   "oldfieldname": "select_print_heading", 
+   "oldfieldtype": "Select", 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "read_only": 0
+  }
+ ], 
+ "icon": "icon-cog", 
+ "idx": 1, 
+ "modified": "2015-05-20 05:38:44.482696", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "POS Profile", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "apply_user_permissions": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "submit": 0
+  }
+ ], 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "user"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
old mode 100755
new mode 100644
similarity index 87%
rename from erpnext/accounts/doctype/pos_setting/pos_setting.py
rename to erpnext/accounts/doctype/pos_profile/pos_profile.py
index 0a80061..eeb2bcf
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -8,22 +8,22 @@
 
 from frappe.model.document import Document
 
-class POSSetting(Document):
+class POSProfile(Document):
 	def validate(self):
 		self.check_for_duplicate()
 		self.validate_expense_account()
 		self.validate_all_link_fields()
 
 	def check_for_duplicate(self):
-		res = frappe.db.sql("""select name, user from `tabPOS Setting`
+		res = frappe.db.sql("""select name, user from `tabPOS Profile`
 			where ifnull(user, '') = %s and name != %s and company = %s""",
 			(self.user, self.name, self.company))
 		if res:
 			if res[0][1]:
-				msgprint(_("POS Setting {0} already created for user: {1} and company {2}").format(res[0][0],
+				msgprint(_("POS Profile {0} already created for user: {1} and company {2}").format(res[0][0],
 					res[0][1], self.company), raise_exception=1)
 			else:
-				msgprint(_("Global POS Setting {0} already created for company {1}").format(res[0][0],
+				msgprint(_("Global POS Profile {0} already created for company {1}").format(res[0][0],
 					self.company), raise_exception=1)
 
 	def validate_expense_account(self):
@@ -57,7 +57,7 @@
 			condition = ""
 
 		pos_view_users = frappe.db.sql_list("""select user
-			from `tabPOS Setting` {0}""".format(condition))
+			from `tabPOS Profile` {0}""".format(condition))
 
 		for user in pos_view_users:
 			if user:
diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
new file mode 100644
index 0000000..62274a3
--- /dev/null
+++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('POS Profile')
+
+class TestPOSProfile(unittest.TestCase):
+	pass
diff --git a/erpnext/accounts/doctype/pos_setting/README.md b/erpnext/accounts/doctype/pos_setting/README.md
deleted file mode 100644
index 2ddef78..0000000
--- a/erpnext/accounts/doctype/pos_setting/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Standard settings for Point of Sales (POS) type of Sales Invoice.
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_setting/__init__.py b/erpnext/accounts/doctype/pos_setting/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/accounts/doctype/pos_setting/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.json b/erpnext/accounts/doctype/pos_setting/pos_setting.json
deleted file mode 100755
index b18a411..0000000
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.json
+++ /dev/null
@@ -1,263 +0,0 @@
-{
- "allow_rename": 0,
- "autoname": "hash",
- "creation": "2013-05-24 12:15:51",
- "docstatus": 0,
- "doctype": "DocType",
- "fields": [
-  {
-   "fieldname": "user",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "User",
-   "oldfieldname": "user",
-   "oldfieldtype": "Link",
-   "options": "User",
-   "permlevel": 0,
-   "read_only": 0
-  },
-  {
-   "description": "",
-   "fieldname": "territory",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Territory",
-   "oldfieldname": "territory",
-   "oldfieldtype": "Link",
-   "options": "Territory",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "fieldname": "naming_series",
-   "fieldtype": "Select",
-   "in_list_view": 1,
-   "label": "Series",
-   "no_copy": 1,
-   "oldfieldname": "naming_series",
-   "oldfieldtype": "Select",
-   "options": "[Select]",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "fieldname": "currency",
-   "fieldtype": "Link",
-   "in_list_view": 0,
-   "label": "Currency",
-   "oldfieldname": "currency",
-   "oldfieldtype": "Select",
-   "options": "Currency",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "fieldname": "selling_price_list",
-   "fieldtype": "Link",
-   "label": "Price List",
-   "oldfieldname": "price_list_name",
-   "oldfieldtype": "Select",
-   "options": "Price List",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 0
-  },
-  {
-   "fieldname": "company",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Company",
-   "oldfieldname": "company",
-   "oldfieldtype": "Link",
-   "options": "Company",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "fieldname": "column_break0",
-   "fieldtype": "Column Break",
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "read_only": 0
-  },
-  {
-   "default": "1",
-   "description": "Create Stock Ledger Entries when you submit a Sales Invoice",
-   "fieldname": "update_stock",
-   "fieldtype": "Check",
-   "label": "Update Stock",
-   "permlevel": 0,
-   "reqd": 0
-  },
-  {
-   "fieldname": "customer",
-   "fieldtype": "Link",
-   "in_list_view": 0,
-   "label": "Customer",
-   "oldfieldname": "customer_account",
-   "oldfieldtype": "Link",
-   "options": "Customer",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 0
-  },
-  {
-   "fieldname": "cash_bank_account",
-   "fieldtype": "Link",
-   "label": "Cash/Bank Account",
-   "oldfieldname": "cash_bank_account",
-   "oldfieldtype": "Link",
-   "options": "Account",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "fieldname": "income_account",
-   "fieldtype": "Link",
-   "label": "Income Account",
-   "oldfieldname": "income_account",
-   "oldfieldtype": "Link",
-   "options": "Account",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
-   "fieldname": "expense_account",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "label": "Expense Account",
-   "options": "Account",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0,
-   "reqd": 0
-  },
-  {
-   "fieldname": "warehouse",
-   "fieldtype": "Link",
-   "label": "Warehouse",
-   "oldfieldname": "warehouse",
-   "oldfieldtype": "Link",
-   "options": "Warehouse",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 0
-  },
-  {
-   "fieldname": "cost_center",
-   "fieldtype": "Link",
-   "label": "Cost Center",
-   "oldfieldname": "cost_center",
-   "oldfieldtype": "Link",
-   "options": "Cost Center",
-   "permlevel": 0,
-   "read_only": 0,
-   "reqd": 1
-  },
-  {
-   "fieldname": "taxes_and_charges",
-   "fieldtype": "Link",
-   "label": "Taxes and Charges",
-   "oldfieldname": "charge",
-   "oldfieldtype": "Link",
-   "options": "Sales Taxes and Charges Template",
-   "permlevel": 0,
-   "read_only": 0
-  },
-  {
-   "fieldname": "write_off_account",
-   "fieldtype": "Link",
-   "label": "Write Off Account",
-   "options": "Account",
-   "permlevel": 0,
-   "precision": "",
-   "reqd": 1
-  },
-  {
-   "fieldname": "write_off_cost_center",
-   "fieldtype": "Link",
-   "label": "Write Off Cost Center",
-   "options": "Cost Center",
-   "permlevel": 0,
-   "precision": "",
-   "reqd": 1
-  },
-  {
-   "allow_on_submit": 1,
-   "fieldname": "letter_head",
-   "fieldtype": "Link",
-   "label": "Letter Head",
-   "oldfieldname": "letter_head",
-   "oldfieldtype": "Select",
-   "options": "Letter Head",
-   "permlevel": 0,
-   "print_hide": 1,
-   "read_only": 0
-  },
-  {
-   "fieldname": "tc_name",
-   "fieldtype": "Link",
-   "label": "Terms and Conditions",
-   "oldfieldname": "tc_name",
-   "oldfieldtype": "Link",
-   "options": "Terms and Conditions",
-   "permlevel": 0,
-   "read_only": 0
-  },
-  {
-   "allow_on_submit": 1,
-   "fieldname": "select_print_heading",
-   "fieldtype": "Link",
-   "in_filter": 0,
-   "label": "Print Heading",
-   "oldfieldname": "select_print_heading",
-   "oldfieldtype": "Select",
-   "options": "Print Heading",
-   "permlevel": 0,
-   "read_only": 0
-  }
- ],
- "icon": "icon-cog",
- "idx": 1,
- "modified": "2015-02-05 05:11:42.344181",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "POS Setting",
- "owner": "Administrator",
- "permissions": [
-  {
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts Manager",
-   "share": 1,
-   "submit": 0,
-   "write": 1
-  },
-  {
-   "apply_user_permissions": 1,
-   "delete": 0,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts User",
-   "submit": 0
-  }
- ],
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "user"
-}
diff --git a/erpnext/accounts/doctype/pos_setting/test_pos_setting.py b/erpnext/accounts/doctype/pos_setting/test_pos_setting.py
deleted file mode 100644
index 4f521f0..0000000
--- a/erpnext/accounts/doctype/pos_setting/test_pos_setting.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import frappe
-import unittest
-
-test_records = frappe.get_test_records('POS Setting')
-
-class TestPOSSetting(unittest.TestCase):
-	pass
diff --git a/erpnext/accounts/doctype/pos_setting/test_records.json b/erpnext/accounts/doctype/pos_setting/test_records.json
deleted file mode 100644
index fe51488..0000000
--- a/erpnext/accounts/doctype/pos_setting/test_records.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 7c366c1..e5af176 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -160,12 +160,12 @@
 					frappe.throw(_("Time Log Batch {0} must be 'Submitted'").format(d.time_log_batch))
 
 	def set_pos_fields(self, for_validate=False):
-		"""Set retail related fields from pos settings"""
+		"""Set retail related fields from POS Profiles"""
 		if cint(self.is_pos) != 1:
 			return
 
-		from erpnext.stock.get_item_details import get_pos_settings_item_details, get_pos_settings
-		pos = get_pos_settings(self.company)
+		from erpnext.stock.get_item_details import get_pos_profiles_item_details, get_pos_profiles
+		pos = get_pos_profiles(self.company)
 
 		if pos:
 			if not for_validate and not self.customer:
@@ -184,7 +184,7 @@
 			# set pos values in items
 			for item in self.get("items"):
 				if item.get('item_code'):
-					for fname, val in get_pos_settings_item_details(pos,
+					for fname, val in get_pos_profiles_item_details(pos,
 						frappe._dict(item.as_dict()), pos).items():
 
 						if (not for_validate) or (for_validate and not item.get(fname)):
@@ -371,24 +371,24 @@
 
 
 	def get_warehouse(self):
-		user_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
+		user_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
 			where ifnull(user,'') = %s and company = %s""", (frappe.session['user'], self.company))
-		warehouse = user_pos_setting[0][1] if user_pos_setting else None
+		warehouse = user_pos_profile[0][1] if user_pos_profile else None
 
 		if not warehouse:
-			global_pos_setting = frappe.db.sql("""select name, warehouse from `tabPOS Setting`
+			global_pos_profile = frappe.db.sql("""select name, warehouse from `tabPOS Profile`
 				where ifnull(user,'') = '' and company = %s""", self.company)
 
-			if global_pos_setting:
-				warehouse = global_pos_setting[0][1]
-			elif not user_pos_setting:
-				msgprint(_("POS Setting required to make POS Entry"), raise_exception=True)
+			if global_pos_profile:
+				warehouse = global_pos_profile[0][1]
+			elif not user_pos_profile:
+				msgprint(_("POS Profile required to make POS Entry"), raise_exception=True)
 
 		return warehouse
 
 	def on_update(self):
 		if cint(self.update_stock) == 1:
-			# Set default warehouse from pos setting
+			# Set default warehouse from POS Profile
 			if cint(self.is_pos) == 1:
 				w = self.get_warehouse()
 				if w:
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 9db2b36..63977b7 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -462,7 +462,7 @@
 
 	def test_pos_gl_entry_with_aii(self):
 		set_perpetual_inventory()
-		self.make_pos_setting()
+		self.make_pos_profile()
 
 		self._insert_purchase_receipt()
 
@@ -517,19 +517,19 @@
 
 		set_perpetual_inventory(0)
 
-		frappe.db.sql("delete from `tabPOS Setting`")
+		frappe.db.sql("delete from `tabPOS Profile`")
 
-	def make_pos_setting(self):
-		pos_setting = frappe.get_doc({
+	def make_pos_profile(self):
+		pos_profile = frappe.get_doc({
 			"cash_bank_account": "_Test Account Bank Account - _TC",
 			"company": "_Test Company",
 			"cost_center": "_Test Cost Center - _TC",
 			"currency": "INR",
-			"doctype": "POS Setting",
+			"doctype": "POS Profile",
 			"expense_account": "_Test Account Cost for Goods Sold - _TC",
 			"income_account": "Sales - _TC",
-			"name": "_Test POS Setting",
-			"naming_series": "_T-POS Setting-",
+			"name": "_Test POS Profile",
+			"naming_series": "_T-POS Profile-",
 			"selling_price_list": "_Test Price List",
 			"territory": "_Test Territory",
 			"warehouse": "_Test Warehouse - _TC",
@@ -537,8 +537,8 @@
 			"write_off_cost_center": "_Test Write Off Cost Center - _TC"
 		})
 
-		if not frappe.db.exists("POS Setting", "_Test POS Setting"):
-			pos_setting.insert()
+		if not frappe.db.exists("POS Profile", "_Test POS Profile"):
+			pos_profile.insert()
 
 	def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self):
 		set_perpetual_inventory()
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 1bc5681..df7757b 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -35,7 +35,7 @@
 	});
 
 	$.ajax({
-		url: "/api/resource/POS Setting",
+		url: "/api/resource/POS Profile",
 		success: function(data) {
 			if(!data.data.length) {
 				page.main.find(".pos-setting-message").removeClass('hide');
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 168f9b1..f664a9e 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -29,7 +29,7 @@
 def get_provisional_profit_loss(asset, liability, equity, period_list):
 	if asset and (liability or equity):
 		provisional_profit_loss = {
-			"account_name": _("Provisional Profit / Loss (Credit)"),
+			"account_name": _("'Provisional Profit / Loss (Credit)'"),
 			"account": None,
 			"warn_if_negative": True
 		}
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 8f4b2ca..e592f69 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -38,7 +38,7 @@
 	data += [
 		get_balance_row(_("System Balance"), balance_as_per_system),
 		[""]*len(columns),
-		["", _("Amounts not reflected in bank"), total_debit, total_credit, "", "", "", ""],
+		["", '"' + _("Amounts not reflected in bank") + '"', total_debit, total_credit, "", "", "", ""],
 		get_balance_row(_("Amounts not reflected in system"), amounts_not_reflected_in_system),
 		[""]*len(columns),
 		get_balance_row(_("Expected balance as per bank"), bank_bal)
@@ -68,6 +68,6 @@
 
 def get_balance_row(label, amount):
 	if amount > 0:
-		return ["", label, amount, 0, "", "", "", ""]
+		return ["", '"' + label + '"', amount, 0, "", "", "", ""]
 	else:
-		return ["", label, 0, abs(amount), "", "", "", ""]
+		return ["", '"' + label + '"', 0, abs(amount), "", "", "", ""]
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 88d1beb..e769373 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -146,7 +146,7 @@
 
 def add_total_row(out, balance_must_be, period_list):
 	row = {
-		"account_name": _("Total ({0})").format(balance_must_be),
+		"account_name": _("'Total ({0})'").format(balance_must_be),
 		"account": None
 	}
 	for period in period_list:
@@ -207,7 +207,7 @@
 	add_to_list(None, 0)
 
 	return filtered_accounts, accounts_by_name
-	
+
 def sort_root_accounts(roots):
 	"""Sort root types as Asset, Liability, Equity, Income, Expense"""
 
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 2731baa..de476f7 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -120,14 +120,14 @@
 
 			# Totals and closing for individual ledger, if grouped by account
 			if filters.get("group_by_account"):
-				data += [{"account": "Totals", "debit": acc_dict.total_debit,
+				data += [{"account": "'Totals'", "debit": acc_dict.total_debit,
 					"credit": acc_dict.total_credit},
 					get_balance_row("Closing (Opening + Totals)",
 						(acc_dict.opening + acc_dict.total_debit - acc_dict.total_credit)), {}]
 
 	# Total debit and credit between from and to date
 	if total_debit or total_credit:
-		data.append({"account": "Totals", "debit": total_debit, "credit": total_credit})
+		data.append({"account": "'Totals'", "debit": total_debit, "credit": total_credit})
 
 	# Closing for filtered account
 	if filters.get("account"):
@@ -168,7 +168,7 @@
 
 def get_balance_row(label, balance):
 	return {
-		"account": label,
+		"account": "'" + label + "'",
 		"debit": balance if balance > 0 else 0,
 		"credit": -1*balance if balance < 0 else 0,
 	}
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 1d13376..6e7b13e 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -27,7 +27,7 @@
 def get_net_profit_loss(income, expense, period_list):
 	if income and expense:
 		net_profit_loss = {
-			"account_name": _("Net Profit / Loss"),
+			"account_name": _("'Net Profit / Loss'"),
 			"account": None,
 			"warn_if_negative": True
 		}
diff --git a/erpnext/change_log/current/rename_pos_setting.md b/erpnext/change_log/current/rename_pos_setting.md
new file mode 100644
index 0000000..2705a17
--- /dev/null
+++ b/erpnext/change_log/current/rename_pos_setting.md
@@ -0,0 +1 @@
+- POS Setting is renamed to POS Profile
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 6b02c1b..1b29002 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -113,7 +113,7 @@
 				},
 				{
 					"type": "doctype",
-					"name": "POS Setting",
+					"name": "POS Profile",
 					"label": _("Point-of-Sale Setting"),
 					"description": _("Rules to calculate shipping amount for a sale")
 				},
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index aa8638e..c16d9b1 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -5,7 +5,7 @@
 app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "5.0.5"
+app_version = "5.0.6"
 
 error_report_email = "support@erpnext.com"
 
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 185a915..2990ab0 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -155,3 +155,4 @@
 erpnext.patches.v5_0.repost_requested_qty
 erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency
 erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle
+erpnext.patches.v5_0.rename_pos_setting
diff --git a/erpnext/patches/v5_0/rename_pos_setting.py b/erpnext/patches/v5_0/rename_pos_setting.py
new file mode 100644
index 0000000..ad579b6
--- /dev/null
+++ b/erpnext/patches/v5_0/rename_pos_setting.py
@@ -0,0 +1,5 @@
+import frappe
+
+def execute():
+	if frappe.db.table_exists("POS Setting"):
+		frappe.rename_doc("DocType", "POS Setting", "POS Profile")
diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js
index 85f8e05..5ab04dd 100644
--- a/erpnext/public/js/feature_setup.js
+++ b/erpnext/public/js/feature_setup.js
@@ -117,7 +117,7 @@
 				'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
 			'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
 		},
-		'POS Setting': {'fields':['conversion_rate','currency']},
+		'POS Profile': {'fields':['conversion_rate','currency']},
 		'Quotation': {
 			'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
 				'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 1725de7..d717e20 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -34,8 +34,7 @@
 						method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
 						source_doctype: "Opportunity",
 						get_query_filters: {
-							docstatus: 1,
-							status: "Submitted",
+							status: ["not in", ["Lost", "Closed"]],
 							enquiry_type: cur_frm.doc.order_type,
 							customer: cur_frm.doc.customer || undefined,
 							lead: cur_frm.doc.lead || undefined,
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 3c820fa..3f73932 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -51,7 +51,7 @@
 	get_price_list_rate(args, item_doc, out)
 
 	if args.transaction_type == "selling" and cint(args.is_pos):
-		out.update(get_pos_settings_item_details(args.company, args))
+		out.update(get_pos_profiles_item_details(args.company, args))
 
 	# update args with out, if key or value not exists
 	for key, value in out.iteritems():
@@ -267,16 +267,16 @@
 		item_supplier = item_doc.get("supplier_items", {"supplier": args.supplier})
 		out.supplier_part_no = item_supplier[0].supplier_part_no if item_supplier else None
 
-def get_pos_settings_item_details(company, args, pos_settings=None):
+def get_pos_profiles_item_details(company, args, pos_profiles=None):
 	res = frappe._dict()
 
-	if not pos_settings:
-		pos_settings = get_pos_settings(company)
+	if not pos_profiles:
+		pos_profiles = get_pos_profiles(company)
 
-	if pos_settings:
+	if pos_profiles:
 		for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
-			if not args.get(fieldname) and pos_settings.get(fieldname):
-				res[fieldname] = pos_settings.get(fieldname)
+			if not args.get(fieldname) and pos_profiles.get(fieldname):
+				res[fieldname] = pos_profiles.get(fieldname)
 
 		if res.get("warehouse"):
 			res.actual_qty = get_available_qty(args.item_code,
@@ -284,15 +284,15 @@
 
 	return res
 
-def get_pos_settings(company):
-	pos_settings = frappe.db.sql("""select * from `tabPOS Setting` where user = %s
+def get_pos_profiles(company):
+	pos_profiles = frappe.db.sql("""select * from `tabPOS Profile` where user = %s
 		and company = %s""", (frappe.session['user'], company), as_dict=1)
 
-	if not pos_settings:
-		pos_settings = frappe.db.sql("""select * from `tabPOS Setting`
+	if not pos_profiles:
+		pos_profiles = frappe.db.sql("""select * from `tabPOS Profile`
 			where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
 
-	return pos_settings and pos_settings[0] or None
+	return pos_profiles and pos_profiles[0] or None
 
 
 def get_serial_nos_by_fifo(args, item_doc):
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 8ba1b5a..9a698c5 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -69,7 +69,18 @@
    "reqd": 1
   }, 
   {
-   "depends_on": "eval:doc.__islocal", 
+   "fieldname": "fold", 
+   "fieldtype": "Fold", 
+   "permlevel": 0
+  }, 
+  {
+   "fieldname": "section_break_7", 
+   "fieldtype": "Section Break", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "depends_on": "", 
    "fieldname": "description", 
    "fieldtype": "Text", 
    "label": "Description", 
@@ -79,28 +90,39 @@
    "reqd": 0
   }, 
   {
-   "fieldname": "fold", 
-   "fieldtype": "Fold", 
+   "fieldname": "column_break_9", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "resolution_date", 
+   "fieldtype": "Datetime", 
+   "in_filter": 0, 
+   "label": "Resolution Date", 
+   "no_copy": 1, 
+   "oldfieldname": "resolution_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "read_only": 1, 
+   "search_index": 0
+  }, 
+  {
+   "fieldname": "first_responded_on", 
+   "fieldtype": "Datetime", 
+   "label": "First Responded On", 
    "permlevel": 0
   }, 
   {
    "fieldname": "additional_info", 
    "fieldtype": "Section Break", 
-   "label": "Reference", 
+   "label": "", 
    "options": "icon-pushpin", 
    "permlevel": 0, 
    "read_only": 1
   }, 
   {
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "column_break0", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 1, 
-   "width": "50%"
-  }, 
-  {
    "fieldname": "lead", 
    "fieldtype": "Link", 
    "label": "Lead", 
@@ -115,6 +137,12 @@
    "permlevel": 0
   }, 
   {
+   "fieldname": "column_break_16", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -141,6 +169,31 @@
    "search_index": 0
   }, 
   {
+   "fieldname": "section_break_19", 
+   "fieldtype": "Section Break", 
+   "permlevel": 0, 
+   "precision": ""
+  }, 
+  {
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "resolution_details", 
+   "fieldtype": "Small Text", 
+   "label": "Resolution Details", 
+   "no_copy": 1, 
+   "oldfieldname": "resolution_details", 
+   "oldfieldtype": "Text", 
+   "permlevel": 0, 
+   "read_only": 0
+  }, 
+  {
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "read_only": 1
+  }, 
+  {
    "default": "Today", 
    "fieldname": "opening_date", 
    "fieldtype": "Date", 
@@ -171,44 +224,6 @@
    "reqd": 0
   }, 
   {
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "column_break1", 
-   "fieldtype": "Column Break", 
-   "oldfieldtype": "Column Break", 
-   "permlevel": 0, 
-   "read_only": 1
-  }, 
-  {
-   "fieldname": "first_responded_on", 
-   "fieldtype": "Datetime", 
-   "label": "First Responded On", 
-   "permlevel": 0
-  }, 
-  {
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "resolution_date", 
-   "fieldtype": "Datetime", 
-   "in_filter": 0, 
-   "label": "Resolution Date", 
-   "no_copy": 1, 
-   "oldfieldname": "resolution_date", 
-   "oldfieldtype": "Date", 
-   "permlevel": 0, 
-   "read_only": 1, 
-   "search_index": 0
-  }, 
-  {
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "resolution_details", 
-   "fieldtype": "Small Text", 
-   "label": "Resolution Details", 
-   "no_copy": 1, 
-   "oldfieldname": "resolution_details", 
-   "oldfieldtype": "Text", 
-   "permlevel": 0, 
-   "read_only": 0
-  }, 
-  {
    "fieldname": "content_type", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -218,7 +233,7 @@
  ], 
  "icon": "icon-ticket", 
  "idx": 1, 
- "modified": "2015-04-02 22:06:02.684820", 
+ "modified": "2015-05-20 07:16:53.673114", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Issue", 
diff --git a/setup.py b/setup.py
index 669c901..31eea3d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = "5.0.5"
+version = "5.0.6"
 
 with open("requirements.txt", "r") as f:
 	install_requires = f.readlines()