Fixed conflict while merging with master
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 19a8c74..59ec9c2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -318,15 +318,13 @@
 	# Validates Debit To Account and Customer Matches
 	# ------------------------------------------------
 	def validate_debit_to_acc(self):
-		if self.doc.customer and not cint(self.doc.is_pos):
-			acc_head = webnotes.conn.sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
-			if acc_head and acc_head[0][0]:
-				if not cstr(acc_head[0][0]) == cstr(self.doc.debit_to):
-					msgprint("Debit To %s do not match with Customer %s for Company %s i.e. %s" %(self.doc.debit_to,self.doc.customer,self.doc.company,cstr(acc_head[0][0])))
-					raise Exception, "Validation Error "
-			if not acc_head:
-				 msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
-				 raise Exception, "Validation Error "
+		if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
+			acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
+			
+			if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \
+				(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
+				msgprint("Debit To: %s do not match with Customer: %s for Company: %s.\n If both correctly entered, please select Master Type \
+					and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
 
 
 	# Validate Debit To Account
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 346e248..b30a401 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -247,7 +247,8 @@
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	var args = {
 		type: 'Expense Claim',
-		doctype: 'Expense Claim'
+		doctype: 'Expense Claim',
+		send_to: doc.exp_approver
 	}
 	cur_frm.cscript.notify(doc, args);
 }
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
index 937ada7..e9952c4 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -157,3 +157,7 @@
 	
 	def on_cancel(self):
 		set(self.doc, 'approval_status', 'Cancelled')
+
+	def get_formatted_message(self, args):
+		""" get formatted message for auto notification"""
+		return get_obj('Notification Control').get_formatted_message(args)
diff --git a/erpnext/patches/april_2012/repost_stock_for_posting_time.py b/erpnext/patches/april_2012/repost_stock_for_posting_time.py
new file mode 100644
index 0000000..095449a
--- /dev/null
+++ b/erpnext/patches/april_2012/repost_stock_for_posting_time.py
@@ -0,0 +1,9 @@
+def execute():
+	import webnotes
+	from webnotes.model.code import get_obj
+
+	bins = webnotes.conn.sql("select distinct t2.name from `tabStock Ledger Entry` t1, tabBin t2 where t1.posting_time > '00:00:00' and t1.posting_time < '00:01:00' and t1.item_code = t2.item_code and t1.warehouse = t2.warehouse")
+	webnotes.conn.sql("update `tabStock Ledger Entry` set posting_time = '00:00:00' where posting_time > '00:00:00' and posting_time < '00:01:00'")
+
+	for d in bins:
+		get_obj('Bin', d[0]).update_entries_after(posting_date = '2000-01-01', posting_time = '12:01')
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index e0f9ea3..9d9e5a3 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -307,5 +307,10 @@
 		'patch_file': 'serial_no_fixes',
 		'description': 'fixes for sle creation while import'
 	},
+	{
+		'patch_module': 'patches.april_2012',
+		'patch_file': 'repost_stock_for_posting_time',
+		'description': 'repost stock for posting time 00:00:seconds'
+	},
 
 ]
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index ef8333b..320131c 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -84,6 +84,7 @@
 	def get_comm_rate(self, sales_partner):
 		return get_obj('Sales Common').get_comm_rate(sales_partner, self)
 
+
 # SALES ORDER DETAILS TRIGGER FUNCTIONS
 # ================================================================================
 	# Get Item Details
diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py
index 2a21e80..8602fe2 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.py
+++ b/erpnext/setup/doctype/notification_control/notification_control.py
@@ -23,7 +23,7 @@
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
-	
+
 # -----------------------------------------------------------------------------------------
 # Notification control
 class DocType:
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index f645e8f..ce2cae6 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -267,7 +267,7 @@
 		
 		# if no prev sle, start from the first one (for repost)
 		if not prev_sle:
-			cqty, cval, val_rate, self.fcfs_bal = 0, 0, 0, []
+			cqty, cval, val_rate, stock_val, self.fcfs_bal = 0, 0, 0, 0, []
 		
 		# normal
 		else:
@@ -322,8 +322,8 @@
 			where name=%s""", (cqty, flt(val_rate), cstr(self.fcfs_bal), stock_val, sle['name']))
 		
 		# update the bin
-		if sll:
-			sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s where name=%s", \
+		if sll or not prev_sle:
+			sql("update `tabBin` set valuation_rate=%s, actual_qty=%s, stock_value = %s, projected_qty = (actual_qty + indented_qty + ordered_qty + planned_qty - reserved_qty) where name=%s", \
 				(flt(val_rate), cqty, flt(stock_val), self.doc.name))
 
 
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index cf3bd2f..d6f7000 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -99,6 +99,12 @@
 				you entered posting time correctly, please contact ERPNext support team.")
 			raise Exception
 	
+	def scrub_posting_time(self):
+		if not self.doc.posting_time or self.doc.posting_time == '12:0':
+			self.doc.posting_time = '00:00'
+		if len(self.doc.posting_time.split(':')) > 2:
+			self.doc.posting_time = '00:00'
+			
 
 	def validate(self):
 		self.validate_mandatory()
@@ -106,3 +112,4 @@
 		self.validate_item()
 		self.actual_amt_check()
 		self.check_stock_frozen_date()
+		self.scrub_posting_time()
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index eecbb06..902e193 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -18,6 +18,7 @@
 from webnotes.utils import load_json, cint, cstr, flt, get_defaults
 from webnotes.model.doc import Document, addchild, removechild, getchildren
 from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj
 from webnotes import msgprint
 
 class TransactionBase:
@@ -230,3 +231,8 @@
 		ret = webnotes.conn.sql("select default_currency from tabCompany where name = '%s'" %(name))
 		dcc = ret and ret[0][0] or get_defaults()['currency']						
 		return dcc	
+	
+
+	def get_formatted_message(self, args):
+		""" get formatted message for auto notification"""
+		return get_obj('Notification Control').get_formatted_message(args)