Merge branch 'version-12-hotfix' into version-12
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 5e26693..260478f 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '12.0.3'
+__version__ = '12.0.4'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/bank/bank_dashboard.py b/erpnext/accounts/doctype/bank/bank_dashboard.py
index 4324041..e047b9a 100644
--- a/erpnext/accounts/doctype/bank/bank_dashboard.py
+++ b/erpnext/accounts/doctype/bank/bank_dashboard.py
@@ -6,6 +6,9 @@
 def get_data():
 	return {
 		'fieldname': 'bank',
+		'non_standard_fieldnames': {
+			'Paymnet Order': 'company_bank'
+		},
 		'transactions': [
 			{
 				'label': _('Bank Deatils'),
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index 50557f1..492eabe 100755
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -145,7 +145,7 @@
 
 	def populate_depends_on(self):
 		if self.parent_task:
-			parent = frappe.get_cached_doc('Task', self.parent_task)
+			parent = frappe.get_doc('Task', self.parent_task)
 			if not self.name in [row.task for row in parent.depends_on]:
 				parent.append("depends_on", {
 					"doctype": "Task Depends On",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index f40560a..b530332 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -802,13 +802,13 @@
 
 					self.add_to_stock_entry_detail(item_dict)
 
-					if self.purpose != "Send to Subcontractor":
-						scrap_item_dict = self.get_bom_scrap_material(self.fg_completed_qty)
-						for item in itervalues(scrap_item_dict):
-							if self.pro_doc and self.pro_doc.scrap_warehouse:
-								item["to_warehouse"] = self.pro_doc.scrap_warehouse
+				if self.purpose != "Send to Subcontractor" and self.purpose == "Manufacture":
+					scrap_item_dict = self.get_bom_scrap_material(self.fg_completed_qty)
+					for item in itervalues(scrap_item_dict):
+						if self.pro_doc and self.pro_doc.scrap_warehouse:
+							item["to_warehouse"] = self.pro_doc.scrap_warehouse
 
-						self.add_to_stock_entry_detail(scrap_item_dict, bom_no=self.bom_no)
+					self.add_to_stock_entry_detail(scrap_item_dict, bom_no=self.bom_no)
 
 			# fetch the serial_no of the first stock entry for the second stock entry
 			if self.work_order and self.purpose == "Manufacture":
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index ff5b026..5fda2a4 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -363,8 +363,17 @@
 			self.stock_queue.append([0, sle.incoming_rate or sle.outgoing_rate or self.valuation_rate])
 
 	def check_if_allow_zero_valuation_rate(self, voucher_type, voucher_detail_no):
-		ref_item_dt = voucher_type + (" Detail" if voucher_type == "Stock Entry" else " Item")
-		return frappe.db.get_value(ref_item_dt, voucher_detail_no, "allow_zero_valuation_rate")
+		ref_item_dt = ""
+
+		if voucher_type == "Stock Entry":
+			ref_item_dt = voucher_type + " Detail"
+		elif voucher_type in ["Purchase Invoice", "Sales Invoice", "Delivery Note", "Purchase Receipt"]:
+			ref_item_dt = voucher_type + " Item"
+
+		if ref_item_dt:
+			return frappe.db.get_value(ref_item_dt, voucher_detail_no, "allow_zero_valuation_rate")
+		else:
+			return 0
 
 	def get_sle_before_datetime(self):
 		"""get previous stock ledger entry before current time-bucket"""