Merge pull request #5077 from frappe/master

Master
diff --git a/.travis.yml b/.travis.yml
index cb3dd5e..12a73c9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,9 +23,6 @@
   - cd ~/frappe-bench
   - bench get-app erpnext $TRAVIS_BUILD_DIR
   - bench use test_site
-  - bench setup redis-cache
-  - bench setup redis-async-broker
-  - bench setup procfile --with-celery-broker
   - bench reinstall
   - bench build
   - bench build-website
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/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 906c131..9505528 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):
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/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 736d03c..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):
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.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index a67f109..0e47a75 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -2692,7 +2692,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-21 13:13:43.694604", 
+ "modified": "2016-03-25 07:32:03.043734", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
@@ -2739,26 +2739,6 @@
    "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": 1, 
    "apply_user_permissions": 0, 
    "cancel": 1, 
@@ -2825,5 +2805,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "supplier", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 180831e..f95569d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -429,7 +429,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 +449,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 = []
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 20b8d1b..af690fb 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -3418,7 +3418,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-21 13:12:12.430038", 
+ "modified": "2016-03-25 07:31:46.017116", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
@@ -3470,26 +3470,6 @@
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Customer", 
-   "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, 
@@ -3531,5 +3511,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "customer", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
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..41bff7c 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_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", 
@@ -66,6 +68,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -88,6 +91,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item Name", 
@@ -113,6 +117,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", 
@@ -136,6 +141,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Edit Description", 
@@ -160,6 +166,7 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -187,6 +194,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -210,6 +218,7 @@
    "fieldtype": "Image", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image View", 
@@ -235,6 +244,7 @@
    "fieldtype": "Attach", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
@@ -259,6 +269,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -282,6 +293,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
@@ -307,6 +319,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Price List Rate", 
@@ -329,36 +342,11 @@
    "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, 
-   "unique": 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, 
@@ -381,6 +369,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "UOM", 
@@ -405,6 +394,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)", 
@@ -427,10 +417,166 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "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, 
+   "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_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_break1", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -453,6 +599,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Rate", 
@@ -479,6 +626,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Amount", 
@@ -505,6 +653,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -527,6 +676,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Rate (Company Currency)", 
@@ -553,6 +703,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Amount (Company Currency)", 
@@ -579,6 +730,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Pricing Rule", 
@@ -603,6 +755,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -626,6 +779,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Rate", 
@@ -651,6 +805,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Net Amount", 
@@ -676,6 +831,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -699,6 +855,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)", 
@@ -724,6 +881,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)", 
@@ -750,6 +908,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Drop Ship", 
@@ -774,6 +933,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivered By Supplier", 
@@ -798,6 +958,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Accounting Details", 
@@ -821,6 +982,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Income Account", 
@@ -849,6 +1011,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Expense Account", 
@@ -874,6 +1037,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -897,6 +1061,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Cost Center", 
@@ -926,6 +1091,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Stock Details", 
@@ -949,6 +1115,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Warehouse", 
@@ -975,6 +1142,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 1, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Warehouse (Optional)", 
@@ -1000,6 +1168,7 @@
    "fieldtype": "Small Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Serial No", 
@@ -1025,6 +1194,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Batch No", 
@@ -1050,6 +1220,7 @@
    "fieldtype": "Link", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
@@ -1076,6 +1247,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Brand Name", 
@@ -1101,6 +1273,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", 
@@ -1126,6 +1299,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -1148,6 +1322,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 Warehouse", 
@@ -1174,6 +1349,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Available Qty at Warehouse", 
@@ -1199,6 +1375,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "References", 
@@ -1223,6 +1400,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Time Log Batch", 
@@ -1247,6 +1425,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Order", 
@@ -1273,6 +1452,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Sales Order Item", 
@@ -1298,6 +1478,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -1321,6 +1502,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Note", 
@@ -1347,6 +1529,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Delivery Note Item", 
@@ -1372,6 +1555,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivered Qty", 
@@ -1397,6 +1581,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -1420,6 +1605,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
@@ -1445,7 +1631,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-02-01 11:16:58.288462", 
+ "modified": "2016-03-22 11:09:35.263922", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice Item", 
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 0c8d999..f4a0538 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/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 7e05b95..1f60f8f 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -9,24 +9,26 @@
 
 def execute(filters=None):
 	period_list = get_period_list(filters.fiscal_year, filters.periodicity)
-	
+
 	asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False)
 	liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False)
 	equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False)
-	
-	provisional_profit_loss = get_provisional_profit_loss(asset, liability, equity, 
+
+	provisional_profit_loss = get_provisional_profit_loss(asset, liability, equity,
 		period_list, filters.company)
 
+	message = check_opening_balance(asset, liability, equity)
+
 	data = []
 	data.extend(asset or [])
-	data.extend(liability or [])	
+	data.extend(liability or [])
 	data.extend(equity or [])
 	if provisional_profit_loss:
 		data.append(provisional_profit_loss)
 
 	columns = get_columns(filters.periodicity, period_list, company=filters.company)
 
-	return columns, data
+	return columns, data, message
 
 def get_provisional_profit_loss(asset, liability, equity, period_list, company):
 	if asset and (liability or equity):
@@ -51,9 +53,20 @@
 
 			if provisional_profit_loss[period.key]:
 				has_value = True
-			
+
 			total += flt(provisional_profit_loss[period.key])
 			provisional_profit_loss["total"] = total
 
 		if has_value:
 			return provisional_profit_loss
+
+def check_opening_balance(asset, liability, equity):
+	# Check if previous year balance sheet closed
+	opening_balance = flt(asset[0].get("opening_balance", 0))
+	if liability:
+		opening_balance -= flt(liability[0].get("opening_balance", 0))
+	if equity:
+		opening_balance -= flt(asset[0].get("opening_balance", 0))
+
+	if opening_balance:
+		return _("Previous Financial Year is not closed")
\ No newline at end of file
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 3e70a0e..1a59a9d 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -125,14 +125,20 @@
 				if entry.posting_date <= period.to_date:
 					if accumulated_values or entry.posting_date >= period.from_date:
 						d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
+						
+			if entry.posting_date < period_list[0].year_start_date:
+				d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
 
 def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
 	"""accumulate children's values in parent accounts"""
 	for d in reversed(accounts):
 		if d.parent_account:
 			for period in period_list:
-				accounts_by_name[d.parent_account][period.key] = accounts_by_name[d.parent_account].get(period.key, 0.0) + \
-					d.get(period.key, 0.0)
+				accounts_by_name[d.parent_account][period.key] = \
+					accounts_by_name[d.parent_account].get(period.key, 0.0) + d.get(period.key, 0.0)
+			
+			accounts_by_name[d.parent_account]["opening_balance"] = \
+				accounts_by_name[d.parent_account].get("opening_balance", 0.0) + d.get("opening_balance", 0.0)
 
 def prepare_data(accounts, balance_must_be, period_list, company_currency):
 	data = []
@@ -150,13 +156,14 @@
 			"indent": flt(d.indent),
 			"year_start_date": year_start_date,
 			"year_end_date": year_end_date,
-			"currency": company_currency
+			"currency": company_currency,
+			"opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1)
 		})
 		for period in period_list:
-			if d.get(period.key):
+			if d.get(period.key) and balance_must_be=="Credit":
 				# change sign based on Debit or Credit, since calculation is done using (debit - credit)
-				d[period.key] *= (1 if balance_must_be=="Debit" else -1)
-
+				d[period.key] *= -1
+		
 			row[period.key] = flt(d.get(period.key, 0.0), 3)
 
 			if abs(row[period.key]) >= 0.005:
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 9a9a865..6dcc865 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -178,6 +178,9 @@
 			&& !this.frm.doc.shipping_address) {
 				erpnext.utils.get_shipping_address(this.frm)
 		}
+
+		var company_doc = frappe.get_doc(":Company", me.frm.doc.company);
+		me.frm.set_value("letter_head", company_doc.default_letter_head);
 	},
 	
 	shipping_address: function(){
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index df63e29..be704e9 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -69,7 +69,7 @@
 				frappe.throw(_("Warehouse is mandatory for stock Item {0} in row {1}").format(d.item_code, d.idx))
 
 			# validate purchase item
-			if not (obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Material Transfer"):
+			if obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Purchase":
 				if item.is_purchase_item != 1 and item.is_sub_contracted_item != 1:
 					frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx))
 
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/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 2b4b989..7a3202f 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -2693,7 +2693,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-21 13:13:07.334625", 
+ "modified": "2016-03-25 07:32:01.820327", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
@@ -2765,26 +2765,6 @@
    "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, 
@@ -2806,5 +2786,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "supplier", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
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..f41c6da
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -0,0 +1,80 @@
+// 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_person").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');
+	},
+	
+	refresh: function(frm, cdt, cdn){
+		if (frm.doc.docstatus === 1) {
+			frm.add_custom_button(__("Make Supplier Quotation"), function(){ frm.trigger("make_suppplier_quotation") });
+		}
+	},
+
+	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..88a91a0
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.json
@@ -0,0 +1,767 @@
+{
+ "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": "RFQ 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": "response", 
+   "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-25 01:14:01.194848", 
+ "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": ""
+}
\ 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..92089e4
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -0,0 +1,177 @@
+# -*- 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, cint
+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')
+		self.send_to_supplier()
+
+	def on_cancel(self):
+		frappe.db.set(self, 'status', 'Cancelled')
+
+	def send_to_supplier(self):
+		link = get_url("/rfq/" + self.name)
+		for supplier_data in self.suppliers:
+			if supplier_data.email_id and cint(supplier_data.sent_email_to_supplier)==1:
+				update_password_link = self.create_supplier_user(supplier_data, link)
+				self.supplier_rfq_mail(supplier_data, update_password_link, link)
+
+	def create_supplier_user(self, supplier_data, link):
+		from frappe.utils import random_string, get_url
+
+		update_password_link = ''
+		if not supplier_data.user_id:
+			user = self.create_user(supplier_data)
+			key = random_string(32)
+			user.reset_password_key = key
+			user.redirect_url = link
+			user.save(ignore_permissions=True)
+
+			update_password_link = get_url("/update-password?key=" + key)
+			frappe.get_doc('Contact', supplier_data.contact_person).save()
+
+		return update_password_link
+
+	def create_user(self, supplier_data):
+		user = frappe.get_doc({
+			'doctype': 'User',
+			'send_welcome_email': 0,
+			'email': supplier_data.email_id,
+			'first_name': supplier_data.supplier_name,
+			'user_type': 'Website User'
+		})
+
+		return user
+
+	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.response, 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))
+
+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
+
+@frappe.whitelist()
+def get_supplier(doctype, txt, searchfield, start, page_len, filters):
+	query = """Select supplier from `tabRFQ Supplier` where parent = %(parent)s and supplier like %(txt)s
+				limit %(start)s, %(page_len)s """
+				
+	return frappe.db.sql(query, {'parent': filters.get('parent'),
+		'start': start, 'page_len': page_len, 'txt': "%%%s%%" % frappe.db.escape(txt)})
+
+# 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..305253c
--- /dev/null
+++ b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.json
@@ -0,0 +1,612 @@
+{
+ "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, 
+   "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-25 01:14:38.490488", 
+ "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"
+}
\ 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/rfq_supplier/__init__.py b/erpnext/buying/doctype/rfq_supplier/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/buying/doctype/rfq_supplier/__init__.py
diff --git a/erpnext/buying/doctype/rfq_supplier/rfq_supplier.json b/erpnext/buying/doctype/rfq_supplier/rfq_supplier.json
new file mode 100644
index 0000000..02a6f0b
--- /dev/null
+++ b/erpnext/buying/doctype/rfq_supplier/rfq_supplier.json
@@ -0,0 +1,213 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2016-02-29 17:31:02.993221", 
+ "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_person", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Contact Person", 
+   "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": "Send Request for Quotation to Supplier", 
+   "fieldname": "sent_email_to_supplier", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Sent 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_person.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
+  }, 
+  {
+   "allow_on_submit": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "user_id", 
+   "fieldtype": "Read Only", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "User Id", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "contact_person.user", 
+   "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-25 13:18:11.017660", 
+ "modified_by": "Administrator", 
+ "module": "Buying", 
+ "name": "RFQ Supplier", 
+ "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/buying/doctype/rfq_supplier/rfq_supplier.py b/erpnext/buying/doctype/rfq_supplier/rfq_supplier.py
new file mode 100644
index 0000000..a7ba65c
--- /dev/null
+++ b/erpnext/buying/doctype/rfq_supplier/rfq_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 RFQSupplier(Document):
+	pass
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 6466643..c9bcc46 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -1780,7 +1780,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-16 15:36:05.481917", 
+ "modified": "2016-03-25 07:32:02.711099", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation", 
@@ -1872,19 +1872,19 @@
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
-   "email": 1, 
+   "email": 0, 
    "export": 0, 
    "if_owner": 0, 
    "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
+   "permlevel": 1, 
+   "print": 0, 
    "read": 1, 
-   "report": 1, 
-   "role": "Supplier", 
+   "report": 0, 
+   "role": "Purchase Manager", 
    "set_user_permissions": 0, 
    "share": 0, 
    "submit": 0, 
-   "write": 0
+   "write": 1
   }, 
   {
    "amend": 0, 
@@ -1900,11 +1900,11 @@
    "print": 0, 
    "read": 1, 
    "report": 0, 
-   "role": "Purchase Manager", 
+   "role": "All", 
    "set_user_permissions": 0, 
    "share": 0, 
    "submit": 0, 
-   "write": 1
+   "write": 0
   }
  ], 
  "read_only": 0, 
@@ -1913,5 +1913,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "supplier", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
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..e14f0da 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"))
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/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..5882578 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 = 'RFQ 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/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/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/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/fixtures/web_form.json b/erpnext/fixtures/web_form.json
index a248886..25b5f4f 100644
--- a/erpnext/fixtures/web_form.json
+++ b/erpnext/fixtures/web_form.json
@@ -4,6 +4,439 @@
   "allow_delete": 1, 
   "allow_edit": 1, 
   "allow_multiple": 1, 
+  "breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"projects?project=Collaborative Project Management\"}]", 
+  "doc_type": "Task", 
+  "docstatus": 0, 
+  "doctype": "Web Form", 
+  "introduction_text": null, 
+  "is_standard": 1, 
+  "login_required": 1, 
+  "modified": "2016-03-06 02:09:28.583572", 
+  "name": "tasks", 
+  "page_name": "tasks", 
+  "published": 1, 
+  "success_message": null, 
+  "success_url": "/projects?project=Collaborative Project Management", 
+  "title": "Tasks", 
+  "web_form_fields": [
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "project", 
+    "fieldtype": "Link", 
+    "hidden": 0, 
+    "label": "Project", 
+    "options": "Project", 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "subject", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Subject", 
+    "options": null, 
+    "read_only": 0, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "description", 
+    "fieldtype": "Text", 
+    "hidden": 0, 
+    "label": "Details", 
+    "options": null, 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "priority", 
+    "fieldtype": "Select", 
+    "hidden": 0, 
+    "label": "Priority", 
+    "options": "Low\nMedium\nHigh\nUrgent", 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "exp_start_date", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "Expected Start Date", 
+    "options": null, 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "exp_end_date", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "Expected End Date", 
+    "options": null, 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "status", 
+    "fieldtype": "Select", 
+    "hidden": 0, 
+    "label": "Status", 
+    "options": "Open\nWorking\nPending Review\nOverdue\nClosed\nCancelled", 
+    "read_only": 0, 
+    "reqd": 0
+   }
+  ], 
+  "web_page_link_text": null
+ }, 
+ {
+  "allow_comments": 0, 
+  "allow_delete": 1, 
+  "allow_edit": 0, 
+  "allow_multiple": 0, 
+  "breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"project?project=Collaborative Project Management\"}]", 
+  "doc_type": "Time Log", 
+  "docstatus": 0, 
+  "doctype": "Web Form", 
+  "introduction_text": null, 
+  "is_standard": 0, 
+  "login_required": 1, 
+  "modified": "2016-03-11 12:26:41.147028", 
+  "name": "time-log", 
+  "page_name": "time-log", 
+  "published": 1, 
+  "success_message": null, 
+  "success_url": "/test?project=Collaborative Project Management", 
+  "title": "Time Log", 
+  "web_form_fields": [
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "project", 
+    "fieldtype": "Link", 
+    "hidden": 0, 
+    "label": "Project", 
+    "options": "Project", 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "title", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Title", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "employee", 
+    "fieldtype": "Link", 
+    "hidden": 0, 
+    "label": "Employee", 
+    "options": "Employee", 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "from_time", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "From Time", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "to_time", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "To Time", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": "0", 
+    "description": null, 
+    "fieldname": "hours", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Hours", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": "Will be updated when batched.", 
+    "fieldname": "time_log_batch", 
+    "fieldtype": "Link", 
+    "hidden": 0, 
+    "label": "Time Log Batch", 
+    "options": "Time Log Batch", 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": "Open", 
+    "description": null, 
+    "fieldname": "status", 
+    "fieldtype": "Select", 
+    "hidden": 0, 
+    "label": "Status", 
+    "options": "Open\nWorking\nPending Review\nClosed\nCancelled", 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "note", 
+    "fieldtype": "Text", 
+    "hidden": 0, 
+    "label": "Note", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }
+  ], 
+  "web_page_link_text": null
+ }, 
+ {
+  "allow_comments": 1, 
+  "allow_delete": 1, 
+  "allow_edit": 1, 
+  "allow_multiple": 1, 
+  "breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"projects?project=Collaborative Project Management\"}]", 
+  "doc_type": "Issue", 
+  "docstatus": 0, 
+  "doctype": "Web Form", 
+  "introduction_text": null, 
+  "is_standard": 1, 
+  "login_required": 1, 
+  "modified": "2016-03-11 13:10:53.133110", 
+  "name": "issues-view", 
+  "page_name": "issues-view", 
+  "published": 1, 
+  "success_message": null, 
+  "success_url": "/projects?project=Collaborative Project Management", 
+  "title": "Issues-view", 
+  "web_form_fields": [
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "project", 
+    "fieldtype": "Link", 
+    "hidden": 0, 
+    "label": "Project", 
+    "options": "Project", 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "subject", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Subject", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "description", 
+    "fieldtype": "Text", 
+    "hidden": 0, 
+    "label": "Description", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "raised_by", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Raised By (Email)", 
+    "options": "Email", 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": "Today", 
+    "description": null, 
+    "fieldname": "opening_date", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "Opening Date", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "resolution_date", 
+    "fieldtype": "Datetime", 
+    "hidden": 0, 
+    "label": "Resolution Date", 
+    "options": null, 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "resolution_details", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Resolution Details", 
+    "options": null, 
+    "read_only": 0, 
+    "reqd": 0
+   }, 
+   {
+    "default": "Open", 
+    "description": null, 
+    "fieldname": "status", 
+    "fieldtype": "Select", 
+    "hidden": 0, 
+    "label": "Status", 
+    "options": "Open\nReplied\nHold\nClosed", 
+    "read_only": 0, 
+    "reqd": 0
+   }
+  ], 
+  "web_page_link_text": null
+ }, 
+ {
+  "allow_comments": 1, 
+  "allow_delete": 1, 
+  "allow_edit": 1, 
+  "allow_multiple": 1, 
+  "breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"projects?project=Collaborative Project Management\"}]", 
+  "doc_type": "Task", 
+  "docstatus": 0, 
+  "doctype": "Web Form", 
+  "introduction_text": null, 
+  "is_standard": 1, 
+  "login_required": 1, 
+  "modified": "2016-03-15 00:00:39.230196", 
+  "name": "tasks-view", 
+  "page_name": "tasks-view", 
+  "published": 1, 
+  "success_message": null, 
+  "success_url": "/projects?project=Collaborative Project Management", 
+  "title": "Tasks-view", 
+  "web_form_fields": [
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "project", 
+    "fieldtype": "Link", 
+    "hidden": 0, 
+    "label": "Project", 
+    "options": "Project", 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "subject", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Subject", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 1
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "description", 
+    "fieldtype": "Data", 
+    "hidden": 0, 
+    "label": "Details", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "exp_start_date", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "Expected Start Date", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "exp_end_date", 
+    "fieldtype": "Date", 
+    "hidden": 0, 
+    "label": "Expected End Date", 
+    "options": null, 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "priority", 
+    "fieldtype": "Select", 
+    "hidden": 0, 
+    "label": "Priority", 
+    "options": "Low\nMedium\nHigh\nUrgent", 
+    "read_only": 1, 
+    "reqd": 0
+   }, 
+   {
+    "default": null, 
+    "description": null, 
+    "fieldname": "status", 
+    "fieldtype": "Select", 
+    "hidden": 0, 
+    "label": "Status", 
+    "options": "Open\nWorking\nPending Review\nOverdue\nClosed\nCancelled", 
+    "read_only": 0, 
+    "reqd": 0
+   }
+  ], 
+  "web_page_link_text": null
+ }, 
+ {
+  "allow_comments": 1, 
+  "allow_delete": 1, 
+  "allow_edit": 1, 
+  "allow_multiple": 1, 
   "breadcrumbs": "[{\"title\":\"Issues\", \"name\":\"issues\"}]", 
   "doc_type": "Issue", 
   "docstatus": 0, 
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index fd54dd7..04c81de 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -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"},
 ]
 
@@ -143,3 +150,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/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/salary_slip/salary_slip.js b/erpnext/hr/doctype/salary_slip/salary_slip.js
index 905ec21..88796a2 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.js
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.js
@@ -2,7 +2,16 @@
 // License: GNU General Public License v3. See license.txt
 
 cur_frm.add_fetch('employee', 'company', 'company');
-cur_frm.add_fetch('company', 'default_letter_head', 'letter_head');
+
+frappe.ui.form.on("Salary Slip", {
+	company: function(frm) {
+		var company = locals[':Company'][frm.doc.company];
+		if(!frm.doc.letter_head && company.default_letter_head) {
+			frm.set_value('letter_head', company.default_letter_head);
+		}
+	}
+})
+
 
 // On load
 // -------------------------------------------------------------------
@@ -76,8 +85,8 @@
 	var total_earn = 0;
 	for(var i = 0; i < tbl.length; i++){
 		if(cint(tbl[i].e_depends_on_lwp) == 1) {
-			tbl[i].e_modified_amount =  Math.round(tbl[i].e_amount)*(flt(doc.payment_days) / 
-				cint(doc.total_days_in_month)*100)/100;			
+			tbl[i].e_modified_amount =  Math.round(tbl[i].e_amount)*(flt(doc.payment_days) /
+				cint(doc.total_days_in_month)*100)/100;
 			refresh_field('e_modified_amount', tbl[i].name, 'earnings');
 		} else if(reset_amount) {
 			tbl[i].e_modified_amount = tbl[i].e_amount;
@@ -106,7 +115,7 @@
 		total_ded += flt(tbl[i].d_modified_amount);
 	}
 	doc.total_deduction = total_ded;
-	refresh_field('total_deduction');	
+	refresh_field('total_deduction');
 }
 
 // Calculate net payable amount
@@ -137,5 +146,5 @@
 cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
 	return{
 		query: "erpnext.controllers.queries.employee_query"
-	}		
+	}
 }
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index d2e95fa..404ae38 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -6,6 +6,7 @@
 		frm.doc.status = 'Draft';
 
 	frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date");
+	frm.add_fetch("sales_order", "project", "project");
 
 	if(frm.doc.__islocal) {
 		frm.set_value({
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 5614f37..2c58fd2 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -51,12 +51,14 @@
 
 	def validate_sales_order(self):
 		if self.sales_order:
-			so = frappe.db.sql("""select name, delivery_date from `tabSales Order`
+			so = frappe.db.sql("""select name, delivery_date, project from `tabSales Order`
 				where name=%s and docstatus = 1""", self.sales_order, as_dict=1)
 
 			if len(so):
 				if not self.expected_delivery_date:
 					self.expected_delivery_date = so[0].delivery_date
+				
+				self.project = so[0].project
 
 				self.validate_production_order_against_so()
 			else:
@@ -265,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/manufacturing/doctype/production_planning_tool/production_planning_tool.json b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
index 9ccd55e..8817f65 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
@@ -12,11 +12,12 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "default": "Sales Order", 
+   "default": "", 
    "fieldname": "get_items_from", 
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Items From", 
@@ -44,6 +45,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Filters", 
@@ -67,6 +69,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Item", 
@@ -92,6 +95,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Customer", 
@@ -117,6 +121,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Warehouse", 
@@ -143,6 +148,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
@@ -167,6 +173,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -190,6 +197,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
@@ -213,6 +221,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
@@ -233,10 +242,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "depends_on": "eval: doc.get_items_from == \"Sales Order\"", 
+   "fieldname": "project", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Project", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "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.get_items_from == \"Sales Order\"", 
    "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, 
@@ -261,6 +298,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Sales Orders", 
@@ -285,6 +323,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Orders", 
@@ -310,6 +349,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -334,6 +374,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Material Request", 
@@ -359,6 +400,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Material Requests", 
@@ -384,6 +426,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Select Items", 
@@ -408,6 +451,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Get Items", 
@@ -435,6 +479,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Use Multi-Level BOM", 
@@ -458,6 +503,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Items", 
@@ -483,6 +529,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Production Orders", 
@@ -507,6 +554,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Create Production Orders", 
@@ -532,6 +580,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Material Requirement", 
@@ -555,6 +604,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Material Request For Warehouse", 
@@ -580,6 +630,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Create Material Requests", 
@@ -605,6 +656,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Download Materials Required", 
@@ -631,7 +683,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-02-23 02:37:51.260645", 
+ "modified": "2016-03-16 06:18:50.179089", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Planning Tool", 
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index b79b136..57eca4b 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -32,6 +32,8 @@
 			so_filter += " and so.transaction_date <= %(to_date)s"
 		if self.customer:
 			so_filter += " and so.customer = %(customer)s"
+		if self.project:
+			so_filter += " and so.project = %(project)s"
 
 		if self.fg_item:
 			item_filter += " and item.name = %(item)s"
@@ -53,6 +55,7 @@
 				"from_date": self.from_date,
 				"to_date": self.to_date,
 				"customer": self.customer,
+				"project": self.project,
 				"item": self.fg_item,
 				"company": self.company
 			}, as_dict=1)
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index efcceb3..d0b738f 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -257,4 +257,5 @@
 execute:frappe.delete_doc_if_exists("Web Form", "contact") #2016-03-10
 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
\ No newline at end of file
+erpnext.patches.v6_27.fix_recurring_order_status
+erpnext.patches.v6_20x.remove_customer_supplier_roles
\ No newline at end of file
diff --git a/erpnext/patches/v6_20x/remove_customer_supplier_roles.py b/erpnext/patches/v6_20x/remove_customer_supplier_roles.py
new file mode 100644
index 0000000..e5e3d3f
--- /dev/null
+++ b/erpnext/patches/v6_20x/remove_customer_supplier_roles.py
@@ -0,0 +1,18 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	for role in ('Customer', 'Supplier'):
+		frappe.db.sql('''delete from `tabUserRole`
+			where role=%s and parent in ("Administrator", "Guest")''', role)
+
+		if not frappe.db.sql('select name from `tabUserRole` where role=%s', role):
+
+			# delete DocPerm
+			for doctype in frappe.db.sql('select parent from tabDocPerm where role=%s', role):
+				d = frappe.get_doc("DocType", doctype[0])
+				d.permissions = [p for p in d.permissions if p.role != role]
+				d.save()
+
+			# delete Role
+			frappe.delete_doc_if_exists('Role', role)
diff --git a/erpnext/patches/v6_27/fix_recurring_order_status.py b/erpnext/patches/v6_27/fix_recurring_order_status.py
index c67973a..5843c9f 100644
--- a/erpnext/patches/v6_27/fix_recurring_order_status.py
+++ b/erpnext/patches/v6_27/fix_recurring_order_status.py
@@ -11,41 +11,44 @@
 			"stock_doctype": "Delivery Note",
 			"invoice_doctype": "Sales Invoice",
 			"stock_doctype_ref_field": "against_sales_order",
-			"invoice_ref_field": "sales_order"
+			"invoice_ref_field": "sales_order",
+			"qty_field": "delivered_qty"
 		},
 		{
 			"doctype": "Purchase Order",
 			"stock_doctype": "Purchase Receipt",
 			"invoice_doctype": "Purchase Invoice",
 			"stock_doctype_ref_field": "prevdoc_docname",
-			"invoice_ref_field": "purchase_order"
+			"invoice_ref_field": "purchase_order",
+			"qty_field": "received_qty"
 		}):
-		
-		order_list = frappe.db.sql("""select name from `tab{0}` 
-			where docstatus=1 and is_recurring=1 
+
+		order_list = frappe.db.sql("""select name from `tab{0}`
+			where docstatus=1 and is_recurring=1
 			and ifnull(recurring_id, '') != name and creation >= '2016-01-25'"""
 			.format(doc["doctype"]), as_dict=1)
-	
+
 		for order in order_list:
-			frappe.db.sql("""update `tab{0} Item` 
-				set delivered_qty=0, billed_amt=0 where parent=%s""".format(doc["doctype"]), order.name)
-		
+			frappe.db.sql("""update `tab{0} Item`
+				set {1}=0, billed_amt=0 where parent=%s""".format(doc["doctype"],
+					doc["qty_field"]), order.name)
+
 			# Check against Delivery Note and Purchase Receipt
-			stock_doc_list = frappe.db.sql("""select distinct parent from `tab{0} Item` 
+			stock_doc_list = frappe.db.sql("""select distinct parent from `tab{0} Item`
 				where docstatus=1 and ifnull({1}, '')=%s"""
 				.format(doc["stock_doctype"], doc["stock_doctype_ref_field"]), order.name)
-			
+
 			if stock_doc_list:
 				for dn in stock_doc_list:
 					frappe.get_doc(doc["stock_doctype"], dn[0]).update_qty(update_modified=False)
-		
+
 			# Check against Invoice
-			invoice_list = frappe.db.sql("""select distinct parent from `tab{0} Item` 
+			invoice_list = frappe.db.sql("""select distinct parent from `tab{0} Item`
 				where docstatus=1 and ifnull({1}, '')=%s"""
 				.format(doc["invoice_doctype"], doc["invoice_ref_field"]), order.name)
-			
+
 			if invoice_list:
 				for dn in invoice_list:
 					frappe.get_doc(doc["invoice_doctype"], dn[0]).update_qty(update_modified=False)
-		
+
 			frappe.get_doc(doc["doctype"], order.name).set_status(update=True, update_modified=False)
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.json b/erpnext/projects/doctype/project/project.json
index 1f1943c..34bb36f 100644
--- a/erpnext/projects/doctype/project/project.json
+++ b/erpnext/projects/doctype/project/project.json
@@ -326,6 +326,57 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
+   "collapsible": 1, 
+   "fieldname": "users_section", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Users", 
+   "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": "users", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Users", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project User", 
+   "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": "sb_milestones", 
    "fieldtype": "Section Break", 
@@ -921,7 +972,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 4, 
- "modified": "2016-03-10 05:10:21.779365", 
+ "modified": "2016-03-25 06:46:29.485193", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Project", 
@@ -972,5 +1023,6 @@
  "read_only_onload": 0, 
  "search_fields": "customer, status, priority, is_active", 
  "sort_order": "DESC", 
- "timeline_field": "customer"
+ "timeline_field": "customer", 
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index ec4f523..fa2f6b4 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -124,6 +124,29 @@
 
 		self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
 
+
+
+def get_project_list(doctype, txt, filters, limit_start, limit_page_length=20):
+	return frappe.db.sql('''select distinct project.*
+		from tabProject project, `tabProject User` project_user
+		where
+			(project_user.user = %(user)s
+			and project_user.parent = project.name)
+			or project.owner = %(user)s
+			order by project.modified desc
+			limit {0}, {1}
+		'''.format(limit_start, limit_page_length),
+			{'user':frappe.session.user},
+			as_dict=True,
+			update={'doctype':'Project'})
+
+def get_list_context(context=None):
+	return {
+		"title": _("My Projects"),
+		"get_list": get_project_list,
+		"row_template": "templates/includes/project_row.html"
+	}
+
 @frappe.whitelist()
 def get_cost_center_name(project):
 	return frappe.db.get_value("Project", project, "cost_center")
diff --git a/erpnext/projects/doctype/project_user/__init__.py b/erpnext/projects/doctype/project_user/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/projects/doctype/project_user/__init__.py
diff --git a/erpnext/projects/doctype/project_user/project_user.json b/erpnext/projects/doctype/project_user/project_user.json
new file mode 100644
index 0000000..f808701
--- /dev/null
+++ b/erpnext/projects/doctype/project_user/project_user.json
@@ -0,0 +1,58 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "creation": "2016-03-25 02:52:19.283003", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "user", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "User", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "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
+  }
+ ], 
+ "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-25 03:01:08.629640", 
+ "modified_by": "Administrator", 
+ "module": "Projects", 
+ "name": "Project User", 
+ "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/projects/doctype/project_user/project_user.py b/erpnext/projects/doctype/project_user/project_user.py
new file mode 100644
index 0000000..3198f3b
--- /dev/null
+++ b/erpnext/projects/doctype/project_user/project_user.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 ProjectUser(Document):
+	pass
diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json
index 9816df8..31d6538 100644
--- a/erpnext/projects/doctype/task/task.json
+++ b/erpnext/projects/doctype/task/task.json
@@ -17,6 +17,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Subject", 
@@ -36,12 +37,13 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
+   "bold": 1, 
    "collapsible": 0, 
    "fieldname": "project", 
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Project", 
@@ -68,6 +70,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -93,6 +96,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Status", 
@@ -119,6 +123,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Priority", 
@@ -145,6 +150,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -168,6 +174,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expected Start Date", 
@@ -195,6 +202,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expected Time (in hours)", 
@@ -220,6 +228,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -243,6 +252,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Expected End Date", 
@@ -268,6 +278,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -292,6 +303,7 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Details", 
@@ -319,6 +331,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Depends On", 
@@ -343,6 +356,7 @@
    "fieldtype": "Table", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "depends_on", 
@@ -369,6 +383,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -395,6 +410,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Start Date (via Time Logs)", 
@@ -422,6 +438,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual Time (in hours)", 
@@ -447,6 +464,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -470,6 +488,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Actual End Date (via Time Logs)", 
@@ -495,6 +514,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -518,6 +538,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Costing Amount (via Time Logs)", 
@@ -544,6 +565,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Expense Claim (via Expense Claim)", 
@@ -569,6 +591,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -592,6 +615,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Total Billing Amount (via Time Logs)", 
@@ -616,6 +640,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -640,6 +665,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Review Date", 
@@ -666,6 +692,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Closing Date", 
@@ -691,6 +718,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -713,6 +741,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
@@ -741,7 +770,7 @@
  "istable": 0, 
  "max_attachments": 5, 
  "menu_index": 0, 
- "modified": "2016-02-03 01:11:46.043538", 
+ "modified": "2016-03-29 01:01:50.074252", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Task", 
@@ -773,5 +802,6 @@
  "search_fields": "subject", 
  "sort_order": "DESC", 
  "timeline_field": "project", 
- "title_field": "subject"
+ "title_field": "subject", 
+ "track_seen": 1
 }
\ No newline at end of file
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..1efe4b7 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -643,6 +643,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
+				}	
 			}
 		};
 
@@ -957,5 +963,3 @@
 
 	frm.cscript.calculate_taxes_and_totals();
 });
-
-
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 0a3d5b5..7cfee77 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -2129,7 +2129,7 @@
  "istable": 0, 
  "max_attachments": 1, 
  "menu_index": 0, 
- "modified": "2016-03-03 06:30:26.308629", 
+ "modified": "2016-03-25 07:31:44.251525", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation", 
@@ -2182,27 +2182,6 @@
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "match": "", 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Customer", 
-   "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, 
@@ -2327,5 +2306,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "customer", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
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..2c02e03 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, 
@@ -435,6 +407,163 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "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", 
    "hidden": 0, 
@@ -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-22 11:12:36.533712", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation Item", 
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/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 7e37cb7..c0cb201 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -3018,7 +3018,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-03-21 13:11:32.654873", 
+ "modified": "2016-03-25 07:31:45.471702", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
@@ -3110,26 +3110,6 @@
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 0, 
-   "role": "Customer", 
-   "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, 
@@ -3171,5 +3151,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "customer", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 529c17c..4111eb4 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -336,6 +336,10 @@
 def make_material_request(source_name, target_doc=None):
 	def postprocess(source, doc):
 		doc.material_request_type = "Purchase"
+		
+	def update_item(source, target, source_parent):
+		target.project = source_parent.project
+		
 
 	so = frappe.get_doc("Sales Order", source_name)
 
@@ -353,7 +357,8 @@
 			"field_map": {
 				"parent": "sales_order",
 				"stock_uom": "uom"
-			}
+			},
+			"postprocess": update_item
 		}
 	}, target_doc, postprocess)
 
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..b81393f 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, 
@@ -436,6 +407,163 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "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", 
    "hidden": 0, 
@@ -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-22 11:09:12.915922", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order Item", 
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/email_digest/quotes.py b/erpnext/setup/doctype/email_digest/quotes.py
index 4b996d9..95afe97 100644
--- a/erpnext/setup/doctype/email_digest/quotes.py
+++ b/erpnext/setup/doctype/email_digest/quotes.py
@@ -28,6 +28,7 @@
 		("A small body of determined spirits fired by an unquenchable faith in their mission can alter the course of history.", "Mahatma Gandhi"),
 		("If two wrongs don't make a right, try three.", "Laurence J. Peter"),
 		("Inspiration exists, but it has to find you working.", "Pablo Picasso"),
+		("The world’s first speeding ticket was given to a man going 4 times the speed limit! Walter Arnold was traveling at a breakneck 8 miles an hour in a 2mph zone, and was caught by a policeman on bicycle and fined one shilling!"),
 	]
 
 	return random.choice(quotes)
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/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 27271af..7d5e250 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -437,3 +437,6 @@
 				break
 
 	return territory
+
+def show_terms(doc):
+	return doc.tc_name	
diff --git a/erpnext/shopping_cart/utils.py b/erpnext/shopping_cart/utils.py
index b8d5054..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,10 +31,36 @@
 	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"},
 		{"label": _("Invoices"), "url": "invoices"},
 		{"label": _("Shipments"), "url": "shipments"},
 		{"label": _("Issues"), "url": "issues"},
-		{"label": _("Addresses"), "url": "addresses"},
+		{"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/boot.py b/erpnext/startup/boot.py
index 445c09d..f3f620e 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -38,7 +38,8 @@
 	if country and frappe.db.exists("Country", country):
 		bootinfo.docs += [frappe.get_doc("Country", country)]
 
-	bootinfo.docs += frappe.db.sql("""select * from tabCurrency
+	bootinfo.docs += frappe.db.sql("""select name, fraction, fraction_units,
+		number_format, smallest_currency_fraction_value, symbol from tabCurrency
 		where enabled=1""", as_dict=1, update={"doctype":":Currency"})
 
 def get_letter_heads():
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/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index b4bb456..11890dc 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -2799,7 +2799,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-18 05:10:56.813113", 
+ "modified": "2016-03-25 07:31:44.919162", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
@@ -2891,26 +2891,6 @@
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Customer", 
-   "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, 
@@ -2932,5 +2912,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "customer", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
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..6f49793 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)", 
@@ -443,10 +431,168 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "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-22 11:10:15.168345", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note Item", 
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index ac889fb..37d0b77 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -246,7 +246,7 @@
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
@@ -425,7 +425,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
@@ -2323,7 +2323,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2016-03-10 05:15:41.190950", 
+ "modified": "2016-03-28 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..39ef7e2 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()
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/material_request_item/material_request_item.json b/erpnext/stock/doctype/material_request_item/material_request_item.json
index eecb42a..f6c0ac2 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.json
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.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": "Item Code", 
@@ -44,6 +45,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -66,6 +68,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Name", 
@@ -93,6 +96,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -117,6 +121,7 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -144,6 +149,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -167,6 +173,7 @@
    "fieldtype": "Attach Image", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Image", 
@@ -191,6 +198,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quantity and Warehouse", 
@@ -214,6 +222,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quantity", 
@@ -241,6 +250,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Stock UOM", 
@@ -269,6 +279,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "For Warehouse", 
@@ -297,6 +308,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -319,6 +331,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Required Date", 
@@ -346,6 +359,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "More Information", 
@@ -370,6 +384,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Item Group", 
@@ -396,6 +411,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Brand", 
@@ -424,6 +440,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead Time Date", 
@@ -449,6 +466,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Order", 
@@ -469,10 +487,37 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "project", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Project", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "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_break3", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -495,6 +540,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Min Order Qty", 
@@ -522,6 +568,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Projected Qty", 
@@ -549,6 +596,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Completed Qty", 
@@ -574,6 +622,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Page Break", 
@@ -601,7 +650,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-01-30 06:03:41.424851", 
+ "modified": "2016-03-17 07:20:38.969978", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Material Request Item", 
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/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index b14a700..3c5780a 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -2416,7 +2416,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-16 15:52:17.581445", 
+ "modified": "2016-03-25 07:32:02.276482", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
@@ -2508,26 +2508,6 @@
    "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, 
@@ -2549,5 +2529,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "timeline_field": "supplier", 
- "title_field": "title"
+ "title_field": "title", 
+ "track_seen": 0
 }
\ No newline at end of file
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/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js
index 22396b7..f1f0b66 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.js
+++ b/erpnext/stock/doctype/warehouse/warehouse.js
@@ -1,9 +1,25 @@
 // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.refresh = function(doc) {
-	cur_frm.toggle_display('warehouse_name', doc.__islocal);
-}
+frappe.ui.form.on("Warehouse", {
+	refresh: function(frm) {
+		frm.toggle_display('warehouse_name', frm.doc.__islocal);
+
+		frm.add_custom_button(__("Stock Balance"), function() {
+			frappe.set_route("query-report", "Stock Balance", {"warehouse": frm.doc.name});
+		});
+ 		if(frm.doc.__onload && frm.doc.__onload.account) {
+	 		frm.add_custom_button(__("General Ledger"), function() {
+				frappe.route_options = {
+					"account": frm.doc.__onload.account,
+					"company": frm.doc.company
+				}
+				frappe.set_route("query-report", "General Ledger");
+			});
+ 		}
+	}
+});
+
 
 cur_frm.set_query("create_account_under", function() {
 	return {
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 610c7b8..901b229 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -14,6 +14,14 @@
 		if not self.warehouse_name.endswith(suffix):
 			self.name = self.warehouse_name + suffix
 
+	def onload(self):
+		'''load account name for General Ledger Report'''
+		account = frappe.db.get_value("Account", {
+			"account_type": "Warehouse", "company": self.company, "warehouse": self.name})
+
+		if account:
+			self.set_onload('account', account)
+
 	def validate(self):
 		if self.email_id:
 			validate_email_add(self.email_id, True)
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/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 1f40a21..2591937 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.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": "Subject", 
@@ -40,6 +41,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Series", 
@@ -64,6 +66,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Subject", 
@@ -87,6 +90,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -110,6 +114,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Status", 
@@ -137,6 +142,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Raised By (Email)", 
@@ -163,6 +169,7 @@
    "fieldtype": "Fold", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -185,6 +192,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -209,6 +217,7 @@
    "fieldtype": "Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Description", 
@@ -234,6 +243,7 @@
    "fieldtype": "Column 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": "Datetime", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resolution Date", 
@@ -283,6 +294,7 @@
    "fieldtype": "Datetime", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "First Responded On", 
@@ -306,6 +318,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -330,6 +343,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Lead", 
@@ -354,6 +368,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Contact", 
@@ -378,6 +393,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -401,6 +417,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer", 
@@ -427,6 +444,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Customer Name", 
@@ -448,10 +466,37 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "project", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Project", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "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_19", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -476,6 +521,7 @@
    "fieldtype": "Small Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Resolution Details", 
@@ -502,6 +548,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -526,6 +573,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Opening Date", 
@@ -551,6 +599,7 @@
    "fieldtype": "Time", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Opening Time", 
@@ -576,6 +625,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
@@ -600,6 +650,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Content Type", 
@@ -623,6 +674,7 @@
    "fieldtype": "Attach", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Attachment", 
@@ -650,7 +702,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-02-03 01:08:48.180242", 
+ "modified": "2016-03-25 07:31:44.715945", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Issue", 
@@ -658,26 +710,6 @@
  "permissions": [
   {
    "amend": 0, 
-   "apply_user_permissions": 1, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 0, 
-   "email": 1, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Customer", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
-   "write": 1
-  }, 
-  {
-   "amend": 0, 
    "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 1, 
@@ -702,5 +734,6 @@
  "search_fields": "status,customer,subject,raised_by", 
  "sort_order": "ASC", 
  "timeline_field": "customer", 
- "title_field": "subject"
+ "title_field": "subject", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/templates/emails/request_for_quotation.html b/erpnext/templates/emails/request_for_quotation.html
new file mode 100644
index 0000000..91bdd6b
--- /dev/null
+++ b/erpnext/templates/emails/request_for_quotation.html
@@ -0,0 +1,12 @@
+<h3>{{_("Request for Quotation")}}</h3>
+<br>
+<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 }}">{{ rfq_link }}</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/cart.css b/erpnext/templates/includes/cart.css
index 7a18530..07302db 100644
--- a/erpnext/templates/includes/cart.css
+++ b/erpnext/templates/includes/cart.css
@@ -23,3 +23,10 @@
 	margin-top: 80px;
 	margin-bottom: 60px;
 }
+
+.cart-link {
+	margin-top: 40px;
+	text-align: right;
+
+
+}
\ No newline at end of file
diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js
index 0c29569..9cb5e6e 100644
--- a/erpnext/templates/includes/cart.js
+++ b/erpnext/templates/includes/cart.js
@@ -147,3 +147,8 @@
 	$(".cart-icon").hide();
 	shopping_cart.bind_events();
 });
+
+function show_terms() {
+  var html = $(".cart-terms").html();
+    frappe.msgprint(html);
+}
diff --git a/erpnext/templates/includes/project_row.html b/erpnext/templates/includes/project_row.html
new file mode 100644
index 0000000..3c7331b
--- /dev/null
+++ b/erpnext/templates/includes/project_row.html
@@ -0,0 +1,29 @@
+{% if doc.status=="Open" %}
+<div class="web-list-item">
+	<a class="no-decoration" href="/projects?project={{ doc.name }}">
+		<div class="row">
+			<div class="col-xs-4">
+           
+				{{ doc.name }}
+			</div>
+			<div class="col-xs-4">
+				{% if doc.percent_complete %}
+					<div class="progress" style="margin-bottom: 0!important;">
+					  <div class="progress-bar progress-bar-warning" role="progressbar" 
+					  	aria-valuenow="{{ doc.percent_complete|round|int }}"
+					  	aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
+					    {{ doc.percent_complete|round|int }}% Complete
+					  </div>
+					</div>
+				{% else %}
+					<span class="indicator {{ "red" if doc.status=="Open" else "darkgrey"  }}">
+						{{ doc.status }}</span>
+				{% endif %}
+			</div>
+			<div class="col-xs-4 text-right small text-muted">
+				{{ frappe.utils.pretty_date(doc.modified) }}
+			</div>
+		</div>
+	</a>
+</div>
+{% endif %}
diff --git a/erpnext/templates/includes/projects.css b/erpnext/templates/includes/projects.css
new file mode 100644
index 0000000..99ec4c8
--- /dev/null
+++ b/erpnext/templates/includes/projects.css
@@ -0,0 +1,177 @@
+/* CSS used here will be applied after bootstrap.css */
+
+.underline {
+	text-decoration: underline;
+}
+
+.page-container .indicator {
+	font-weight: normal;
+}
+
+.page-container .project-item {
+	padding-top: 5px;
+	padding-bottom: 5px;
+}
+
+#project-search {
+	border: none;
+}
+
+.task-link {
+	font-weight: bold;
+}
+
+.task-link.seen {
+	font-weight: normal;
+}
+
+.row-header {
+    font-size: 14px;
+    font-weight: 500;
+    padding-bottom: 8px;
+    border-bottom: 2px solid #d1d8dd;
+    margin: 0!important;
+}
+
+.content_display{
+  padding: 5px;
+  font-weight: normal;
+  font-size: 12px;
+  vertical-align: middle;
+  color: #6c7680;
+}
+
+.close-btn{
+  display: none;
+}
+
+.content_display:hover .close-btn{
+	display : block;
+}
+
+.btn-link{
+	padding: 0 10px 0 0;
+}
+
+.bold {
+	font-weight: bold;
+}
+
+
+.task-btn, .issue-btn, .timelog-btn{
+	padding: 8px;
+}
+
+.timeline-centered {
+    position: relative;
+    margin-bottom: 10px;
+}
+
+.timeline-centered:before {
+    content: '';
+    position: absolute;
+    display: block;
+    width: 3px;
+    background: #f5f5f6;
+    /*left: 50%;*/
+    top: 0px;
+    bottom: 0px;
+    margin-left: 10px;
+}
+
+.timeline-centered .timeline-entry {
+    position: relative;
+    /*width: 50%;
+float: right;*/
+    margin-top: 5px;
+    margin-left: 10px;
+    margin-bottom: 5px;
+    clear: both;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner {
+    position: relative;
+    margin-left: -3px;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon {
+	margin-top:14px;
+    background: #fff;
+    color: #737881;
+    display: block;
+    width: 10px;
+    height: 10px;
+    -webkit-background-clip: padding-box;
+    -moz-background-clip: padding;
+    background-clip: padding-box;
+    -webkit-border-radius: 20px;
+    -moz-border-radius: 20px;
+    border-radius: 20px;
+    text-align: center;
+    -moz-box-shadow: 0 0 0 2px #f5f5f6;
+    -webkit-box-shadow: 0 0 0 2px #f5f5f6;
+    box-shadow: 0 0 0 2px #f5f5f6;
+    line-height: 30px;
+    float: left;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-primary {
+    background-color: #303641;
+    color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-secondary {
+    background-color: #ee4749;
+    color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-success {
+    background-color: #98d85b;
+    color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-info {
+    background-color: #21a9e1;
+    color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-warning {
+    background-color: #ffa00a;
+    color: #fff;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-icon.bg-danger {
+    background-color: #ff5858;
+    color: #fff;
+}
+
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-label {
+    position: relative;
+    background: #f5f5f6;
+    padding: 1em;
+    margin-left: 40px;
+    -webkit-background-clip: padding-box;
+    -moz-background-clip: padding;
+    background-clip: padding-box;
+    -webkit-border-radius: 3px;
+    -moz-border-radius: 3px;
+    border-radius: 3px;
+}
+
+.timeline-centered .timeline-entry .timeline-entry-inner .timeline-label:after {
+    content: '';
+    display: block;
+    position: absolute;
+    width: 0;
+    height: 0;
+    border-style: solid;
+    border-width: 9px 9px 9px 0;
+    border-color: transparent #f5f5f6 transparent transparent;
+    left: 0;
+    top: 10px;
+    margin-left: -9px;
+}
diff --git a/erpnext/templates/includes/projects/macros.html b/erpnext/templates/includes/projects/macros.html
new file mode 100644
index 0000000..5b22583
--- /dev/null
+++ b/erpnext/templates/includes/projects/macros.html
@@ -0,0 +1,2 @@
+{% macro back_link(doc) %}&back-to=/projects?project={{ doc.name }}&back-to-title={{ doc.project_name }}{% endmacro %}
+
diff --git a/erpnext/templates/includes/projects/project_issues.html b/erpnext/templates/includes/projects/project_issues.html
new file mode 100644
index 0000000..f8924f5
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_issues.html
@@ -0,0 +1,28 @@
+{%- from "templates/includes/projects/macros.html" import back_link -%}
+
+{% for issue in doc.issues %}
+		<div class='issue'>
+			<div class='row project-item'>
+				<div class='col-xs-9'>
+					<a class="no-decoration" href="/issues?name={{ issue.name}}{{ back_link(doc) }}">
+						<span class="indicator {{ "red" if issue.status=="Open" else "green" }}">
+							{% if issue.status == "Closed" %}
+							{{ issue.subject }} resolved {{ frappe.utils.pretty_date(issue.resolution_date) }}
+							{% else %}
+							{{ issue.subject }} raised on {{ issue.opening_date }}
+							{% endif %}
+						</span>
+					</a>
+				</div>
+				<div class='col-xs-3'>
+					<div class='pull-right'>
+						{% if issue.todo %}
+						<span class="avatar avatar-small" title="{{ issue.todo.owner }}"> <img src="{{ 				issue.todo.user_image }}"></span>
+						{% else %}
+						<span class="avatar avatar-small avatar-empty"></span>
+						{% endif %}
+					</div>
+				</div>
+			</div>
+		</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/project_search_box.html b/erpnext/templates/includes/projects/project_search_box.html
new file mode 100644
index 0000000..59ebaa4
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_search_box.html
@@ -0,0 +1,21 @@
+<div class="project-search">
+	<input type="text" id="project-search"
+	placeholder="Search...">
+		<span style="position:relative;
+		left:-19px;"> <a href="/projects?project={{doc.name}}" class="octicon octicon-x text-extra-muted" title="Clear" ></a> </span>
+</div>
+
+<script>
+frappe.ready(function() {
+	var thread = null;
+	function findResult(t) {
+		window.location.href="/projects?project={{doc.name}}&q=" + t;
+	}
+
+	$("#project-search").keyup(function() {
+		clearTimeout(thread);
+		var $this = $(this); thread = setTimeout(function(){findResult($this.val())}, 1000);
+	});
+	$(".form-search").on("submit", function() { return false; });
+});
+</script>
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/project_tasks.html b/erpnext/templates/includes/projects/project_tasks.html
new file mode 100644
index 0000000..3db5a68
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_tasks.html
@@ -0,0 +1,24 @@
+{%- from "templates/includes/projects/macros.html" import back_link -%}
+
+{% for task in doc.tasks %}
+	<div class='task'>
+		<div class='row project-item'>
+			<div class='col-xs-9'>
+				{% if task.todo %}
+				<span class="avatar avatar-small" title="{{ task.todo.owner }}">
+					<img src="{{ task.todo.user_image }}">
+				</span>
+				{% else %}
+				<span class="avatar avatar-small avatar-empty"></span>
+				{% endif %}
+				<a class="no-decoration task-link {{ task.css_seen }}" href="/tasks?name={{ task.name }}{{ back_link(doc) }}">
+					{% if task.status == "Closed" %}
+					{{ task.subject }} completed on {{ task.closing_date }}
+					{% else %}
+					{{ task.subject }}
+					{% endif %}
+				</a>
+			</div>
+		</div>
+	</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/project_timelogs.html b/erpnext/templates/includes/projects/project_timelogs.html
new file mode 100644
index 0000000..7b5913b
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_timelogs.html
@@ -0,0 +1,22 @@
+{%- from "templates/includes/projects/macros.html" import back_link -%}
+
+{% for timelog in doc.timelogs %}
+<div class='timelog'>
+  <div class='row project-item'>
+    <div class='col-xs-9'>
+      <a class="no-decoration" href="/timelog_info?timelog={{ timelog.name}}">
+        <span class="indicator {{ "green" if timelog.status=="Draft" else "blue" if timelog.status=="Submitted" else 			"darkgrey"}}">
+
+			{{ timelog.title }}: From {{ frappe.format_date(timelog.from_time) }} to {{ 				frappe.format_date(timelog.to_time) }}
+
+</span>
+      </a>
+    </div>
+    <div class='col-xs-3'>
+	    <div class='pull-right'>
+	       <span class="avatar avatar-small" title="{{ timelog.modified_by }}"> <img src="{{ timelog.user_image }}"></span>
+	    </div>
+	</div>
+  </div>
+</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/timeline.html b/erpnext/templates/includes/projects/timeline.html
new file mode 100644
index 0000000..605404b
--- /dev/null
+++ b/erpnext/templates/includes/projects/timeline.html
@@ -0,0 +1,17 @@
+{% for timeline in doc.timelines %}
+	<article class="timeline-entry">
+		<div class="timeline-entry-inner">
+			<div class="timeline-icon {{ "bg-danger" if ((timeline.reference_name).startswith('ISS') and (timeline.subject).startswith('Open')) else "bg-warning" if ((timeline.reference_name).startswith('TASK') and (timeline.subject).startswith('Open')) else "bg-success" if (timeline.subject).startswith('Closed') else "bg-info"}}">		
+			</div>
+			<div class="timeline-label">
+				<span class="avatar avatar-small" title="{{ timeline.modified_by }}"> <img src="{{ timeline.user_image }}"></span>
+				<span class='indicator'>
+				{{timeline.reference_name}} {{timeline.subject }}
+				</span>
+				<span class='indicator pull-right'>
+				{{ frappe.utils.pretty_date(timeline.creation) }}
+				</span>
+			</div>
+		</div>
+	</article>
+{% endfor %}
\ No newline at end of file
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..de9a95f
--- /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">
+            <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/cart.html b/erpnext/templates/pages/cart.html
index 6891bce..f2104f9 100644
--- a/erpnext/templates/pages/cart.html
+++ b/erpnext/templates/pages/cart.html
@@ -61,6 +61,15 @@
         </div>
     	<div id="cart-totals">
     	</div>
+        {% if doc.tc_name %}
+          <div class="cart-terms" style="display: none;" title={{doc.tc_name}}>
+          {{doc.tc_name}}
+          {{doc.terms}}
+          </div>
+          <div class="cart-link">
+            <a href="#" onclick="show_terms();return false;">*Terms and Conditions</a>
+          </div>  
+        {% endif %}
     	<div class="cart-addresses">
             {% include "templates/includes/cart/cart_address.html" %}
     	</div>
diff --git a/erpnext/templates/pages/cart_terms.html b/erpnext/templates/pages/cart_terms.html
new file mode 100644
index 0000000..521c583
--- /dev/null
+++ b/erpnext/templates/pages/cart_terms.html
@@ -0,0 +1,2 @@
+
+<div>{{doc.terms}}</div>
\ No newline at end of file
diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html
index 03e625d..3252eb9 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -1,4 +1,4 @@
-t{% extends "templates/web.html" %}
+{% extends "templates/web.html" %}
 
 {% block header %}
 <h1>{{ doc.name }}</h1>
diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html
new file mode 100644
index 0000000..fef79ce
--- /dev/null
+++ b/erpnext/templates/pages/projects.html
@@ -0,0 +1,109 @@
+{% extends "templates/web.html" %}
+
+{% block title %}{{ doc.project_name }}{% endblock %}
+
+{%- from "templates/includes/projects/macros.html" import back_link -%}
+
+{% block breadcrumbs %}
+   <div class="page-breadcrumbs" data-html-block="breadcrumbs">
+   	<ul class="breadcrumb">
+   		<li>
+   			<span class="icon icon-angle-left"></span>
+   			<a href="/project">Projects</a>
+   		</li>
+   	</ul>
+   </div>
+{% endblock %}
+
+{% block header %}
+<h1 class= "title">
+{{ doc.project_name }}
+</h1>
+{% endblock %}
+
+{% block style %}
+	<style>
+		{% include "templates/includes/projects.css" %}
+	</style>
+{% endblock %}
+
+
+{% block page_content %}
+
+{% include 'templates/includes/projects/project_search_box.html' %}
+
+<!-- {% if frappe.form_dict.q %}
+	<p class="text-muted"> <a href="/projects?project={{doc.name}}" class="text-muted">
+	Filtered by "{{ frappe.form_dict.q }}" Clear</a></p>
+{% else %}
+	<h3>{{ _("Activity Feed") }}</h3>
+	<div class='project-timelines timeline-centered'>
+	{% include "erpnext/templates/includes/projects/timeline.html" %}
+	</div>
+		{% if doc.timelines|length > 9 %}
+		<p><a class='more-timelines small underline'>{{ _("More") }}</a><p>
+		{% endif %}
+
+{% endif %} -->
+
+<div class='padding'></div>
+
+<h3>{{ _("Tasks") }}</h3>
+
+<p>
+<a class='small underline' href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
+<a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
+</p>
+
+{% if doc.tasks %}
+	<div class='project-task-section'>
+		<div class='project-task'>
+		{% include "erpnext/templates/includes/projects/project_tasks.html" %}
+		</div>
+		<p><a id= 'more-task' style='display: none;' class='more-tasks small underline'>{{ _("More") }}</a><p>
+	</div>
+{% else %}
+	<p class="text-muted">No tasks</p>
+{% endif %}
+
+
+<!-- <div class='padding'></div>
+<h3>{{ _("Issues") }}</h3>
+
+<p>
+	<a class='small underline' href='/issues?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New issue</a>
+	<a class='small underline issue-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
+</p>
+
+{% if doc.issues %}
+	<div class='project-issue-section'>
+		<div class='project-issue'>
+			{% include "erpnext/templates/includes/projects/project_issues.html" %}
+		</div>
+		<p><a id='more-issue' style='display: none;' class='more-issues small underline'>{{ _("More") }}</a><p>
+	</div>
+{% else %}
+	<p class="text-muted">No Issues</p>
+{% endif %} -->
+
+<div class='padding'></div>
+
+<h3>{{ _("Time Logs") }}</h3>
+
+{% if doc.timelogs %}
+	<div class='project-timelogs'>
+	{% include "erpnext/templates/includes/projects/project_timelogs.html" %}
+	</div>
+	{% if doc.timelogs|length > 9 %}
+		<p><a class='more-timelogs small underline'>{{ _("More") }}</a><p>
+	{% endif %}
+{% else %}
+	<p class="text-muted">No time logs</p>
+{% endif %}
+</div>
+
+<script>
+	{% include "erpnext/templates/pages/projects.js" %}
+</script>
+
+{% endblock %}
diff --git a/erpnext/templates/pages/projects.js b/erpnext/templates/pages/projects.js
new file mode 100644
index 0000000..a0e0ee0
--- /dev/null
+++ b/erpnext/templates/pages/projects.js
@@ -0,0 +1,136 @@
+frappe.ready(function() {
+
+	$('.task-status-switch').on('click', function() {
+		var $btn = $(this);
+		if($btn.attr('data-status')==='Open') {
+			reload_items('closed', 'task', $btn);
+		} else {
+			reload_items('open', 'task', $btn);
+		}
+	})
+
+
+	$('.issue-status-switch').on('click', function() {
+		var $btn = $(this);
+		if($btn.attr('data-status')==='Open') {
+			reload_items('closed', 'issue', $btn);
+		} else {
+			reload_items('open', 'issue', $btn);
+		}
+	})
+
+	//
+	// $('.btn-closed-tasks').click(function() {
+	// 	reload_items('closed','tasks');
+	// });
+	//
+	// $('.btn-open-tasks').click(function() {
+	// 	reload_items('open','tasks');
+	// });
+	//
+	// $('.btn-closed-issues').click(function() {
+	// 	reload_items('closed','issues');
+	// });
+	//
+	// $('.btn-open-issues').click(function() {
+	// 	reload_items('open','issues');
+	// });
+
+	var start = 10;
+	$(".more-tasks").click(function() {
+		more_items('task', true);
+	});
+
+	$(".more-issues").click(function() {
+		more_items('issue', true);
+	});
+
+	$(".more-timelogs").click(function() {
+		more_items('timelog', false);
+	});
+
+	$(".more-timelines").click(function() {
+		more_items('timeline', false);
+	});
+
+
+	var reload_items = function(item_status, item, $btn) {
+		$.ajax({
+			method: "GET",
+			url: "/",
+			dataType: "json",
+			data: {
+				cmd: "erpnext.templates.pages.projects.get_"+ item +"_html",
+				project: '{{ doc.name }}',
+				item_status: item_status,
+			},
+			dataType: "json",
+			success: function(data) {
+				if(typeof data.message == 'undefined') {
+					$('.project-'+ item).html("No "+ item_status +" "+ item);
+					$(".more-"+ item).toggle(false);
+				}
+				$('.project-'+ item).html(data.message);
+				$(".more-"+ item).toggle(true);
+
+				// update status
+				if(item_status==='open') {
+					$btn.html(__('Show closed')).attr('data-status', 'Open');
+				} else {
+					$btn.html(__('Show open')).attr('data-status', 'Closed');
+				}
+			}
+		});
+
+	}
+
+	var more_items = function(item, item_status){
+		if(item_status)
+		{
+			var item_status = $('.project-'+ item +'-section .btn-group .bold').hasClass('btn-closed-'+ item)
+				? 'closed' : 'open';
+		}
+		$.ajax({
+			method: "GET",
+			url: "/",
+			dataType: "json",
+			data: {
+				cmd: "erpnext.templates.pages.projects.get_"+ item +"_html",
+				project: '{{ doc.name }}',
+				start: start,
+				item_status: item_status,
+			},
+			dataType: "json",
+			success: function(data) {
+
+				$(data.message).appendTo('.project-'+ item);
+				if(typeof data.message == 'undefined') {
+					$(".more-"+ item).toggle(false);
+				}
+			start = start+10;
+			}
+		});
+	}
+
+	var close_item = function(item, item_name){
+		var args = {
+			project: '{{ doc.name }}',
+			item_name: item_name,
+		}
+		frappe.call({
+			btn: this,
+			type: "POST",
+			method: "erpnext.templates.pages.projects.set_"+ item +"_status",
+			args: args,
+			callback: function(r) {
+				if(r.exc) {
+					if(r._server_messages)
+						frappe.msgprint(r._server_messages);
+				} else {
+					$(this).remove();
+				}
+			}
+		})
+		return false;
+	}
+});
\ No newline at end of file
diff --git a/erpnext/templates/pages/projects.py b/erpnext/templates/pages/projects.py
new file mode 100644
index 0000000..c2cb6c7
--- /dev/null
+++ b/erpnext/templates/pages/projects.py
@@ -0,0 +1,164 @@
+# 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
+import json
+
+def get_context(context):
+	context.no_cache = 1
+
+	project = frappe.get_doc('Project', frappe.form_dict.project)
+
+	project.has_permission('read')
+
+	context.issues = frappe.get_all('Issue', filters={'project': project.project_name},
+	fields=['subject', 'opening_date', 'resolution_date', 'status', 'name', 'resolution_details','modified','modified_by'])
+
+	project.tasks = get_tasks(project.name, start=0, item_status='open',
+		search=frappe.form_dict.get("q"))
+
+	project.issues = get_issues(project.name, start=0, item_status='open',
+		search=frappe.form_dict.get("q"))
+
+	project.timelogs = get_timelogs(project.name, start=0,
+		search=frappe.form_dict.get("q"))
+
+	project.timelines = get_timeline(project.project_name, start=0)
+
+
+
+	context.doc = project
+
+
+def get_timeline(project, start=10):
+	'''Get timeline from project, tasks, issues'''
+	issues_condition = ''
+	project_issues = get_issues(project)
+
+	if project_issues:
+		issue_names = '({0})'.format(", ".join(["'{0}'".format(i.name) for i in project_issues]))
+		issues_condition = """or (reference_doctype='Issue' and reference_name IN {issue_names})""".format(issue_names=issue_names)
+
+
+	timelines = frappe.db.sql("""
+		select
+			sender_full_name,
+			subject, communication_date, comment_type, name, creation, modified_by, reference_doctype, reference_name,
+			_liked_by, comment_type, _comments
+		from
+			tabCommunication
+		where
+			(reference_doctype='Project' and reference_name=%s)
+			or (timeline_doctype='Project' and timeline_name=%s)
+			{issues_condition}
+		order by
+			modified DESC limit {start}, {limit}""".format(
+			issues_condition=issues_condition, start=start, limit=10),
+			(project, project), as_dict=True);
+	for timeline in timelines:
+ 		timeline.user_image = frappe.db.get_value('User', timeline.modified_by, 'user_image')
+	return timelines
+
+@frappe.whitelist()
+def get_timelines_html(project, start=0):
+	return frappe.render_template("erpnext/templates/includes/projects/timeline.html",
+		{"doc": {
+			"timelines": get_timeline(project, start)}
+		}, is_path=True)
+
+def get_issue_list(project):
+	return [issue.name for issue in get_issues(project)]
+
+
+
+def get_tasks(project, start=0, search=None, item_status=None):
+	filters = {"project": project}
+	if search:
+		filters["subject"] = ("like", "%{0}%".format(search))
+	if item_status:
+		filters["status"] = item_status
+	tasks = frappe.get_all("Task", filters=filters,
+		fields=["name", "subject", "status", "exp_start_date", "exp_end_date", "priority", "_seen"],
+		limit_start=start, limit_page_length=10)
+
+	for task in tasks:
+		task.todo = frappe.get_all('ToDo',filters={'reference_name':task.name, 'reference_type':'Task'},
+		fields=["assigned_by", "owner", "modified", "modified_by"])
+
+		if task.todo:
+			task.todo=task.todo[0]
+			task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image')
+
+		if task._comments:
+			task.comment_count = len(json.loads(task._comments or "[]"))
+
+		task.css_seen = ''
+		if task._seen:
+			if frappe.session.user in json.loads(task._seen):
+				task.css_seen = 'seen'
+
+	return tasks
+
+@frappe.whitelist()
+def get_task_html(project, start=0, item_status=None):
+	return frappe.render_template("erpnext/templates/includes/projects/project_tasks.html",
+		{"doc": {
+			"name": project,
+			"project_name": project,
+			"tasks": get_tasks(project, start, item_status=item_status)}
+		}, is_path=True)
+
+
+
+
+def get_issues(project, start=0, search=None, item_status=None):
+	filters = {"project": project}
+	if search:
+		filters["subject"] = ("like", "%{0}%".format(search))
+	if item_status:
+		filters["status"] = item_status
+	issues = frappe.get_all("Issue", filters=filters,
+		fields=["name", "subject", "status", "opening_date", "resolution_date", "resolution_details"],
+		order_by='modified desc',
+		limit_start=start, limit_page_length=10)
+
+	for issue in issues:
+		issue.todo = frappe.get_all('ToDo',filters={'reference_name':issue.name, 'reference_type':'Issue'},
+		fields=["assigned_by", "owner", "modified", "modified_by"])
+		if issue.todo:
+			issue.todo=issue.todo[0]
+			issue.todo.user_image = frappe.db.get_value('User', issue.todo.owner, 'user_image')
+
+	return issues
+
+@frappe.whitelist()
+def get_issue_html(project, start=0, item_status=None):
+	return frappe.render_template("erpnext/templates/includes/projects/project_issues.html",
+		{"doc": {
+			"name": project,
+			"project_name": project,
+			"issues": get_issues(project, start, item_status=item_status)}
+		}, is_path=True)
+
+
+
+
+
+def get_timelogs(project, start=0, search=None):
+	filters = {"project": project}
+	if search:
+		filters["title"] = ("like", "%{0}%".format(search))
+
+	timelogs = frappe.get_all('Time Log', filters=filters,
+	fields=['name','title','task','activity_type','from_time','to_time','hours','status','modified','modified_by'],
+	limit_start=start, limit_page_length=10)
+	for timelog in timelogs:
+		timelog.user_image = frappe.db.get_value('User', timelog.modified_by, 'user_image')
+	return timelogs
+
+@frappe.whitelist()
+def get_timelog_html(project, start=0):
+	return frappe.render_template("erpnext/templates/includes/projects/project_timelogs.html",
+		{"doc": {"timelogs": get_timelogs(project, start)}}, is_path=True)
+
diff --git a/erpnext/templates/pages/rfq.html b/erpnext/templates/pages/rfq.html
new file mode 100644
index 0000000..5556d26
--- /dev/null
+++ b/erpnext/templates/pages/rfq.html
@@ -0,0 +1,83 @@
+{% 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-5 text-left text-muted">{{ _("Terms and Conditions: ") }}</div>
+		</div>
+		<div class="row terms">
+			<div class="col-xs-5 text-left text-muted">
+				<textarea  class="form-control terms-feedback" style="border:1px solid #cccccc; padding:4px"></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..fbdd6db
--- /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 `tabRFQ Supplier`
+		where supplier = '{supplier}'""".format(supplier=supplier)):
+		status = False
+	return status
diff --git a/erpnext/templates/pages/task_info.html b/erpnext/templates/pages/task_info.html
new file mode 100644
index 0000000..c756cd5
--- /dev/null
+++ b/erpnext/templates/pages/task_info.html
@@ -0,0 +1,149 @@
+{% extends "templates/web.html" %}
+{% block title %} {{ doc.name }} {% endblock %}
+{% block breadcrumbs %}
+<div class="page-breadcrumbs" data-html-block="breadcrumbs">	                    
+	<ul class="breadcrumb">
+		<li>
+			<span class="icon icon-angle-left"></span>
+			<a href="/projects?project={{ doc.project }}">{{ doc.project }}</a>
+		</li>	
+	</ul>
+</div>
+{% endblock %}
+{% block page_content %}
+<div class="row">	
+	<div class=" col-sm-8 ">
+		<h1> {{ doc.subject }} </h1>
+    </div>
+	
+	<div class="col-sm-4">
+		<div class="page-header-actions-block" data-html-block="header-actions">	
+			<button type="submit" class="btn btn-primary btn-sm btn-form-submit">
+	    		Update</button>
+	    		<a href="tasks" class="btn btn-default btn-sm">
+	    		Cancel</a>
+		</div>
+    </div>
+</div>
+
+<div class="page-content-block">
+	<form role="form" data-web-form="tasks">
+	
+		<input type="hidden" name="web_form" value="tasks">
+		<input type="hidden" name="doctype" value="Task">
+		<input type="hidden" name="name" value="TASK00056">
+
+		<div class="row">
+			<div class="col-sm-12" style="max-width: 500px;">
+				<div class="form-group">		
+					<label for="project" class="control-label text-muted small">Project</label>
+						<input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">		
+				</div>
+
+				<div class="form-group">
+					<label for="subject" class="control-label text-muted small">Subject</label>
+					<input type="text" class="form-control" name="subject" readonly value="{{ doc.subject }}">
+				</div>
+								
+				<div class="form-group">
+					<label for="description" class="control-label text-muted small">Details</label>
+					<textarea class="form-control" style="height: 200px;" name="description">{{ doc.description }}</textarea>
+				</div>						
+								
+				<div class="form-group">
+					<label for="priority" class="control-label text-muted small">Priority</label>
+					<input type="text" class="form-control" name="priority" readonly value="{{ doc.priority }}">
+				</div>
+							
+				<div class="form-group">
+					<label for="exp_start_date" class="control-label text-muted small">Expected Start Date</label>
+					<input type="text" class="form-control hasDatepicker" name="exp_start_date" readonly value="{{ doc.exp_start_date }}">
+				</div>
+			
+				<div class="form-group">
+					<label for="exp_end_date" class="control-label text-muted small">Expected End Date</label>
+					<input type="text" class="form-control hasDatepicker" name="exp_end_date" readonly value="{{ doc.exp_end_date }}">
+				</div>
+
+				<div class="form-group">
+					<label for="status" class="control-label text-muted small">Status</label>
+					<select class="form-control" name="status" id="status" data-label="Status" data-fieldtype="Select">
+						<option value="Open" selected="selected">
+							Open</option><option value="Working">
+							Working</option><option value="Pending Review">
+							Pending Review</option><option value="Overdue">
+							Overdue</option><option value="Closed">
+							Closed</option><option value="Cancelled">
+							Cancelled</option>
+					</select>
+				</div>
+			</div>
+		</div>		
+	</form>
+</div>
+
+<div class="comments">
+	<h3>Comments</h3>
+	<div class="no-comment">
+		{% for comment in comments %}
+			<p class="text-muted">{{comment.sender_full_name}} : {{comment.subject}} on 									   									{{comment.communication_date.strftime('%Y-%m-%d')}}</p>
+		{% endfor %}
+	</div>
+	<div class="comment-form-wrapper">
+		<a class="add-comment btn btn-default btn-sm">Add Comment</a>
+		<div style="display: none;" id="comment-form">
+			<p>Add Comment</p>
+			<form>	
+				<fieldset>
+					<textarea class="form-control" name="comment" rows="5" placeholder="Comment"></textarea>
+					<p>
+						<button class="btn btn-primary btn-sm" id="submit-comment">Submit</button>
+					</p>
+				</fieldset>
+			</form>
+		</div>
+	</div>
+</div>
+				<script>
+					frappe.ready(function() {
+						var n_comments = $(".comment-row").length;
+						$(".add-comment").click(function() {
+							$(this).toggle(false);
+							$("#comment-form").toggle();
+							$("#comment-form textarea").val("");
+						})
+						$("#submit-comment").click(function() {
+							var args = {
+								comment_by_fullname: "test",
+								comment_by: "admin@localhost.com",
+								comment: $("[name='comment']").val(),
+								reference_doctype: "Task",
+								reference_name: "TASK00069",
+								comment_type: "Comment",
+								page_name: "tasks",
+							}
+
+							frappe.call({
+								btn: this,
+								type: "POST",
+								method: "frappe.templates.includes.comments.comments.add_comment",
+								args: args,
+								callback: function(r) {
+									if(r.exc) {
+										if(r._server_messages)
+											frappe.msgprint(r._server_messages);
+									} else {
+										$(r.message).appendTo("#comment-list");
+										$(".no-comment, .add-comment").toggle(false);
+										$("#comment-form")
+											.replaceWith('<div class="text-muted">Thank you for your comment!</div>')
+									}
+								}
+							})
+
+							return false;
+						})
+					});
+				</script>
+					
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/task_info.py b/erpnext/templates/pages/task_info.py
new file mode 100644
index 0000000..b832b88
--- /dev/null
+++ b/erpnext/templates/pages/task_info.py
@@ -0,0 +1,14 @@
+from __future__ import unicode_literals
+import frappe
+
+from frappe import _
+
+def get_context(context):
+	context.no_cache = 1
+
+	task = frappe.get_doc('Task', frappe.form_dict.task)
+	
+	context.comments = frappe.get_all('Communication', filters={'reference_name': task.name, 'comment_type': 'comment'},
+	fields=['subject', 'sender_full_name', 'communication_date'])
+	
+	context.doc = task
\ No newline at end of file
diff --git a/erpnext/templates/pages/timelog_info.html b/erpnext/templates/pages/timelog_info.html
new file mode 100644
index 0000000..76dbc32
--- /dev/null
+++ b/erpnext/templates/pages/timelog_info.html
@@ -0,0 +1,48 @@
+{% extends "templates/web.html" %}
+{% block title %} {{ doc.name }} {% endblock %}
+{% block breadcrumbs %}
+<div class="page-breadcrumbs" data-html-block="breadcrumbs">	                    
+	<ul class="breadcrumb">
+		<li>
+			<span class="icon icon-angle-left"></span>
+			<a href="/projects?project={{ doc.project }}">{{ doc.project }}</a>
+		</li>	
+</ul>
+</div>
+{% endblock %}
+
+{% block page_content %}
+	<div class=" col-sm-8 ">
+		<h1> {{ doc.name }} </h1>
+	</div>
+
+	<div class="page-content-block">
+		<div class="row">
+			<div class="col-sm-12" style="max-width: 500px;">							
+				<label for="project" class="control-label text-muted small">Project</label>
+				<input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">	
+				
+				<label for="activity_type" class="control-label text-muted small">Activity Type</label>
+				<input type="text" class="form-control" name="activity_type" readonly value= "{{ doc.activity_type }}">	
+
+				<label for="task" class="control-label text-muted small">Task</label>
+				<input type="text" class="form-control" name="task" readonly value= "{{ doc.task }}">	
+
+				<label for="from_time" class="control-label text-muted small">From Time</label>
+				<input type="text" class="form-control" name="from_time" readonly value= "{{ doc.from_time }}">	
+				
+				<label for="to_time" class="control-label text-muted small">To Time</label>
+				<input type="text" class="form-control" name="to_time" readonly value= "{{ doc.to_time }}">	
+				
+				<label for="to_time" class="control-label text-muted small">Hours</label>
+				<input type="text" class="form-control" name="Hours" readonly value= "{{ doc.hours }}">
+
+				<label for="status" class="control-label text-muted small">Status</label>
+				<input type="text" class="form-control" name="status" readonly value= "{{ doc.status }}">	
+				
+				<label for="Note" class="control-label text-muted small">Note</label>
+				<textarea class="form-control" name="Hours" readonly> {{ doc.note }} </textarea>
+			</div>
+		</div>
+	</div>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/timelog_info.py b/erpnext/templates/pages/timelog_info.py
new file mode 100644
index 0000000..7a3361c
--- /dev/null
+++ b/erpnext/templates/pages/timelog_info.py
@@ -0,0 +1,11 @@
+from __future__ import unicode_literals
+import frappe
+
+from frappe import _
+
+def get_context(context):
+	context.no_cache = 1
+
+	timelog = frappe.get_doc('Time Log', frappe.form_dict.timelog)
+	
+	context.doc = timelog
\ No newline at end of file
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