diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 559779e..c3c3a38 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -130,16 +130,6 @@
 	return 'SELECT DISTINCT `tabPurchase Request`.`name` FROM `tabPurchase Request` WHERE `tabPurchase Request`.company = "' + doc.company + '" and `tabPurchase Request`.`docstatus` = 1 and `tabPurchase Request`.`status` != "Stopped" and ifnull(`tabPurchase Request`.`per_ordered`,0) < 100 and `tabPurchase Request`.%(key)s LIKE "%s" ORDER BY `tabPurchase Request`.`name` DESC LIMIT 50';
 }
 
-/*
-//*********** get approved supplier quotation ********************
-cur_frm.fields_dict['supplier_qtn'].get_query = function(doc) {
-	var cond='';
-	if(doc.supplier) cond = 'ifnull(`tabSupplier Quotation`.supplier, "") = "'+doc.supplier+'" and';
-	
-	return repl('SELECT DISTINCT `tabSupplier Quotation`.`name` FROM `tabSupplier Quotation` WHERE `tabSupplier Quotation`.company = "%(company)s" and`tabSupplier Quotation`.`docstatus` = 1 and `tabSupplier Quotation`.`approval_status` = "Approved" and %(cond)s `tabSupplier Quotation`.%(key)s LIKE "%s" ORDER BY `tabSupplier Quotation`.`name` DESC LIMIT 50', {company:doc.company,cond:cond});
-}
-*/
-
 
 //========================= Get Last Purhase Rate =====================================
 cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
diff --git a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py
index a2105c3..6f51942 100644
--- a/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py
+++ b/erpnext/hr/doctype/attendance_control_panel/attendance_control_panel.py
@@ -8,11 +8,11 @@
 # 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 # GNU General Public License for more details.
-# 
+# 	
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 # Please edit this list and import only required elements
 import webnotes
@@ -34,89 +34,85 @@
 
 
 class DocType:
-  def __init__(self,d,dt):
-    self.doc, self.doclist = d,dt
-    
-  #==========================================================================
-  def get_att_list(self):
-    
-    lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
-    
-    dt = self.date_diff_list()          # get date list inbetween from date and to date
-    
-    att_dt = self.get_att_data()        # get default attendance data like fiscal yr, company, naming series
-      
-    fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']
-   
-    res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2") 
-   
-    for d in dt:
-      for r in res:       
-        lst.append([r[0],r[1],d,'',fy,comp,sr])
+	def __init__(self,d,dt):
+		self.doc, self.doclist = d,dt
+		
+	#==========================================================================
+	def get_att_list(self):
+		lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
+		
+		dt = self.date_diff_list()					# get date list inbetween from date and to date		
+		att_dt = self.get_att_data()				# get default attendance data like fiscal yr, company, naming series
+			
+		fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']	 
+		res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2") 
+	 
+		for d in dt:
+			for r in res:			 
+				lst.append([r[0],r[1],d,'',fy,comp,sr])
 
-    return lst
-  
-  #------------------------------------------------------------------------------
-  # get date list inbetween from date and to date
-  def date_diff_list(self):
-    import datetime
-    #get from date 
-    att_fr_date = self.doc.att_fr_date and self.doc.att_fr_date or ''
-    
-    #get to date
-    att_to_date = self.doc.att_to_date and self.doc.att_to_date or ''
+		return lst
+	
+	#------------------------------------------------------------------------------
+	# get date list inbetween from date and to date
+	def date_diff_list(self):
+		import datetime
+		#get from date 
+		att_fr_date = self.doc.att_fr_date and self.doc.att_fr_date or ''
+		
+		#get to date
+		att_to_date = self.doc.att_to_date and self.doc.att_to_date or ''
 
-    if att_to_date:
-      r = (getdate(self.doc.att_to_date)+datetime.timedelta(days=1)-getdate(self.doc.att_fr_date)).days
-    else:
-      r = 1
-    dateList = [getdate(self.doc.att_fr_date)+datetime.timedelta(days=i) for i in range(0,r)]
-    dt=([str(date) for date in dateList])
-    
-    return dt
+		if att_to_date:
+			r = (getdate(self.doc.att_to_date)+datetime.timedelta(days=1)-getdate(self.doc.att_fr_date)).days
+		else:
+			r = 1
+		dateList = [getdate(self.doc.att_fr_date)+datetime.timedelta(days=i) for i in range(0,r)]
+		dt=([str(date) for date in dateList])
+		
+		return dt
 
-  #------------------------------------------------------------------------------
-  def get_att_data(self):
-    
-    fy = get_defaults()['fiscal_year']    #get default fiscal year 
+	#------------------------------------------------------------------------------
+	def get_att_data(self):
+		fy = get_defaults()['fiscal_year']		#get default fiscal year 
+		comp = get_defaults()['company']		#get default company
+		
+		#get naming series of attendance
+		import webnotes.model.doctype
+		docfield = webnotes.model.doctype.get('Attendance')
+		series = [d.options for d in docfield if d.doctype == 'DocField' and d.fieldname == 'naming_series']
+		if not series:
+			msgprint("Please create naming series for Attendance.\nGo to Setup--> Numbering Series.")
+			raise Exception
+		else:
+			sr = series[0][0] or ''
+		
+		return {'fy':fy,'comp':comp,'sr':sr}
 
-    comp = get_defaults()['company']    #get default company
-    
-    #get naming series of attendance
-    #sr = sql("select series_options from `tabNaming Series Options` where doc_type='Attendance'")
-    sr = sql("select options from `tabDocField` where parent = 'Attendance' and fieldname = 'naming_series'")
-    if not sr:
-      msgprint("Please create naming series for Attendance.\nGo to Setup--> Manage Series.")
-      raise Exception
-    else:
-      sr = sr and sr[0][0]
-    
-    return {'fy':fy,'comp':comp,'sr':sr}
+	#=================================================================================	
+	def import_att_data(self):
+		filename = self.doc.file_list.split(',')
 
-  #=================================================================================  
-  def import_att_data(self):
-    filename = self.doc.file_list.split(',')
-
-    if not filename:
-      msgprint("Please attach a .CSV File.")
-      raise Exception
-    
-    if filename[0].find('.csv') < 0:
-      raise Exception
-    
-    if not filename and filename[0] and file[1]:
-      msgprint("Please Attach File. ")
-      raise Exception
-      
-    from webnotes.utils import file_manager
-    fn, content = file_manager.get_file(filename[1])
+		if not filename:
+			msgprint("Please attach a .CSV File.")
+			raise Exception
+		
+		if filename[0].find('.csv') < 0:
+			raise Exception
+		
+		if not filename and filename[0] and file[1]:
+			msgprint("Please Attach File. ")
+			raise Exception
+			
+		from webnotes.utils import file_manager
+		fn, content = file_manager.get_file(filename[1])
  
 	# NOTE: Don't know why this condition exists
-    if not isinstance(content, basestring) and hasattr(content, 'tostring'):
-      content = content.tostring()
+		if not isinstance(content, basestring) and hasattr(content, 'tostring'):
+			content = content.tostring()
 
-    import webnotes.model.import_docs
-    im = webnotes.model.import_docs.CSVImport()
-    out = im.import_csv(content,self.doc.import_date_format, cint(self.doc.overwrite))
-    return out
+		import webnotes.model.import_docs
+		im = webnotes.model.import_docs.CSVImport()
+		out = im.import_csv(content,self.doc.import_date_format, cint(self.doc.overwrite))
+		return out
 
diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py
index e097a4c..4a17a03 100644
--- a/erpnext/selling/doctype/lead/lead.py
+++ b/erpnext/selling/doctype/lead/lead.py
@@ -8,11 +8,11 @@
 # 
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 # GNU General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
 # Please edit this list and import only required elements
 import webnotes
@@ -34,195 +34,169 @@
 
 
 class DocType:
-  def __init__(self, doc, doclist):
-    self.doc = doc
-    self.doclist = doclist
-  
-  # Autoname
-  # ---------
-  def autoname(self):
-    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-  
-  #check status of lead
-  #------------------------
-  def check_status(self):
-    chk = sql("select status from `tabLead` where name=%s", self.doc.name)
-    chk = chk and chk[0][0] or ''
-    return cstr(chk)
+	def __init__(self, doc, doclist):
+		self.doc = doc
+		self.doclist = doclist
+	
+	# Autoname
+	# ---------
+	def autoname(self):
+		self.doc.name = make_autoname(self.doc.naming_series+'.#####')
+	
+	#check status of lead
+	#------------------------
+	def check_status(self):
+		chk = sql("select status from `tabLead` where name=%s", self.doc.name)
+		chk = chk and chk[0][0] or ''
+		return cstr(chk)
 
-  # Gets states belonging cto country selected
-  # =====================================================================
-  #def check_state(self):
-  #  return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
-  
-  # Get item detail (will be removed later)
-  #=======================================
-  def get_item_detail(self,item_code):
-    it=sql("select item_name,brand,item_group,description,stock_uom from `tabItem` where name='%s'"%item_code)
-    if it:
-      ret = {
-      'item_name'  : it and it[0][0] or '',
-      'brand'      : it and it[0][1] or '',
-      'item_group' : it and it[0][2] or '',
-      'description': it and it[0][3] or '',
-      'uom' : it and it[0][4] or ''
-      }
-      return ret
-  
-  def validate(self):
-    import string
-    # Get Address
-    # ======================================================================
-    #if (self.doc.address_line1) or (self.doc.address_line2) or (self.doc.city) or (self.doc.state) or (self.doc.country) or (self.doc.pincode):
-    #  address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
-    #  comp_address=''
-    #  for d in address:
-    #    if self.doc.fields[d]:
-    #      comp_address += self.doc.fields[d] + "\n"
-    #  if self.doc.website:
-    #    comp_address += "Website : "+ self.doc.website
-    #  self.doc.address = comp_address
-    
-    if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
-      msgprint("Please Enter Quotation Lost Reason")
-      raise Exception  
-    
-    if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
-      msgprint("Please specify campaign name")
-      raise Exception
-    
-    if self.doc.email_id:
-      if not validate_email_add(self.doc.email_id):
-        msgprint('Please enter valid email id.')
-        raise Exception
-    
-    if not self.doc.naming_series:
-      if session['user'] == 'Guest':
-        so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
-        #so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
-        if so:
-          sr = so[0][0].split("\n")
-          set(self.doc, 'naming_series', sr[0])
-      else:
-        msgprint("Please specify naming series")
-        raise Exception  
-  
-  def on_update(self):
-    # Add to calendar
-    # ========================================================================
-    if self.doc.contact_by:
-      self.add_calendar_event()
-    
-    if session['user'] == 'Guest':
-      if self.doc.email_id:
-        self.send_email_notification()
-    
-    if not self.doc.naming_series:
-      if session['user'] == 'Guest':
-        #so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
-        so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
-        if so:
-          sr = so[0][0].split("\n")
-          set(self.doc, 'naming_series', sr[0])
-      else:
-        msgprint("Please specify naming series")
-        raise Exception
-  
-  def send_email_notification(self):
-    if not validate_email_add(self.doc.email_id.strip(' ')):
-      msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
-      raise Exception
-    else:
-      subject = 'Thank you for interest in erpnext'
-       
-      sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
-      #sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
-      msgprint("Mail Sent")
-  
-  def get_notification_msg(self):
-    t = """
-<html>
-<body>
-Dear %s,<br><br>
 
-Thank you for contacting us.<br><br>
+	# Get item detail (will be removed later)
+	#=======================================
+	def get_item_detail(self,item_code):
+		it=sql("select item_name,brand,item_group,description,stock_uom from `tabItem` where name='%s'"%item_code)
+		if it:
+			ret = {
+			'item_name'	: it and it[0][0] or '',
+			'brand'			: it and it[0][1] or '',
+			'item_group' : it and it[0][2] or '',
+			'description': it and it[0][3] or '',
+			'uom' : it and it[0][4] or ''
+			}
+			return ret
+	
+	def validate(self):
+		import string		
+		if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
+			msgprint("Please Enter Quotation Lost Reason")
+			raise Exception	
+		
+		if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
+			msgprint("Please specify campaign name")
+			raise Exception
+		
+		if self.doc.email_id:
+			if not validate_email_add(self.doc.email_id):
+				msgprint('Please enter valid email id.')
+				raise Exception
+		
+	
+	def on_update(self):
+		# Add to calendar
+		# ========================================================================
+		if self.doc.contact_by:
+			self.add_calendar_event()
+		
+		if session['user'] == 'Guest':
+			if self.doc.email_id:
+				self.send_email_notification()
+		
+		if not self.doc.naming_series:
+			if session['user'] == 'Guest':
+				import webnotes.model.doctype
+				docfield = webnotes.model.doctype.get('Lead')
+				series = [d.options for d in docfield if d.doctype == 'DocField' and d.fieldname == 'naming_series']
+				if series:
+					sr = series[0].split("\n")
+					set(self.doc, 'naming_series', sr[0])
+			else:
+				msgprint("Please specify naming series")
+				raise Exception
+	
+	def send_email_notification(self):
+		if not validate_email_add(self.doc.email_id.strip(' ')):
+			msgprint('error:%s is not a valid email id' % self.doc.email_id.strip(' '))
+			raise Exception
+		else:
+			subject = 'Thank you for interest in erpnext'
+			 
+			sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
+			msgprint("Mail Sent")
+	
+	def get_notification_msg(self):
+		t = """
+			<html>
+				<body>
+					Dear %s,<br><br>
 
-You have left following message for us,<br>
-%s
-<br><br>
+					Thank you for contacting us.<br><br>
 
-You will receive reply on this shortly.<br><br>
+					You have left following message for us,<br>
+					%s
+					<br><br>
 
-Cheers!
-</body>
-</html>
-""" % (self.doc.lead_name, self.doc.remark)
+					You will receive reply on this shortly.<br><br>
 
-    return t
+					Cheers!
+				</body>
+			</html>
+		""" % (self.doc.lead_name, self.doc.remark)
 
-  # Add to Calendar
-  # ===========================================================================
-  def add_calendar_event(self):
-    # delete any earlier event by this lead
-    sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name)
-  
-    in_calendar_of = self.doc.lead_owner
-    
-    # get profile (id) if exists for contact_by
-    email_id = webnotes.conn.get_value('Sales Person', self.doc.contact_by, 'email_id')
-    if webnotes.conn.exists('Profile', email_id):
-      in_calendar_of = email_id
-    
-    ev = Document('Event')
-    ev.owner = in_calendar_of
-    ev.description = 'Contact ' + cstr(self.doc.lead_name) + '.By : ' + cstr(self.doc.contact_by) + '.To Discuss : ' + cstr(self.doc.remark)
-    ev.event_date = self.doc.contact_date
-    ev.event_hour = '10:00'
-    ev.event_type = 'Private'
-    ev.ref_type = 'Lead'
-    ev.ref_name = self.doc.name
-    ev.save(1)
+		return t
+
+	# Add to Calendar
+	# ===========================================================================
+	def add_calendar_event(self):
+		# delete any earlier event by this lead
+		sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name)
+	
+		in_calendar_of = self.doc.lead_owner
+		
+		# get profile (id) if exists for contact_by
+		email_id = webnotes.conn.get_value('Sales Person', self.doc.contact_by, 'email_id')
+		if webnotes.conn.exists('Profile', email_id):
+			in_calendar_of = email_id
+		
+		ev = Document('Event')
+		ev.owner = in_calendar_of
+		ev.description = 'Contact ' + cstr(self.doc.lead_name) + '.By : ' + cstr(self.doc.contact_by) + '.To Discuss : ' + cstr(self.doc.remark)
+		ev.event_date = self.doc.contact_date
+		ev.event_hour = '10:00'
+		ev.event_type = 'Private'
+		ev.ref_type = 'Lead'
+		ev.ref_name = self.doc.name
+		ev.save(1)
 
 
 #-----------------Email-------------------------------------------- 
-  def send_emails(self, email=[], subject='', message=''):
-    if email:
-      sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]])
-      msgprint("Mail Sent")
-      self.add_in_follow_up(message,'Email')
+	def send_emails(self, email=[], subject='', message=''):
+		if email:
+			sendmail(email, sender = webnotes.user.name, subject = subject , parts = [['text/html', message]])
+			msgprint("Mail Sent")
+			self.add_in_follow_up(message,'Email')
 
-#-------------------------Checking Sent Mails Details----------------------------------------------        
-  def send_mail(self):
-    if not self.doc.subject or not self.doc.message:
-      msgprint("Please enter subject & message in their respective fields.")
-    elif not self.doc.email_id:
-      msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.")
-      raise Exception
-    else :
-     self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
+#-------------------------Checking Sent Mails Details----------------------------------------------				
+	def send_mail(self):
+		if not self.doc.subject or not self.doc.message:
+			msgprint("Please enter subject & message in their respective fields.")
+		elif not self.doc.email_id:
+			msgprint("Recipient not specified. Please add email id of lead in 'Email id' field provided in 'Contact Info' section.")
+			raise Exception
+		else :
+		 self.send_emails([self.doc.email_id.strip(' ')], subject = self.doc.subject ,message = self.doc.message)
 
 #---------------------- Add details in follow up table----------------
-  def add_in_follow_up(self,message,type):
-    import datetime
-    child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
-    child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
-    child.notes = message
-    child.follow_up_type = type
-    child.save()
+	def add_in_follow_up(self,message,type):
+		import datetime
+		child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist)
+		child.date = datetime.datetime.now().date().strftime('%Y-%m-%d')
+		child.notes = message
+		child.follow_up_type = type
+		child.save()
 
 #-------------------SMS----------------------------------------------
-  def send_sms(self):
-    if not self.doc.sms_message or not self.doc.mobile_no:
-      msgprint("Please enter mobile number in Basic Info Section and message in SMS Section ")
-      raise Exception
-    else:
-      receiver_list = []
-      if self.doc.mobile_no:
-        receiver_list.append(self.doc.mobile_no)
-      for d in getlist(self.doclist,'lead_sms_detail'):
-        if d.other_mobile_no:
-          receiver_list.append(d.other_mobile_no)
-    
-    if receiver_list:
-      msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
-      self.add_in_follow_up(self.doc.sms_message,'SMS')
+	def send_sms(self):
+		if not self.doc.sms_message or not self.doc.mobile_no:
+			msgprint("Please enter mobile number in Basic Info Section and message in SMS Section ")
+			raise Exception
+		else:
+			receiver_list = []
+			if self.doc.mobile_no:
+				receiver_list.append(self.doc.mobile_no)
+			for d in getlist(self.doclist,'lead_sms_detail'):
+				if d.other_mobile_no:
+					receiver_list.append(d.other_mobile_no)
+		
+		if receiver_list:
+			msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message))
+			self.add_in_follow_up(self.doc.sms_message,'SMS')
