Merge pull request #5023 from nabinhait/balance_sheet_opening

[fix][balance sheet] Check if precious fiscal  year is closed
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 0fa96da..36a86ab 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.27.1'
+__version__ = '6.27.3'
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index c2628c9..a67f109 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-18 13:13:43.694604", 
+ "modified": "2016-03-21 13:13:43.694604", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 598cfb8..20b8d1b 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-18 13:12:12.430038", 
+ "modified": "2016-03-21 13:12:12.430038", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 055f059..2b4b989 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-18 13:13:07.334625", 
+ "modified": "2016-03-21 13:13:07.334625", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py
index 3a62716..2298c3f 100644
--- a/erpnext/controllers/trends.py
+++ b/erpnext/controllers/trends.py
@@ -43,6 +43,10 @@
 	inc, cond= '',''
 	query_details =  conditions["based_on_select"] + conditions["period_wise_select"]
 
+	posting_date = 't1.transaction_date'
+	if conditions.get('trans') in ['Sales Invoice', 'Purchase Invoice', 'Purchase Receipt', 'Delivery Note']:
+		posting_date = 't1.posting_date'
+
 	if conditions["based_on_select"] in ["t1.project,", "t2.project,"]:
 		cond = 'and '+ conditions["based_on_select"][:-1] +' IS Not NULL'
 
@@ -65,11 +69,11 @@
 		else :
 			inc = 1
 		data1 = frappe.db.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
-					where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date and
+					where t2.parent = t1.name and t1.company = %s and %s between %s and %s and
 					t1.docstatus = 1 %s %s
 					group by %s
 				""" % (query_details,  conditions["trans"],  conditions["trans"], conditions["addl_tables"], "%s",
-					"%s", "%s", conditions.get("addl_tables_relational_cond"), cond, conditions["group_by"]), (filters.get("company"),
+					posting_date, "%s", "%s", conditions.get("addl_tables_relational_cond"), cond, conditions["group_by"]), (filters.get("company"),
 					year_start_date, year_end_date),as_list=1)
 
 		for d in range(len(data1)):
@@ -80,11 +84,11 @@
 
 			#to get distinct value of col specified by group_by in filter
 			row = frappe.db.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s
-						where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date
+						where t2.parent = t1.name and t1.company = %s and %s between %s and %s
 						and t1.docstatus = 1 and %s = %s %s
 					""" %
 					(sel_col,  conditions["trans"],  conditions["trans"], conditions["addl_tables"],
-						"%s", "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
+						"%s", posting_date, "%s", "%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
 					(filters.get("company"), year_start_date, year_end_date, data1[d][0]), as_list=1)
 
 			for i in range(len(row)):
@@ -92,11 +96,11 @@
 
 				#get data for group_by filter
 				row1 = frappe.db.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s
-							where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date
+							where t2.parent = t1.name and t1.company = %s and %s between %s and %s
 							and t1.docstatus = 1 and %s = %s and %s = %s %s
 						""" %
 						(sel_col, conditions["period_wise_select"], conditions["trans"],
-							conditions["trans"], conditions["addl_tables"], "%s", "%s","%s", sel_col,
+							conditions["trans"], conditions["addl_tables"], "%s", posting_date, "%s","%s", sel_col,
 							"%s", conditions["group_by"], "%s", conditions.get("addl_tables_relational_cond")),
 						(filters.get("company"), year_start_date, year_end_date, row[i][0],
 							data1[d][0]), as_list=1)
@@ -109,12 +113,12 @@
 				data.append(des)
 	else:
 		data = frappe.db.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
-					where t2.parent = t1.name and t1.company = %s and t1.posting_date >= %s and %s >= t1.posting_date and
+					where t2.parent = t1.name and t1.company = %s and %s between %s and %s and
 					t1.docstatus = 1 %s %s
 					group by %s
 				""" %
 				(query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"],
-					"%s", "%s", "%s", cond, conditions.get("addl_tables_relational_cond", ""), conditions["group_by"]),
+					"%s", posting_date, "%s", "%s", cond, conditions.get("addl_tables_relational_cond", ""), conditions["group_by"]),
 				(filters.get("company"), year_start_date, year_end_date), as_list=1)
 
 	return data
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index e58625b..6e86d84 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.27.1"
+app_version = "6.27.3"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
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..04022c5 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:
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 43ec83d..efcceb3 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -256,4 +256,5 @@
 erpnext.patches.v6_20x.set_compact_print
 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
\ No newline at end of file
+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
diff --git a/erpnext/patches/v5_0/portal_fixes.py b/erpnext/patches/v5_0/portal_fixes.py
index d808692..d7e3b44 100644
--- a/erpnext/patches/v5_0/portal_fixes.py
+++ b/erpnext/patches/v5_0/portal_fixes.py
@@ -3,4 +3,4 @@
 
 def execute():
 	frappe.reload_doc("website", "doctype", "web_form_field", force=True)
-	erpnext.setup.install.add_web_forms()
+	#erpnext.setup.install.add_web_forms()
diff --git a/erpnext/patches/v6_27/__init__.py b/erpnext/patches/v6_27/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/erpnext/patches/v6_27/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/patches/v6_27/fix_recurring_order_status.py b/erpnext/patches/v6_27/fix_recurring_order_status.py
new file mode 100644
index 0000000..5843c9f
--- /dev/null
+++ b/erpnext/patches/v6_27/fix_recurring_order_status.py
@@ -0,0 +1,54 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	for doc in (
+		{
+			"doctype": "Sales Order",
+			"stock_doctype": "Delivery Note",
+			"invoice_doctype": "Sales Invoice",
+			"stock_doctype_ref_field": "against_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",
+			"qty_field": "received_qty"
+		}):
+
+		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 {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`
+				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`
+				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/patches/v6_8/make_webform_standard.py b/erpnext/patches/v6_8/make_webform_standard.py
index d4e1484..8633ba6 100644
--- a/erpnext/patches/v6_8/make_webform_standard.py
+++ b/erpnext/patches/v6_8/make_webform_standard.py
@@ -1,9 +1,13 @@
 import frappe
 
 def execute():
-	frappe.reload_doctype("Web Form")
-	frappe.delete_doc("Web Form", "Issues")
-	frappe.delete_doc("Web Form", "Addresses")
+	pass
 
-	from erpnext.setup.install import add_web_forms
-	add_web_forms()
+	# done via fixtures
+
+	# frappe.reload_doctype("Web Form")
+	# frappe.delete_doc("Web Form", "Issues")
+	# frappe.delete_doc("Web Form", "Addresses")
+
+	# from erpnext.setup.install import add_web_forms
+	# add_web_forms()
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index a9d4e29..7e37cb7 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-18 13:11:32.654873", 
+ "modified": "2016-03-21 13:11:32.654873", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
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/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/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/setup.py b/setup.py
index 847e727..bd41d1d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 from pip.req import parse_requirements
 
-version = "6.27.1"
+version = "6.27.3"
 requirements = parse_requirements("requirements.txt", session="")
 
 setup(