Merge pull request #5084 from KanchanChauhan/PM-UI-Edits

UI Changes
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 36a86ab..9ebc832 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.27.3'
+__version__ = '6.27.5'
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/in_standard_chart_of_accounts.json b/erpnext/accounts/doctype/account/chart_of_accounts/verified/in_standard_chart_of_accounts.json
index c300894..ab41039 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/in_standard_chart_of_accounts.json
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/in_standard_chart_of_accounts.json
@@ -48,7 +48,8 @@
 	            },
 	            "Plant and Machinery": {
 	                "account_type": "Fixed Asset"
-	            }
+	            },
+				"Accumulated Depreciations": {}
 	        },
 	        "Investments": {
 	        	"is_group": 1
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
index 481ada8..532a015 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
@@ -52,7 +52,8 @@
 	            },
 	            _("Plant and Machinery"): {
 	                "account_type": "Fixed Asset"
-	            }
+	            },
+	            _("Accumulated Depreciations"): {}
 	        },
 	        _("Investments"): {
 	        	"is_group": 1
diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py
index 83516da..4580d02 100644
--- a/erpnext/accounts/doctype/account/test_account.py
+++ b/erpnext/accounts/doctype/account/test_account.py
@@ -35,7 +35,12 @@
 
 		# related to Account Inventory Integration
 		["_Test Account Stock In Hand", "Current Assets", 0, None, None],
-		["_Test Account Fixed Assets", "Current Assets", 0, None, None],
+		
+		# fixed asset depreciation
+		["_Test Fixed Asset", "Current Assets", 0, "Fixed Asset", None],
+		["_Test Accumulated Depreciations", "Current Assets", 0, None, None],
+		["_Test Depreciations", "Expenses", 0, None, None],
+		["_Test Gain/Loss on Asset Disposal", "Expenses", 0, None, None],
 
 		# Receivable / Payable Account
 		["_Test Receivable", "Current Assets", 0, "Receivable", None],
diff --git a/erpnext/accounts/doctype/asset/__init__.py b/erpnext/accounts/doctype/asset/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/asset/__init__.py
diff --git a/erpnext/accounts/doctype/asset/asset.js b/erpnext/accounts/doctype/asset/asset.js
new file mode 100644
index 0000000..0b28a36
--- /dev/null
+++ b/erpnext/accounts/doctype/asset/asset.js
@@ -0,0 +1,60 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.provide("erpnext.asset");
+
+frappe.ui.form.on('Asset', {
+	onload: function(frm) {
+		frm.set_query("item_code", function() {
+			return {
+				"filters": {
+					"is_stock_item": 0,
+					"is_fixed_asset": 1,
+					"disabled": 0
+				}
+			};
+		});
+	},
+	
+	refresh: function(frm) {
+		if (frm.doc.docstatus==1) {
+			if (in_list(["Submittted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
+				cur_frm.add_custom_button("Scrap Asset", function() {
+					erpnext.asset.scrap_asset(frm);
+				});
+			} else if (frm.doc.status=='Scrapped') {
+				cur_frm.add_custom_button("Restore Asset", function() {
+					erpnext.asset.restore_asset(frm);
+				});
+			}
+		}
+	}
+});
+
+erpnext.asset.scrap_asset = function(frm) {
+	frappe.confirm(__("Do you really want to scrap this asset?"), function () {
+		frappe.call({
+			args: {
+				"asset_name": frm.doc.name
+			},
+			method: "erpnext.accounts.doctype.asset.depreciation.scrap_asset",
+			callback: function(r) {
+				cur_frm.reload_doc();
+			}
+		})
+	})
+}
+
+erpnext.asset.restore_asset = function(frm) {
+	frappe.confirm(__("Do you really want to restore this scrapped asset?"), function () {
+		frappe.call({
+			args: {
+				"asset_name": frm.doc.name
+			},
+			method: "erpnext.accounts.doctype.asset.depreciation.restore_asset",
+			callback: function(r) {
+				cur_frm.reload_doc();
+			}
+		})
+	})
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset/asset.json b/erpnext/accounts/doctype/asset/asset.json
new file mode 100644
index 0000000..6c9a0df
--- /dev/null
+++ b/erpnext/accounts/doctype/asset/asset.json
@@ -0,0 +1,619 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:asset_name", 
+ "creation": "2016-03-01 17:01:27.920130", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "asset_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Asset Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "asset_category", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Asset Category", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Asset Category", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "item_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Item", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Draft", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Draft\nSubmitted\nPartially Depreciated\nFully Depreciated\nSold\nScrapped", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "purchase_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Purchase Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "supplier", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Supplier", 
+   "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": 0, 
+   "fieldname": "purchase_invoice", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Purchase Invoice", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Purchase Invoice", 
+   "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, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "journal_entry_for_scrap", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Journal Entry for Scrap", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Journal Entry", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "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, 
+   "fieldname": "section_break_5", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "default": "", 
+   "depends_on": "", 
+   "fieldname": "depreciation_method", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Depreciation Method", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nStraight Line\nDouble Declining Balance", 
+   "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": 0, 
+   "fieldname": "number_of_depreciations", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Number of Depreciations", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "number_of_months_in_a_period", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Number of Months in a Period", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "", 
+   "fieldname": "next_depreciation_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Next Depreciation Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0, 
+   "fieldname": "column_break_11", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "gross_purchase_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Gross Purchase Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "expected_value_after_useful_life", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Expected Value After Useful Life", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "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": 0, 
+   "fieldname": "current_value", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Current Value (After Depreciation)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "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": 0, 
+   "fieldname": "section_break_14", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Depreciation Schedule", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "schedules", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Depreciation Schedules", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Depreciation Schedule", 
+   "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, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Asset", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-03-28 15:57:21.022765", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Asset", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }
+ ], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py
new file mode 100644
index 0000000..d6547a6
--- /dev/null
+++ b/erpnext/accounts/doctype/asset/asset.py
@@ -0,0 +1,129 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.utils import flt, add_months, cint
+from frappe.model.document import Document
+
+class Asset(Document):
+	def validate(self):
+		self.set_status()
+		self.validate_fixed_asset_item()
+		self.validate_asset_values()
+		self.set_depreciation_settings()
+		self.make_depreciation_schedule()
+		self.validate_depreciation_settings_in_company()
+		
+	def on_submit(self):
+		self.set_status()
+		
+	def on_cancel(self):
+		self.validate_cancellation()
+		self.delete_depreciation_entries()
+		self.set_status()
+		
+	def validate_fixed_asset_item(self):
+		item = frappe.get_doc("Item", self.item_code)
+		if item.disabled:
+			frappe.throw(_("Item {0} has been disabled").format(self.item_code))
+		if item.is_stock_item:
+			frappe.throw(_("Item {0} must be a non-stock item").format(self.item_code))
+			
+	def validate_asset_values(self):
+		if flt(self.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
+			frappe.throw(_("Expected Value After Useful Life must be less than Gross Purchase Amount"))
+			
+		if not flt(self.gross_purchase_amount):
+			frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
+			
+		if not self.current_value and self.next_depreciation_date:
+			self.current_value = flt(self.gross_purchase_amount)
+		else:
+			if flt(self.current_value) > flt(self.gross_purchase_amount):
+				frappe.throw(_("Current Value After Depreciation must be less than equal to {0}")
+					.format(flt(self.gross_purchase_amount)))
+							
+	def set_depreciation_settings(self):
+		asset_category = frappe.get_doc("Asset Category", self.asset_category)
+		
+		for field in ("depreciation_method", "number_of_depreciations", "number_of_months_in_a_period"):
+			if not self.get(field):
+				self.set(field, asset_category.get(field))
+				
+	def make_depreciation_schedule(self):
+		self.schedules = []
+		if not self.get("schedules") and self.next_depreciation_date:
+			accumulated_depreciation = 0
+			value_after_depreciation = flt(self.current_value)
+			for n in xrange(self.number_of_depreciations):
+				schedule_date = add_months(self.next_depreciation_date, 
+					n * cint(self.number_of_months_in_a_period))
+					
+				depreciation_amount = self.get_depreciation_amount(value_after_depreciation)
+				
+				self.append("schedules", {
+					"schedule_date": schedule_date,
+					"depreciation_amount": depreciation_amount,
+					"accumulated_depreciation_amount": accumulated_depreciation + depreciation_amount
+				})
+				accumulated_depreciation += flt(depreciation_amount)
+				value_after_depreciation -= flt(depreciation_amount)
+									
+	def get_depreciation_amount(self, depreciable_value):
+		if self.depreciation_method == "Straight Line":
+			depreciation_amount = (flt(self.current_value) - 
+				flt(self.expected_value_after_useful_life)) / cint(self.number_of_depreciations)
+		else:
+			factor = 200.0 /  cint(self.number_of_depreciations)
+			depreciation_amount = flt(depreciable_value * factor / 100, 0)
+
+			value_after_depreciation = flt(depreciable_value) - depreciation_amount
+			if value_after_depreciation < flt(self.expected_value_after_useful_life):
+				depreciation_amount = flt(depreciable_value) - flt(self.expected_value_after_useful_life)
+
+		return depreciation_amount
+		
+	def validate_cancellation(self):
+		if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"):
+			frappe.throw(_("Asset cannot be cancelled, as it is already {0}").format(self.status))
+				
+		if self.purchase_invoice:
+			frappe.throw(_("Please cancel Purchase Invoice {0} first").format(self.purchase_invoice))
+		
+	def delete_depreciation_entries(self):
+		total_depreciation_amount = 0
+		for d in self.get("schedules"):
+			if d.journal_entry:
+				frappe.get_doc("Journal Entry", d.journal_entry).cancel()
+			
+				d.db_set("journal_entry", None)
+				total_depreciation_amount += flt(d.depreciation_amount)
+		self.db_set("current_value", (self.current_value + total_depreciation_amount))
+		
+	def validate_depreciation_settings_in_company(self):
+		company = frappe.get_doc("Company", self.company)
+		for field in ("accumulated_depreciation_account", "depreciation_expense_account", 
+			"disposal_account", "depreciation_cost_center"):
+				if not company.get(field):
+					frappe.throw(_("Please set {0} in Company {1}")
+						.format(company.meta.get_label(field), self.company))
+	
+	def set_status(self, status=None):
+		if not status:
+			if self.docstatus == 0:
+				status = "Draft"
+			elif self.docstatus == 1:
+				status = "Submitted"
+				if self.journal_entry_for_scrap:
+					status = "Scrapped"
+				elif flt(self.current_value) <= flt(self.expected_value_after_useful_life):
+					status = "Fully Depreciated"
+				elif flt(self.current_value) < flt(self.gross_purchase_amount):
+					status = 'Partially Depreciated'
+			elif self.docstatus == 2:
+				status = "Cancelled"
+
+		self.db_set("status", status)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset/depreciation.py b/erpnext/accounts/doctype/asset/depreciation.py
new file mode 100644
index 0000000..993489c
--- /dev/null
+++ b/erpnext/accounts/doctype/asset/depreciation.py
@@ -0,0 +1,168 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.utils import flt, today, getdate
+
+def post_depreciation_entries(date=None):
+	if not date:
+		date = today()
+	for asset in get_depreciable_assets(date):
+		make_depreciation_entry(asset, date)
+		frappe.db.commit()
+	
+def get_depreciable_assets(date):
+	return frappe.db.sql_list("""select a.name
+		from tabAsset a, `tabDepreciation Schedule` ds
+		where a.name = ds.parent and a.docstatus=1 and ds.schedule_date<=%s 
+			and a.status in ('Submitted', 'Partially Depreciated') 
+			and ifnull(ds.journal_entry, '')=''""", date)
+
+def make_depreciation_entry(asset_name, date=None):
+	if not date:
+		date = today()
+	
+	asset = frappe.get_doc("Asset", asset_name)
+	fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
+		get_depreciation_accounts(asset)
+		
+	depreciation_cost_center = frappe.db.get_value("Company", asset.company, "depreciation_cost_center")
+	
+	for d in asset.get("schedules"):
+		if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
+			je = frappe.new_doc("Journal Entry")
+			je.voucher_type = "Depreciation Entry"
+			je.posting_date = d.schedule_date
+			je.company = asset.company
+			je.remark = "Depreciation Entry against {0} worth {1}".format(asset_name, d.depreciation_amount)
+			
+			je.append("accounts", {
+				"account": accumulated_depreciation_account,
+				"credit_in_account_currency": d.depreciation_amount,
+				"reference_type": "Asset",
+				"reference_name": asset.name
+			})
+	
+			je.append("accounts", {
+				"account": depreciation_expense_account,
+				"debit_in_account_currency": d.depreciation_amount,
+				"reference_type": "Asset",
+				"reference_name": asset.name,
+				"cost_center": depreciation_cost_center
+			})
+			
+			je.flags.ignore_permissions = True
+			je.submit()
+	
+			d.db_set("journal_entry", je.name)
+			asset.current_value -= d.depreciation_amount
+			
+		asset.db_set("current_value", asset.current_value)
+		asset.set_status()
+	
+def get_depreciation_accounts(asset):
+	accounts = frappe.db.sql("""select fixed_asset_account, accumulated_depreciation_account, 
+			depreciation_expense_account from `tabAsset Category Account`
+			where parent=%s and company=%s""", (asset.asset_category, asset.company), as_dict=1)[0]
+	
+	fixed_asset_account = accounts.fixed_asset_account
+	accumulated_depreciation_account = accounts.accumulated_depreciation_account
+	depreciation_expense_account = accounts.depreciation_expense_account
+	
+	if not accumulated_depreciation_account or not depreciation_expense_account:
+		accounts = frappe.db.get_value("Company", asset.company, 
+			["accumulated_depreciation_account", "depreciation_expense_account"])
+		
+		if not accumulated_depreciation_account:
+			accumulated_depreciation_account = accounts[0]
+		if not depreciation_expense_account:
+			depreciation_expense_account = accounts[1]
+			
+	if not fixed_asset_account or not accumulated_depreciation_account or not depreciation_expense_account:
+		frappe.throw(_("Please set Depreciation related Accounts in Asset Category {0} or Company {1}")
+			.format(asset.asset_category, asset.company))
+			
+	return fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account
+	
+@frappe.whitelist()
+def scrap_asset(asset_name):
+	asset = frappe.get_doc("Asset", asset_name)
+	
+	if asset.docstatus != 1:
+		frappe.throw(_("Asset {0} must be submitted").format(asset.name))
+	elif asset.status in ("Cancelled", "Sold", "Scrapped"):
+		frappe.throw(_("Asset {0} cannot be scrapped, as it is already {1}").format(asset.name, asset.status))
+
+	je = frappe.new_doc("Journal Entry")
+	je.voucher_type = "Journal Entry"
+	je.posting_date = today()
+	je.company = asset.company
+	je.remark = "Scrap Entry for asset {0}".format(asset_name)
+	
+	for entry in get_gl_entries_on_asset_disposal(asset):
+		entry.update({
+			"reference_type": "Asset",
+			"reference_name": asset_name
+		})
+		je.append("accounts", entry)
+	
+	je.flags.ignore_permissions = True
+	je.submit()
+	
+	frappe.db.set_value("Asset", asset_name, "journal_entry_for_scrap", je.name)
+	asset.set_status("Scrapped")
+	
+@frappe.whitelist()
+def restore_asset(asset_name):
+	asset = frappe.get_doc("Asset", asset_name)
+	
+	je = asset.journal_entry_for_scrap
+	asset.db_set("journal_entry_for_scrap", None)
+	frappe.get_doc("Journal Entry", je).cancel()
+	
+	asset.set_status()
+		
+@frappe.whitelist()
+def get_gl_entries_on_asset_disposal(asset, selling_amount=0):
+	fixed_asset_account, accumulated_depr_account, depr_expense_account = get_depreciation_accounts(asset)
+	disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(asset.company)
+	accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.current_value)
+	
+	gl_entries = [
+		{
+			"account": fixed_asset_account,
+			"credit_in_account_currency": asset.gross_purchase_amount,
+			"credit": asset.gross_purchase_amount
+		}, 
+		{
+			"account": accumulated_depr_account,
+			"debit_in_account_currency": accumulated_depr_amount,
+			"debit": accumulated_depr_amount
+		}
+	]
+	
+	profit_amount = flt(selling_amount) - flt(asset.current_value)
+	if flt(asset.current_value) and profit_amount:
+		debit_or_credit = "debit" if profit_amount < 0 else "credit"
+		gl_entries.append({
+			"account": disposal_account,
+			"cost_center": depreciation_cost_center,
+			debit_or_credit: abs(profit_amount),
+			debit_or_credit + "_in_account_currency": abs(profit_amount)
+		})
+	
+	return gl_entries
+	
+def get_disposal_account_and_cost_center(company):
+	disposal_account, depreciation_cost_center = frappe.db.get_value("Company", company, 
+		["disposal_account", "depreciation_cost_center"])
+		
+	if not disposal_account:
+		frappe.throw(_("Please set 'Asset Disposal Account' in Company {0}").format(company))
+	if not depreciation_cost_center:
+		frappe.throw(_("Please set 'Asset Depreciation Cost Center' in Company {0}").format(company))
+		
+	return disposal_account, depreciation_cost_center
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset/test_asset.py b/erpnext/accounts/doctype/asset/test_asset.py
new file mode 100644
index 0000000..9902034
--- /dev/null
+++ b/erpnext/accounts/doctype/asset/test_asset.py
@@ -0,0 +1,204 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+from frappe.utils import cstr
+from erpnext.accounts.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+
+class TestAsset(unittest.TestCase):
+	def setUp(self):
+		set_depreciation_settings_in_company()
+		create_asset()
+		
+	def test_fixed_asset_must_be_non_stock_item(self):
+		item = frappe.get_doc("Item", "Macbook Pro")
+		item.is_stock_item = 1
+		self.assertRaises(frappe.ValidationError, item.save)
+	
+	def test_schedule_for_straight_line_method(self):
+		asset = frappe.get_doc("Asset", "Macbook Pro 1")
+		
+		self.assertEqual(asset.status, "Draft")
+		
+		expected_schedules = [
+			["2015-12-31", 30000, 30000],
+			["2016-03-31", 30000, 60000],
+			["2016-06-30", 30000, 90000]
+		]
+		
+		schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount] 
+			for d in asset.get("schedules")]
+		
+		self.assertEqual(schedules, expected_schedules)
+		
+		
+	def test_schedule_for_double_declining_method(self):
+		asset = frappe.get_doc("Asset", "Macbook Pro 1")
+		asset.depreciation_method = "Double Declining Balance"
+		asset.save()
+		
+		expected_schedules = [
+			["2015-12-31", 66667, 66667],
+			["2016-03-31", 22222, 88889],
+			["2016-06-30", 1111, 90000]
+		]
+		
+		schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount] 
+			for d in asset.get("schedules")]
+		
+		self.assertEqual(schedules, expected_schedules)
+		
+	def test_depreciation(self):
+		asset = frappe.get_doc("Asset", "Macbook Pro 1")
+		asset.submit()
+		asset.load_from_db()
+		self.assertEqual(asset.status, "Submitted")
+		
+		post_depreciation_entries(date="2016-01-01")
+		asset.load_from_db()
+		
+		self.assertEqual(asset.status, "Partially Depreciated")
+		
+		expected_gle = (
+			("_Test Accumulated Depreciations - _TC", 0.0, 30000.0),
+			("_Test Depreciations - _TC", 30000.0, 0.0)
+		)
+		
+		gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry` 
+			where against_voucher_type='Asset' and against_voucher = %s
+			order by account""", asset.name)
+			
+		self.assertEqual(gle, expected_gle)
+		self.assertEqual(asset.get("current_value"), 70000)
+		
+		
+	def test_scrap_asset(self):
+		asset = frappe.get_doc("Asset", "Macbook Pro 1")
+		asset.submit()
+		post_depreciation_entries(date="2016-01-01")
+		
+		scrap_asset("Macbook Pro 1")
+		
+		asset.load_from_db()
+		self.assertEqual(asset.status, "Scrapped")
+		self.assertTrue(asset.journal_entry_for_scrap)
+		
+		expected_gle = (
+			("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
+			("_Test Fixed Asset - _TC", 0.0, 100000.0),
+			("_Test Gain/Loss on Asset Disposal - _TC", 70000.0, 0.0)
+		)
+		
+		gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry` 
+			where voucher_type='Journal Entry' and voucher_no = %s
+			order by account""", asset.journal_entry_for_scrap)
+		
+		self.assertEqual(gle, expected_gle)
+		
+		restore_asset("Macbook Pro 1")
+		
+		asset.load_from_db()
+		self.assertFalse(asset.journal_entry_for_scrap)
+		self.assertEqual(asset.status, "Partially Depreciated")
+		
+	def test_asset_sale(self):
+		frappe.get_doc("Asset", "Macbook Pro 1").submit()
+		post_depreciation_entries(date="2016-01-01")
+		
+		si = create_sales_invoice(item_code="Macbook Pro", rate=25000, do_not_save=True)
+		si.get("items")[0].asset = "Macbook Pro 1"
+		si.submit()
+		
+		self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Sold")
+		
+		expected_gle = (
+			("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
+			("_Test Fixed Asset - _TC", 0.0, 100000.0),
+			("_Test Gain/Loss on Asset Disposal - _TC", 45000.0, 0.0),
+			("Debtors - _TC", 25000.0, 0.0)
+		)
+		
+		gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry` 
+			where voucher_type='Sales Invoice' and voucher_no = %s
+			order by account""", si.name)
+		
+		self.assertEqual(gle, expected_gle)
+		
+		si.cancel()
+		
+		self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Partially Depreciated")
+		
+	def tearDown(self):
+		asset = frappe.get_doc("Asset", "Macbook Pro 1")
+		
+		if asset.docstatus == 1 and asset.status not in ("Scrapped", "Sold", "Draft", "Cancelled"):
+			asset.cancel()
+			
+			self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Cancelled")
+		
+		frappe.delete_doc("Asset", "Macbook Pro 1")
+
+def create_asset():
+	if not frappe.db.exists("Asset Category", "Computers"):
+		create_asset_category()
+	
+	if not frappe.db.exists("Item", "Macbook Pro"):
+		create_fixed_asset_item()
+	
+	asset = frappe.get_doc({
+		"doctype": "Asset",
+		"asset_name": "Macbook Pro 1",
+		"asset_category": "Computers",
+		"item_code": "Macbook Pro",
+		"company": "_Test Company",
+		"purchase_date": "2015-01-01",
+		"next_depreciation_date": "2015-12-31",
+		"gross_purchase_amount": 100000,
+		"expected_value_after_useful_life": 10000
+	})
+	try:
+		asset.save()
+	except frappe.DuplicateEntryError:
+		pass
+	
+	return asset
+	
+def create_asset_category():
+	asset_category = frappe.new_doc("Asset Category")
+	asset_category.asset_category_name = "Computers"
+	asset_category.number_of_depreciations = 3
+	asset_category.number_of_months_in_a_period = 3
+	asset_category.append("accounts", {
+		"company": "_Test Company",
+		"fixed_asset_account": "_Test Fixed Asset - _TC",
+		"accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC",
+		"depreciation_expense_account": "_Test Depreciations - _TC"
+	})
+	asset_category.insert()
+	
+def create_fixed_asset_item():
+	try:
+		frappe.get_doc({
+			"doctype": "Item",
+			"item_code": "Macbook Pro",
+			"item_name": "Macbook Pro",
+			"description": "Macbook Pro Retina Display",
+			"item_group": "All Item Groups",
+			"stock_uom": "Nos",
+			"is_fixed_asset": 1,
+			"is_stock_item": 0
+		}).insert()
+	except frappe.DuplicateEntryError:
+		pass
+	
+def set_depreciation_settings_in_company():
+	company = frappe.get_doc("Company", "_Test Company")
+	company.accumulated_depreciation_account = "_Test Accumulated Depreciations - _TC"
+	company.depreciation_expense_account = "_Test Depreciations - _TC"
+	company.disposal_account = "_Test Gain/Loss on Asset Disposal - _TC"
+	company.depreciation_cost_center = "_Test Cost Center - _TC"
+	company.save()
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset_category/__init__.py b/erpnext/accounts/doctype/asset_category/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category/__init__.py
diff --git a/erpnext/accounts/doctype/asset_category/asset_category.js b/erpnext/accounts/doctype/asset_category/asset_category.js
new file mode 100644
index 0000000..862a202
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category/asset_category.js
@@ -0,0 +1,36 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+cur_frm.fields_dict['accounts'].grid.get_field('fixed_asset_account').get_query = function(doc, cdt, cdn) {
+	var d  = locals[cdt][cdn];
+	return {
+		"filters": {
+			"account_type": "Fixed Asset",
+			"root_type": "Asset",
+			"is_group": 0,
+			"company": d.company
+		}
+	};
+}
+
+cur_frm.fields_dict['accounts'].grid.get_field('accumulated_depreciation_account').get_query = function(doc, cdt, cdn) {
+	var d  = locals[cdt][cdn];
+	return {
+		"filters": {
+			"root_type": "Asset",
+			"is_group": 0,
+			"company": d.company
+		}
+	};
+}
+
+cur_frm.fields_dict['accounts'].grid.get_field('depreciation_expense_account').get_query = function(doc, cdt, cdn) {
+	var d  = locals[cdt][cdn];
+	return {
+		"filters": {
+			"root_type": "Expense",
+			"is_group": 0,
+			"company": d.company
+		}
+	};
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset_category/asset_category.json b/erpnext/accounts/doctype/asset_category/asset_category.json
new file mode 100644
index 0000000..bad635f
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category/asset_category.json
@@ -0,0 +1,232 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "field:asset_category_name", 
+ "creation": "2016-03-01 17:41:39.778765", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "asset_category_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Asset Category Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Straight Line", 
+   "fieldname": "depreciation_method", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Depreciation Method", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nStraight Line\nDouble Declining Balance", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "number_of_depreciations", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Number of Depreciations", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "number_of_months_in_a_period", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Number of Months in a Period", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break_2", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Accounts", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "accounts", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Accounts", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Asset Category 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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-03-28 12:45:42.131821", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Asset Category", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset_category/asset_category.py b/erpnext/accounts/doctype/asset_category/asset_category.py
new file mode 100644
index 0000000..7acd883
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category/asset_category.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.model.document import Document
+
+class AssetCategory(Document):
+	def validate(self):
+		for field in ("depreciation_method", "number_of_depreciations", 
+				"number_of_months_in_a_period", "accounts"):
+			if not self.get(field):
+				frappe.throw(_("{0} is mandatory").format(self.meta.get_label(field)), frappe.MandatoryError)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset_category/test_asset_category.py b/erpnext/accounts/doctype/asset_category/test_asset_category.py
new file mode 100644
index 0000000..d119066
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category/test_asset_category.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+class TestAssetCategory(unittest.TestCase):
+	def test_mandatory_fields(self):
+		asset_category = frappe.new_doc("Asset Category")
+		asset_category.asset_category_name = "Computers"
+		
+		self.assertRaises(frappe.MandatoryError, asset_category.insert)
+		
+		asset_category.number_of_depreciations = 5
+		asset_category.number_of_months_in_a_period = 12
+		asset_category.append("accounts", {
+			"company": "_Test Company",
+			"fixed_asset_account": "_Test Fixed Asset - _TC",
+			"accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC",
+			"depreciation_expense_account": "_Test Depreciations - _TC"
+		})
+		
+		try:
+			asset_category.insert()
+		except frappe.DuplicateEntryError:
+			pass
+			
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset_category_account/__init__.py b/erpnext/accounts/doctype/asset_category_account/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category_account/__init__.py
diff --git a/erpnext/accounts/doctype/asset_category_account/asset_category_account.json b/erpnext/accounts/doctype/asset_category_account/asset_category_account.json
new file mode 100644
index 0000000..5144e85
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category_account/asset_category_account.json
@@ -0,0 +1,136 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2016-03-07 15:55:18.806409", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "fixed_asset_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Fixed Asset 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": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "accumulated_depreciation_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Accumulated Depreciation 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": 0, 
+   "fieldname": "depreciation_expense_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Depreciation Expense 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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-03-07 19:02:09.879979", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Asset Category Account", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/asset_category_account/asset_category_account.py b/erpnext/accounts/doctype/asset_category_account/asset_category_account.py
new file mode 100644
index 0000000..67925f4
--- /dev/null
+++ b/erpnext/accounts/doctype/asset_category_account/asset_category_account.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class AssetCategoryAccount(Document):
+	pass
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index c14990a..2dcf958 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -18,17 +18,17 @@
 					`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
 
 				if inv and inv[0][0] != 'Yes':
-					frappe.throw("C-form is not applicable for Invoice: {0}".format(d.invoice_no))
+					frappe.throw(_("C-form is not applicable for Invoice: {0}".format(d.invoice_no)))
 
 				elif inv and inv[0][1] and inv[0][1] != self.name:
-					frappe.throw("""Invoice {0} is tagged in another C-form: {1}.
+					frappe.throw(_("""Invoice {0} is tagged in another C-form: {1}.
 						If you want to change C-form no for this invoice,
 						please remove invoice no from the previous c-form and then try again"""\
-						.format(d.invoice_no, inv[0][1]))
+						.format(d.invoice_no, inv[0][1])))
 
 				elif not inv:
-					frappe.throw("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
-						Please enter a valid Invoice".format(d.idx, d.invoice_no))
+					frappe.throw(_("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
+						Please enter a valid Invoice".format(d.idx, d.invoice_no)))
 
 	def on_update(self):
 		"""	Update C-Form No on invoices"""
diff --git a/erpnext/accounts/doctype/depreciation_schedule/__init__.py b/erpnext/accounts/doctype/depreciation_schedule/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/depreciation_schedule/__init__.py
diff --git a/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json b/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json
new file mode 100644
index 0000000..50fba88
--- /dev/null
+++ b/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.json
@@ -0,0 +1,160 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 1, 
+ "autoname": "", 
+ "creation": "2016-03-02 15:11:01.278862", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "schedule_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Schedule Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "depreciation_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Depreciation Amount", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "accumulated_depreciation_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Accumulated Depreciation Amount", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "journal_entry", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Journal Entry", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Journal Entry", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-03-09 12:21:27.938215", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Depreciation Schedule", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.py b/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.py
new file mode 100644
index 0000000..957d6d1
--- /dev/null
+++ b/erpnext/accounts/doctype/depreciation_schedule/depreciation_schedule.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class DepreciationSchedule(Document):
+	pass
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 906c131..dd8d51e 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -41,7 +41,7 @@
 		mandatory = ['account','remarks','voucher_type','voucher_no','company']
 		for k in mandatory:
 			if not self.get(k):
-				frappe.throw(_("{0} is required").format(self.meta.get_label(k)))
+				frappe.throw(_("{0} is required").format(_(self.meta.get_label(k))))
 
 		account_type = frappe.db.get_value("Account", self.account, "account_type")
 		if account_type in ["Receivable", "Payable"] and not (self.party_type and self.party):
@@ -88,8 +88,8 @@
 					"Cost Center", self.cost_center, "company")
 
 			return self.cost_center_company[self.cost_center]
-
-		if self.cost_center and _get_cost_center_company() != self.company:
+		
+		if self.cost_center and _get_cost_center_company() != self.company:	
 			frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
 
 	def validate_party(self):
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json
index 63ba380..4361819 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.json
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json
@@ -1,1207 +1,1209 @@
 {
- "allow_copy": 0,
- "allow_import": 1,
- "allow_rename": 0,
- "autoname": "naming_series:",
- "creation": "2013-03-25 10:53:52",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "autoname": "naming_series:", 
+ "creation": "2013-03-25 10:53:52", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
  "fields": [
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "entry_type_and_date",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "",
-   "length": 0,
-   "no_copy": 0,
-   "options": "icon-flag",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "entry_type_and_date", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "icon-flag", 
+   "permlevel": 0, 
+   "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": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "default": "",
-   "fieldname": "title",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Title",
-   "length": 0,
-   "no_copy": 1,
-   "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,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "", 
+   "fieldname": "title", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Title", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0,
-   "default": "Journal Entry",
-   "fieldname": "voucher_type",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Entry Type",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "voucher_type",
-   "oldfieldtype": "Select",
-   "options": "Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Journal Entry", 
+   "fieldname": "voucher_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Entry Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "voucher_type", 
+   "oldfieldtype": "Select", 
+   "options": "Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry\nDepreciation Entry", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "naming_series",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Series",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "naming_series",
-   "oldfieldtype": "Select",
-   "options": "JV-",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Series", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "naming_series", 
+   "oldfieldtype": "Select", 
+   "options": "JV-", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break1",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "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": 0, 
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "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, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "posting_date",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Posting Date",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "posting_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "posting_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Posting Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "posting_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "company",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Company",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "company",
-   "oldfieldtype": "Link",
-   "options": "Company",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 1,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "company", 
+   "oldfieldtype": "Link", 
+   "options": "Company", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "2_add_edit_gl_entries",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "icon-table",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "2_add_edit_gl_entries", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-table", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "accounts",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Accounting Entries",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "entries",
-   "oldfieldtype": "Table",
-   "options": "Journal Entry Account",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "accounts", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Accounting Entries", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "entries", 
+   "oldfieldtype": "Table", 
+   "options": "Journal Entry Account", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "section_break99",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break99", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "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": 0,
-   "description": "",
-   "fieldname": "cheque_no",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Reference Number",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "cheque_no",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "cheque_no", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Reference Number", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "cheque_no", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "cheque_date",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Reference Date",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "cheque_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "cheque_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Reference Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "cheque_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "user_remark",
-   "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "User Remark",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "user_remark",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "user_remark", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "User Remark", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "user_remark", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "column_break99",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break99", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "total_debit",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Total Debit",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "total_debit",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "total_debit", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Total Debit", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "total_debit", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "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,
-   "fieldname": "total_credit",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Total Credit",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "total_credit",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "total_credit", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Total Credit", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "total_credit", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "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,
-   "depends_on": "difference",
-   "fieldname": "difference",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Difference (Dr - Cr)",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "difference",
-   "oldfieldtype": "Currency",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "difference", 
+   "fieldname": "difference", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Difference (Dr - Cr)", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "difference", 
+   "oldfieldtype": "Currency", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "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,
-   "depends_on": "difference",
-   "fieldname": "get_balance",
-   "fieldtype": "Button",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Make Difference Entry",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Button",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "difference", 
+   "fieldname": "get_balance", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Make Difference Entry", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Button", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "multi_currency",
-   "fieldtype": "Check",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Multi Currency",
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "precision": "",
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "multi_currency", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Multi Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "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,
-   "fieldname": "total_amount",
-   "fieldtype": "Currency",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Total Amount",
-   "length": 0,
-   "no_copy": 1,
-   "options": "",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "total_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Total Amount", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "total_amount_in_words",
-   "fieldtype": "Data",
-   "hidden": 1,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Total Amount in Words",
-   "length": 0,
-   "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "total_amount_in_words", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Total Amount in Words", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "fieldname": "reference",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Reference",
-   "length": 0,
-   "no_copy": 0,
-   "options": "icon-pushpin",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "reference", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Reference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "icon-pushpin", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "clearance_date",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Clearance Date",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "clearance_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "clearance_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Clearance Date", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "clearance_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "",
-   "fieldname": "remark",
-   "fieldtype": "Small Text",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Remark",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "remark",
-   "oldfieldtype": "Small Text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "remark", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Remark", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "remark", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "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,
-   "fieldname": "column_break98",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break98", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "bill_no",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Bill No",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "bill_no",
-   "oldfieldtype": "Data",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "bill_no", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Bill No", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "bill_no", 
+   "oldfieldtype": "Data", 
+   "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,
-   "fieldname": "bill_date",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Bill Date",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "bill_date",
-   "oldfieldtype": "Date",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "bill_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Bill Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "bill_date", 
+   "oldfieldtype": "Date", 
+   "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,
-   "fieldname": "due_date",
-   "fieldtype": "Date",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Due Date",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "due_date",
-   "oldfieldtype": "Date",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "due_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Due Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "due_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "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,
-   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
-   "fieldname": "write_off",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Write Off",
-   "length": 0,
-   "no_copy": 0,
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'", 
+   "fieldname": "write_off", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Write Off", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0,
-   "default": "Accounts Receivable",
-   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
-   "fieldname": "write_off_based_on",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Write Off Based On",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Accounts Receivable\nAccounts Payable",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Accounts Receivable", 
+   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'", 
+   "fieldname": "write_off_based_on", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Write Off Based On", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Accounts Receivable\nAccounts Payable", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
-   "fieldname": "get_outstanding_invoices",
-   "fieldtype": "Button",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Get Outstanding Invoices",
-   "length": 0,
-   "no_copy": 0,
-   "options": "get_outstanding_invoices",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'", 
+   "fieldname": "get_outstanding_invoices", 
+   "fieldtype": "Button", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Get Outstanding Invoices", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "get_outstanding_invoices", 
+   "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,
-   "fieldname": "column_break_30",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_30", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0,
-   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
-   "fieldname": "write_off_amount",
-   "fieldtype": "Currency",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Write Off Amount",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "eval:doc.voucher_type == 'Write Off Entry'", 
+   "fieldname": "write_off_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Write Off Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "fieldname": "printing_settings",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Printing Settings",
-   "length": 0,
-   "no_copy": 0,
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "printing_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Printing Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0,
-   "fieldname": "pay_to_recd_from",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Pay To / Recd From",
-   "length": 0,
-   "no_copy": 1,
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "pay_to_recd_from", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Pay To / Recd From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "column_break_35",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_35", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "letter_head",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Letter Head",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Letter Head",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Letter Head", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "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": 1,
-   "bold": 0,
-   "collapsible": 0,
-   "fieldname": "select_print_heading",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Print Heading",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "select_print_heading",
-   "oldfieldtype": "Link",
-   "options": "Print Heading",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 1,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Print Heading", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "select_print_heading", 
+   "oldfieldtype": "Link", 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 1,
-   "fieldname": "addtional_info",
-   "fieldtype": "Section Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "More Information",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Section Break",
-   "options": "icon-file-text",
-   "permlevel": 0,
-   "print_hide": 0,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "addtional_info", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "More Information", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-file-text", 
+   "permlevel": 0, 
+   "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": 0,
-   "fieldname": "column_break3",
-   "fieldtype": "Column Break",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldtype": "Column Break",
-   "permlevel": 0,
-   "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": 0, 
+   "fieldname": "column_break3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "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, 
    "width": "50%"
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "default": "No",
-   "description": "",
-   "fieldname": "is_opening",
-   "fieldtype": "Select",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 0,
-   "label": "Is Opening",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "is_opening",
-   "oldfieldtype": "Select",
-   "options": "No\nYes",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 0,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 1,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "No", 
+   "description": "", 
+   "fieldname": "is_opening", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Is Opening", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "is_opening", 
+   "oldfieldtype": "Select", 
+   "options": "No\nYes", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
    "unique": 0
-  },
+  }, 
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
-   "fieldname": "stock_entry",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Stock Entry",
-   "length": 0,
-   "no_copy": 0,
-   "options": "Stock Entry",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)", 
+   "fieldname": "stock_entry", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Stock Entry", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Stock Entry", 
+   "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,
-   "fieldname": "amended_from",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 1,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Amended From",
-   "length": 0,
-   "no_copy": 1,
-   "oldfieldname": "amended_from",
-   "oldfieldtype": "Link",
-   "options": "Journal Entry",
-   "permlevel": 0,
-   "print_hide": 1,
-   "print_hide_if_no_value": 0,
-   "read_only": 1,
-   "report_hide": 0,
-   "reqd": 0,
-   "search_index": 0,
-   "set_only_once": 0,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "amended_from", 
+   "oldfieldtype": "Link", 
+   "options": "Journal Entry", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
    "unique": 0
   }
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "icon": "icon-file-text",
- "idx": 1,
- "in_create": 0,
- "in_dialog": 0,
- "is_submittable": 1,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "menu_index": 0,
- "modified": "2016-03-11 01:38:50.944475",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "Journal Entry",
- "owner": "Administrator",
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "icon-file-text", 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "menu_index": 0, 
+ "modified": "2016-03-28 16:26:09.195775", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Journal Entry", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 1,
-   "apply_user_permissions": 0,
-   "cancel": 1,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts User",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 1,
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 1,
-   "apply_user_permissions": 0,
-   "cancel": 1,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 1,
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Auditor",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Auditor", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
   }
- ],
- "read_only": 0,
- "read_only_onload": 1,
- "search_fields": "voucher_type,posting_date, due_date, cheque_no",
- "sort_field": "modified",
- "sort_order": "DESC",
- "title_field": "title"
-}
+ ], 
+ "read_only": 0, 
+ "read_only_onload": 1, 
+ "search_fields": "voucher_type,posting_date, due_date, cheque_no", 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "title_field": "title", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 74b749a..b667c54 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -501,7 +501,7 @@
 
 	def validate_empty_accounts_table(self):
 		if not self.get('accounts'):
-			frappe.throw("Accounts table cannot be blank.")
+			frappe.throw(_("Accounts table cannot be blank."))
 
 	def set_account_and_party_balance(self):
 		account_balance = {}
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index 9277da5..28b57bd 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -16,6 +16,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account", 
@@ -44,6 +45,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Type", 
@@ -68,6 +70,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Balance", 
@@ -96,6 +99,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Cost Center", 
@@ -124,6 +128,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -146,6 +151,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Type", 
@@ -170,6 +176,7 @@
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Party", 
@@ -194,6 +201,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Balance", 
@@ -221,6 +229,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
@@ -245,6 +254,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Currency", 
@@ -270,6 +280,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -293,6 +304,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Exchange Rate", 
@@ -317,6 +329,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount", 
@@ -340,6 +353,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Debit", 
@@ -365,6 +379,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Debit in Company Currency", 
@@ -392,6 +407,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -414,6 +430,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Credit", 
@@ -439,6 +456,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit in Company Currency", 
@@ -466,6 +484,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
@@ -489,12 +508,13 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference Type", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim", 
+   "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -514,6 +534,7 @@
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Reference Name", 
@@ -539,6 +560,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -561,6 +583,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Advance", 
@@ -587,6 +610,7 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Account", 
@@ -614,12 +638,13 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2015-12-02 04:14:37.571883", 
+ "modified": "2016-03-07 19:10:27.135795", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Journal Entry Account", 
  "owner": "Administrator", 
  "permissions": [], 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "sort_order": "DESC"
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
index 854f5b3..70c0397 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
@@ -89,3 +89,8 @@
 cur_frm.cscript.buying = function() {
 	cur_frm.cscript.set_options_for_applicable_for();
 }
+
+//Dynamically change the description based on type of margin
+cur_frm.cscript.type = function(doc){
+	cur_frm.set_df_property('rate', 'description', doc.type=='Percentage'?'In Percentage %':'In Amount')
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
index eb77ae2..23fc76d 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
@@ -17,6 +17,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -40,6 +41,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Title", 
@@ -65,6 +67,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Apply On", 
@@ -90,6 +93,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Code", 
@@ -115,6 +119,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Brand", 
@@ -140,6 +145,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Group", 
@@ -164,6 +170,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -188,6 +195,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Priority", 
@@ -212,6 +220,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Disable", 
@@ -235,6 +244,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -258,6 +268,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Selling", 
@@ -281,6 +292,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Buying", 
@@ -304,6 +316,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -328,6 +341,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Applicable For", 
@@ -353,6 +367,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
@@ -378,6 +393,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
@@ -403,6 +419,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Territory", 
@@ -428,6 +445,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
@@ -453,6 +471,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Campaign", 
@@ -478,6 +497,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
@@ -503,6 +523,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Type", 
@@ -527,6 +548,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -550,6 +572,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Min Qty", 
@@ -573,6 +596,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -596,6 +620,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Max Qty", 
@@ -619,6 +644,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -643,6 +669,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid From", 
@@ -666,6 +693,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Valid Upto", 
@@ -689,6 +717,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -711,6 +740,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
@@ -731,10 +761,115 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "depends_on": "eval: doc.selling == 1", 
+   "fieldname": "margin", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "default": "Percentage", 
+   "fieldname": "margin_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nPercentage\nAmount", 
+   "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": 0, 
+   "fieldname": "column_break_33", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "default": "0", 
+   "depends_on": "eval:doc.margin_type", 
+   "fieldname": "margin_rate_or_amount", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Rate or Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": 0, 
    "fieldname": "price_discount_section", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -759,6 +894,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price or Discount", 
@@ -783,6 +919,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -806,6 +943,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price", 
@@ -830,6 +968,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Discount on Price List Rate (%)", 
@@ -854,6 +993,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "For Price List", 
@@ -878,6 +1018,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -902,6 +1043,7 @@
    "fieldtype": "HTML", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule Help", 
@@ -928,7 +1070,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-01-15 04:05:11.633824", 
+ "modified": "2016-03-16 17:35:25.935271", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Pricing Rule", 
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index cd6bcf4..b4fe148 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -124,7 +124,7 @@
 		"name": args.name,
 		"pricing_rule": None
 	})
-
+	
 	if args.ignore_pricing_rule or not args.item_code:
 		return item_details
 
@@ -155,6 +155,8 @@
 	if pricing_rule:
 		item_details.pricing_rule = pricing_rule.name
 		item_details.pricing_rule_for = pricing_rule.price_or_discount
+		item_details.margin_type = pricing_rule.margin_type
+		item_details.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
 		if pricing_rule.price_or_discount == "Price":
 			item_details.update({
 				"price_list_rate": pricing_rule.price/flt(args.conversion_rate) \
@@ -163,7 +165,6 @@
 			})
 		else:
 			item_details.discount_percentage = pricing_rule.discount_percentage
-
 	return item_details
 
 def get_pricing_rules(args):
@@ -242,6 +243,8 @@
 		for p in pricing_rules:
 			if p.item_code and args.variant_of:
 				p.variant_of = args.variant_of
+			else:
+				p.variant_of = None
 
 	# find pricing rule with highest priority
 	if pricing_rules:
@@ -251,7 +254,7 @@
 
 	# apply internal priority
 	all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory",
-		"supplier", "supplier_type", "campaign", "sales_partner"]
+		"supplier", "supplier_type", "campaign", "sales_partner", "variant_of"]
 
 	if len(pricing_rules) > 1:
 		for field_set in [["item_code", "variant_of", "item_group", "brand"],
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index d8d74bc..814c5c0 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -86,6 +86,54 @@
 
 		frappe.db.sql("delete from `tabPricing Rule`")
 
+	def test_pricing_rule_for_margin(self):
+		from erpnext.stock.get_item_details import get_item_details
+		from frappe import MandatoryError
+
+		frappe.db.sql("delete from `tabPricing Rule`")
+
+		test_record = {
+			"doctype": "Pricing Rule",
+			"title": "_Test Pricing Rule",
+			"apply_on": "Item Code",
+			"item_code": "_Test FG Item 2",
+			"selling": 1,
+			"price_or_discount": "Discount Percentage",
+			"price": 0,
+			"margin_type": "Percentage",
+			"margin_rate_or_amount": 10,
+			"company": "_Test Company"
+		}
+		frappe.get_doc(test_record.copy()).insert()
+		
+		item_price = frappe.get_doc({
+			"doctype": "Item Price",
+			"price_list": "_Test Price List 2",
+			"item_code": "_Test FG Item 2",
+			"price_list_rate": 100
+		})
+		
+		item_price.insert(ignore_permissions=True)
+
+		args = frappe._dict({
+			"item_code": "_Test FG Item 2",
+			"company": "_Test Company",
+			"price_list": "_Test Price List",
+			"currency": "_Test Currency",
+			"doctype": "Sales Order",
+			"conversion_rate": 1,
+			"price_list_currency": "_Test Currency",
+			"plc_conversion_rate": 1,
+			"order_type": "Sales",
+			"customer": "_Test Customer",
+			"name": None
+		})
+		details = get_item_details(args)
+		self.assertEquals(details.get("margin_type"), "Percentage")
+		self.assertEquals(details.get("margin_rate_or_amount"), 10)
+
+		frappe.db.sql("delete from `tabPricing Rule`")
+
 	def test_pricing_rule_for_variants(self):
 		from erpnext.stock.get_item_details import get_item_details
 		from frappe import MandatoryError
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 4d865b8..bcb0503 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -196,7 +196,7 @@
 
 // Get Print Heading
 cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
-return{
+	return {
 		filters:[
 			['Print Heading', 'docstatus', '!=', 2]
 		]
@@ -204,12 +204,24 @@
 }
 
 cur_frm.set_query("expense_account", "items", function(doc) {
-	return{
-		query: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.get_expense_account",
+	return {
+		query: "erpnext.controllers.queries.get_expense_account",
 		filters: {'company': doc.company}
 	}
 });
 
+cur_frm.set_query("asset", "items", function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	return {
+		filters: {
+			'item_code': d.item_code,
+			'docstatus': 1,
+			'company': doc.company,
+			'status': 'Submitted'
+		}
+	}
+});
+
 cur_frm.cscript.expense_account = function(doc, cdt, cdn){
 	var d = locals[cdt][cdn];
 	if(d.idx == 1 && d.expense_account){
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 180831e..2699f44 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -55,14 +55,15 @@
 		self.set_against_expense_account()
 		self.validate_write_off_account()
 		self.update_valuation_rate("items")
-		self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount",
-			"items")
+		self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items")
+		self.validate_fixed_asset_account()
 		self.create_remarks()
 
 	def create_remarks(self):
 		if not self.remarks:
 			if self.bill_no and self.bill_date:
-				self.remarks = _("Against Supplier Invoice {0} dated {1}").format(self.bill_no, formatdate(self.bill_date))
+				self.remarks = _("Against Supplier Invoice {0} dated {1}").format(self.bill_no, 
+					formatdate(self.bill_date))
 			else:
 				self.remarks = _("No Remarks")
 
@@ -152,12 +153,13 @@
 		stock_items = self.get_stock_items()
 		for item in self.get("items"):
 			# in case of auto inventory accounting,
-			# against expense account is always "Stock Received But Not Billed"
-			# for a stock item and if not epening entry and not drop-ship entry
+			# expense account is always "Stock Received But Not Billed" for a stock item 
+			# except epening entry, drop-ship entry and fixed asset items
 
-			if auto_accounting_for_stock and item.item_code in stock_items \
-				and self.is_opening == 'No' and (not item.po_detail or
-					not frappe.db.get_value("Purchase Order Item", item.po_detail, "delivered_by_supplier")):
+			if auto_accounting_for_stock and item.item_code in stock_items and self.is_opening == 'No' \
+				and (not item.po_detail 
+					or not frappe.db.get_value("Purchase Order Item", item.po_detail, "delivered_by_supplier")
+					or not frappe.db.get_value("Item", item.item_code, "is_fixed_asset")):
 
 				item.expense_account = stock_not_billed_account
 				item.cost_center = None
@@ -235,6 +237,7 @@
 
 	def on_submit(self):
 		self.check_prev_docstatus()
+		self.validate_asset()
 
 		frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
 			self.company, self.base_grand_total)
@@ -248,7 +251,34 @@
 			self.update_billing_status_in_pr()
 
 		self.update_project()
-
+		
+	def validate_asset(self):
+		for d in self.get("items"):
+			if frappe.db.get_value("Item", d.item_code, "is_fixed_asset"):
+				if not d.asset:
+					frappe.throw(_("Row #{0}: Asset is mandatory against a Fixed Asset Item").format(d.idx))
+				else:
+					asset = frappe.get_doc("Asset", d.asset)
+					
+					super(PurchaseInvoice, self).validate_asset(asset, d)
+		
+					if getdate(asset.purchase_date) != getdate(self.posting_date):
+						frappe.throw(_("Purchase Date of asset {0} does not match with Purchase Invoice date")
+							.format(d.asset))
+					
+					if asset.supplier and asset.supplier != self.supplier:
+						frappe.throw(_("Supplier of asset {0} does not match with the supplier in the Purchase Invoice").format(d.asset))
+				
+					if asset.status != "Submitted":
+						frappe.throw(_("Row #{0}: Asset {1} is already {2}")
+							.format(d.idx, d.asset, asset.status))
+					
+					frappe.db.set_value("Asset", asset.name, "purchase_invoice", 
+						(self.name if self.docstatus==1 else None))
+						
+					if self.docstatus==1 and not asset.supplier:
+						frappe.db.set_value("Asset", asset.name, "supplier", self.supplier)
+					
 	def make_gl_entries(self):
 		auto_accounting_for_stock = \
 			cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
@@ -415,6 +445,7 @@
 
 		self.make_gl_entries_on_cancel()
 		self.update_project()
+		self.validate_asset()
 
 	def update_project(self):
 		project_list = []
@@ -429,7 +460,7 @@
 	def validate_supplier_invoice(self):
 		if self.bill_date:
 			if getdate(self.bill_date) > getdate(self.posting_date):
-				frappe.throw("Supplier Invoice Date cannot be greater than Posting Date")
+				frappe.throw(_("Supplier Invoice Date cannot be greater than Posting Date"))
 
 		if self.bill_no:
 			if cint(frappe.db.get_single_value("Accounts Settings", "check_supplier_invoice_uniqueness")):
@@ -449,7 +480,7 @@
 
 				if pi:
 					pi = pi[0][0]
-					frappe.throw("Supplier Invoice No exists in Purchase Invoice {0}".format(pi))
+					frappe.throw(_("Supplier Invoice No exists in Purchase Invoice {0}".format(pi)))
 
 	def update_billing_status_in_pr(self, update_modified=True):
 		updated_pr = []
@@ -465,28 +496,18 @@
 
 		for pr in set(updated_pr):
 			frappe.get_doc("Purchase Receipt", pr).update_billing_percentage(update_modified=update_modified)
+			
+	def validate_fixed_asset_account(self):
+		for d in self.get('items'):
+			if frappe.db.get_value("Item", d.item_code, "is_fixed_asset"):
+				account_type = frappe.db.get_value("Account", d.expense_account, "account_type")
+				if account_type != 'Fixed Asset':
+					frappe.throw(_("Row {0}# Account must be of type 'Fixed Asset'").format(d.idx))
 
 	def on_recurring(self, reference_doc):
 		self.due_date = None
 
 @frappe.whitelist()
-def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
-	from erpnext.controllers.queries import get_match_cond
-
-	# expense account can be any Debit account,
-	# but can also be a Liability account with account_type='Expense Account' in special circumstances.
-	# Hence the first condition is an "OR"
-	return frappe.db.sql("""select tabAccount.name from `tabAccount`
-			where (tabAccount.report_type = "Profit and Loss"
-					or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary"))
-				and tabAccount.is_group=0
-				and tabAccount.docstatus!=2
-				and tabAccount.company = %(company)s
-				and tabAccount.{key} LIKE %(txt)s
-				{mcond}""".format( key=frappe.db.escape(searchfield), mcond=get_match_cond(doctype) ),
-				{ 'company': filters['company'], 'txt': "%%%s%%" % frappe.db.escape(txt) })
-
-@frappe.whitelist()
 def make_debit_note(source_name, target_doc=None):
 	from erpnext.controllers.sales_and_purchase_return import make_return_doc
 	return make_return_doc("Purchase Invoice", source_name, target_doc)
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index ae44c1a..784c747 100755
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -1080,6 +1080,32 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "asset", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Asset", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Asset", 
+   "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": 0, 
    "fieldname": "po_detail", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -1239,7 +1265,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-03-18 05:05:27.752823", 
+ "modified": "2016-03-28 05:05:27.752823", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice Item", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 89af721..f6f746a 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -471,3 +471,15 @@
 		}
 	}
 });
+
+cur_frm.set_query("asset", "items", function(doc, cdt, cdn) {
+	var d = locals[cdt][cdn];
+	return {
+		filters: [
+			["Asset", "item_code", "=", d.item_code],
+			["Asset", "docstatus", "=", 1],
+			["Asset", "status", "in", ["Submitted", "Partially Depreciated", "Fully Depreciated"]],
+			["Asset", "company", "=", doc.company]
+		]
+	}
+});
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 2d45abe..9ffe8a9 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -13,6 +13,7 @@
 from erpnext.controllers.selling_controller import SellingController
 from erpnext.accounts.utils import get_account_currency
 from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
+from erpnext.accounts.doctype.asset.depreciation import get_gl_entries_on_asset_disposal
 
 form_grid_templates = {
 	"items": "templates/form_grid/item_grid.html"
@@ -55,11 +56,11 @@
 		self.validate_uom_is_integer("stock_uom", "qty")
 		self.check_close_sales_order("sales_order")
 		self.validate_debit_to_acc()
-		self.validate_fixed_asset_account()
 		self.clear_unallocated_advances("Sales Invoice Advance", "advances")
 		self.validate_advance_jv("Sales Order")
 		self.add_remarks()
 		self.validate_write_off_account()
+		self.set_income_account_for_fixed_assets()
 
 		if cint(self.is_pos):
 			self.validate_pos()
@@ -309,14 +310,6 @@
 
 		self.party_account_currency = account.account_currency
 
-	def validate_fixed_asset_account(self):
-		"""Validate Fixed Asset and whether Income Account Entered Exists"""
-		for d in self.get('items'):
-			is_asset_item = frappe.db.get_value("Item", d.item_code, "is_asset_item")
-			account_type = frappe.db.get_value("Account", d.income_account, "account_type")
-			if is_asset_item == 1 and account_type != 'Fixed Asset':
-				msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(d.income_account, d.item_code), raise_exception=True)
-
 	def validate_with_previous_doc(self):
 		super(SalesInvoice, self).validate_with_previous_doc({
 			"Sales Order": {
@@ -456,6 +449,17 @@
 				msgprint(_("POS Profile required to make POS Entry"), raise_exception=True)
 
 		return warehouse
+		
+	def set_income_account_for_fixed_assets(self):
+		disposal_account = None
+		for d in self.get("items"):
+			if frappe.db.get_value("Item", d.item_code, "is_fixed_asset"):
+				if not disposal_account:
+					disposal_account = frappe.db.get_value("Company", self.company, "disposal_account")
+					if not disposal_account:
+						frappe.throw(_("Please mention 'Gain/Loss Account on Asset Disposal' in Company"))
+				
+				d.income_account = disposal_account
 
 	def on_update(self):
 		if cint(self.is_pos) == 1:
@@ -480,6 +484,13 @@
 
 			if d.delivery_note and frappe.db.get_value("Delivery Note", d.delivery_note, "docstatus") != 1:
 				throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
+				
+	def validate_asset(self, asset, item_row):
+		super(SalesInvoice, self).validate_asset(asset, item_row)
+		
+		if self.docstatus == 1 and asset.status in ("Scrapped", "Cancelled", "Sold"):
+			frappe.throw(_("Row #{0}: Asset {1} cannot be submitted, it is already {2}")
+				.format(item_row.idx, asset.name, asset.status))
 
 	def make_gl_entries(self, repost_future_gle=True):
 		gl_entries = self.get_gl_entries()
@@ -566,17 +577,31 @@
 		# income account gl entries
 		for item in self.get("items"):
 			if flt(item.base_net_amount):
-				account_currency = get_account_currency(item.income_account)
-				gl_entries.append(
-					self.get_gl_dict({
-						"account": item.income_account,
-						"against": self.customer,
-						"credit": item.base_net_amount,
-						"credit_in_account_currency": item.base_net_amount \
-							if account_currency==self.company_currency else item.net_amount,
-						"cost_center": item.cost_center
-					}, account_currency)
-				)
+				if frappe.db.get_value("Item", item.item_code, "is_fixed_asset"):
+					if not item.asset:
+						frappe.throw(_("Row #{0}: Asset is mandatory against a Fixed Asset Item")
+							.format(item.idx))
+					else:
+						asset = frappe.get_doc("Asset", item.asset)
+						self.validate_asset(asset, item)
+					
+						fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount)
+						for gle in fixed_asset_gl_entries:
+							gl_entries.append(self.get_gl_dict(gle))
+						
+						asset.set_status("Sold" if self.docstatus==1 else None)
+				else:
+					account_currency = get_account_currency(item.income_account)
+					gl_entries.append(
+						self.get_gl_dict({
+							"account": item.income_account,
+							"against": self.customer,
+							"credit": item.base_net_amount,
+							"credit_in_account_currency": item.base_net_amount \
+								if account_currency==self.company_currency else item.net_amount,
+							"cost_center": item.cost_center
+						}, account_currency)
+					)
 
 		# expense account gl entries
 		if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index fc8ca63..bac24d8 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -910,6 +910,19 @@
 
 		self.assertRaises(InvalidAccountCurrency, si5.submit)
 
+	def test_create_so_with_margin(self):
+		si = create_sales_invoice(item_code="_Test Item", qty=1, do_not_submit=True)
+		price_list_rate = si.items[0].price_list_rate
+		si.items[0].margin_type = 'Percentage'
+		si.items[0].margin_rate_or_amount = 25
+		si.insert()
+
+		self.assertNotEquals(si.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
+		si.items[0].margin_rate_or_amount = 25
+		si.submit()
+
+		self.assertNotEquals(si.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
+
 def create_sales_invoice(**args):
 	si = frappe.new_doc("Sales Invoice")
 	args = frappe._dict(args)
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 79f5f55..a86d6a8 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -1,1458 +1,1671 @@
 {
- "allow_copy": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "autoname": "hash", 
- "creation": "2013-06-04 11:02:19", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "Document", 
+ "allow_copy": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "hash",
+ "creation": "2013-06-04 11:02:19",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Document",
  "fields": [
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "barcode", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Barcode", 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "barcode",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Barcode",
+   "length": 0,
+   "no_copy": 0,
+   "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": 1, 
-   "collapsible": 0, 
-   "fieldname": "item_code", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Item", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "item_code", 
-   "oldfieldtype": "Link", 
-   "options": "Item", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 1,
+   "collapsible": 0,
+   "fieldname": "item_code",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "Item",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "item_code",
+   "oldfieldtype": "Link",
+   "options": "Item",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "col_break1", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "col_break1",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "item_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Item Name", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "item_name", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "item_name",
+   "fieldtype": "Data",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Item Name",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "item_name",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "customer_item_code", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer's Item Code", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "customer_item_code",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer's Item Code",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "print_hide": 1,
+   "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": 1, 
-   "fieldname": "section_break_6", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Edit Description", 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "fieldname": "section_break_6",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Edit Description",
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "description", 
-   "fieldtype": "Text Editor", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Description", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "description", 
-   "oldfieldtype": "Text", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "200px", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "description",
+   "fieldtype": "Text Editor",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Description",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "description",
+   "oldfieldtype": "Text",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "print_width": "200px",
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "200px"
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_8", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_8",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "image_view", 
-   "fieldtype": "Image", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Image View", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "image", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "image_view",
+   "fieldtype": "Image",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Image View",
+   "length": 0,
+   "no_copy": 0,
+   "options": "image",
+   "permlevel": 0,
+   "precision": "",
+   "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, 
-   "fieldname": "image", 
-   "fieldtype": "Attach", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Image", 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "image",
+   "fieldtype": "Attach",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Image",
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "quantity_and_rate", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "quantity_and_rate",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 1, 
-   "collapsible": 0, 
-   "fieldname": "qty", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Quantity", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "qty", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 1,
+   "collapsible": 0,
+   "fieldname": "qty",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Quantity",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "qty",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "price_list_rate", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Price List Rate", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "ref_rate", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "price_list_rate",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Price List Rate",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "ref_rate",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "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, 
-   "depends_on": "price_list_rate", 
-   "fieldname": "discount_percentage", 
-   "fieldtype": "Percent", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Discount on Price List Rate (%)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "adj_rate", 
-   "oldfieldtype": "Float", 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "col_break2",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "col_break2", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "stock_uom",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "UOM",
+   "length": 0,
+   "no_copy": 0,
+   "options": "UOM",
+   "permlevel": 0,
+   "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, 
-   "fieldname": "stock_uom", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "UOM", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "UOM", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_price_list_rate",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Price List Rate (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "base_ref_rate",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "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, 
-   "fieldname": "base_price_list_rate", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Price List Rate (Company Currency)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "base_ref_rate", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "fieldname": "discount_and_margin",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Discount and Margin",
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "section_break1", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "price_list_rate",
+   "fieldname": "discount_percentage",
+   "fieldtype": "Percent",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Discount on Price List Rate (%)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "adj_rate",
+   "oldfieldtype": "Float",
+   "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": 1, 
-   "collapsible": 0, 
-   "fieldname": "rate", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Rate", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "export_rate", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_19",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "amount", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Amount", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "export_amount", 
-   "oldfieldtype": "Currency", 
-   "options": "currency", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "price_list_rate",
+   "fieldname": "margin_type",
+   "fieldtype": "Select",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Margin Type",
+   "length": 0,
+   "no_copy": 0,
+   "options": "\nPercentage\nAmount",
+   "permlevel": 0,
+   "precision": "",
+   "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, 
-   "fieldname": "col_break3", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate",
+   "fieldname": "margin_rate_or_amount",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Margin Rate or Amount",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "2",
+   "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, 
-   "fieldname": "base_rate", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Rate (Company Currency)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "basic_rate", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate",
+   "fieldname": "total_margin",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Total Margin",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "2",
+   "print_hide": 1,
+   "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, 
-   "fieldname": "base_amount", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Amount (Company Currency)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "amount", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "section_break1",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "pricing_rule", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Pricing Rule", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Pricing Rule", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 1,
+   "collapsible": 0,
+   "fieldname": "rate",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Rate",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "export_rate",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "section_break_21", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "amount",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Amount",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "export_amount",
+   "oldfieldtype": "Currency",
+   "options": "currency",
+   "permlevel": 0,
+   "print_hide": 0,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "net_rate", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Net Rate", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "col_break3",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "net_amount", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Net Amount", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_rate",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Rate (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "basic_rate",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_24", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_amount",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Amount (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "amount",
+   "oldfieldtype": "Currency",
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "base_net_rate", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Net Rate (Company Currency)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "pricing_rule",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Pricing Rule",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Pricing Rule",
+   "permlevel": 0,
+   "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, 
-   "fieldname": "base_net_amount", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Net Amount (Company Currency)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "section_break_21",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "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": "eval:doc.delivered_by_supplier==1", 
-   "fieldname": "drop_ship", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Drop Ship", 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "net_rate",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Net Rate",
+   "length": 0,
+   "no_copy": 0,
+   "options": "currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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, 
-   "fieldname": "delivered_by_supplier", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Delivered By Supplier", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "net_amount",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Net Amount",
+   "length": 0,
+   "no_copy": 0,
+   "options": "currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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": 1, 
-   "fieldname": "accounting", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Accounting Details", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_24",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "income_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Income Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "income_account", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "120px", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "base_net_rate",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Net Rate (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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,
+   "fieldname": "base_net_amount",
+   "fieldtype": "Currency",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Net Amount (Company Currency)",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Company:company:default_currency",
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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": 1,
+   "collapsible_depends_on": "eval:doc.delivered_by_supplier==1",
+   "fieldname": "drop_ship",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Drop Ship",
+   "length": 0,
+   "no_copy": 0,
+   "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": 0,
+   "fieldname": "delivered_by_supplier",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Delivered By Supplier",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "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": 1,
+   "fieldname": "accounting",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Accounting Details",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0,
+   "fieldname": "income_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Income Account",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "income_account",
+   "oldfieldtype": "Link",
+   "options": "Account",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "print_width": "120px",
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "120px"
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "expense_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Expense Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Account", 
-   "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,
+   "fieldname": "expense_account",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Expense Account",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Account",
+   "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,
    "width": "120px"
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "col_break4", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "col_break4",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0, 
-   "default": ":Company", 
-   "fieldname": "cost_center", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Cost Center", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "cost_center", 
-   "oldfieldtype": "Link", 
-   "options": "Cost Center", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "120px", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "default": ":Company",
+   "fieldname": "cost_center",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Cost Center",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "cost_center",
+   "oldfieldtype": "Link",
+   "options": "Cost Center",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "print_width": "120px",
+   "read_only": 0,
+   "report_hide": 0,
+   "reqd": 1,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "120px"
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 1, 
-   "collapsible_depends_on": "eval:doc.serial_no || doc.batch_no", 
-   "fieldname": "warehouse_and_reference", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Stock Details", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "collapsible_depends_on": "eval:doc.serial_no || doc.batch_no",
+   "fieldname": "warehouse_and_reference",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Stock Details",
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "warehouse", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Warehouse", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "warehouse", 
-   "oldfieldtype": "Link", 
-   "options": "Warehouse", 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "warehouse",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Warehouse",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "warehouse",
+   "oldfieldtype": "Link",
+   "options": "Warehouse",
+   "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, 
-   "fieldname": "target_warehouse", 
-   "fieldtype": "Link", 
-   "hidden": 1, 
-   "ignore_user_permissions": 1, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customer Warehouse (Optional)", 
-   "length": 0, 
-   "no_copy": 1, 
-   "options": "Warehouse", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "target_warehouse",
+   "fieldtype": "Link",
+   "hidden": 1,
+   "ignore_user_permissions": 1,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Customer Warehouse (Optional)",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Warehouse",
+   "permlevel": 0,
+   "precision": "",
+   "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, 
-   "fieldname": "serial_no", 
-   "fieldtype": "Small Text", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Serial No", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "serial_no", 
-   "oldfieldtype": "Small Text", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "serial_no",
+   "fieldtype": "Small Text",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 1,
+   "label": "Serial No",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "serial_no",
+   "oldfieldtype": "Small Text",
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "batch_no", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Batch No", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Batch", 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "batch_no",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 1,
+   "label": "Batch No",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Batch",
+   "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, 
-   "description": "", 
-   "fieldname": "item_group", 
-   "fieldtype": "Link", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Item Group", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "item_group", 
-   "oldfieldtype": "Link", 
-   "options": "Item Group", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "description": "",
+   "fieldname": "item_group",
+   "fieldtype": "Link",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Item Group",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "item_group",
+   "oldfieldtype": "Link",
+   "options": "Item Group",
+   "permlevel": 0,
+   "print_hide": 1,
+   "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, 
-   "fieldname": "brand", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Brand Name", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "brand", 
-   "oldfieldtype": "Data", 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "brand",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Brand Name",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "brand",
+   "oldfieldtype": "Data",
+   "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, 
-   "fieldname": "item_tax_rate", 
-   "fieldtype": "Small Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Item Tax Rate", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "item_tax_rate", 
-   "oldfieldtype": "Small Text", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "item_tax_rate",
+   "fieldtype": "Small Text",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Item Tax Rate",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "item_tax_rate",
+   "oldfieldtype": "Small Text",
+   "permlevel": 0,
+   "print_hide": 1,
+   "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, 
-   "fieldname": "col_break5", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "col_break5",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "permlevel": 0,
+   "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": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "actual_batch_qty", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Available Batch Qty at Warehouse", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "150px", 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "actual_batch_qty",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Available Batch Qty at Warehouse",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "precision": "",
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "print_width": "150px",
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
+   "unique": 0,
    "width": "150px"
-  }, 
+  },
   {
-   "allow_on_submit": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "actual_qty", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Available Qty at Warehouse", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "actual_qty", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "actual_qty",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Available Qty at Warehouse",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "actual_qty",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "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": 1, 
-   "fieldname": "edit_references", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "References", 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 1,
+   "fieldname": "edit_references",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "References",
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "time_log_batch", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Time Log Batch", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Time Log Batch", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "time_log_batch",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Time Log Batch",
+   "length": 0,
+   "no_copy": 0,
+   "options": "Time Log Batch",
+   "permlevel": 0,
+   "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": 0, 
-   "fieldname": "sales_order", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Sales Order", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "sales_order", 
-   "oldfieldtype": "Link", 
-   "options": "Sales Order", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "sales_order",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Sales Order",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "sales_order",
+   "oldfieldtype": "Link",
+   "options": "Sales Order",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "so_detail", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Sales Order Item", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "so_detail", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "so_detail",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Sales Order Item",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "so_detail",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_50", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "column_break_50",
+   "fieldtype": "Column Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "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": 0, 
-   "fieldname": "delivery_note", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Delivery Note", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "delivery_note", 
-   "oldfieldtype": "Link", 
-   "options": "Delivery Note", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "delivery_note",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Delivery Note",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "delivery_note",
+   "oldfieldtype": "Link",
+   "options": "Delivery Note",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "dn_detail", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Delivery Note Item", 
-   "length": 0, 
-   "no_copy": 1, 
-   "oldfieldname": "dn_detail", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "dn_detail",
+   "fieldtype": "Data",
+   "hidden": 1,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 1,
+   "in_list_view": 0,
+   "label": "Delivery Note Item",
+   "length": 0,
+   "no_copy": 1,
+   "oldfieldname": "dn_detail",
+   "oldfieldtype": "Data",
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 1,
+   "report_hide": 0,
+   "reqd": 0,
+   "search_index": 1,
+   "set_only_once": 0,
    "unique": 0
-  }, 
+  },
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "delivered_qty", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Delivered Qty", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "delivered_qty", 
-   "oldfieldtype": "Currency", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "delivered_qty",
+   "fieldtype": "Float",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Delivered Qty",
+   "length": 0,
+   "no_copy": 0,
+   "oldfieldname": "delivered_qty",
+   "oldfieldtype": "Currency",
+   "permlevel": 0,
+   "print_hide": 1,
+   "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, 
-   "fieldname": "section_break_54", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "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, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "asset",
+   "fieldtype": "Link",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Asset",
+   "length": 0,
+   "no_copy": 1,
+   "options": "Asset",
+   "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": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "page_break", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Page Break", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 1, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "allow_on_submit": 0,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "section_break_54",
+   "fieldtype": "Section Break",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "length": 0,
+   "no_copy": 0,
+   "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": 1,
+   "bold": 0,
+   "collapsible": 0,
+   "fieldname": "page_break",
+   "fieldtype": "Check",
+   "hidden": 0,
+   "ignore_user_permissions": 0,
+   "ignore_xss_filter": 0,
+   "in_filter": 0,
+   "in_list_view": 0,
+   "label": "Page Break",
+   "length": 0,
+   "no_copy": 1,
+   "permlevel": 0,
+   "print_hide": 1,
+   "print_hide_if_no_value": 0,
+   "read_only": 0,
+   "report_hide": 1,
+   "reqd": 0,
+   "search_index": 0,
+   "set_only_once": 0,
    "unique": 0
   }
- ], 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "idx": 1, 
- "in_create": 0, 
- "in_dialog": 0, 
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 1, 
- "max_attachments": 0, 
- "modified": "2016-02-01 11:16:58.288462", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Sales Invoice Item", 
- "owner": "Administrator", 
- "permissions": [], 
- "read_only": 0, 
- "read_only_onload": 0, 
- "sort_field": "modified", 
- "sort_order": "DESC"
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 1,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2016-03-29 11:09:35.263924",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Sales Invoice Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "read_only": 0,
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 7e64ea3..222682e 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -60,6 +60,9 @@
 				chart_area.get(0), wrapper.page);
 		})
 
+	if(frappe.defaults.get_default('company')) {
+		wrapper.$company_select.val(frappe.defaults.get_default('company'));
+	}
 	wrapper.$company_select.change();
 }
 
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 0c8d999..9e3319c 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -16,7 +16,7 @@
 
 @frappe.whitelist()
 def get_party_details(party=None, account=None, party_type="Customer", company=None,
-	posting_date=None, price_list=None, currency=None, doctype=None):
+	posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
 
 	if not party:
 		return {}
@@ -25,7 +25,7 @@
 		frappe.throw(_("{0}: {1} does not exists").format(party_type, party))
 
 	return _get_party_details(party, account, party_type,
-		company, posting_date, price_list, currency, doctype)
+		company, posting_date, price_list, currency, doctype, ignore_permissions)
 
 def _get_party_details(party=None, account=None, party_type="Customer", company=None,
 	posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
@@ -313,8 +313,8 @@
 	if party_type and party_name:
 		party = frappe.db.get_value(party_type, party_name, ["is_frozen", "disabled"], as_dict=True)
 		if party.disabled:
-			frappe.throw("{0} {1} is disabled".format(party_type, party_name), PartyDisabled)
+			frappe.throw(_("{0} {1} is disabled").format(party_type, party_name), PartyDisabled)
 		elif party.is_frozen:
 			frozen_accounts_modifier = frappe.db.get_value( 'Accounts Settings', None,'frozen_accounts_modifier')
 			if not frozen_accounts_modifier in frappe.get_roles():
-				frappe.throw("{0} {1} is frozen".format(party_type, party_name), PartyFrozen)
+				frappe.throw(_("{0} {1} is frozen").format(party_type, party_name), PartyFrozen)
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 617beff..78924e9 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -47,7 +47,7 @@
 
 			if(is_drop_ship && doc.status!="Delivered"){
 				cur_frm.add_custom_button(__('Delivered'),
-					 this.delivered_by_supplier, __("Status"));
+					this.delivered_by_supplier, __("Status"));
 
 				cur_frm.page.set_inner_btn_group_as_primary(__("Status"));
 			}
diff --git a/erpnext/buying/doctype/request_for_quotation/__init__.py b/erpnext/buying/doctype/request_for_quotation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/__init__.py
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
new file mode 100644
index 0000000..40e62f1
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -0,0 +1,97 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+
+{% include 'buying/doctype/purchase_common/purchase_common.js' %};
+
+frappe.require("assets/erpnext/js/utils.js");
+
+frappe.ui.form.on("Request for Quotation",{
+	setup: function(frm){
+		frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn){
+			var d =locals[cdt][cdn];
+			return {
+				filters: {'supplier': d.supplier}
+			}
+		}
+	},
+
+	onload: function(frm){
+		frm.add_fetch('standard_reply', 'response', 'response');
+
+		if(!frm.doc.message_for_supplier) {
+			frm.set_value("message_for_supplier", __("Please supply the specified items at the best possible rates"))
+		}
+	},
+
+	refresh: function(frm, cdt, cdn){
+		if (frm.doc.docstatus === 1) {
+			frm.add_custom_button(__("Make Supplier Quotation"),
+				function(){ frm.trigger("make_suppplier_quotation") });
+
+			frm.add_custom_button(__("Send Supplier Emails"), function() {
+				frappe.call({
+					method: 'erpnext.buying.doctype.request_for_quotation.request_for_quotation.send_supplier_emails',
+					args: {
+						rfq_name: frm.doc.name
+					}
+				});
+			});
+		}
+	},
+
+	make_suppplier_quotation: function(frm){
+		var doc = frm.doc;
+		var dialog = new frappe.ui.Dialog({
+			title: __("For Supplier"),
+			fields: [
+				{"fieldtype": "Select", "label": __("Supplier"),
+					"fieldname": "supplier", "options":"Supplier",
+					"options": $.map(doc.suppliers,
+						function(d) { return d.supplier }), "reqd": 1 },
+				{"fieldtype": "Button", "label": __("Make Supplier Quotation"),
+					"fieldname": "make_supplier_quotation", "cssClass": "btn-primary"},
+			]
+		});
+
+		dialog.fields_dict.make_supplier_quotation.$input.click(function() {
+			args = dialog.get_values();
+			if(!args) return;
+			dialog.hide();
+			return frappe.call({
+				type: "GET",
+				method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.make_supplier_quotation",
+				args: {
+					"source_name": doc.name,
+					"for_supplier": args.supplier
+				},
+				freeze: true,
+				callback: function(r) {
+					if(!r.exc) {
+						var doc = frappe.model.sync(r.message);
+						frappe.set_route("Form", r.message.doctype, r.message.name);
+					}
+				}
+			});
+		});
+		dialog.show()
+	}
+})
+
+erpnext.buying.RequestforQuotationController = erpnext.buying.BuyingController.extend({
+	refresh: function() {
+		this._super();
+	},
+
+	calculate_taxes_and_totals: function() {
+		return;
+	},
+
+	tc_name: function() {
+		this.get_terms();
+	}
+});
+
+
+// for backward compatibility: combine new and previous states
+$.extend(cur_frm.cscript, new erpnext.buying.RequestforQuotationController({frm: cur_frm}));
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
new file mode 100644
index 0000000..7f1988a
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
@@ -0,0 +1,768 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "autoname": "naming_series:", 
+ "creation": "2016-02-25 01:24:07.224790", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Document", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Series", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "naming_series", 
+   "oldfieldtype": "Select", 
+   "options": "RFQ-", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "company", 
+   "oldfieldtype": "Link", 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Column Break", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "50%", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "50%"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "transaction_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "transaction_date", 
+   "oldfieldtype": "Date", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "suppliers_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "suppliers", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Supplier Detail", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Request for Quotation Supplier", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "items_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-shopping-cart", 
+   "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": 0, 
+   "fieldname": "items", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Items", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "po_details", 
+   "oldfieldtype": "Table", 
+   "options": "Request for Quotation Item", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "supplier_response_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "standard_reply", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Standard Reply", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Standard Reply", 
+   "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": 0, 
+   "fieldname": "message_for_supplier", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Message for Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "terms", 
+   "fieldname": "terms_section_break", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Terms and Conditions", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-legal", 
+   "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": 0, 
+   "fieldname": "tc_name", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Terms", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "tc_name", 
+   "oldfieldtype": "Link", 
+   "options": "Terms and Conditions", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "fieldname": "terms", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Terms and Conditions", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "terms", 
+   "oldfieldtype": "Text Editor", 
+   "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, 
+   "fieldname": "printing_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Printing Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "select_print_heading", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Print Heading", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "select_print_heading", 
+   "oldfieldtype": "Link", 
+   "options": "Print Heading", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "letter_head", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Letter Head", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "letter_head", 
+   "oldfieldtype": "Select", 
+   "options": "Letter Head", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": 1, 
+   "fieldname": "more_info", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "More Information", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-file-text", 
+   "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": 0, 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "status", 
+   "oldfieldtype": "Select", 
+   "options": "\nDraft\nSubmitted\nCancelled", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "fiscal_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Fiscal Year", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "fiscal_year", 
+   "oldfieldtype": "Select", 
+   "options": "Fiscal Year", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Request for Quotation", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "icon-shopping-cart", 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-03-29 06:18:26.398938", 
+ "modified_by": "Administrator", 
+ "module": "Buying", 
+ "name": "Request for Quotation", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Manufacturing Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }, 
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Stock User", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Supplier", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 1, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Purchase Manager", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 1, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "All", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
+  }
+ ], 
+ "read_only": 0, 
+ "read_only_onload": 1, 
+ "search_fields": "status, transaction_date", 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "timeline_field": "", 
+ "title_field": "", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
new file mode 100644
index 0000000..8c23f96
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -0,0 +1,188 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe, json
+from frappe import _
+from frappe.utils import get_url, random_string
+from frappe.utils.user import get_user_fullname
+from frappe.model.mapper import get_mapped_doc
+from erpnext.stock.doctype.material_request.material_request import set_missing_values
+from erpnext.controllers.buying_controller import BuyingController
+
+STANDARD_USERS = ("Guest", "Administrator")
+
+class RequestforQuotation(BuyingController):
+	def validate(self):
+		self.validate_duplicate_supplier()
+		self.validate_common()
+
+	def validate_duplicate_supplier(self):
+		supplier_list = [d.supplier for d in self.suppliers]
+		if len(supplier_list) != len(set(supplier_list)):
+			frappe.throw(_("Same supplier has been entered multiple times"))
+
+	def validate_common(self):
+		pc = frappe.get_doc('Purchase Common')
+		pc.validate_for_items(self)
+
+	def on_submit(self):
+		frappe.db.set(self, 'status', 'Submitted')
+
+	def on_cancel(self):
+		frappe.db.set(self, 'status', 'Cancelled')
+
+	def send_to_supplier(self):
+		link = get_url("/rfq/" + self.name)
+		for rfq_supplier in self.suppliers:
+			if rfq_supplier.email_id and rfq_supplier.send_email_to_supplier:
+
+				# make new user if required
+				update_password_link = self.create_supplier_user(rfq_supplier, link)
+
+				self.supplier_rfq_mail(rfq_supplier, update_password_link, link)
+
+	def create_supplier_user(self, rfq_supplier, link):
+		'''Create a new user for the supplier if not set in contact'''
+		update_password_link = ''
+
+		contact = frappe.get_doc("Contact", rfq_supplier.contact)
+		if not contact.user:
+			if frappe.db.exists("User", rfq_supplier.email_id):
+				user = frappe.get_doc("User", rfq_supplier.email_id)
+			else:
+				user, update_password_link = self.create_user(rfq_supplier, link)
+
+			# set user_id in contact
+			contact = frappe.get_doc('Contact', rfq_supplier.contact)
+			contact.user = user.name
+			contact.save()
+
+		return update_password_link
+
+	def create_user(self, rfq_supplier, link):
+		user = frappe.get_doc({
+			'doctype': 'User',
+			'send_welcome_email': 0,
+			'email': rfq_supplier.email_id,
+			'first_name': rfq_supplier.supplier_name,
+			'user_type': 'Website User'
+		})
+
+		# reset password
+		key = random_string(32)
+		update_password_link = get_url("/update-password?key=" + key)
+		user.reset_password_key = key
+		user.redirect_url = link
+		user.save(ignore_permissions=True)
+
+		return user, update_password_link
+
+	def supplier_rfq_mail(self, data, update_password_link, rfq_link):
+		full_name = get_user_fullname(frappe.session['user'])
+		if full_name == "Guest":
+			full_name = "Administrator"
+
+		args = {
+			'update_password_link': update_password_link,
+			'message': frappe.render_template(self.message_for_supplier, data.as_dict()),
+			'rfq_link': rfq_link,
+			'user_fullname': full_name
+		}
+
+		subject = _("Request for Quotation")
+		template = "templates/emails/request_for_quotation.html"
+		sender = frappe.session.user not in STANDARD_USERS and frappe.session.user or None
+
+		frappe.sendmail(recipients=data.email_id, sender=sender, subject=subject,
+			message=frappe.get_template(template).render(args),
+			attachments = [frappe.attach_print('Request for Quotation', self.name)],as_bulk=True)
+
+		frappe.msgprint(_("Email sent to supplier {0}").format(data.supplier))
+
+@frappe.whitelist()
+def send_supplier_emails(rfq_name):
+	rfq = frappe.get_doc("Request for Quotation", rfq_name)
+	if rfq.docstatus==1:
+		rfq.send_to_supplier()
+
+
+def get_list_context(context=None):
+	from erpnext.controllers.website_list_for_contact import get_list_context
+	list_context = get_list_context(context)
+	return list_context
+
+
+# This method is used to make supplier quotation from material request form.
+@frappe.whitelist()
+def make_supplier_quotation(source_name, for_supplier, target_doc=None):
+	def postprocess(source, target_doc):
+		target_doc.supplier = for_supplier
+		set_missing_values(source, target_doc)
+
+	doclist = get_mapped_doc("Request for Quotation", source_name, {
+		"Request for Quotation": {
+			"doctype": "Supplier Quotation",
+			"validation": {
+				"docstatus": ["=", 1]
+			}
+		},
+		"Request for Quotation Item": {
+			"doctype": "Supplier Quotation Item",
+			"field_map": [
+				["name", "request_for_quotation_item"],
+				["parent", "request_for_quotation"],
+				["uom", "uom"]
+			],
+		}
+	}, target_doc, postprocess)
+
+	return doclist
+
+# This method is used to make supplier quotation from supplier's portal.
+@frappe.whitelist()
+def create_supplier_quotation(doc):
+	if isinstance(doc, basestring):
+		doc = json.loads(doc)
+
+	supplier = frappe.get_doc('Supplier', doc.get('supplier'))
+
+	try:
+		sq_doc = frappe.get_doc({
+			"doctype": "Supplier Quotation",
+			"supplier": supplier.name,
+			"terms": doc.get("terms"),
+			"company": doc.get("company"),
+			"currency": supplier.default_currency,
+			"buying_price_list": supplier.default_price_list or frappe.db.get_value('Buying Settings', None, 'buying_price_list')
+		})
+		add_items(sq_doc, supplier, doc.get('items'))
+		sq_doc.flags.ignore_permissions = True
+		sq_doc.run_method("set_missing_values")
+		sq_doc.save()
+		frappe.msgprint(_("Supplier Quotation {0} created").format(sq_doc.name))
+		return sq_doc.name
+	except Exception:
+		return
+
+def add_items(sq_doc, supplier, items):
+	for data in items:
+		if data.get("qty") > 0:
+			if isinstance(data, dict):
+				data = frappe._dict(data)
+
+			create_rfq_items(sq_doc, supplier, data)
+
+def create_rfq_items(sq_doc, supplier, data):
+	sq_doc.append('items', {
+		"item_code": data.item_code,
+		"item_name": data.item_name,
+		"description": data.description,
+		"qty": data.qty,
+		"rate": data.rate,
+		"supplier_part_no": frappe.db.get_value("Item Supplier", {'parent': data.item_code, 'supplier': supplier}, "supplier_part_no"),
+		"warehouse": data.warehouse or '',
+		"request_for_quotation_item": data.name,
+		"request_for_quotation": data.parent
+	})
diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
new file mode 100644
index 0000000..d643a05
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+from frappe.utils import nowdate
+
+class TestRequestforQuotation(unittest.TestCase):
+	def test_make_supplier_quotation(self):
+		from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
+		rfq = make_request_for_quotation()
+		
+		sq = make_supplier_quotation(rfq.name, rfq.get('suppliers')[0].supplier)
+		sq.submit()
+		
+		sq1 = make_supplier_quotation(rfq.name, rfq.get('suppliers')[1].supplier)
+		sq1.submit()
+		
+		self.assertEquals(sq.supplier, rfq.get('suppliers')[0].supplier)
+		self.assertEquals(sq.get('items')[0].request_for_quotation, rfq.name)
+		self.assertEquals(sq.get('items')[0].item_code, "_Test Item")
+		self.assertEquals(sq.get('items')[0].qty, 5)
+		
+		self.assertEquals(sq1.supplier, rfq.get('suppliers')[1].supplier)
+		self.assertEquals(sq1.get('items')[0].request_for_quotation, rfq.name)
+		self.assertEquals(sq1.get('items')[0].item_code, "_Test Item")
+		self.assertEquals(sq1.get('items')[0].qty, 5)
+
+	def test_make_supplier_quotation_from_portal(self):
+		from erpnext.buying.doctype.request_for_quotation.request_for_quotation import create_supplier_quotation
+		rfq = make_request_for_quotation()
+		rfq.get('items')[0].rate = 100
+		rfq.supplier = rfq.suppliers[0].supplier
+		supplier_quotation_name = create_supplier_quotation(rfq)
+		
+		supplier_quotation_doc = frappe.get_doc('Supplier Quotation', supplier_quotation_name)
+		
+		self.assertEquals(supplier_quotation_doc.supplier, rfq.get('suppliers')[0].supplier)
+		self.assertEquals(supplier_quotation_doc.get('items')[0].request_for_quotation, rfq.name)
+		self.assertEquals(supplier_quotation_doc.get('items')[0].item_code, "_Test Item")
+		self.assertEquals(supplier_quotation_doc.get('items')[0].qty, 5)
+		self.assertEquals(supplier_quotation_doc.get('items')[0].amount, 500)
+		
+
+def make_request_for_quotation():
+	supplier_data = get_supplier_data()
+	rfq = frappe.new_doc('Request for Quotation')
+	rfq.transaction_date = nowdate()
+	rfq.status = 'Draft'
+	rfq.company = '_Test Company'
+	rfq.response = 'Test Data'
+	
+	for data in supplier_data:
+		rfq.append('suppliers', data)
+	
+	rfq.append("items", {
+		"item_code": "_Test Item",
+		"description": "_Test Item",
+		"uom": "_Test UOM",
+		"qty": 5,
+		"warehouse": "_Test Warehouse - _TC",
+		"schedule_date": nowdate()
+	})
+	
+	rfq.submit()
+	
+	return rfq
+	
+def get_supplier_data():
+	return [{
+		"supplier": "_Test Supplier",
+		"supplier_name": "_Test Supplier"
+	},
+	{
+		"supplier": "_Test Supplier 1",
+		"supplier_name": "_Test Supplier 1"
+	}]
\ No newline at end of file
diff --git a/erpnext/buying/doctype/request_for_quotation_item/__init__.py b/erpnext/buying/doctype/request_for_quotation_item/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_item/__init__.py
diff --git a/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
new file mode 100644
index 0000000..2892e3b
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
@@ -0,0 +1,614 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "hash", 
+ "creation": "2016-02-25 08:04:02.452958", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 1, 
+   "collapsible": 0, 
+   "fieldname": "item_code", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Item Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_code", 
+   "oldfieldtype": "Link", 
+   "options": "Item", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "item_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Item Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "section_break_5", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "description", 
+   "oldfieldtype": "Small Text", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "300px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "300px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break1", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "image", 
+   "fieldtype": "Attach", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Image", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "image_view", 
+   "fieldtype": "Image", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Image View", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "image", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "fieldname": "quantity", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 1, 
+   "collapsible": 0, 
+   "fieldname": "qty", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Quantity", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "qty", 
+   "oldfieldtype": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "60px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "60px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "col_break2", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "default": "Today", 
+   "fieldname": "schedule_date", 
+   "fieldtype": "Date", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Required Date", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "uom", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "UOM", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "uom", 
+   "oldfieldtype": "Link", 
+   "options": "UOM", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "100px", 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "100px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "warehouse_and_reference", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Warehouse and Reference", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "warehouse", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Warehouse", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "warehouse", 
+   "oldfieldtype": "Link", 
+   "options": "Warehouse", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "fieldname": "project_name", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Project Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "fieldname": "material_request", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Material Request", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Material Request", 
+   "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, 
+   "fieldname": "col_break4", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "material_request_item", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Material Request Item", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0, 
+   "fieldname": "brand", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Brand", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "brand", 
+   "oldfieldtype": "Link", 
+   "options": "Brand", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "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, 
+   "description": "", 
+   "fieldname": "item_group", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Item Group", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "item_group", 
+   "oldfieldtype": "Link", 
+   "options": "Item Group", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "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": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "page_break", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Page Break", 
+   "length": 0, 
+   "no_copy": 1, 
+   "oldfieldname": "page_break", 
+   "oldfieldtype": "Check", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-03-29 05:28:39.203232", 
+ "modified_by": "Administrator", 
+ "module": "Buying", 
+ "name": "Request for Quotation Item", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py
new file mode 100644
index 0000000..cc897af
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class RequestforQuotationItem(Document):
+	pass
diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/__init__.py b/erpnext/buying/doctype/request_for_quotation_supplier/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_supplier/__init__.py
diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
new file mode 100644
index 0000000..b51bc17
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
@@ -0,0 +1,188 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2016-03-29 05:59:11.896885", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "supplier", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Supplier", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "contact", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Contact", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Contact", 
+   "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": 0, 
+   "default": "1", 
+   "description": "", 
+   "fieldname": "send_email_to_supplier", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Send Email to Supplier", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0, 
+   "fieldname": "column_break_3", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "supplier_name", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Supplier Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "supplier.supplier_name", 
+   "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": 0, 
+   "fieldname": "email_id", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Email Id", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "contact.email_id", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-03-29 06:03:50.811469", 
+ "modified_by": "Administrator", 
+ "module": "Buying", 
+ "name": "Request for Quotation Supplier", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py
new file mode 100644
index 0000000..4b0bbbe
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class RequestforQuotationSupplier(Document):
+	pass
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index e12c9ff..c9bcc46 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -1885,6 +1885,26 @@
    "share": 0, 
    "submit": 0, 
    "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 1, 
+   "print": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "All", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
+   "write": 0
   }
  ], 
  "read_only": 0, 
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
index b09667b..1275fcd 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -883,6 +883,32 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "request_for_quotation", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Request for Quotation", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Request for Quotation", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "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, 
    "fieldname": "col_break4", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -932,6 +958,31 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "request_for_quotation_item", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Request for Quotation Item", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "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, 
    "fieldname": "brand", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -1046,7 +1097,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-03-18 05:15:03.936587", 
+ "modified": "2016-03-25 17:01:59.632826", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation Item", 
diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py
index c259f06..0dc51f6 100644
--- a/erpnext/config/buying.py
+++ b/erpnext/config/buying.py
@@ -14,6 +14,11 @@
 				},
 				{
 					"type": "doctype",
+					"name": "Request for Quotation",
+					"description": _("Request for quotation."),
+				},
+				{
+					"type": "doctype",
 					"name": "Supplier Quotation",
 					"description": _("Quotations received from Suppliers."),
 				},
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index bcaa9fb..83155f1 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -48,9 +48,12 @@
 		self.validate_party()
 		self.validate_currency()
 		
-		if self.meta.get_field("is_recurring") and not self.get("__islocal"):
-			validate_recurring_document(self)
-			convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))
+		if self.meta.get_field("is_recurring"):
+			if self.amended_from and self.recurring_id:
+				self.recurring_id = None
+			if not self.get("__islocal"):
+				validate_recurring_document(self)
+				convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))
 
 	def on_update_after_submit(self):
 		if self.meta.get_field("is_recurring"):
@@ -138,6 +141,10 @@
 			for fieldname in self.meta.get_valid_columns():
 				parent_dict[fieldname] = self.get(fieldname)
 
+			if self.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
+				document_type = "{} Item".format(self.doctype)
+				parent_dict.update({"document_type": document_type})
+
 			for item in self.get("items"):
 				if item.get("item_code"):
 					args = parent_dict.copy()
@@ -166,6 +173,7 @@
 								item.set(fieldname, value)
 
 					if ret.get("pricing_rule"):
+						# if user changed the discount percentage then set user's discount percentage ?
 						item.set("discount_percentage", ret.get("discount_percentage"))
 						if ret.get("pricing_rule_for") == "Price":
 							item.set("pricing_list_rate", ret.get("pricing_list_rate"))
@@ -271,7 +279,7 @@
 		res = frappe.db.sql("""
 			select
 				t1.name as jv_no, t1.remark, t2.{0} as amount, t2.name as jv_detail_no,
-				reference_name as against_order
+				t2.reference_name as against_order
 			from
 				`tabJournal Entry` t1, `tabJournal Entry Account` t2
 			where
@@ -450,7 +458,20 @@
 				# Note: not validating with gle account because we don't have the account
 				# at quotation / sales order level and we shouldn't stop someone
 				# from creating a sales invoice if sales order is already created
-
+				
+	def validate_asset(self, asset, item_row):
+		if asset.company != self.company:
+			frappe.throw(_("Row #{0}: Asset {1} does not belong to company {2}")
+				.format(item_row.idx, item_row.asset, self.company))
+				
+		elif asset.item_code != item_row.item_code:
+			frappe.throw(_("Row #{0}: Asset {1} does not linked to Item {2}")
+				.format(item_row.idx, item_row.asset, item_row.item_code))
+		elif asset.docstatus != 1:
+			frappe.throw(_("Row #{0}: Asset {1} must be submitted").format(item_row.idx, item_row.asset))
+		elif item_row.qty > 1:
+			frappe.throw(_("Row #{0}: Qty must be 1, as item is linked to an asset").format(item_row.idx))
+						
 @frappe.whitelist()
 def get_tax_rate(account_head):
 	return frappe.db.get_value("Account", account_head, "tax_rate")
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index c9b660d..5361126 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -20,8 +20,9 @@
 			}
 
 	def get_feed(self):
-		return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
-			self.grand_total)
+		if self.get("supplier_name"):
+			return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
+				self.grand_total)
 
 	def validate(self):
 		super(BuyingController, self).validate()
@@ -40,7 +41,7 @@
 
 		# set contact and address details for supplier, if they are not mentioned
 		if getattr(self, "supplier", None):
-			self.update_if_missing(get_party_details(self.supplier, party_type="Supplier"))
+			self.update_if_missing(get_party_details(self.supplier, party_type="Supplier", ignore_permissions=self.flags.ignore_permissions))
 
 		self.set_missing_item_details()
 
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index eff5f53..eb16ac5 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -341,3 +341,27 @@
 				'txt': "%%%s%%" % frappe.db.escape(txt),
 				'company': filters.get("company", "")
 			})
+
+
+@frappe.whitelist()
+def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
+	from erpnext.controllers.queries import get_match_cond
+	
+	if not filters: filters = {}
+
+	condition = ""
+	if filters.get("company"):
+		condition += "and tabAccount.company = %(company)s"
+		
+	return frappe.db.sql("""select tabAccount.name from `tabAccount`
+		where (tabAccount.report_type = "Profit and Loss"
+				or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary"))
+			and tabAccount.is_group=0
+			and tabAccount.docstatus!=2
+			and tabAccount.{key} LIKE %(txt)s
+			{condition} {match_condition}"""
+		.format(condition=condition, key=frappe.db.escape(searchfield), 
+			match_condition=get_match_cond(doctype)), {
+			'company': filters['company'], 
+			'txt': "%%%s%%" % frappe.db.escape(txt)
+		})
\ No newline at end of file
diff --git a/erpnext/controllers/recurring_document.py b/erpnext/controllers/recurring_document.py
index 2df7352..42b847e 100644
--- a/erpnext/controllers/recurring_document.py
+++ b/erpnext/controllers/recurring_document.py
@@ -181,14 +181,13 @@
 			doc.db_set("recurring_id", doc.name)
 
 		set_next_date(doc, posting_date)
-
+		
+		if doc.next_date:
+			validate_recurring_next_date(doc)
+		
 	elif doc.recurring_id:
-		frappe.db.sql("""update `tab%s` set is_recurring = 0
-			where recurring_id = %s""" % (doc.doctype, '%s'), (doc.recurring_id))
-			
-	if doc.next_date:
-		validate_recurring_next_date(doc)
-
+		doc.db_set("recurring_id", None)
+	
 def validate_notification_email_id(doc):
 	if doc.notify_by_email:
 		if doc.notification_email_address:
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index d4a64f2..67cec8a 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -59,6 +59,11 @@
 					item.rate = flt(item.price_list_rate *
 						(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
 
+				if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']:
+					item.total_margin = self.calculate_margin(item)
+					item.rate = flt(item.total_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\
+						if item.total_margin > 0 else item.rate
+
 				item.net_rate = item.rate
 				item.amount = flt(item.rate * item.qty,	item.precision("amount"))
 				item.net_amount = item.amount
@@ -434,4 +439,18 @@
 			self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_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"))
\ No newline at end of file
+			self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
+
+	def calculate_margin(self, item):
+		total_margin = 0.0
+		if item.price_list_rate:
+			if item.pricing_rule and not self.doc.ignore_pricing_rule: 
+				pricing_rule = frappe.get_doc('Pricing Rule', item.pricing_rule)
+				item.margin_type = pricing_rule.margin_type
+				item.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
+
+			if item.margin_type and item.margin_rate_or_amount:
+				margin_value = item.margin_rate_or_amount if item.margin_type == 'Amount' else flt(item.price_list_rate) * flt(item.margin_rate_or_amount) / 100
+				total_margin = flt(item.price_list_rate) + flt(margin_value)
+
+		return total_margin 
diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py
index ae6e9e4..7b934e7 100644
--- a/erpnext/controllers/website_list_for_contact.py
+++ b/erpnext/controllers/website_list_for_contact.py
@@ -28,15 +28,14 @@
 	filters.append((doctype, "docstatus", "=", 1))
 
 	if user != "Guest" and is_website_user():
+		parties_doctype = 'Request for Quotation Supplier' if doctype == 'Request for Quotation' else doctype
 		# find party for this contact
-		customers, suppliers = get_customers_suppliers(doctype, user)
+		customers, suppliers = get_customers_suppliers(parties_doctype, user)
+		key, parties = get_party_details(customers, suppliers)
 
-		if customers:
-			key, parties = "customer", customers
-		elif suppliers:
-			key, parties = "supplier", suppliers
-		else:
-			key, parties = "customer", []
+		if doctype == 'Request for Quotation':
+			if key == 'customer': frappe.throw(_("Not Permitted"), frappe.PermissionError)
+			return rfq_transaction_list(parties_doctype, doctype, parties, limit_start, limit_page_length)
 
 		filters.append((doctype, key, "in", parties))
 
@@ -52,6 +51,23 @@
 	return post_process(doctype, get_list(doctype, txt, filters, limit_start, limit_page_length,
 		fields="name", order_by = "modified desc"))
 
+def get_party_details(customers, suppliers):
+	if customers:
+		key, parties = "customer", customers
+	elif suppliers:
+		key, parties = "supplier", suppliers
+	else:
+		key, parties = "customer", []
+
+	return key, parties
+
+def rfq_transaction_list(parties_doctype, doctype, parties, limit_start, limit_page_length):
+	data = frappe.db.sql("""select distinct parent as name, supplier from `tab{doctype}`
+			where supplier = '{supplier}' and docstatus=1  order by modified desc limit {start}, {len}""".
+			format(doctype=parties_doctype, supplier=parties[0], start=limit_start, len = limit_page_length), as_dict=1)
+
+	return post_process(doctype, data)
+
 def post_process(doctype, data):
 	result = []
 	for d in data:
diff --git a/erpnext/docs/assets/img/accounts/asset-category.png b/erpnext/docs/assets/img/accounts/asset-category.png
new file mode 100644
index 0000000..ccbb6ec
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/asset-category.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/asset-purchase-invoice.png b/erpnext/docs/assets/img/accounts/asset-purchase-invoice.png
new file mode 100644
index 0000000..a421bc9
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/asset-purchase-invoice.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/asset-sales.png b/erpnext/docs/assets/img/accounts/asset-sales.png
new file mode 100644
index 0000000..329c0e2
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/asset-sales.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/asset.png b/erpnext/docs/assets/img/accounts/asset.png
new file mode 100644
index 0000000..5d741a2
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/asset.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/depreciation-entry.png b/erpnext/docs/assets/img/accounts/depreciation-entry.png
new file mode 100644
index 0000000..e35180c
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/depreciation-entry.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/depreciation-schedule.png b/erpnext/docs/assets/img/accounts/depreciation-schedule.png
new file mode 100644
index 0000000..400e4c8
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/depreciation-schedule.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/scrap-journal-entry.png b/erpnext/docs/assets/img/accounts/scrap-journal-entry.png
new file mode 100644
index 0000000..f4ba533
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/scrap-journal-entry.png
Binary files differ
diff --git a/erpnext/docs/assets/img/buying/make-supplier-quotation-from-rfq.png b/erpnext/docs/assets/img/buying/make-supplier-quotation-from-rfq.png
new file mode 100644
index 0000000..135e9fc
--- /dev/null
+++ b/erpnext/docs/assets/img/buying/make-supplier-quotation-from-rfq.png
Binary files differ
diff --git a/erpnext/docs/assets/img/buying/request-for-quotation.png b/erpnext/docs/assets/img/buying/request-for-quotation.png
new file mode 100644
index 0000000..b8b1ec2
--- /dev/null
+++ b/erpnext/docs/assets/img/buying/request-for-quotation.png
Binary files differ
diff --git a/erpnext/docs/assets/img/selling/margin-item-price-list.png b/erpnext/docs/assets/img/selling/margin-item-price-list.png
new file mode 100644
index 0000000..4961755
--- /dev/null
+++ b/erpnext/docs/assets/img/selling/margin-item-price-list.png
Binary files differ
diff --git a/erpnext/docs/assets/img/selling/margin-pricing-rule.png b/erpnext/docs/assets/img/selling/margin-pricing-rule.png
new file mode 100644
index 0000000..6dba884
--- /dev/null
+++ b/erpnext/docs/assets/img/selling/margin-pricing-rule.png
Binary files differ
diff --git a/erpnext/docs/assets/img/selling/margin-quotation-item.png b/erpnext/docs/assets/img/selling/margin-quotation-item.png
new file mode 100644
index 0000000..d5ee8a3
--- /dev/null
+++ b/erpnext/docs/assets/img/selling/margin-quotation-item.png
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/budgeting-1.png b/erpnext/docs/assets/old_images/erpnext/budgeting-1.png
deleted file mode 100644
index 29038a0..0000000
--- a/erpnext/docs/assets/old_images/erpnext/budgeting-1.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/budgeting-2-1.png b/erpnext/docs/assets/old_images/erpnext/budgeting-2-1.png
deleted file mode 100644
index 7cd431e..0000000
--- a/erpnext/docs/assets/old_images/erpnext/budgeting-2-1.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/budgeting-3.png b/erpnext/docs/assets/old_images/erpnext/budgeting-3.png
deleted file mode 100644
index 29037c7..0000000
--- a/erpnext/docs/assets/old_images/erpnext/budgeting-3.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/budgeting-4-1.png b/erpnext/docs/assets/old_images/erpnext/budgeting-4-1.png
deleted file mode 100644
index 6348f1e..0000000
--- a/erpnext/docs/assets/old_images/erpnext/budgeting-4-1.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/user/manual/en/accounts/advance-payment-entry.md b/erpnext/docs/user/manual/en/accounts/advance-payment-entry.md
index 042e800..010d897 100644
--- a/erpnext/docs/user/manual/en/accounts/advance-payment-entry.md
+++ b/erpnext/docs/user/manual/en/accounts/advance-payment-entry.md
@@ -7,19 +7,17 @@
 bed costing $10000 She is asked to give some advance before the furniture
 house begins work on her order. She gives them $5000 in cash.
 
-  
-Go to Accounts and open a new Journal Entry to make the advance entry.
+Once Sales Order or Purchase Order is submitted, you will find option to create Advance Payment entry against it.
+
+To directly create Advance Payment Entry, Go to:
 
 > Accounts > Documents > Journal Entry > New Journal Entry  
 
-Mention the voucher type as cash voucher. This differs for different
-customers. If somebody pays by cheque the voucher type will be Bank Voucher.
-Then select the customer account and make the respective debit and credit
-entries.  
+Select a Voucher Type based on a mode in which advance payment is made.
 
 Since the customer has given $5000 as cash advance,it will be recorded as a
-credit entry against the customer. To balance it with the debit entry [Double
-accounting Entry] enter $5000 as debit against the company's cash account. In
+credit entry against the customer. To balance it with the debit entry [as per the Double
+accounting system] enter $5000 as debit against the company's cash account. In
 the row "Is Advance" click 'Yes'.
 
 #### Figure 1 : Journal Entry -Advance Entry  
@@ -43,7 +41,7 @@
 
 <img class="screenshot" alt="Advace Payment" src="{{docs_base_url}}/assets/img/accounts/advance-payment-2.png">
 
-Save and submit the JV. If this document is not saved it will not be pulled in
+Save and submit the Journal Entry. If this document is not saved it will not be pulled in
 other accounting documents.
 
 When you make a new Sales Invoice for the same customer, mention the advance
diff --git a/erpnext/docs/user/manual/en/accounts/budgeting.md b/erpnext/docs/user/manual/en/accounts/budgeting.md
index a5f35d2..49a73ac 100644
--- a/erpnext/docs/user/manual/en/accounts/budgeting.md
+++ b/erpnext/docs/user/manual/en/accounts/budgeting.md
@@ -11,48 +11,35 @@
 You can define it in the Cost Center. If you have seasonal sales you can also
 define a budget distribution that the budget will follow.
 
-In order to allocate budget, go to Accounts > Setup > Chart of Cost Centers and click on Chart of Cost Center.
-Select a Cost Center and click on Open.
+In order to allocate budget, go to:
 
-#### Step 1: Click on Edit.
+> Accounts > Setup > Chart of Cost Centers 
 
-![]({{docs_base_url}}/assets/old_images/erpnext/budgeting-1.png)  
+and click on Chart of Cost Center. Select a Cost Center and click on Open.
 
-<img alt="Accounts Receivable" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/accounts-receivable.png">
+#### Step 1: Click on Edit.	 
 
-#### Step 2: Enter Monthly Distribution.
+<img alt="Cost Center" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-1.gif">
 
-![]({{docs_base_url}}/assets/old_images/erpnext/budgeting-2-1.png)
+#### Step 3:Add New Row and select budget account.  
 
+<img alt="Cost Center Account" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-2.png"> 
+
+#### Step 3: Enter Monthly Distribution (optional)
+
+<img alt="Cost Center" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-distribution.gif">
 
 If you leave the** **distribution ID blank, ERPNext will calculate on a yearly
 basis or in equal proportion for every month.
 
-#### Step 3:Add New Row and select budget account.  
-
-
-
-![]({{docs_base_url}}/assets/old_images/erpnext/budgeting-3.png)  
-
-
-
 ### To Create New Distribution ID
 
-ERPNext allows you to take a few budget actions. It signifies whether to stop
-, warn or Ignore  if you exceed budgets.  
-
-![]({{docs_base_url}}/assets/old_images/erpnext/budgeting-4.png)
-
-
+ERPNext allows you to take a few budget actions. It signifies whether to stop, warn or Ignore  if you exceed budgets.
 
 These can be defined from the Company record.
 
-![]({{docs_base_url}}/assets/old_images/erpnext/budgeting-4-1.png)  
+<img alt="Cost Center" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-company.gif">
 
-
-
-Even if you choose to “ignore” budget overruns, you will get a wealth of
-information from the “Budget vs Actual” variance report. This report shows
-month wise actual expenses as compared to the budgeted expenses.
+Even if you choose to “ignore” budget overruns, you will get a wealth of information from the “Budget vs Actual” variance report. This report shows month wise actual expenses as compared to the budgeted expenses.
 
 {next}
diff --git a/erpnext/docs/user/manual/en/accounts/index.txt b/erpnext/docs/user/manual/en/accounts/index.txt
index 1a1d5d5..fcb7441 100644
--- a/erpnext/docs/user/manual/en/accounts/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/index.txt
@@ -10,6 +10,7 @@
 opening-entry
 accounting-reports
 accounting-entries
+managing-fixed-assets
 budgeting
 opening-accounts
 item-wise-tax
diff --git a/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md b/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
new file mode 100644
index 0000000..35b83aa
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
@@ -0,0 +1,71 @@
+In ERPNext, you can maintain your fixed asset records like Computers, Building, Cars etc and manage depreciations, sell or disposal of those assets.
+
+## Asset Category
+
+To start first you should create Asset Category, depending on the type of assets. For example, all your desktops and laptops can be part of a Asset Category named "Computers". Here, you can set default depreciation method, periodicity and depreciation related accounts, which will be applicable to all the assets under the category.
+
+<img class="screenshot" alt="Asset Category" src="{{docs_base_url}}/assets/img/accounts/asset-category.png">
+
+> **Note:** You can also set default depreciation related Accounts and Cost Centers in Company.
+
+
+## Asset
+
+Next step will be creating the fixed asset records. The assets which are partially / fully depreciated can also be created/maintained for the future reference.
+
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/asset.png">
+
+Explanation of the fields:
+
+1. Asset Category: The category of assets it belongs to.
+2. Item Code: The item/product code for the asset, which must be marked as a fixed asset and a non-stock item.
+3. Status: The options are - Draft, Submitted, Partially Depreciated, Fully Depreciated, Sold and Scrapped.
+4. Gross Purchase Amount: The purchase cost of the asset
+5. Expected Value After Useful Life: Useful Life is the time period over in which the company expects that the asset will be productive. After that period, either the asset is scrapped or sold. In case it is sold, mention the estimated value here. This value is also known as Salvage Value, Scrap Value or Residual Value.
+6. Current Value (After Depreciation): In case you are creating record of an existing asset which has already been partially/fully depreciated, mention the currect value of the asset. In case of new asset, mention the purchase amount or leave it blank.
+7. Depreciation Method: There are two options: Straight Line and Double Declining Balance.
+	- Straight Line: This method spreads the cost of the fixed asset evenly over its useful life.
+	- Double Declining Method: An accelerated method of depreciation, it results in higher depreciation expense in the earlier years of ownership.
+8. Number of Depreciations: The number of depreciations during the useful life. In case of existing assets which are partially depreciated, mention the number of pending depreciations.
+9. Number of Months in a Period: The number of months between two depreciations.
+10. Next Depreciation Date: Mention the next depreciation date, even if it is the first one. If depreciation already completed, leave it blank.
+
+### Depreciations
+
+The system automatically creates a schedule for depreciation based on depreciation method and other related inputs in the Asset record.
+
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/depreciation-schedule.png">
+
+On the scheduled date, system creates depreciation entry by creating a Journal Entry and the same Journal Entry is updated in the depreciation table for reference. Next Depreciation Date and Current Value are also updated on submission of depreciation entry.
+
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/depreciation-entry.png">
+
+In the depreciation entry, the "Accumulated Depreciation Account" is credited and "Depreciation Expense Account" is debited. The related accounts can be set in the Asset Category or Company.
+
+
+## Purchase an asset
+
+For purchasing an asset, first create an item for the asset with "Is Fixed Asset" checked. Then create a Purchase Invoice against that item. In the Purchase Invoice Item row, you have to mention Asset name and associated fixed asset account should be set as Expense Account. Fixed asset accounts are identified based on "Fixed Asset" account type.
+
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/asset-purchase-invoice.png">
+
+System will validate purchase date, supplier with the value mentioned in the Asset record. On submission of the Invoice, the "Fixed Asset Account" will be debited. It will also update Purchase Invoice number in the Asset.
+
+
+## Sell an ssset
+
+To sale an asset, create a Sales Invoice against the item linked with the asset. On submission of Sales Invoice, following entries will take place:
+
+- "Receivable Account" (Debtors) will be debited by the sales amount.
+- "Fixed Asset Account" will be credited by the purchase amount of asset.
+- "Accumulated Depreciation Account" will be debited by the total depreciated amount till now.
+- "Gain/Loss Account on Asset Disposal" will be credited/debited based on gain/loss amount. The Gain/Loss account can be set in Company record.
+
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/asset-sales.png">
+
+
+## Scrap an Asset
+
+You can scrap an asset anytime using the "Scrap Asset" button in the Asset record. The "Gain/Loss Account on Asset Disposal" mentioned in the Company is debited by the Current Value (After Depreciation) of the asset. , After scrapping, you can also restore the asset using "Restore Asset" button.
+
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/scrap-journal-entry.png">
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/accounts/opening-accounts.md b/erpnext/docs/user/manual/en/accounts/opening-accounts.md
index 28ba0c2..fc86cdd 100644
--- a/erpnext/docs/user/manual/en/accounts/opening-accounts.md
+++ b/erpnext/docs/user/manual/en/accounts/opening-accounts.md
@@ -1,4 +1,4 @@
-Now that you have completed most of the setup, its time to start moving in!
+	Now that you have completed most of the setup, its time to start moving in!
 
 There are two important sets of data you need to enter before you start your
 operations.
@@ -29,11 +29,7 @@
 
 #### Temporary Accounts
 
-A nice way to simplify opening is to use a temporary account
-just for opening. These accounts will become zero once all your old
-invoices and opening balances of bank, debt stock etc are entered.
-In the standard chart of accounts, a **Temporary Opening** account is created under
-assets
+A nice way to simplify opening is to use a temporary account just for opening. These accounts will become zero once all your old invoices and opening balances of bank, debt stock etc are entered. In the standard chart of accounts, a **Temporary Opening** account is created under assets
 
 #### The Opening Entry
 
@@ -54,7 +50,6 @@
 
 ![Opening Temp Entry]({{docs_base_url}}/assets/old_images/erpnext/image-temp-opening.png)
 
-
 ![Opening Entry]({{docs_base_url}}/assets/old_images/erpnext/opening-entry-2.png)
 
 Temporary Asset and Liability account is used for balancing purpose. When you update opening balance in Liability Account, you can use Temporary Asset Account for balancing.
@@ -68,26 +63,19 @@
   * In this method you can update opening balance of specific balancesheet accounts and not for all.
   * Opening entry is only for balance sheet accounts and not for expense or Income accounts.
 
-After completing the accounting entries, the trial balance report will look
-like the one given below:
-
+After completing the accounting entries, the trial balance report will look like the one given below:
 
 ![Trial Balance]({{docs_base_url}}/assets/old_images/erpnext/trial-balance-1.png)
 
 #### Outstanding Invoices
 
-After your Opening Journal Entrys are made, you will need to enter each
-Sales Invoice and Purchase Invoice that is yet to be paid.
+After your Opening Journal Entrys are made, you will need to enter each Sales Invoice and Purchase Invoice that is yet to be paid.
 
-Since you have already booked the income or expense on these invoices in the
-previous period, select the temp opening account **Temporary Opening** in the “Income” and
-“Expense” accounts.
+Since you have already booked the income or expense on these invoices in the previous period, select the temp opening account **Temporary Opening** in the “Income” and “Expense” accounts.
 
 > Note: Make sure to set each invoice as “Is Opening”!
 
-If you don’t care what items are in that invoice, just make a dummy item entry
-in the Invoice. Item code in the Invoice is not necessary, so it should not be
-such a problem.
+If you don’t care what items are in that invoice, just make a dummy item entry in the Invoice. Item code in the Invoice is not necessary, so it should not be such a problem.
 
 Once all your invoices are entered, your **Temporary Opening** account will have a balance of zero!
 
diff --git a/erpnext/docs/user/manual/en/buying/index.txt b/erpnext/docs/user/manual/en/buying/index.txt
index a12bb06..25c8797 100644
--- a/erpnext/docs/user/manual/en/buying/index.txt
+++ b/erpnext/docs/user/manual/en/buying/index.txt
@@ -1,4 +1,5 @@
 supplier
+request-for-quotation
 supplier-quotation
 purchase-order
 setup
diff --git a/erpnext/docs/user/manual/en/buying/request-for-quotation.md b/erpnext/docs/user/manual/en/buying/request-for-quotation.md
new file mode 100644
index 0000000..379cdb5
--- /dev/null
+++ b/erpnext/docs/user/manual/en/buying/request-for-quotation.md
@@ -0,0 +1,14 @@
+A Request for Quotation is a document that an organization submits to one or more suppliers eliciting quotation for items.
+
+In ERPNext, You can create request for quotation directly by going to:
+
+`Buying > Documents > Request for Quotation > New Request for Quotation`
+
+Create Request for Quotation:
+
+![Request For Quotation]({{docs_base_url}}/assets/img/buying/request-for-quotation.png)
+
+Create Supplier Quotation from Request for Quotation form:
+
+![Request For Quotation]({{docs_base_url}}/assets/img/buying/make-supplier-quotation-from-rfq.png)
+ 
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/print-format.md b/erpnext/docs/user/manual/en/customize-erpnext/print-format.md
index 34ef16d..f0ca942 100644
--- a/erpnext/docs/user/manual/en/customize-erpnext/print-format.md
+++ b/erpnext/docs/user/manual/en/customize-erpnext/print-format.md
@@ -29,7 +29,7 @@
 
 Print Formats are rendered on the server side using the [Jinja Templating Language](http://jinja.pocoo.org/docs/templates/). All forms have access to the doc object which contains information about the document that is being formatted. You can also access common utilities via the frappe module.
 
-For styling, the [Boostrap CSS Framework](http://getbootstrap.com/) is provided and you can enjoy the full range of classes.
+For styling, the [Bootstrap CSS Framework](http://getbootstrap.com/) is provided and you can enjoy the full range of classes.
 
 > Note: Pre-printed stationary is usually not a good idea because your Prints
 will look incomplete (inconsistent) when you send them by mail.
diff --git a/erpnext/docs/user/manual/en/selling/articles/adding-margin.md b/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
new file mode 100644
index 0000000..2a9ddfa
--- /dev/null
+++ b/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
@@ -0,0 +1,37 @@
+#Adding Margin
+
+User Can apply the margin on Quotation Item and Sales Order Item using following two options.
+1)Price Rule: With the help of this method user can apply the margin on Quotation and Sales Order based on condition. you can find the section margin on pricing rule where a user has to select the type of margin whether it is Percentage or Amount and rate or amount. The system will apply the margin on quotation item and sales order item if pricing rule is enabled.
+
+To setup Pricing Rule, go to:
+
+`Selling > Setup > Pricing Rule` or `Accounts > Setup > Pricing Rule`
+
+####Adding Margin in Pricing Rule
+
+<img alt="Adding Margin in Pricing Rule" class="screenshot"  src="{{docs_base_url}}/assets/img/articles/margin-pricing-rule.png">
+
+Total Margin is calculated as follows:
+`Rate = Price List Rate + Margin Rate`
+
+So, In order to apply the Margin you need to add the Price List for the Item
+
+To add Price List, go to:
+
+`Selling > Setup > Item Price` or `Stock > Setup > Item Price`
+
+####Adding Item Price
+
+<img alt="Adding Margin in Pricing Rule" class="screenshot"  src="{{docs_base_url}}/assets/img/articles/margin-item-price-list.png">
+
+2) Apply margin direct on Item: If user wants to apply the margin without pricing rule, they can use this option. In Quotation Item and Sales Order Item, user can select the margin type and rate or amount. The system will calculate the margin and apply it on price list rate to calculate the rate of the product.
+
+To add margin directly on Quotation or Sales Order, go to:
+
+`Selling > Document > Quotation`
+
+add item and scroll down to section where you can find the Margin Type
+
+####Adding Margin in Quotation
+
+<img alt="Adding Margin in Quotation" class="screenshot"  src="{{docs_base_url}}/assets/img/articles/margin-quotation-item.png">
diff --git a/erpnext/docs/user/manual/en/stock/accounting-of-inventory-stock/perpetual-inventory.md b/erpnext/docs/user/manual/en/stock/accounting-of-inventory-stock/perpetual-inventory.md
index fbe880f..80970bf 100644
--- a/erpnext/docs/user/manual/en/stock/accounting-of-inventory-stock/perpetual-inventory.md
+++ b/erpnext/docs/user/manual/en/stock/accounting-of-inventory-stock/perpetual-inventory.md
@@ -143,11 +143,11 @@
 <p><strong>Stock Ledger</strong>
 </p>
 
-![pr<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-2.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-2.png">
 
 **General Ledger**
 
-![pr<em>general</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-3.png)
+<img alt="Leger" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-3.png">
 
 As stock balance increases through Purchase Receipt, "Store" and "Fixed Asset
 Warehouse" accounts are debited and a temporary account "Stock Receipt But Not
@@ -162,7 +162,7 @@
 
 **General Ledger**
 
-![pi<em>general</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-4.png)
+<img alt="General" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-4.png">
 
 Here "Stock Received But Not Billed" account is debited and nullified the
 effect of Purchase Receipt.
@@ -220,11 +220,11 @@
 
 **Stock Ledger**
 
-![dn<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-5.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-5.png">
 
 **General Ledger**
 
-![dn<em>general</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-6.png)
+<img alt="General" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-6.png">
 
 As item is delivered from "Stores" warehouse, "Stores" account is credited and
 equal amount is debited to the expense account "Cost of Goods Sold". The
@@ -254,11 +254,11 @@
 
 **Stock Ledger**
 
-![si<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-7.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-7.png">
 
 **General Ledger**
 
-![si<em>general</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-8.png)
+<img alt="General" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-8.png">
 
 Here, apart from normal account entries for invoice, "Stores" and "Cost of
 Goods Sold" accounts are also affected based on the valuation amount.
@@ -292,11 +292,11 @@
 
 **Stock Ledger**
 
-![mr<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-9.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-9.png">
 
 **General Ledger**
 
-![mr<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-10.png)
+<img alt="General" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-10.png">
 
 * * *
 
@@ -327,11 +327,11 @@
 
 **Stock Ledger**
 
-![mi<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-11.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-11.png">
 
 **General Ledger**
 
-![mi<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-12.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-12.png">
 
 * * *
 
@@ -364,8 +364,10 @@
 
 **Stock Ledger**
 
-![mtn<em>stock</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-13.png)
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-13.png">
 
 **General Ledger**
 
-![mtn<em>general</em>ledger]({{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-14.png)
\ No newline at end of file
+<img alt="Stock" class="screenshot" src="{{docs_base_url}}/assets/old_images/erpnext/accounting-for-stock-14.png">
+
+{ next }
\ No newline at end of file
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 6e86d84..3799565 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.27.3"
+app_version = "6.27.5"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
@@ -71,6 +71,13 @@
 			"parents": [{"title": _("Shipments"), "name": "shipments"}]
 		}
 	},
+	{"from_route": "/rfq", "to_route": "Request for Quotation"},
+	{"from_route": "/rfq/<path:name>", "to_route": "rfq",
+		"defaults": {
+			"doctype": "Request for Quotation",
+			"parents": [{"title": _("Request for Quotation"), "name": "rfq"}]
+		}
+	},
 	{"from_route": "/jobs", "to_route": "Job Opening"},
 ]
 
@@ -130,7 +137,8 @@
 		"erpnext.support.doctype.issue.issue.auto_close_tickets",
 		"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year",
 		"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
-		"erpnext.projects.doctype.task.task.set_tasks_as_overdue"
+		"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
+		"erpnext.accounts.doctype.asset.depreciation.post_depreciation_entries"
 	]
 }
 
@@ -143,3 +151,7 @@
 get_translated_dict = {
 	("doctype", "Global Defaults"): "frappe.geo.country_info.get_translated_dict"
 }
+
+bot_parsers = [
+	'erpnext.utilities.bot.FindItemBot',
+]
\ No newline at end of file
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index db580f4..9e6afff 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -229,14 +229,13 @@
 		and status = 'Active'""", {"date": today()}, as_dict=True)
 
 def get_holiday_list_for_employee(employee, raise_exception=True):
-	employee = frappe.db.get_value("Employee", employee, ["holiday_list", "company"], as_dict=True)
-	holiday_list = employee.holiday_list
+	holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"])
 
 	if not holiday_list:
-		holiday_list = frappe.db.get_value("Company", employee.company, "default_holiday_list")
+		holiday_list = frappe.db.get_value("Company", company, "default_holiday_list")
 
 	if not holiday_list and raise_exception:
-		frappe.throw(_("Please set a Holiday List for either the Employee or the Company"))
+		frappe.throw(_('Please set a default Holiday List for Employee {0} or Company {0}').format(employee, company))
 
 	return holiday_list
 
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 16e78a6..d6bb12e 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -39,7 +39,7 @@
 					d1.account_type = r.message.account_type;
 				}
 
-				loaddoc('Journal Entry', jv.name);
+				frappe.set_route('Form', 'Journal Entry', jv.name);
 			}
 		});
 	}
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 5bf7e9d..6882034 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -335,16 +335,14 @@
 
 
 def get_holidays(employee, from_date, to_date):
-	tot_hol = frappe.db.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1
-		where e1.name = %s and h1.parent = h2.name and e1.holiday_list = h2.name
-		and h1.holiday_date between %s and %s""", (employee, from_date, to_date))[0][0]
+	'''get holidays between two dates for the given employee'''
+	holiday_list = get_holiday_list_for_employee(employee)
 
-	if not tot_hol:
-		tot_hol = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
-			where h1.parent = h2.name and h1.holiday_date between %s and %s
-			and h2.is_default = 1""", (from_date, to_date))[0][0]
+	holidays = frappe.db.sql("""select count(distinct holiday_date) from `tabHoliday` h1, `tabHoliday List` h2
+		where h1.parent = h2.name and h1.holiday_date between %s and %s
+		and h2.name = %s""", (from_date, to_date, holiday_list))[0][0]
 
-	return tot_hol
+	return holidays
 
 def is_lwp(leave_type):
 	lwp = frappe.db.sql("select is_lwp from `tabLeave Type` where name = %s", leave_type)
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 24a21d9..97196f0 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -56,7 +56,7 @@
 		self.manage_default_bom()
 
 	def get_item_det(self, item_code):
-		item = frappe.db.sql("""select name, item_name, is_asset_item, is_purchase_item,
+		item = frappe.db.sql("""select name, item_name, is_fixed_asset, is_purchase_item,
 			docstatus, description, image, is_sub_contracted_item, stock_uom, default_bom,
 			last_purchase_rate
 			from `tabItem` where name=%s""", item_code, as_dict = 1)
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 04022c5..2c58fd2 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -267,7 +267,7 @@
 
 				# if time log needs to be moved, make sure that the from time is not the same
 				if _from_time == time_log.from_time:
-					frappe.throw("Capacity Planning Error")
+					frappe.throw(_("Capacity Planning Error"))
 
 			d.planned_start_time = time_log.from_time
 			d.planned_end_time = time_log.to_time
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d0b738f..5c2376e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -258,4 +258,5 @@
 erpnext.patches.v6_20x.remove_fiscal_year_from_holiday_list
 erpnext.patches.v6_24.map_customer_address_to_shipping_address_on_po
 erpnext.patches.v6_27.fix_recurring_order_status
-erpnext.patches.v6_20x.remove_customer_supplier_roles
\ No newline at end of file
+erpnext.patches.v6_20x.remove_customer_supplier_roles
+erpnext.patches.v6_24.rename_item_field
diff --git a/erpnext/patches/v6_24/rename_item_field.py b/erpnext/patches/v6_24/rename_item_field.py
new file mode 100644
index 0000000..1425d8f
--- /dev/null
+++ b/erpnext/patches/v6_24/rename_item_field.py
@@ -0,0 +1,10 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+	frappe.reload_doctype("Item")
+	rename_field("Item", "is_asset_item", "is_fixed_asset")
\ No newline at end of file
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index 443ddba..31d6538 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -37,7 +37,7 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "fieldname": "project", 
    "fieldtype": "Link", 
@@ -770,7 +770,7 @@
  "istable": 0, 
  "max_attachments": 5, 
  "menu_index": 0, 
- "modified": "2016-03-25 05:27:03.346334", 
+ "modified": "2016-03-29 01:01:50.074252", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Task", 
diff --git a/erpnext/projects/doctype/task/task_list.js b/erpnext/projects/doctype/task/task_list.js
index 48a4655..212aec0 100644
--- a/erpnext/projects/doctype/task/task_list.js
+++ b/erpnext/projects/doctype/task/task_list.js
@@ -1,5 +1,6 @@
 frappe.listview_settings['Task'] = {
 	add_fields: ["project", "status", "priority", "exp_end_date"],
+	filters: [["status", "=", "Open"]],
 	onload: function(listview) {
 		var method = "erpnext.projects.doctype.task.task.set_multiple_status";
 
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index b2a855d..1d523d9 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -193,7 +193,7 @@
 			or self.get_overlap_for("user")
 
 		if not overlapping:
-			frappe.throw("Logical error: Must find overlapping")
+			frappe.throw(_("Logical error: Must find overlapping"))
 
 		self.from_time = get_datetime(overlapping.to_time) + get_mins_between_operations()
 
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 6de5154..9f4ee9f 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -441,10 +441,15 @@
 		this.frm.toggle_reqd("plc_conversion_rate",
 			!!(this.frm.doc.price_list_name && this.frm.doc.price_list_currency));
 
-		var company_currency = this.get_company_currency();
-		this.change_form_labels(company_currency);
-		this.change_grid_labels(company_currency);
-		this.frm.refresh_fields();
+		if(this.frm.doc_currency!==this.frm.doc.currency) {
+			// reset names only when the currency is different
+
+			var company_currency = this.get_company_currency();
+			this.change_form_labels(company_currency);
+			this.change_grid_labels(company_currency);
+			this.frm.refresh_fields();
+			this.frm.doc_currency = this.frm.doc.currency;
+		}
 	},
 
 	change_form_labels: function(company_currency) {
@@ -643,6 +648,12 @@
 					"parenttype": d.parenttype,
 					"parent": d.parent
 				});
+
+				// if doctype is Quotation Item / Sales Order Iten then add Margin Type and rate in item_list
+				if (in_list(["Quotation Item", "Sales Order Item", "Delivery Note Item", "Sales Invoice Item"]), d.doctype){
+					item_list[0]["margin_type"] = d.margin_type
+					item_list[0]["margin_rate_or_amount"] = d.margin_rate_or_amount
+				}
 			}
 		};
 
@@ -845,7 +856,7 @@
 			if(!this.frm.doc.recurring_id) {
 				this.frm.set_value('recurring_id', this.frm.doc.name);
 			}
-			
+
 			var owner_email = this.frm.doc.owner=="Administrator"
 				? frappe.user_info("Administrator").email
 				: this.frm.doc.owner;
@@ -873,7 +884,7 @@
 			}
 		}
 	},
-	
+
 	set_gross_profit: function(item) {
 		if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) {
 			rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1);
@@ -891,7 +902,7 @@
 	} else {
 		item.discount_percentage = 0.0;
 	}
-	
+
 	cur_frm.cscript.set_gross_profit(item);
 	cur_frm.cscript.calculate_taxes_and_totals();
 })
@@ -957,5 +968,3 @@
 
 	frm.cscript.calculate_taxes_and_totals();
 });
-
-
diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py
index 3f30d05..e3b359d 100644
--- a/erpnext/selling/doctype/quotation/test_quotation.py
+++ b/erpnext/selling/doctype/quotation/test_quotation.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 from __future__ import unicode_literals
 
-import frappe, json
+import frappe
 from frappe.utils import flt
 import unittest
 
@@ -32,5 +32,40 @@
 		sales_order.transaction_date = "2013-05-12"
 		sales_order.insert()
 
+	def test_create_quotation_with_margin(self):
+		from erpnext.selling.doctype.quotation.quotation import make_sales_order
+		from erpnext.selling.doctype.sales_order.sales_order \
+			import make_delivery_note, make_sales_invoice
+
+		total_margin = flt((1500*18.75)/100 + 1500)
+
+		test_records[0]['items'][0]['price_list_rate'] = 1500
+		test_records[0]['items'][0]['margin_type'] = 'Percentage'
+		test_records[0]['items'][0]['margin_rate_or_amount'] = 18.75
+
+		quotation = frappe.copy_doc(test_records[0])
+		quotation.insert()
+
+		self.assertEquals(quotation.get("items")[0].rate, total_margin)
+		self.assertRaises(frappe.ValidationError, make_sales_order, quotation.name)
+		quotation.submit()
+
+		sales_order = make_sales_order(quotation.name)
+		sales_order.delivery_date = "2016-01-02"
+		sales_order.naming_series = "_T-Quotation-"
+		sales_order.transaction_date = "2016-01-01"
+		sales_order.insert()
+
+		self.assertEquals(quotation.get("items")[0].rate, total_margin)
+
+		sales_order.submit()
+
+		dn = make_delivery_note(sales_order.name)
+		self.assertEquals(quotation.get("items")[0].rate, total_margin)
+		dn.save()
+
+		si = make_sales_invoice(sales_order.name)
+		self.assertEquals(quotation.get("items")[0].rate, total_margin)
+		si.save()
 
 test_records = frappe.get_test_records('Quotation')
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index b58568f..eca07cf 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -7,6 +7,7 @@
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
+ "document_type": "Document", 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -325,35 +326,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "price_list_rate", 
-   "fieldname": "discount_percentage", 
-   "fieldtype": "Percent", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Discount on Price List Rate (%)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "adj_rate", 
-   "oldfieldtype": "Float", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "100px", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
-   "width": "100px"
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "col_break2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -434,6 +406,163 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "discount_and_margin", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Discount and Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "discount_percentage", 
+   "fieldtype": "Percent", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "adj_rate", 
+   "oldfieldtype": "Float", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "100px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_18", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "margin_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nPercentage\nAmount", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate", 
+   "fieldname": "margin_rate_or_amount", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Rate or Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate", 
+   "fieldname": "total_margin", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Total Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 1, 
+   "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, 
    "fieldname": "section_break1", 
    "fieldtype": "Section Break", 
@@ -458,6 +587,7 @@
    "allow_on_submit": 0, 
    "bold": 1, 
    "collapsible": 0, 
+   "depends_on": "", 
    "fieldname": "rate", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -1097,7 +1227,7 @@
  "istable": 1, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-02-26 18:30:22.286356", 
+ "modified": "2016-03-29 07:06:02.477033", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation Item", 
@@ -1106,5 +1236,6 @@
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 16c98b9..22800b7 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -216,7 +216,7 @@
 	tn = frappe.model.make_new_doc_and_get_name('Contact');
 	locals['Contact'][tn].is_customer = 1;
 	if(doc.customer) locals['Contact'][tn].customer = doc.customer;
-	loaddoc('Contact', tn);
+	frappe.set_route('Form', 'Contact', tn);
 }
 
 cur_frm.fields_dict['project'].get_query = function(doc, cdt, cdn) {
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index edd7cdf..4ba6ff0 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -415,6 +415,21 @@
 
 		self.assertEquals(get_reserved_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_reserved_qty)
 
+	def test_create_so_with_margin(self):
+		so = make_sales_order(item_code="_Test Item", qty=1, do_not_submit=True)
+		so.items[0].price_list_rate = price_list_rate = 100
+		so.items[0].margin_type = 'Percentage'
+		so.items[0].margin_rate_or_amount = 25
+		so.insert()
+		
+		new_so = frappe.copy_doc(so)
+		new_so.save(ignore_permissions=True)
+		
+		self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
+		new_so.items[0].margin_rate_or_amount = 25
+		new_so.submit()
+
+		self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
 
 def make_sales_order(**args):
 	so = frappe.new_doc("Sales Order")
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index fb65ee8..c356a56 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -326,35 +326,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "price_list_rate", 
-   "fieldname": "discount_percentage", 
-   "fieldtype": "Percent", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Discount on Price List Rate (%)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "adj_rate", 
-   "oldfieldtype": "Float", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "70px", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
-   "width": "70px"
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "col_break2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -435,6 +406,163 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "discount_and_margin", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Discount and Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "discount_percentage", 
+   "fieldtype": "Percent", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "adj_rate", 
+   "oldfieldtype": "Float", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "70px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "70px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_19", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "margin_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nPercentage\nAmount", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate", 
+   "fieldname": "margin_rate_or_amount", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Rate or Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate", 
+   "fieldname": "total_margin", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Total Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 1, 
+   "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, 
    "fieldname": "section_break_simple1", 
    "fieldtype": "Section Break", 
@@ -459,8 +587,9 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "depends_on": "eval: doc.type != \"\"", 
    "fieldname": "rate", 
-   "fieldtype": "Currency", 
+   "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -502,6 +631,7 @@
    "oldfieldtype": "Currency", 
    "options": "currency", 
    "permlevel": 0, 
+   "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "print_width": "100px", 
@@ -1392,7 +1522,7 @@
  "istable": 1, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-02-26 11:08:24.708912", 
+ "modified": "2016-03-29 07:06:13.657725", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order Item", 
@@ -1401,5 +1531,6 @@
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 25045fa..bfefb9f 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -122,10 +122,13 @@
 		var item = frappe.get_doc(cdt, cdn);
 		frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
 
-		item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
-			precision("rate", item));
-		
-		this.set_gross_profit(item);
+		// check if child doctype is Sales Order Item/Qutation Item and calculate the rate
+		if(in_list(["Quotation Item", "Sales Order Item", "Delivery Note Item", "Sales Invoice Item"]), cdt)
+			this.calculate_revised_margin_and_rate(item, doc,cdt, cdn);
+		else
+			item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
+				precision("rate", item));
+
 		this.calculate_taxes_and_totals();
 	},
 
@@ -302,11 +305,51 @@
 			callback: function(r) {
 				if(!r.exc){
 					var doc = frappe.model.sync(r.message);
-					console.log(r.message)
 					frappe.set_route("Form", r.message.doctype, r.message.name);
 				}
 			}
 		})
+	},
+
+	rate: function(doc, cdt, cdn){
+		// if user changes the rate then set margin Rate or amount to 0
+		item = locals[cdt][cdn];
+		item.margin_type = "";
+		item.margin_rate_or_amount = 0.0;
+		cur_frm.refresh_fields();
+	},
+
+	margin_rate_or_amount: function(doc, cdt, cdn) {
+		// calculated the revised total margin and rate on margin rate changes
+		item = locals[cdt][cdn];
+		this.calculate_revised_margin_and_rate(item)
+		this.calculate_taxes_and_totals();
+		cur_frm.refresh_fields();
+	},
+
+	margin_type: function(doc, cdt, cdn){
+		// calculate the revised total margin and rate on margin type changes
+		item = locals[cdt][cdn];
+		this.calculate_revised_margin_and_rate(item, doc,cdt, cdn)
+		this.calculate_taxes_and_totals();
+		cur_frm.refresh_fields();
+	},
+
+	calculate_revised_margin_and_rate: function(item){
+		if(in_list(["Percentage", "Amount"], item.margin_type)){
+			if(item.margin_type == "Percentage")
+				item.total_margin = item.price_list_rate + item.price_list_rate * ( item.margin_rate_or_amount / 100);
+			else
+				item.total_margin = item.price_list_rate + item.margin_rate_or_amount;
+			item.rate = flt(item.total_margin * (1 - item.discount_percentage / 100.0),
+				precision("rate", item));
+		}
+		else{
+			item.rate_or_amount = 0.0;
+			item.total_margin = 0.0;
+			item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
+				precision("rate", item));
+		}
 	}
 });
 
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 01a2d1d..dfa6c0a 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -136,8 +136,12 @@
 		["default_expense_account", {"root_type": "Expense"}],
 		["default_income_account", {"root_type": "Income"}],
 		["round_off_account", {"root_type": "Expense"}],
+		["accumulated_depreciation_account", {"root_type": "Asset"}],
+		["depreciation_expense_account", {"root_type": "Expense"}],
+		["disposal_account", {"report_type": "Profit and Loss"}],
 		["cost_center", {}],
-		["round_off_cost_center", {}]
+		["round_off_cost_center", {}],
+		["depreciation_cost_center", {}]
 	], function(i, v) {
 		erpnext.company.set_custom_query(frm, v);
 	});
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index 76165ef..9d6785d 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -253,7 +253,6 @@
    "no_copy": 0, 
    "options": "Terms and Conditions", 
    "permlevel": 0, 
-   "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
@@ -965,6 +964,159 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "fixed_asset_depreciation_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Fixed Asset Depreciation Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "accumulated_depreciation_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Accumulated Depreciation Account", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0, 
+   "fieldname": "depreciation_expense_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Depreciation Expense Account", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0, 
+   "fieldname": "column_break_40", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "fieldname": "disposal_account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Gain/Loss Account on Asset Disposal", 
+   "length": 0, 
+   "no_copy": 1, 
+   "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": 0, 
+   "fieldname": "depreciation_cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Asset Depreciation Cost Center", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Cost Center", 
+   "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": 0, 
    "description": "For reference only.", 
    "fieldname": "company_info", 
    "fieldtype": "Section Break", 
@@ -1235,8 +1387,8 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-08 20:21:46.331870", 
- "modified_by": "anand@erpnext.com", 
+ "modified": "2016-03-10 04:34:43.440914", 
+ "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Company", 
  "owner": "Administrator", 
diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json
index a1ccee2..e5ccc2d 100644
--- a/erpnext/setup/doctype/item_group/item_group.json
+++ b/erpnext/setup/doctype/item_group/item_group.json
@@ -18,6 +18,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "General Settings", 
@@ -25,6 +26,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -40,6 +42,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Group Name", 
@@ -49,6 +52,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -58,13 +62,14 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "description": "", 
    "fieldname": "parent_item_group", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Parent Item Group", 
@@ -75,6 +80,7 @@
    "options": "Item Group", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -91,6 +97,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Has Child Node", 
@@ -101,6 +108,7 @@
    "options": "\nYes\nNo", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -116,12 +124,14 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -137,6 +147,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Income Account", 
@@ -145,6 +156,7 @@
    "options": "Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -160,6 +172,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Expense Account", 
@@ -168,6 +181,7 @@
    "options": "Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -183,6 +197,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Cost Center", 
@@ -191,6 +206,7 @@
    "options": "Cost Center", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -206,6 +222,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Settings", 
@@ -213,6 +230,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -229,6 +247,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Show in Website", 
@@ -236,6 +255,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -252,6 +272,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Name", 
@@ -259,6 +280,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -275,6 +297,7 @@
    "fieldtype": "Read Only", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Parent Website Route", 
@@ -283,6 +306,7 @@
    "options": "", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -300,6 +324,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Slideshow", 
@@ -308,6 +333,7 @@
    "options": "Website Slideshow", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -325,6 +351,7 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -332,6 +359,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -348,6 +376,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Website Specifications", 
@@ -356,6 +385,7 @@
    "options": "Item Website Specification", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -371,6 +401,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "lft", 
@@ -380,6 +411,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -395,6 +427,7 @@
    "fieldtype": "Int", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "rgt", 
@@ -404,6 +437,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -420,6 +454,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "old_parent", 
@@ -430,6 +465,7 @@
    "options": "Item Group", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 1, 
    "reqd": 0, 
@@ -448,7 +484,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 3, 
- "modified": "2015-11-16 06:29:48.316308", 
+ "modified": "2016-03-28 08:38:30.868523", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Item Group", 
@@ -577,5 +613,7 @@
  ], 
  "read_only": 0, 
  "read_only_onload": 0, 
- "search_fields": "parent_item_group"
+ "search_fields": "parent_item_group", 
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index c3bd452..28a07f3 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -49,7 +49,9 @@
 			"company_tagline"	:"Testing",
 			"email"				:"test@erpnext.com",
 			"password"			:"test",
-			"chart_of_accounts" : "Standard"
+			"chart_of_accounts" : "Standard",
+			"domain"			: "Manufacturing",
+			
 		})
 
 	frappe.db.sql("delete from `tabLeave Allocation`")
diff --git a/erpnext/shopping_cart/utils.py b/erpnext/shopping_cart/utils.py
index 3e1afe2..7cd269d 100644
--- a/erpnext/shopping_cart/utils.py
+++ b/erpnext/shopping_cart/utils.py
@@ -16,6 +16,8 @@
 	return False
 
 def set_cart_count(login_manager):
+	role, parties = check_customer_or_supplier()
+	if role == 'Supplier': return
 	if show_cart_count():
 		from erpnext.shopping_cart.cart import set_cart_count
 		set_cart_count()
@@ -29,6 +31,19 @@
 	context["shopping_cart_enabled"] = cart_enabled
 
 def update_my_account_context(context):
+	check_user_role, parties = check_customer_or_supplier()
+
+	if check_user_role == 'Supplier':
+		get_supplier_context(context)
+	else:
+		get_customer_context(context)
+
+def get_supplier_context(context):
+	context["my_account_list"].extend([
+		{"label": _("Request for Quotations"), "url": "rfq"},
+	])
+
+def get_customer_context(context):
 	context["my_account_list"].extend([
 		{"label": _("Projects"), "url": "project"},
 		{"label": _("Orders"), "url": "orders"},
@@ -37,3 +52,15 @@
 		{"label": _("Issues"), "url": "issues"},
 		{"label": _("Addresses"), "url": "addresses"}
 	])
+
+def check_customer_or_supplier():
+	if frappe.session.user:
+		contacts = frappe.get_all("Contact", fields=["customer", "supplier", "email_id"],
+			filters={"email_id": frappe.session.user})
+
+		customer = [d.customer for d in contacts if d.customer] or None
+		supplier = [d.supplier for d in contacts if d.supplier] or None
+
+		if customer: return 'Customer', customer
+		if supplier : return 'Supplier', supplier
+		return 'Customer', None
\ No newline at end of file
diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py
index 7555312..75e55b5 100644
--- a/erpnext/startup/notifications.py
+++ b/erpnext/startup/notifications.py
@@ -32,6 +32,9 @@
 				"status": ("not in", ("Stopped",)),
 				"per_ordered": ("<", 100)
 			},
+			"Request for Quotation": {
+				"docstatus": 0
+			},
 			"Purchase Order": {
 				"status": ("not in", ("Completed", "Closed")),
 				"docstatus": ("<", 2)
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index f1d11b2..813133d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -122,7 +122,7 @@
 	tn = frappe.model.make_new_doc_and_get_name('Contact');
 	locals['Contact'][tn].is_customer = 1;
 	if(doc.customer) locals['Contact'][tn].customer = doc.customer;
-	loaddoc('Contact', tn);
+	frappe.set_route('Form', 'Contact', tn);
 }
 
 
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 6ed16ce..308bb98 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -17,6 +17,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Barcode", 
@@ -40,6 +41,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Item Code", 
@@ -68,6 +70,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
@@ -95,6 +98,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -117,6 +121,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer's Item Code", 
@@ -140,6 +145,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -164,6 +170,7 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -191,6 +198,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -214,6 +222,7 @@
    "fieldtype": "Attach", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
@@ -238,6 +247,7 @@
    "fieldtype": "Image", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
@@ -263,6 +273,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Rate", 
@@ -286,6 +297,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
@@ -313,6 +325,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
@@ -337,38 +350,11 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "price_list_rate", 
-   "fieldname": "discount_percentage", 
-   "fieldtype": "Float", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Discount on Price List Rate (%)", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "adj_rate", 
-   "oldfieldtype": "Float", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "100px", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
-   "width": "100px"
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "col_break2", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -391,6 +377,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
@@ -419,6 +406,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate (Company Currency)", 
@@ -442,11 +430,169 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "discount_and_margin", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Discount and Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "discount_percentage", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Discount on Price List Rate (%)", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "adj_rate", 
+   "oldfieldtype": "Float", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "print_width": "100px", 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0, 
+   "width": "100px"
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "column_break_19", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "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": 0, 
+   "depends_on": "price_list_rate", 
+   "fieldname": "margin_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nPercentage\nAmount", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate", 
+   "fieldname": "margin_rate_or_amount", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Margin Rate or Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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, 
+   "depends_on": "eval:doc.margin_type && doc.price_list_rate", 
+   "fieldname": "total_margin", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Total Margin", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 1, 
+   "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, 
    "fieldname": "section_break_1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -469,6 +615,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
@@ -497,6 +644,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
@@ -525,6 +673,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -547,6 +696,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
@@ -575,6 +725,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
@@ -603,6 +754,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
@@ -627,6 +779,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -650,6 +803,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
@@ -675,6 +829,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
@@ -700,6 +855,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -723,6 +879,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate (Company Currency)", 
@@ -748,6 +905,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount (Company Currency)", 
@@ -773,6 +931,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse and Reference", 
@@ -796,6 +955,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "From Warehouse", 
@@ -826,6 +986,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Warehouse (Optional)", 
@@ -851,6 +1012,7 @@
    "fieldtype": "Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Serial No", 
@@ -876,6 +1038,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Batch No", 
@@ -902,6 +1065,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Qty at From Warehouse", 
@@ -930,6 +1094,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Batch Qty at From Warehouse", 
@@ -957,6 +1122,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Group", 
@@ -983,6 +1149,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand Name", 
@@ -1011,6 +1178,7 @@
    "fieldtype": "Small Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Item Tax Rate", 
@@ -1036,6 +1204,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -1058,6 +1227,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Account", 
@@ -1084,6 +1254,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Cost Center", 
@@ -1109,6 +1280,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Sales Order", 
@@ -1133,6 +1305,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Sales Invoice", 
@@ -1157,6 +1330,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Sales Order Item", 
@@ -1184,6 +1358,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Sales Invoice Item", 
@@ -1208,6 +1383,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Installed Qty", 
@@ -1235,6 +1411,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billed Amt", 
@@ -1260,6 +1437,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
@@ -1287,7 +1465,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-02-01 11:16:23.749244", 
+ "modified": "2016-03-29 07:06:24.716689", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note Item", 
@@ -1296,5 +1474,6 @@
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index a691f2f..213050c 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -111,40 +111,27 @@
 
 $.extend(erpnext.item, {
 	setup_queries: function(frm) {
-		// Expense Account
-		// ---------------------------------
 		frm.fields_dict['expense_account'].get_query = function(doc) {
 			return {
-				filters: {
-					"report_type": "Profit and Loss",
-					"is_group": 0
-				}
+				query: "erpnext.controllers.queries.get_expense_account",
 			}
 		}
 
-		// Income Account
-		// --------------------------------
 		frm.fields_dict['income_account'].get_query = function(doc) {
 			return {
 				query: "erpnext.controllers.queries.get_income_account"
 			}
 		}
 
-
-		// Purchase Cost Center
-		// -----------------------------
 		frm.fields_dict['buying_cost_center'].get_query = function(doc) {
 			return {
-				filters:{ "is_group": 0 }
+				filters: { "is_group": 0 }
 			}
 		}
 
-
-		// Sales Cost Center
-		// -----------------------------
 		frm.fields_dict['selling_cost_center'].get_query = function(doc) {
 			return {
-				filters:{ "is_group": 0 }
+				filters: { "is_group": 0 }
 			}
 		}
 
@@ -159,7 +146,7 @@
 			}
 		}
 
-		frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) {
+		frm.fields_dict['item_group'].get_query = function(doc, cdt, cdn) {
 			return {
 				filters: [
 					['Item Group', 'docstatus', '!=', 2]
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index ac889fb..99afe33 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -246,6 +246,36 @@
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "", 
+   "depends_on": "", 
+   "description": "", 
+   "fieldname": "is_fixed_asset", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Is Fixed Asset", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "is_asset_item", 
+   "oldfieldtype": "Select", 
+   "options": "", 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
@@ -425,7 +455,7 @@
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -604,36 +634,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "default": "", 
-   "depends_on": "eval:doc.is_stock_item", 
-   "description": "", 
-   "fieldname": "is_asset_item", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Is Fixed Asset Item", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "is_asset_item", 
-   "oldfieldtype": "Select", 
-   "options": "", 
-   "permlevel": 0, 
-   "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": 0, 
    "depends_on": "is_stock_item", 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
@@ -2323,7 +2323,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2016-03-10 05:15:41.190950", 
+ "modified": "2016-03-29 08:29:07.922559", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
@@ -2494,5 +2494,6 @@
  "read_only_onload": 0, 
  "search_fields": "item_name,description,item_group,customer_code", 
  "sort_order": "DESC", 
- "title_field": "item_name"
+ "title_field": "item_name", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index f18bc8b..cc8886b 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -52,11 +52,14 @@
 		if self.is_sales_item=="Yes":
 			self.publish_in_hub = 1
 
+		if not self.description:
+			self.description = self.item_name
+
 	def validate(self):
 		super(Item, self).validate()
 
-		if not self.stock_uom:
-			msgprint(_("Please enter default Unit of Measure"), raise_exception=1)
+		if not self.description:
+			self.description = self.item_name
 
 		self.validate_uom()
 		self.add_default_uom_in_conversion_factor_table()
@@ -77,10 +80,12 @@
 		self.validate_variant_attributes()
 		self.validate_website_image()
 		self.make_thumbnail()
+		self.validate_fixed_asset_item()
 
 		if not self.get("__islocal"):
 			self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
-			self.old_website_item_groups = frappe.db.sql_list("""select item_group from `tabWebsite Item Group`
+			self.old_website_item_groups = frappe.db.sql_list("""select item_group 
+				from `tabWebsite Item Group`
 				where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
 
 	def on_update(self):
@@ -563,6 +568,10 @@
 			if variant:
 				frappe.throw(_("Item variant {0} exists with same attributes")
 					.format(variant), ItemVariantExistsError)
+					
+	def validate_fixed_asset_item(self):
+		if self.is_fixed_asset and self.is_stock_item:
+			frappe.throw(_("Fixed Asset Item must be a non-stock item"))
 
 def validate_end_of_life(item_code, end_of_life=None, disabled=None, verbose=1):
 	if (not end_of_life) or (disabled is None):
diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json
index ca40d45..91a7493 100644
--- a/erpnext/stock/doctype/item/test_records.json
+++ b/erpnext/stock/doctype/item/test_records.json
@@ -9,7 +9,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -41,7 +41,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -64,7 +64,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -93,7 +93,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -113,7 +113,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -134,7 +134,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 1,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -151,7 +151,7 @@
   "has_batch_no": 0,
   "has_serial_no": 0,
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -169,7 +169,7 @@
   "has_batch_no": 0,
   "has_serial_no": 1,
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -187,7 +187,7 @@
   "has_batch_no": 0,
   "has_serial_no": 1,
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 0,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -209,7 +209,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 1,
   "is_sales_item": 1,
   "is_stock_item": 1,
@@ -229,7 +229,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 1,
   "is_purchase_item": 1,
   "is_sales_item": 1,
@@ -250,7 +250,7 @@
   "has_serial_no": 0,
   "income_account": "Sales - _TC",
   "inspection_required": 0,
-  "is_asset_item": 0,
+  "is_fixed_asset": 0,
   "is_pro_applicable": 1,
   "is_purchase_item": 1,
   "is_sales_item": 1,
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index c4b4b0e..982534d 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -50,6 +50,10 @@
 						this.make_purchase_order, __("Make"));
 
 				if(doc.material_request_type === "Purchase")
+					cur_frm.add_custom_button(__("Request for Quotation"),
+						this.make_request_for_quotation, __("Make"));
+
+				if(doc.material_request_type === "Purchase")
 					cur_frm.add_custom_button(__("Supplier Quotation"),
 					this.make_supplier_quotation, __("Make"));
 				
@@ -158,6 +162,14 @@
 			run_link_triggers: true
 		});
 	},
+	
+	make_request_for_quotation: function(){
+		frappe.model.open_mapped_doc({
+			method: "erpnext.stock.doctype.material_request.material_request.make_request_for_quotation",
+			frm: cur_frm,
+			run_link_triggers: true
+		});
+	},
 
 	make_supplier_quotation: function() {
 		frappe.model.open_mapped_doc({
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 679bd2d..6456d03 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -212,6 +212,28 @@
 	}, target_doc, postprocess)
 
 	return doclist
+    
+@frappe.whitelist()
+def make_request_for_quotation(source_name, target_doc=None):
+	doclist = get_mapped_doc("Material Request", source_name, 	{
+		"Material Request": {
+			"doctype": "Request for Quotation",
+			"validation": {
+				"docstatus": ["=", 1],
+				"material_request_type": ["=", "Purchase"]
+			}
+		},
+		"Material Request Item": {
+			"doctype": "Request for Quotation Item",
+			"field_map": [
+				["name", "material_request_item"],
+				["parent", "material_request"],
+				["uom", "uom"]
+			]
+		}
+	}, target_doc)
+
+	return doclist
 
 @frappe.whitelist()
 def make_purchase_order_based_on_supplier(source_name, target_doc=None):
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index fac8555..2a7629e 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -181,7 +181,7 @@
 	locals['Contact'][tn].is_supplier = 1;
 	if(doc.supplier)
 		locals['Contact'][tn].supplier = doc.supplier;
-	loaddoc('Contact', tn);
+	frappe.set_route('Form', 'Contact', tn);
 }
 
 cur_frm.fields_dict['items'].grid.get_field('project').get_query = function(doc, cdt, cdn) {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index ef1f728..30bdc8d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -180,7 +180,7 @@
 				var excise = frappe.model.make_new_doc_and_get_name('Journal Entry');
 				excise = locals['Journal Entry'][excise];
 				excise.voucher_type = 'Excise Entry';
-				loaddoc('Journal Entry', excise.name);
+				frappe.set_route('Form', 'Journal Entry', excise.name);
 			}, __("Make"));
 			cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 	},
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 7808e50..9032c7f 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -101,9 +101,8 @@
 		args.item_code = get_item_code(barcode=args.barcode)
 	elif not args.item_code and args.serial_no:
 		args.item_code = get_item_code(serial_no=args.serial_no)
-
+	
 	set_transaction_type(args)
-
 	return args
 
 @frappe.whitelist()
@@ -433,7 +432,6 @@
 					# update the value
 					if fieldname in item and fieldname not in ("name", "doctype"):
 						item[fieldname] = children[i][fieldname]
-
 		return args
 	else:
 		return {
@@ -511,4 +509,4 @@
 		})
 	
 	return out
-	
\ No newline at end of file
+
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index 0469972..5fab1ac 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -94,7 +94,11 @@
 		validated = False
 
 		employee = frappe.db.get_value("Sales Person", sales_person, "employee")
-		holiday_list = get_holiday_list_for_employee(employee)
+		if employee:
+			holiday_list = get_holiday_list_for_employee(employee)
+		else:
+			holiday_list = frappe.db.get_value("Company", self.company, "default_holiday_list")
+
 		holidays = frappe.db.sql_list('''select holiday_date from `tabHoliday` where parent=%s''', holiday_list)
 
 		if not validated and holidays:
diff --git a/erpnext/templates/emails/request_for_quotation.html b/erpnext/templates/emails/request_for_quotation.html
new file mode 100644
index 0000000..aedd8e2
--- /dev/null
+++ b/erpnext/templates/emails/request_for_quotation.html
@@ -0,0 +1,11 @@
+<h3>{{_("Request for Quotation")}}</h3>
+<p>{{ message }}</p>
+{% if update_password_link %}
+<p>{{_("Please click on the following link to set your new password")}}:</p>
+<p><a href="{{ update_password_link }}">{{ update_password_link }}</a></p>
+{% else %}
+<p>{{_("Request for quotation can be access by clicking following link")}}:</p>
+<p><a href="{{ rfq_link }}">Submit your Quotation</a></p>
+{% endif %}
+<p>{{_("Thank you")}},<br>
+{{ user_fullname }}</p>
\ No newline at end of file
diff --git a/erpnext/templates/generators/job_opening.html b/erpnext/templates/generators/job_opening.html
index 9cfa888..bbc5fee 100644
--- a/erpnext/templates/generators/job_opening.html
+++ b/erpnext/templates/generators/job_opening.html
@@ -12,8 +12,10 @@
 
 <div>{{ description }}</div>
 
-<a class='btn btn-primary'
-	href='/job_application?job_title={{ doc.job_title }}'>
+<p>
+	<a class='btn btn-primary'
+	href='/job_application?job_title={{ doc.name }}'>
 	{{ _("Apply Now") }}</a>
+</p>
 
 {% endblock %}
diff --git a/erpnext/templates/includes/rfq.js b/erpnext/templates/includes/rfq.js
new file mode 100644
index 0000000..3623d77
--- /dev/null
+++ b/erpnext/templates/includes/rfq.js
@@ -0,0 +1,84 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+window.doc={{ doc.as_json() }};
+
+$(document).ready(function() {
+	new rfq();
+	doc.supplier = "{{ doc.supplier }}"
+});
+
+rfq = Class.extend({
+	init: function(){
+		this.onfocus_select_all();
+		this.change_qty();
+		this.change_rate();
+		this.terms();
+		this.submit_rfq();
+	},
+
+	onfocus_select_all: function(){
+		$("input").click(function(){
+			$(this).select();
+		})
+	},
+
+	change_qty: function(){
+		var me = this;
+		$('.rfq-items').on("change", ".rfq-qty", function(){
+			me.idx = parseFloat($(this).attr('data-idx'));
+			me.qty = parseFloat($(this).val());
+			me.rate = parseFloat($(repl('.rfq-rate[data-idx=%(idx)s]',{'idx': me.idx})).val());
+			me.update_qty_rate();
+		})
+	},
+
+	change_rate: function(){
+		var me = this;
+		$(".rfq-items").on("change", ".rfq-rate", function(){
+			me.idx = parseFloat($(this).attr('data-idx'));
+			me.rate = parseFloat($(this).val());
+			me.qty = parseFloat($(repl('.rfq-qty[data-idx=%(idx)s]',{'idx': me.idx})).val());
+			me.update_qty_rate();
+		})
+	},
+
+	terms: function(){
+		$(".terms").on("change", ".terms-feedback", function(){
+			doc.terms = $(this).val();
+		})
+	},
+
+	update_qty_rate: function(){
+		var me = this;
+		doc.grand_total = 0.0;
+		$.each(doc.items, function(idx, data){
+			if(data.idx == me.idx){
+				data.qty = me.qty;
+				data.rate = me.rate;
+				data.amount = (me.rate * me.qty) || 0.0;
+				$(repl('.rfq-amount[data-idx=%(idx)s]',{'idx': me.idx})).text(data.amount.toFixed(2));
+			}
+
+			doc.grand_total += flt(data.amount);
+			$('.tax-grand-total').text(doc.grand_total.toFixed(2));
+		})
+	},
+
+	submit_rfq: function(){
+		$('.btn-sm').click(function(){
+			frappe.freeze();
+			frappe.call({
+				type: "POST",
+				method: "erpnext.buying.doctype.request_for_quotation.request_for_quotation.create_supplier_quotation",
+				args: {
+					doc: doc
+				},
+				btn: this,
+				callback: function(r){
+					frappe.unfreeze();
+				}
+			})
+		})
+	}
+})
diff --git a/erpnext/templates/includes/rfq/rfq_items.html b/erpnext/templates/includes/rfq/rfq_items.html
new file mode 100644
index 0000000..f03fb8f
--- /dev/null
+++ b/erpnext/templates/includes/rfq/rfq_items.html
@@ -0,0 +1,30 @@
+{% from "erpnext/templates/includes/rfq/rfq_macros.html" import item_name_and_description %}
+
+{% 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;">
+			{{ 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"
+				value = "{{ d.get_formatted('qty') }}"
+				data-idx="{{ d.idx }}">
+				<p class="text-muted small" style="margin-top: 10px;">
+					{{_("UOM") + ": "+ d.uom}}
+				</p>
+		</div>
+		<div class="col-sm-2 col-xs-2 text-right">
+				<input type="number" class="form-control text-right rfq-rate"
+				style="margin-top: 5px; max-width: 70px;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;">
+            <span class="rfq-amount" data-idx="{{ d.idx }}">0.00</span>
+        </div>
+		</div>
+	</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/rfq/rfq_macros.html b/erpnext/templates/includes/rfq/rfq_macros.html
new file mode 100644
index 0000000..95bbcfe
--- /dev/null
+++ b/erpnext/templates/includes/rfq/rfq_macros.html
@@ -0,0 +1,21 @@
+{% from "erpnext/templates/includes/macros.html" import product_image_square %}
+
+{% macro item_name_and_description(d, doc) %}
+    <div class="row">
+        <div class="col-xs-4 col-sm-2 order-image-col">
+            <div class="order-image">
+                {{ product_image_square(d.image) }}
+            </div>
+        </div>
+        <div class="col-xs-8 col-sm-10">
+            {{ d.item_code }}
+            <p class="text-muted small">{{ d.description }}</p>
+			{% set supplier_part_no = frappe.db.get_value("Item Supplier", {'parent': d.item_code, 'supplier': doc.supplier}, "supplier_part_no") %}
+			<p class="text-muted small supplier-part-no">
+				{% if supplier_part_no %}
+					{{_("Supplier Part No") + ": "+ supplier_part_no}}
+				{% endif %}
+			</p>
+        </div>
+    </div>
+{% endmacro %}
diff --git a/erpnext/templates/pages/rfq.html b/erpnext/templates/pages/rfq.html
new file mode 100644
index 0000000..8009819
--- /dev/null
+++ b/erpnext/templates/pages/rfq.html
@@ -0,0 +1,82 @@
+{% extends "templates/web.html" %}
+
+{% block header %}
+<h1>{{ doc.name }}</h1>
+{% endblock %}
+
+{% block script %}
+<script>{% include "templates/includes/rfq.js" %}</script>
+{% endblock %}
+
+{% block breadcrumbs %}
+	{% include "templates/includes/breadcrumbs.html" %}
+{% endblock %}
+
+{% block style %}
+<style>
+    {% include "templates/includes/order/order.css" %}
+</style>
+{% endblock %}
+
+{% block header_actions %}
+{% if doc.items %}
+<button class="btn btn-primary btn-sm"
+    type="button">
+    {{ _("Submit") }}</button>
+{% endif %}
+{% endblock %}
+
+{% block page_content %}
+<div class="row">
+    <div class="col-xs-6">
+        <div class="rfq-supplier">{{ doc.supplier }}</div>
+	</div>
+    <div class="col-xs-6 text-muted text-right h6">
+        {{ doc.get_formatted("transaction_date") }}
+    </div>
+</div>
+
+<div class="rfq-content">
+	<div id="order-container">
+			<div id="rfq-items">
+				<div class="row cart-item-header">
+					<div class="col-sm-6 col-xs-6">
+						Items
+					</div>
+					<div class="col-sm-2 col-xs-2 text-right">
+						Qty
+					</div>
+					<div class="col-sm-2 col-xs-2 text-right">
+						Rate
+					</div>
+					<div class="col-sm-2 col-xs-2 text-right">
+						Amount
+					</div>
+				</div>
+				<hr>
+            {% if doc.items %}
+            <div class="rfq-items">
+				{% include "templates/includes/rfq/rfq_items.html" %}
+            </div>
+            {% endif %}
+		</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">
+				<span class="tax-grand-total">0.0</span>
+			</div>
+		</div>
+        {% endif %}
+		<div class="row terms">
+			<div class="col-xs-6">
+				<br><br>
+				<p class="text-muted small">{{ _("Notes: ") }}</p>
+				<textarea class="form-control terms-feedback" style="height: 100px;"></textarea>
+			</div>
+		</div>
+    </div>
+</div>
+
+<!-- no-sidebar -->
+{% endblock %}
diff --git a/erpnext/templates/pages/rfq.py b/erpnext/templates/pages/rfq.py
new file mode 100644
index 0000000..aefa315
--- /dev/null
+++ b/erpnext/templates/pages/rfq.py
@@ -0,0 +1,31 @@
+# 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
+from frappe import _
+
+def get_context(context):
+	context.no_cache = 1
+	context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
+	context.parents = frappe.form_dict.parents
+	context.doc.supplier = get_supplier()
+	unauthrized_user(context.doc.supplier)
+	context["title"] = frappe.form_dict.name
+
+def unauthrized_user(supplier):
+	status = check_supplier_has_docname_access(supplier)
+	if status == False:
+		frappe.throw(_("Not Permitted"), frappe.PermissionError)
+
+def get_supplier():
+	from erpnext.shopping_cart.utils import check_customer_or_supplier
+	key, parties = check_customer_or_supplier()
+	return parties[0] if key == 'Supplier' else ''
+
+def check_supplier_has_docname_access(supplier):
+	status = True
+	if frappe.form_dict.name not in frappe.db.sql_list("""select parent from `tabRequest for Quotation Supplier`
+		where supplier = '{supplier}'""".format(supplier=supplier)):
+		status = False
+	return status
diff --git a/erpnext/utilities/bot.py b/erpnext/utilities/bot.py
new file mode 100644
index 0000000..23e1dd4
--- /dev/null
+++ b/erpnext/utilities/bot.py
@@ -0,0 +1,39 @@
+# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+from __future__ import unicode_literals
+
+from frappe.utils.bot import BotParser
+
+import frappe
+from frappe import _
+
+class FindItemBot(BotParser):
+	def get_reply(self):
+		if self.startswith('where is', 'find item', 'locate'):
+			if not frappe.has_permission('Warehouse'):
+				raise frappe.PermissionError
+
+			item = '%{0}%'.format(self.strip_words(self.query, 'where is', 'find item', 'locate'))
+			items = frappe.db.sql('''select name from `tabItem` where item_code like %(txt)s
+				or item_name like %(txt)s or description like %(txt)s''', dict(txt=item))
+
+			if items:
+				out = []
+				warehouses = frappe.get_all("Warehouse")
+				for item in items:
+					found = False
+					for warehouse in warehouses:
+						qty = frappe.db.get_value("Bin", {'item_code': item[0], 'warehouse': warehouse.name}, 'actual_qty')
+						if qty:
+							out.append(_('{0} units of [{1}](#Form/Item/{1}) found in [{2}](#Form/Warehouse/{2})').format(qty,
+								item[0], warehouse.name))
+							found = True
+
+					if not found:
+						out.append(_('[{0}](#Form/Item/{0}) is out of stock').format(item[0]))
+
+				return "\n\n".join(out)
+
+			else:
+				return _("Did not find any item called {0}".format(item))
\ No newline at end of file
diff --git a/erpnext/utilities/doctype/contact/contact.json b/erpnext/utilities/doctype/contact/contact.json
index 9fef425..3b4f24e 100644
--- a/erpnext/utilities/doctype/contact/contact.json
+++ b/erpnext/utilities/doctype/contact/contact.json
@@ -16,6 +16,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -24,6 +25,7 @@
    "options": "icon-user", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -39,6 +41,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "First Name", 
@@ -48,6 +51,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -57,12 +61,13 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "fieldname": "last_name", 
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Last Name", 
@@ -72,6 +77,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -81,12 +87,13 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "fieldname": "email_id", 
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Id", 
@@ -97,6 +104,7 @@
    "options": "Email", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -112,12 +120,14 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -134,6 +144,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Status", 
@@ -142,6 +153,7 @@
    "options": "Passive\nOpen\nReplied", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -151,12 +163,13 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "fieldname": "phone", 
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Phone", 
@@ -166,6 +179,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -181,6 +195,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Reference", 
@@ -189,6 +204,7 @@
    "options": "icon-pushpin", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -204,6 +220,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "User Id", 
@@ -213,6 +230,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -222,13 +240,14 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "depends_on": "", 
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
@@ -239,6 +258,7 @@
    "options": "Customer", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -255,6 +275,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Name", 
@@ -262,6 +283,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -277,6 +299,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -284,6 +307,7 @@
    "oldfieldtype": "Column Break", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -294,13 +318,14 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "depends_on": "", 
    "fieldname": "supplier", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
@@ -309,6 +334,7 @@
    "options": "Supplier", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -325,6 +351,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Name", 
@@ -332,6 +359,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -348,6 +376,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Partner", 
@@ -356,6 +385,7 @@
    "options": "Sales Partner", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -373,6 +403,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Primary Contact", 
@@ -382,6 +413,7 @@
    "oldfieldtype": "Select", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -397,6 +429,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
@@ -405,6 +438,7 @@
    "options": "icon-file-text", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -420,6 +454,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Mobile No", 
@@ -429,6 +464,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -445,6 +481,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Department", 
@@ -452,6 +489,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -468,6 +506,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Designation", 
@@ -475,6 +514,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -490,6 +530,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Unsubscribed", 
@@ -497,6 +538,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -515,7 +557,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:43.760924", 
+ "modified": "2016-03-29 06:13:33.493737", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "Contact", 
@@ -764,5 +806,7 @@
   }
  ], 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/setup.py b/setup.py
index bd41d1d..581e065 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 from pip.req import parse_requirements
 
-version = "6.27.3"
+version = "6.27.5"
 requirements = parse_requirements("requirements.txt", session="")
 
 setup(