merge latest
diff --git a/erpnext/buying/doctype/supplier_quotation/__init__.py b/erpnext/buying/doctype/supplier_quotation/__init__.py
deleted file mode 100755
index e69de29..0000000
--- a/erpnext/buying/doctype/supplier_quotation/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
deleted file mode 100755
index bf9bdc1..0000000
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ /dev/null
@@ -1,82 +0,0 @@
-cur_frm.cscript.tname = "Supplier Quotation Detail";
-cur_frm.cscript.fname = "supplier_quotation_details";
-
-$import(Purchase Common)
-
-// ======================= OnLoad =============================================
-cur_frm.cscript.onload = function(doc,cdt,cdn){
-
-  
-  if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
-  if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
-  if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1'});
-  if(!doc.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
-  
-  if(doc.__islocal && has_common(user_roles,['Partner','Supplier'])){
-    get_server_fields('get_contact_details','','',doc,cdt,cdn,1);
-  }
-  else if(doc.__islocal && doc.supplier){
-    get_server_fields('get_supplier_details',doc.supplier,'',doc,cdt,cdn,1);
-  }
-
-}
-
-//======================= Refresh ==============================================
-cur_frm.cscript.refresh = function(doc,cdt,cdn){
-
-  if(has_common(user_roles,['Purchase User','Purchase Manager'])){
-    unhide_field(['Approve / Unapprove']);
-    if(doc.approval_status == 'Approved' && doc.status == 'Submitted') { unhide_field(['Create PO']);}
-    else { hide_field(['Create PO']);}
-  }
-  else{ 
-    hide_field(['Create PO']);
-    hide_field(['Approve / Unapprove']);
-  }  
-}
-
-//======================= RFQ NO Get Query ===============================================
-cur_frm.fields_dict['rfq_no'].get_query = function(doc){
-  return 'SELECT DISTINCT `tabRFQ`.name FROM `tabRFQ` WHERE `tabRFQ`.docstatus = 1 AND `tabRFQ`.name LIKE "%s"';
-}
-
-// ***************** Get Contact Person based on supplier selected *****************
-cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
-  return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_supplier = 1 AND `tabContact`.supplier = "'+ doc.supplier+'" AND `tabContact`.docstatus != 2 AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
-}
-
-//=================== On Button Click Functions =====================
-
-//======================== Create Purchase Order =========================================
-cur_frm.cscript['Create PO'] = function(doc,cdt,cdn){
-  n = createLocal("Purchase Order");
-  $c('dt_map', args={
-    'docs':compress_doclist([locals["Purchase Order"][n]]),
-    'from_doctype':'Supplier Quotation',
-    'to_doctype':'Purchase Order',
-    'from_docname':doc.name,
-    'from_to_list':"[['Supplier Quotation', 'Purchase Order'], ['Supplier Quotation Detail', 'PO Detail']]"
-  }
-  , function(r,rt) {
-      loaddoc("Purchase Order", n);
-    }
-  );
-}
-
-//======================== Get Report ===================================================
-cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
-  var callback = function(report){
-  report.set_filter('PO Detail', 'Ref Doc',doc.name)
- }
- loadreport('PO Detail','Itemwise Purchase Details', callback);
-}
-
-cur_frm.cscript['Approve / Unapprove'] = function(doc, cdt, cdn){
-  var d = locals[cdt][cdn];
-  
-  $c_obj(make_doclist(doc.doctype, doc.name),'update_approval_status','', function(r,rt){  
-    refresh_field('approval_status');
-    doc.approval_status = r.message;
-    cur_frm.cscript.refresh(d, d.cdt, d.cdn);
-  });
-}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
deleted file mode 100755
index ac59430..0000000
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ /dev/null
@@ -1,104 +0,0 @@
-class DocType:
-  def __init__(self,doc,doclist=[]):
-    self.doc = doc
-    self.doclist = doclist
-    self.fname = 'supplier_quotation_details'
-    self.tname = 'Supplier Quotation Detail'
-
-  def autoname(self):
-    self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
-  def get_contact_details(self):
-    cd = sql("select concat_ws(' ',t2.first_name,t2.last_name),t2.contact_no, t2.email_id, t2.supplier, t2.supplier_name, t2.supplier_address from `tabProfile` t1, `tabContact` t2 where t1.email=t2.email_id and t1.name=%s", session['user'])
-    ret = {
-      'contact_person'  : cd and cd[0][0] or '',
-      'contact_no'      : cd and cd[0][1] or '',
-      'email'           : cd and cd[0][2] or '',
-      'supplier'   : cd and cd[0][3] or '',
-      'supplier_name'   : cd and cd[0][4] or '',
-      'supplier_address': cd and cd[0][5] or ''
-    }
-    return ret
-
-  def get_rfq_details(self):
-    self.doc.clear_table(self.doclist, 'supplier_quotation_details')
-    get_obj('DocType Mapper','RFQ-Supplier Quotation').dt_map('RFQ','Supplier Quotation',self.doc.rfq_no, self.doc, self.doclist, "[['RFQ Detail', 'Supplier Quotation Detail']]")
-
-  #update approval status
-  def update_approval_status(self):
-    if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
-      set(self.doc, 'approval_status','Approved')
-      return self.doc.approval_status
-    elif self.doc.approval_status == 'Approved':
-      pc_obj = get_obj('Purchase Common')
-      pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
-      set(self.doc, 'approval_status', 'Not Approved')
-      return self.doc.approval_status
-  
-  def validate_item_list(self):
-    if not getlist(self.doclist, 'supplier_quotation_details'):
-      msgprint("Please fetch RFQ details against which this quotation is prapared")
-      raise Exception
-  
-  # On Validate
-  #---------------------------------------------------------------------------------------------------------
-  def validate(self):
-    self.validate_item_list()
-    pc_obj = get_obj(dt='Purchase Common')
-    pc_obj.validate_for_items(self)
-    pc_obj.validate_conversion_rate(self)
-    pc_obj.validate_doc(obj = self, prevdoc_doctype = 'RFQ', prevdoc_docname = self.doc.rfq_no)
-  
-  def on_update(self):
-    set(self.doc, 'status', 'Draft')
-  
-  # checks whether previous documents doctstatus is submitted.
-  def check_previous_docstatus(self):
-    pc_obj = get_obj(dt = 'Purchase Common')
-    for d in getlist(self.doclist, 'rfq_details'):
-      if d.prevdoc_docname:
-        pc_obj.check_docstatus(check = 'Previous', doctype = 'Indent', docname = d.prevdoc_docname)
-  
-  #update rfq
-  def update_rfq(self, status):
-    prevdoc=''
-    for d in getlist(self.doclist, 'supplier_quotation_details'):
-      if d.prevdoc_docname:
-        prevdoc = d.prevdoc_docname
-    
-    if status == 'Submitted':
-      sql("update `tabRFQ` set status = 'Quotation Received' where name=%s", prevdoc)
-    elif status == 'Cancelled':
-      sql("update `tabRFQ` set status = 'Submitted' where name=%s", prevdoc)
-  
-  # On Submit
-  def on_submit(self):
-    # checks whether previous documents doctstatus is submitted.
-    self.check_previous_docstatus() 
-    set(self.doc, 'status', 'Submitted')
-    self.update_rfq('Submitted')
-  
-  # On Cancel
-  #---------------------------------------------------------------------------------------------------------
-  #def check_next_docstatus(self):
-  #  submitted = sql("selct name from `tabPurchase Order` where ref_sq = '%s' and docstatus = 1" % self.doc.name)
-  #  if submitted:
-  #    msgprint("Purchase Order : " + cstr(submitted[0][0]) + " has already been submitted !")
-  #    raise Exception
-    
-  def on_cancel(self):
-    pc_obj = get_obj('Purchase Common')
-    pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
-    #self.check_next_docstatus()
-    set(self.doc, 'status', 'Cancelled')
-    self.update_rfq('Cancelled')
-
-  # GET TERMS & CONDITIONS
-  # =====================================================================================
-  def get_tc_details(self):
-    return get_obj('Purchase Common').get_tc_details(self)
-
-  # Get Supplier Details
-  # --------------------
-  def get_supplier_details(self, name = ''):
-    return get_obj('Purchase Common').get_supplier_details(name)
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt
deleted file mode 100755
index 1297246..0000000
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt
+++ /dev/null
@@ -1,607 +0,0 @@
-# DocType, Supplier Quotation
-[
-
-	# These values are common in all dictionaries
-	{
-		'creation': '2010-10-27 12:55:42',
-		'docstatus': 0,
-		'modified': '2011-01-28 11:41:36',
-		'modified_by': 'rakesh@iwebnotes.com',
-		'owner': 'Administrator'
-	},
-
-	# These values are common for all DocType
-	{
-		'autoname': 'SQ.#####',
-		'colour': 'White:FFF',
-		'doctype': 'DocType',
-		'in_create': 1,
-		'module': 'Buying',
-		'name': '__common__',
-		'read_only': 1,
-		'section_style': 'Tabbed',
-		'server_code_error': ' ',
-		'show_in_menu': 0,
-		'version': 241
-	},
-
-	# These values are common for all DocField
-	{
-		'doctype': 'DocField',
-		'name': '__common__',
-		'parent': 'Supplier Quotation',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
-	},
-
-	# These values are common for all DocPerm
-	{
-		'doctype': 'DocPerm',
-		'name': '__common__',
-		'parent': 'Supplier Quotation',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
-		'read': 1
-	},
-
-	# DocType, Supplier Quotation
-	{
-		'doctype': 'DocType',
-		'name': 'Supplier Quotation'
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 1,
-		'permlevel': 0,
-		'role': 'System Manager',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 2,
-		'permlevel': 0,
-		'role': 'Supplier',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
-		'doctype': 'DocPerm',
-		'idx': 3,
-		'permlevel': 0,
-		'role': 'Purchase User',
-		'submit': 1,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 4,
-		'permlevel': 0,
-		'role': 'Purchase Manager'
-	},
-
-	# DocPerm
-	{
-		'doctype': 'DocPerm',
-		'idx': 5,
-		'permlevel': 1,
-		'role': 'All'
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'doctype': 'DocPerm',
-		'idx': 6,
-		'permlevel': 2,
-		'role': 'Purchase User',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocPerm
-	{
-		'cancel': 0,
-		'doctype': 'DocPerm',
-		'idx': 7,
-		'permlevel': 2,
-		'role': 'Purchase Manager',
-		'submit': 0,
-		'write': 1
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 1,
-		'label': 'Create PO',
-		'oldfieldtype': 'Button',
-		'permlevel': 2,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Enter item rates and details of supplier who is providing quotation',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 2,
-		'label': 'Basic Info',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 3,
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'naming_series',
-		'fieldtype': 'Select',
-		'idx': 4,
-		'in_filter': 1,
-		'label': 'Series',
-		'no_copy': 1,
-		'oldfieldname': 'naming_series',
-		'oldfieldtype': 'Select',
-		'options': '\nSQTN',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': 'Draft',
-		'doctype': 'DocField',
-		'fieldname': 'status',
-		'fieldtype': 'Select',
-		'idx': 5,
-		'in_filter': 1,
-		'label': 'Status',
-		'oldfieldname': 'status',
-		'oldfieldtype': 'Select',
-		'options': '\nDraft\nQuotation Sent\nOrder Confirmed\nCancelled',
-		'permlevel': 1,
-		'reqd': 1,
-		'search_index': 1
-	},
-
-	# DocField
-	{
-		'default': 'Today',
-		'description': 'The date at which current entry is made in system.',
-		'doctype': 'DocField',
-		'fieldname': 'transaction_date',
-		'fieldtype': 'Date',
-		'idx': 6,
-		'in_filter': 1,
-		'label': 'Quotation Date',
-		'oldfieldname': 'transaction_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'activity_log_text',
-		'fieldtype': 'Text',
-		'idx': 7,
-		'label': 'Activity Log Text',
-		'oldfieldname': 'activity_log_text',
-		'oldfieldtype': 'Text',
-		'permlevel': 2
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'company',
-		'fieldtype': 'Link',
-		'idx': 8,
-		'in_filter': 1,
-		'label': 'For Company',
-		'oldfieldname': 'company',
-		'oldfieldtype': 'Link',
-		'options': 'Company',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'fiscal_year',
-		'fieldtype': 'Select',
-		'idx': 9,
-		'in_filter': 1,
-		'label': 'Fiscal Year',
-		'oldfieldname': 'fiscal_year',
-		'oldfieldtype': 'Select',
-		'options': 'link:Fiscal Year',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amended_from',
-		'fieldtype': 'Data',
-		'hidden': 1,
-		'idx': 10,
-		'label': 'Amended From',
-		'no_copy': 1,
-		'oldfieldname': 'amended_from',
-		'oldfieldtype': 'Data',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'amendment_date',
-		'fieldtype': 'Date',
-		'hidden': 1,
-		'idx': 11,
-		'label': 'Amendment Date',
-		'no_copy': 1,
-		'oldfieldname': 'amendment_date',
-		'oldfieldtype': 'Date',
-		'permlevel': 1,
-		'print_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 12,
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 0,
-		'description': 'You can create PO when quotation gets approved.',
-		'doctype': 'DocField',
-		'fieldname': 'approval_status',
-		'fieldtype': 'Select',
-		'idx': 13,
-		'label': 'Approval Status',
-		'oldfieldname': 'approval_status',
-		'oldfieldtype': 'Select',
-		'options': '\nApproved\nNot Approved',
-		'permlevel': 2
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 14,
-		'label': 'Approve / Unapprove',
-		'oldfieldtype': 'Button',
-		'permlevel': 2,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'supplier',
-		'fieldtype': 'Link',
-		'idx': 15,
-		'in_filter': 1,
-		'label': 'Supplier',
-		'oldfieldname': 'supplier',
-		'oldfieldtype': 'Link',
-		'options': 'Supplier',
-		'permlevel': 0,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_name',
-		'fieldtype': 'Data',
-		'idx': 16,
-		'in_filter': 1,
-		'label': 'Supplier Name',
-		'oldfieldname': 'supplier_name',
-		'oldfieldtype': 'Data',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_address',
-		'fieldtype': 'Text',
-		'idx': 17,
-		'label': 'Supplier Address',
-		'oldfieldname': 'supplier_address',
-		'oldfieldtype': 'Text',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'contact_person',
-		'fieldtype': 'Link',
-		'idx': 18,
-		'in_filter': 0,
-		'label': 'Contact Person',
-		'oldfieldname': 'contact_person',
-		'oldfieldtype': 'Link',
-		'permlevel': 0,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'contact_no',
-		'fieldtype': 'Data',
-		'idx': 19,
-		'label': 'Contact No',
-		'oldfieldname': 'contact_no',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'email',
-		'fieldtype': 'Data',
-		'idx': 20,
-		'label': 'Email',
-		'oldfieldname': 'email',
-		'oldfieldtype': 'Data',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 21,
-		'label': 'Item Details',
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'rfq_no',
-		'fieldtype': 'Link',
-		'hidden': 1,
-		'idx': 22,
-		'label': 'RFQ No',
-		'oldfieldname': 'rfq_no',
-		'oldfieldtype': 'Link',
-		'options': 'RFQ',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 23,
-		'label': 'Get Items',
-		'oldfieldtype': 'Button',
-		'options': 'get_rfq_details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'idx': 24,
-		'oldfieldtype': 'Column Break',
-		'permlevel': 0,
-		'width': '50%'
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': "Supplier's currency",
-		'doctype': 'DocField',
-		'fieldname': 'currency',
-		'fieldtype': 'Select',
-		'idx': 25,
-		'label': 'Currency',
-		'oldfieldname': 'currency',
-		'oldfieldtype': 'Select',
-		'options': 'link:Currency',
-		'permlevel': 0,
-		'reqd': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'default': '1',
-		'description': "Rate at which supplier's currency is converted to your currency",
-		'doctype': 'DocField',
-		'fieldname': 'conversion_rate',
-		'fieldtype': 'Currency',
-		'idx': 26,
-		'label': 'Conversion Rate',
-		'no_copy': 1,
-		'oldfieldname': 'conversion_rate',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'print_hide': 1,
-		'reqd': 1,
-		'trigger': 'Client'
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 27,
-		'oldfieldtype': 'Section Break',
-		'options': 'Simple',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'supplier_quotation_details',
-		'fieldtype': 'Table',
-		'idx': 28,
-		'label': 'Quotation Details1',
-		'oldfieldname': 'supplier_quotation_details',
-		'oldfieldtype': 'Table',
-		'options': 'Supplier Quotation Detail',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'net_total',
-		'fieldtype': 'Currency',
-		'idx': 29,
-		'label': 'Net Total',
-		'oldfieldname': 'net_total',
-		'oldfieldtype': 'Currency',
-		'permlevel': 1
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': 'Enter terms and conditions which you want to include',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 30,
-		'label': 'Terms',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'tc_name',
-		'fieldtype': 'Link',
-		'idx': 31,
-		'label': 'Select Terms',
-		'oldfieldname': 'tc_name',
-		'oldfieldtype': 'Link',
-		'options': 'Term',
-		'permlevel': 0,
-		'print_hide': 1,
-		'report_hide': 1
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 32,
-		'label': 'Get Terms',
-		'oldfieldtype': 'Button',
-		'options': 'get_tc_details',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'idx': 33,
-		'label': 'Terms HTML',
-		'oldfieldtype': 'HTML',
-		'options': 'You can add Terms and Notes that will be printed in the Transaction',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'doctype': 'DocField',
-		'fieldname': 'terms',
-		'fieldtype': 'Text Editor',
-		'idx': 34,
-		'label': 'Terms and Conditions',
-		'oldfieldname': 'terms',
-		'oldfieldtype': 'Text Editor',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'colour': 'White:FFF',
-		'description': "Next steps will be visible when you submit the supplier quotation and approval status is 'Approved'",
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'idx': 35,
-		'label': 'Next Steps',
-		'oldfieldtype': 'Section Break',
-		'permlevel': 0
-	},
-
-	# DocField
-	{
-		'allow_on_submit': 1,
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'idx': 36,
-		'label': 'Get Report',
-		'oldfieldtype': 'Button',
-		'permlevel': 0,
-		'trigger': 'Client'
-	}
-]
\ No newline at end of file
diff --git a/erpnext/patches/jan_mar_2012/fix_packing_slip.py b/erpnext/patches/jan_mar_2012/fix_packing_slip.py
new file mode 100644
index 0000000..98eb825
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/fix_packing_slip.py
@@ -0,0 +1,20 @@
+def execute():
+	"""
+		* Change DN to PS mapper
+			+ Set Ref doc should be submitted to 0
+			+ Set validation logic of DN PS Table mapper record to docstatus=0
+	"""
+	import webnotes
+	webnotes.conn.sql("""\
+		UPDATE `tabDocType Mapper`
+		SET ref_doc_submitted=0
+		WHERE name='Delivery Note-Packing Slip'""")
+	
+	webnotes.conn.sql("""\
+		UPDATE `tabTable Mapper Detail`
+		SET validation_logic='docstatus=0'
+		WHERE parent='Delivery Note-Packing Slip'
+		AND docstatus=0
+		AND from_table='Delivery Note'
+		AND to_table='Packing Slip'""")
+
diff --git a/erpnext/patches/jan_mar_2012/no_copy_patch.py b/erpnext/patches/jan_mar_2012/no_copy_patch.py
new file mode 100644
index 0000000..5e97ae3
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/no_copy_patch.py
@@ -0,0 +1,3 @@
+def execute():
+	import webnotes
+	webnotes.conn.sql("update `tabDocField` set no_copy = 1 where fieldname = 'insert_after' and parent = 'Custom Field'")
diff --git a/erpnext/patches/jan_mar_2012/reload_item.py b/erpnext/patches/jan_mar_2012/reload_item.py
new file mode 100644
index 0000000..158b67d
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/reload_item.py
@@ -0,0 +1,6 @@
+def execute():
+	import webnotes
+	from webnotes.modules.module_manager import reload_doc
+	reload_doc('stock', 'doctype', 'item')
+
+	webnotes.conn.sql("update `tabItem` set re_order_qty = min_order_qty")
diff --git a/erpnext/patches/jan_mar_2012/remove_archive.py b/erpnext/patches/jan_mar_2012/remove_archive.py
new file mode 100644
index 0000000..5f2cdab
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/remove_archive.py
@@ -0,0 +1,24 @@
+# TODO take backup before running this patch
+def execute():
+	"""
+		* Restore archived data from arc tables
+		* Drop arc tables
+	"""
+	import webnotes
+	from webnotes.utils import archive
+	arc_tables = webnotes.conn.sql('show tables like "arc%"')
+	try:
+		webnotes.conn.auto_commit_on_excess = 1
+		for tab in arc_tables:
+			tab = tab[0]
+			dt = tab[3:]
+			res = webnotes.conn.sql("SELECT name FROM `%s`" % tab)
+			for dn in res:
+				archive.archive_doc(dt, dn[0], restore=1)
+	except Exception, e:
+		raise e
+	else:
+		webnotes.conn.commit()
+		for tab in arc_tables:
+			webnotes.conn.sql("DROP TABLE `%s`" % tab[0])
+		webnotes.conn.begin()
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
index 9430038..e83d2a6 100644
--- a/erpnext/patches/patch_list.py
+++ b/erpnext/patches/patch_list.py
@@ -79,5 +79,30 @@
 		'patch_module': 'patches.jan_mar_2012',
 		'patch_file': 'subcon_default_val',
 		'description': 'Default value of is_subcontracted in PO, PR is No'
-	}
+	},
+	{
+		'patch_module': 'patches.jan_mar_2012.website',
+		'patch_file': 'all',
+		'description': 'Run all website related patches'
+	},
+	{
+		'patch_module': 'patches.jan_mar_2012',
+		'patch_file': 'remove_archive',
+		'description': 'unarchive all records and drop archive tables'
+	},
+	{
+		'patch_module': 'patches.jan_mar_2012',
+		'patch_file': 'no_copy_patch',
+		'description': 'insert after fld in custom fld should be no_copy'
+	},
+	{
+		'patch_module': 'patches.jan_mar_2012',
+		'patch_file': 'reload_item',
+		'description': 'reload item'
+	},
+	{
+		'patch_module': 'patches.jan_mar_2012',
+		'patch_file': 'fix_packing_slip',
+		'description': 'Update Mapper Delivery Note-Packing Slip'
+	},
 ]
diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
index 4fec879..1177425 100644
--- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
+++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.py
@@ -318,7 +318,6 @@
 				ch.fields[i] = d[i]
 			ch.docstatus = is_submit
 			ch.save(1)
-
 		self.doc.save()
 
 
@@ -351,10 +350,6 @@
 		""" Get all raw materials including items from child bom"""
 		self.cur_flat_bom_items = []
 		for d in getlist(self.doclist, 'bom_materials'):
-			item = {}
-			if d.bom_no:
-				item = sql("select is_sub_contracted_item from `tabItem` where name = '%s'" % d.item_code)
-
 			self.cur_flat_bom_items.append({
 				'item_code'				: d.item_code, 
 				'description'			: d.description, 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 225e0dc..7bd5cba 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -181,7 +181,7 @@
 	# ------------------
 	def validate_po_date(self):
 		# validate p.o date v/s delivery date
-		if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) >= getdate(self.doc.delivery_date):
+		if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) > getdate(self.doc.delivery_date):
 			msgprint("Expected Delivery Date cannot be before Purchase Order Date")
 			raise Exception	
 		# amendment date is necessary if document is amended
diff --git a/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt b/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
index baf2b74..f59ab73 100644
--- a/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
+++ b/erpnext/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
@@ -3,9 +3,9 @@
 
 	# These values are common in all dictionaries
 	{
-		'creation': '2012-02-13 11:28:48',
+		'creation': '2012-02-02 11:50:33',
 		'docstatus': 0,
-		'modified': '2012-02-13 11:28:48',
+		'modified': '2012-02-21 16:11:29',
 		'modified_by': u'Administrator',
 		'owner': u'Administrator'
 	},
@@ -34,7 +34,7 @@
 		'from_doctype': u'Delivery Note',
 		'module': u'Stock',
 		'name': '__common__',
-		'ref_doc_submitted': 1,
+		'ref_doc_submitted': 0,
 		'to_doctype': u'Packing Slip'
 	},
 
@@ -77,7 +77,7 @@
 		'from_table': u'Delivery Note',
 		'match_id': 0,
 		'to_table': u'Packing Slip',
-		'validation_logic': u'docstatus=1'
+		'validation_logic': u'docstatus=0'
 	},
 
 	# Table Mapper Detail
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index 6a228c1..8f1bdf2 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -36,8 +36,8 @@
 		self.doc.planned_qty = flt(self.doc.planned_qty) + flt(planned_qty)
 		self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + flt(self.doc.indented_qty) + flt(self.doc.planned_qty) - flt(self.doc.reserved_qty)
 		self.doc.save()
-		if(( flt(actual_qty)<0 or flt(reserved_qty)>0 )and is_cancelled == 'No' and is_amended=='No'):
-			self.reorder_item(doc_type,doc_name)	
+		if(( flt(actual_qty)<0 or flt(reserved_qty)>0 ) and is_cancelled == 'No' and is_amended=='No'):
+			self.reorder_item(doc_type,doc_name)
 		
 		if actual_qty:
 			# check actual qty with total number of serial no
@@ -304,26 +304,37 @@
 				(flt(val_rate), cqty, flt(stock_val), self.doc.name))
 
 
-	# item re-order
-	# -------------
+
 	def reorder_item(self,doc_type,doc_name):
+		""" Reorder item if stock reaches reorder level"""
+
 		if get_value('Manage Account', None, 'auto_indent'):
 			#check if re-order is required
-			indent_detail_fields = sql("select re_order_level,item_name,description,brand,item_group,lead_time_days,min_order_qty,email_notify from tabItem where item_code = %s",(self.doc.item_code),as_dict=1)
-			i =	indent_detail_fields[0] 
-			item_reorder_level = i['re_order_level'] or 0	 
-			if ((flt(item_reorder_level) > flt(self.doc.projected_qty)) and item_reorder_level) :
-				self.reorder_indent(i,item_reorder_level,doc_type,doc_name,email_notify=i['email_notify'])
+			ret = sql("select re_order_level, item_name, description, brand, item_group, lead_time_days, min_order_qty, email_notify, re_order_qty from tabItem where item_code = %s", (self.doc.item_code), as_dict=1)
+			
+			current_qty = sql("""
+				select sum(t1.actual_qty) + sum(t1.indented_qty) + sum(t1.ordered_qty) -sum(t1.reserved_qty)
+				from tabBin t1, tabWarehouse t2
+				where t1.item_code = %s 
+				and t1.warehouse = t2.name
+				and t2.warehouse_type in ('Stores', 'Reserved', 'Default Warehouse Type')
+				and t1.docstatus != 2
+			""", self.doc.item_code)
 
-		
-	# Re order Auto Intent Generation
-	def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify=1):
+			if ((flt(ret[0]['re_order_level']) > flt(current_qty)) and ret[0]['re_order_level']):
+				self.create_auto_indent(ret[0], doc_type, doc_name)
+
+	
+
+	def create_auto_indent(self, i , doc_type, doc_name):
+		"""	Create indent on reaching reorder level	"""
+
 		indent = Document('Indent')
 		indent.transaction_date = nowdate()
 		indent.naming_series = 'IDT'
 		indent.company = get_defaults()['company']
 		indent.fiscal_year = get_defaults()['fiscal_year']
-		indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level when %s %s was created"%(doc_type,doc_name)
+		indent.remark = "This is an auto generated Indent. It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when %s %s was created"%(doc_type,doc_name)
 		indent.save(1)
 		indent_obj = get_obj('Indent',indent.name,with_children=1)
 		indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
@@ -334,26 +345,29 @@
 		indent_details_child.item_name = i['item_name']
 		indent_details_child.description = i['description']
 		indent_details_child.item_group = i['item_group']
-		if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
-			indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
-		else:
-			indent_details_child.qty = i['min_order_qty']
+		indent_details_child.qty = i['re_order_qty']
 		indent_details_child.brand = i['brand']
 		indent_details_child.save()
 		indent_obj = get_obj('Indent',indent.name,with_children=1)
 		indent_obj.validate()
 		set(indent_obj.doc,'docstatus',1)
 		indent_obj.on_submit()
-		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
-		if(email_notify):
+		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised. It was generated from %s %s"%(indent.name,doc_type, doc_name ))
+		if(i['email_notify']):
 			send_email_notification(doc_type,doc_name)
 			
+
+
 	def send_email_notification(self,doc_type,doc_name):
+		""" Notify user about auto creation of indent"""
+
 		email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")]
 		msg1='An Indent has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
 		sendmail(email_list, sender='automail@webnotestech.com', \
 		subject='Auto Indent Generation Notification', parts=[['text/plain',msg1]])	
-	# validate
+
+
+
 	def validate(self):
 		self.validate_mandatory()
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index d9f4795..10297dd 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -52,7 +52,7 @@
 		unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
 	}
 
-	if(doc.docstatus==1) {
+	if(doc.docstatus==0 && !doc.__islocal) {
 		cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
 	}
 	
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 60aee13..40fdc94 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -309,6 +309,7 @@
 # ON SUBMIT
 # =================================================================================================
 	def on_submit(self):
+		self.validate_packed_qty()
 		set(self.doc, 'message', 'Items against your Order #%s have been delivered. Delivery #%s: ' % (self.doc.po_no, self.doc.name))
 		self.check_qty_in_stock()
 		# Check for Approving Authority
@@ -326,6 +327,28 @@
 		set(self.doc, 'status', 'Submitted')
 
 
+	def validate_packed_qty(self):
+		"""
+			Validate that if packed qty exists, it should be equal to qty
+		"""
+		if not any([d.fields.get('packed_qty') for d in self.doclist]):
+			return
+		packing_error_list = []
+		for d in self.doclist:
+			if d.doctype != 'Delivery Note Detail': continue
+			if d.fields.get('qty') != d.fields.get('packed_qty'):
+				packing_error_list.append([
+					d.fields.get('item_code', ''),
+					d.fields.get('qty', ''),
+					d.fields.get('packed_qty', '')
+				])
+		if packing_error_list:
+			from webnotes.utils import cstr
+			err_msg = "\n".join([("Item: " + d[0] + ", Qty: " + cstr(d[1]) \
+				+ ", Packed: " + cstr(d[2])) for d in packing_error_list])
+			webnotes.msgprint("Packing Error:\n" + err_msg, raise_exception=1)
+
+
 	# *********** Checks whether actual quantity is present in warehouse *************
 	def check_qty_in_stock(self):
 		for d in getlist(self.doclist, 'packing_details'):
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index d37114d..682b69c 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -5,56 +5,56 @@
 	{
 		'creation': '2010-08-08 17:09:05',
 		'docstatus': 0,
-		'modified': '2012-01-30 17:34:23',
-		'modified_by': 'Administrator',
-		'owner': 'Administrator'
+		'modified': '2012-02-21 12:40:01',
+		'modified_by': u'Administrator',
+		'owner': u'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1326963484',
+		'_last_update': u'1329808172',
 		'allow_attach': 1,
 		'allow_trash': 1,
-		'autoname': 'field:item_code',
-		'colour': 'White:FFF',
-		'default_print_format': 'Standard',
+		'autoname': u'field:item_code',
+		'colour': u'White:FFF',
+		'default_print_format': u'Standard',
 		'doctype': 'DocType',
-		'document_type': 'Master',
+		'document_type': u'Master',
 		'max_attachments': 1,
-		'module': 'Stock',
+		'module': u'Stock',
 		'name': '__common__',
-		'search_fields': 'item_name,description,item_group,customer_code',
-		'section_style': 'Tray',
-		'server_code_error': ' ',
+		'search_fields': u'item_name,description,item_group,customer_code',
+		'section_style': u'Tray',
+		'server_code_error': u' ',
 		'show_in_menu': 0,
-		'subject': '%(item_name)s',
-		'tag_fields': 'item_group',
-		'version': 165
+		'subject': u'%(item_name)s',
+		'tag_fields': u'item_group',
+		'version': 171
 	},
 
 	# These values are common for all DocField
 	{
-		'doctype': 'DocField',
+		'doctype': u'DocField',
 		'name': '__common__',
-		'parent': 'Item',
-		'parentfield': 'fields',
-		'parenttype': 'DocType'
+		'parent': u'Item',
+		'parentfield': u'fields',
+		'parenttype': u'DocType'
 	},
 
 	# These values are common for all DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'name': '__common__',
-		'parent': 'Item',
-		'parentfield': 'permissions',
-		'parenttype': 'DocType',
+		'parent': u'Item',
+		'parentfield': u'permissions',
+		'parenttype': u'DocType',
 		'read': 1
 	},
 
 	# DocType, Item
 	{
 		'doctype': 'DocType',
-		'name': 'Item'
+		'name': u'Item'
 	},
 
 	# DocPerm
@@ -62,9 +62,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -74,9 +74,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Manager',
+		'role': u'Material Manager',
 		'submit': 0,
 		'write': 0
 	},
@@ -86,9 +86,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material User',
+		'role': u'Material User',
 		'submit': 0,
 		'write': 0
 	},
@@ -98,9 +98,9 @@
 		'amend': 0,
 		'cancel': 0,
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material User',
+		'role': u'Material User',
 		'submit': 0,
 		'write': 0
 	},
@@ -109,18 +109,18 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
 		'create': 0,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'Material Master Manager',
+		'role': u'Material Master Manager',
 		'write': 0
 	},
 
@@ -128,51 +128,51 @@
 	{
 		'cancel': 1,
 		'create': 1,
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 0,
-		'role': 'System Manager',
+		'role': u'System Manager',
 		'write': 1
 	},
 
 	# DocPerm
 	{
-		'doctype': 'DocPerm',
+		'doctype': u'DocPerm',
 		'permlevel': 1,
-		'role': 'System Manager'
+		'role': u'System Manager'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Item',
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Item',
 		'no_copy': 0,
-		'oldfieldtype': 'Section Break',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'trash_reason',
-		'fieldtype': 'Small Text',
-		'label': 'Trash Reason',
-		'oldfieldname': 'trash_reason',
-		'oldfieldtype': 'Small Text',
+		'doctype': u'DocField',
+		'fieldname': u'trash_reason',
+		'fieldtype': u'Small Text',
+		'label': u'Trash Reason',
+		'oldfieldname': u'trash_reason',
+		'oldfieldtype': u'Small Text',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Item will be saved by this name in the data base.',
-		'doctype': 'DocField',
-		'fieldname': 'item_code',
-		'fieldtype': 'Data',
+		'colour': u'White:FFF',
+		'description': u'Item will be saved by this name in the data base.',
+		'doctype': u'DocField',
+		'fieldname': u'item_code',
+		'fieldtype': u'Data',
 		'in_filter': 0,
-		'label': 'Item Code',
-		'oldfieldname': 'item_code',
-		'oldfieldtype': 'Data',
+		'label': u'Item Code',
+		'oldfieldname': u'item_code',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0
@@ -180,13 +180,13 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_name',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'item_name',
+		'fieldtype': u'Data',
 		'in_filter': 1,
-		'label': 'Item Name',
-		'oldfieldname': 'item_name',
-		'oldfieldtype': 'Data',
+		'label': u'Item Name',
+		'oldfieldname': u'item_name',
+		'oldfieldtype': u'Data',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 1
@@ -194,40 +194,40 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Classify your item in any one item group by clicking on the magnifying glass',
-		'doctype': 'DocField',
-		'fieldname': 'item_group',
-		'fieldtype': 'Link',
+		'colour': u'White:FFF',
+		'description': u'Classify your item in any one item group by clicking on the magnifying glass',
+		'doctype': u'DocField',
+		'fieldname': u'item_group',
+		'fieldtype': u'Link',
 		'in_filter': 1,
-		'label': 'Item Group',
-		'oldfieldname': 'item_group',
-		'oldfieldtype': 'Link',
-		'options': 'Item Group',
+		'label': u'Item Group',
+		'oldfieldname': u'item_group',
+		'oldfieldtype': u'Link',
+		'options': u'Item Group',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'HTML',
-		'label': 'IGHelp',
-		'oldfieldtype': 'HTML',
-		'options': '<a href="javascript:cur_frm.cscript.IGHelp();">To manage Item Group, click here</a>',
+		'doctype': u'DocField',
+		'fieldtype': u'HTML',
+		'label': u'IGHelp',
+		'oldfieldtype': u'HTML',
+		'options': u'<a href="javascript:cur_frm.cscript.IGHelp();">To manage Item Group, click here</a>',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'brand',
-		'fieldtype': 'Link',
+		'doctype': u'DocField',
+		'fieldname': u'brand',
+		'fieldtype': u'Link',
 		'hidden': 0,
-		'label': 'Brand',
-		'oldfieldname': 'brand',
-		'oldfieldtype': 'Link',
-		'options': 'Brand',
+		'label': u'Brand',
+		'oldfieldname': u'brand',
+		'oldfieldtype': u'Link',
+		'options': u'Brand',
 		'permlevel': 0,
 		'print_hide': 1,
 		'reqd': 0
@@ -235,655 +235,696 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Column Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'description',
+		'fieldtype': u'Text',
 		'in_filter': 0,
-		'label': 'Description',
-		'oldfieldname': 'description',
-		'oldfieldtype': 'Text',
+		'label': u'Description',
+		'oldfieldname': u'description',
+		'oldfieldtype': u'Text',
 		'permlevel': 0,
 		'reqd': 1,
 		'search_index': 0,
-		'width': '300px'
+		'width': u'300px'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'description_html',
-		'fieldtype': 'Text',
-		'label': 'Description HTML',
+		'doctype': u'DocField',
+		'fieldname': u'description_html',
+		'fieldtype': u'Text',
+		'label': u'Description HTML',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Generates HTML to include image (1st attachment) in the description',
-		'doctype': 'DocField',
-		'fieldtype': 'Button',
-		'label': 'Add Image',
+		'colour': u'White:FFF',
+		'description': u'Generates HTML to include image (1st attachment) in the description',
+		'doctype': u'DocField',
+		'fieldtype': u'Button',
+		'label': u'Add Image',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Inventory',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Inventory',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Enter unit of measurement in which stock of this item is maintained in your warehouse.',
-		'doctype': 'DocField',
-		'fieldname': 'stock_uom',
-		'fieldtype': 'Link',
-		'label': 'Default UoM',
-		'oldfieldname': 'stock_uom',
-		'oldfieldtype': 'Link',
-		'options': 'UOM',
+		'colour': u'White:FFF',
+		'description': u'Enter unit of measurement in which stock of this item is maintained in your warehouse.',
+		'doctype': u'DocField',
+		'fieldname': u'stock_uom',
+		'fieldtype': u'Link',
+		'label': u'Default UoM',
+		'oldfieldname': u'stock_uom',
+		'oldfieldtype': u'Link',
+		'options': u'UOM',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Yes',
-		'description': 'Select "Yes" if you are maintaining stock of this item in your Inventory.',
-		'doctype': 'DocField',
-		'fieldname': 'is_stock_item',
-		'fieldtype': 'Select',
-		'label': 'Is Stock Item',
-		'oldfieldname': 'is_stock_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'Yes',
+		'description': u'Select "Yes" if you are maintaining stock of this item in your Inventory.',
+		'doctype': u'DocField',
+		'fieldname': u'is_stock_item',
+		'fieldtype': u'Select',
+		'label': u'Is Stock Item',
+		'oldfieldname': u'is_stock_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'valuation_method',
-		'fieldtype': 'Select',
-		'label': 'Valuation Method',
-		'oldfieldname': 'valuation_method',
-		'oldfieldtype': 'Select',
-		'options': '\nFIFO\nMoving Average',
+		'doctype': u'DocField',
+		'fieldname': u'valuation_method',
+		'fieldtype': u'Select',
+		'label': u'Valuation Method',
+		'oldfieldname': u'valuation_method',
+		'oldfieldtype': u'Select',
+		'options': u'\nFIFO\nMoving Average',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'default_warehouse',
-		'fieldtype': 'Link',
-		'label': 'Default Warehouse',
-		'oldfieldname': 'default_warehouse',
-		'oldfieldtype': 'Link',
-		'options': 'Warehouse',
+		'doctype': u'DocField',
+		'fieldname': u'default_warehouse',
+		'fieldtype': u'Link',
+		'label': u'Default Warehouse',
+		'oldfieldname': u'default_warehouse',
+		'oldfieldtype': u'Link',
+		'options': u'Warehouse',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Percentage variation in quantity to be allowed while receiving or delivering this item.',
-		'doctype': 'DocField',
-		'fieldname': 'tolerance',
-		'fieldtype': 'Currency',
-		'label': 'Allowance Percent',
-		'oldfieldname': 'tolerance',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'description': u'Percentage variation in quantity to be allowed while receiving or delivering this item.',
+		'doctype': u'DocField',
+		'fieldname': u'tolerance',
+		'fieldtype': u'Currency',
+		'label': u'Allowance Percent',
+		'oldfieldname': u'tolerance',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 're_order_level',
-		'fieldtype': 'Currency',
-		'label': 'Re-Order Level',
-		'oldfieldname': 're_order_level',
-		'oldfieldtype': 'Currency',
+		'colour': u'White:FFF',
+		'description': u'The system will generate auto indent when stock reaches re-order level.',
+		'doctype': u'DocField',
+		'fieldname': u're_order_level',
+		'fieldtype': u'Currency',
+		'label': u'Re-Order Level',
+		'oldfieldname': u're_order_level',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'email_notify',
-		'fieldtype': 'Check',
-		'label': 'Send Email Notification when stock reaches re-order level',
+		'colour': u'White:FFF',
+		'description': u'The system will create auto indent of re-order quantity when stock reaches re-order level',
+		'doctype': u'DocField',
+		'fieldname': u're_order_qty',
+		'fieldtype': u'Currency',
+		'label': u'Re-Order Qty',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': '0.00',
-		'description': 'You can enter the minimum quantity of this item to be ordered.',
-		'doctype': 'DocField',
-		'fieldname': 'min_order_qty',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'email_notify',
+		'fieldtype': u'Check',
+		'label': u'Send Email Notification when stock reaches re-order level',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'0.00',
+		'description': u'You can enter the minimum quantity of this item to be ordered.',
+		'doctype': u'DocField',
+		'fieldname': u'min_order_qty',
+		'fieldtype': u'Currency',
 		'hidden': 0,
-		'label': 'Minimum Order Qty',
-		'oldfieldname': 'min_order_qty',
-		'oldfieldtype': 'Currency',
+		'label': u'Minimum Order Qty',
+		'oldfieldname': u'min_order_qty',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Select "Yes" if this item is used for some internal purpose in your company.',
-		'doctype': 'DocField',
-		'fieldname': 'is_asset_item',
-		'fieldtype': 'Select',
-		'label': 'Is Asset Item',
-		'oldfieldname': 'is_asset_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Select "Yes" if this item is used for some internal purpose in your company.',
+		'doctype': u'DocField',
+		'fieldname': u'is_asset_item',
+		'fieldtype': u'Select',
+		'label': u'Is Asset Item',
+		'oldfieldname': u'is_asset_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'doctype': 'DocField',
-		'fieldname': 'has_batch_no',
-		'fieldtype': 'Select',
-		'label': 'Has Batch No',
-		'oldfieldname': 'has_batch_no',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'has_batch_no',
+		'fieldtype': u'Select',
+		'label': u'Has Batch No',
+		'oldfieldname': u'has_batch_no',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Selecting "Yes" will give a unique identity to each entity of this item which can be viewed in the Serial No master.',
-		'doctype': 'DocField',
-		'fieldname': 'has_serial_no',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Selecting "Yes" will give a unique identity to each entity of this item which can be viewed in the Serial No master.',
+		'doctype': u'DocField',
+		'fieldname': u'has_serial_no',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Has Serial No',
-		'oldfieldname': 'has_serial_no',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'label': u'Has Serial No',
+		'oldfieldname': u'has_serial_no',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'warranty_period',
-		'fieldtype': 'Data',
-		'label': 'Warranty Period (in days)',
-		'oldfieldname': 'warranty_period',
-		'oldfieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'warranty_period',
+		'fieldtype': u'Data',
+		'label': u'Warranty Period (in days)',
+		'oldfieldname': u'warranty_period',
+		'oldfieldtype': u'Data',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'end_of_life',
-		'fieldtype': 'Date',
-		'label': 'End of Life',
-		'oldfieldname': 'end_of_life',
-		'oldfieldtype': 'Date',
+		'doctype': u'DocField',
+		'fieldname': u'end_of_life',
+		'fieldtype': u'Date',
+		'label': u'End of Life',
+		'oldfieldname': u'end_of_life',
+		'oldfieldtype': u'Date',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'description': 'Net Weight of each Item',
-		'doctype': 'DocField',
-		'fieldname': 'net_weight',
-		'fieldtype': 'Float',
-		'label': 'Net Weight',
+		'description': u'Net Weight of each Item',
+		'doctype': u'DocField',
+		'fieldname': u'net_weight',
+		'fieldtype': u'Float',
+		'label': u'Net Weight',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'weight_uom',
-		'fieldtype': 'Link',
-		'label': 'Weight UOM',
-		'options': 'UOM',
+		'doctype': u'DocField',
+		'fieldname': u'weight_uom',
+		'fieldtype': u'Link',
+		'label': u'Weight UOM',
+		'options': u'UOM',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Purchase Details',
-		'oldfieldtype': 'Section Break',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Purchase Details',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Yes',
-		'description': 'Selecting "Yes" will allow this item to appear in Purchase Order , Purchase Receipt.',
-		'doctype': 'DocField',
-		'fieldname': 'is_purchase_item',
-		'fieldtype': 'Select',
-		'label': 'Is Purchase Item',
-		'oldfieldname': 'is_purchase_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'Yes',
+		'description': u'Selecting "Yes" will allow this item to appear in Purchase Order , Purchase Receipt.',
+		'doctype': u'DocField',
+		'fieldname': u'is_purchase_item',
+		'fieldtype': u'Select',
+		'label': u'Is Purchase Item',
+		'oldfieldname': u'is_purchase_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Indent when you select this item.',
-		'doctype': 'DocField',
-		'fieldname': 'lead_time_days',
-		'fieldtype': 'Int',
-		'label': 'Lead Time Days',
+		'colour': u'White:FFF',
+		'description': u'Lead Time days is number of days by which this item is expected in your warehouse. This days is fetched in Indent when you select this item.',
+		'doctype': u'DocField',
+		'fieldname': u'lead_time_days',
+		'fieldtype': u'Int',
+		'label': u'Lead Time Days',
 		'no_copy': 1,
-		'oldfieldname': 'lead_time_days',
-		'oldfieldtype': 'Int',
+		'oldfieldname': u'lead_time_days',
+		'oldfieldtype': u'Int',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Default Purchase Account in which cost of the item will be debited.',
-		'doctype': 'DocField',
-		'fieldname': 'purchase_account',
-		'fieldtype': 'Link',
-		'label': 'Default Expense Account',
-		'oldfieldname': 'purchase_account',
-		'oldfieldtype': 'Link',
-		'options': 'Account',
+		'colour': u'White:FFF',
+		'description': u'Default Purchase Account in which cost of the item will be debited.',
+		'doctype': u'DocField',
+		'fieldname': u'purchase_account',
+		'fieldtype': u'Link',
+		'label': u'Default Expense Account',
+		'oldfieldname': u'purchase_account',
+		'oldfieldtype': u'Link',
+		'options': u'Account',
 		'permlevel': 0,
-		'trigger': 'Client'
+		'trigger': u'Client'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Default Cost Center for tracking expense for this item.',
-		'doctype': 'DocField',
-		'fieldname': 'cost_center',
-		'fieldtype': 'Link',
-		'label': 'Default Cost Center',
-		'oldfieldname': 'cost_center',
-		'oldfieldtype': 'Link',
-		'options': 'Cost Center',
+		'colour': u'White:FFF',
+		'description': u'Default Cost Center for tracking expense for this item.',
+		'doctype': u'DocField',
+		'fieldname': u'cost_center',
+		'fieldtype': u'Link',
+		'label': u'Default Cost Center',
+		'oldfieldname': u'cost_center',
+		'oldfieldtype': u'Link',
+		'options': u'Cost Center',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Buying Cost will be updated from Purchase Orders and Purchase Receipts. <br>The buying cost will calculated by moving average method.',
-		'doctype': 'DocField',
-		'fieldname': 'buying_cost',
-		'fieldtype': 'Currency',
-		'label': 'Buying Cost',
+		'colour': u'White:FFF',
+		'description': u'Buying Cost will be updated from Purchase Orders and Purchase Receipts. <br>The buying cost will calculated by moving average method.',
+		'doctype': u'DocField',
+		'fieldname': u'buying_cost',
+		'fieldtype': u'Currency',
+		'label': u'Buying Cost',
 		'no_copy': 1,
-		'oldfieldname': 'buying_cost',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'buying_cost',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'last_purchase_rate',
-		'fieldtype': 'Currency',
-		'label': 'Last Purchase Rate',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'last_purchase_rate',
+		'fieldtype': u'Currency',
+		'label': u'Last Purchase Rate',
 		'no_copy': 1,
-		'oldfieldname': 'last_purchase_rate',
-		'oldfieldtype': 'Currency',
+		'oldfieldname': u'last_purchase_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'standard_rate',
-		'fieldtype': 'Currency',
-		'label': 'Standard Rate',
-		'oldfieldname': 'standard_rate',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'standard_rate',
+		'fieldtype': u'Currency',
+		'label': u'Standard Rate',
+		'oldfieldname': u'standard_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'uom_conversion_details',
-		'fieldtype': 'Table',
-		'label': 'UOM Conversion Details',
-		'oldfieldname': 'uom_conversion_details',
-		'oldfieldtype': 'Table',
-		'options': 'UOM Conversion Detail',
+		'doctype': u'DocField',
+		'fieldname': u'uom_conversion_details',
+		'fieldtype': u'Table',
+		'label': u'UOM Conversion Details',
+		'oldfieldname': u'uom_conversion_details',
+		'oldfieldtype': u'Table',
+		'options': u'UOM Conversion Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Sales Details',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldname': u'manufacturer',
+		'fieldtype': u'Data',
+		'label': u'Manufacturer',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'Yes',
-		'description': 'Selecting "Yes" will allow this item to figure in Sales Order, Delivery Note',
-		'doctype': 'DocField',
-		'fieldname': 'is_sales_item',
-		'fieldtype': 'Select',
+		'doctype': u'DocField',
+		'fieldname': u'manufacturer_part_no',
+		'fieldtype': u'Data',
+		'label': u'Manufacturer Part Number',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldname': u'item_supplier_details',
+		'fieldtype': u'Table',
+		'label': u'Item Supplier Details',
+		'options': u'Item Supplier',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Sales Details',
+		'oldfieldtype': u'Section Break',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'colour': u'White:FFF',
+		'default': u'Yes',
+		'description': u'Selecting "Yes" will allow this item to figure in Sales Order, Delivery Note',
+		'doctype': u'DocField',
+		'fieldname': u'is_sales_item',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is Sales Item',
-		'oldfieldname': 'is_sales_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'label': u'Is Sales Item',
+		'oldfieldname': u'is_sales_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Select "Yes" if this item represents some work like training, designing, consulting etc.',
-		'doctype': 'DocField',
-		'fieldname': 'is_service_item',
-		'fieldtype': 'Select',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Select "Yes" if this item represents some work like training, designing, consulting etc.',
+		'doctype': u'DocField',
+		'fieldname': u'is_service_item',
+		'fieldtype': u'Select',
 		'in_filter': 1,
-		'label': 'Is Service Item',
-		'oldfieldname': 'is_service_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'label': u'Is Service Item',
+		'oldfieldname': u'is_service_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Select "Yes" if this item is to be sent to a customer or received from a supplier as a sample. Delivery notes and Purchase Receipts will update stock levels but there will be no invoice against this item.',
-		'doctype': 'DocField',
-		'fieldname': 'is_sample_item',
-		'fieldtype': 'Select',
-		'label': 'Allow Samples',
-		'oldfieldname': 'is_sample_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Select "Yes" if this item is to be sent to a customer or received from a supplier as a sample. Delivery notes and Purchase Receipts will update stock levels but there will be no invoice against this item.',
+		'doctype': u'DocField',
+		'fieldname': u'is_sample_item',
+		'fieldtype': u'Select',
+		'label': u'Allow Samples',
+		'oldfieldname': u'is_sample_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'max_discount',
-		'fieldtype': 'Currency',
-		'label': 'Max Discount (%)',
-		'oldfieldname': 'max_discount',
-		'oldfieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'max_discount',
+		'fieldtype': u'Currency',
+		'label': u'Max Discount (%)',
+		'oldfieldname': u'max_discount',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'default_income_account',
-		'fieldtype': 'Link',
-		'label': 'Default Income Account',
-		'options': 'Account',
+		'doctype': u'DocField',
+		'fieldname': u'default_income_account',
+		'fieldtype': u'Link',
+		'label': u'Default Income Account',
+		'options': u'Account',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'default_sales_cost_center',
-		'fieldtype': 'Link',
-		'label': 'Cost Center',
-		'options': 'Cost Center',
+		'doctype': u'DocField',
+		'fieldname': u'default_sales_cost_center',
+		'fieldtype': u'Link',
+		'label': u'Cost Center',
+		'options': u'Cost Center',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'sales_rate',
-		'fieldtype': 'Currency',
+		'doctype': u'DocField',
+		'fieldname': u'sales_rate',
+		'fieldtype': u'Currency',
 		'hidden': 1,
-		'label': 'Sales Rate',
-		'oldfieldname': 'sales_rate',
-		'oldfieldtype': 'Currency',
+		'label': u'Sales Rate',
+		'oldfieldname': u'sales_rate',
+		'oldfieldtype': u'Currency',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Column Break',
-		'oldfieldtype': 'Column Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Column Break',
+		'oldfieldtype': u'Column Break',
 		'permlevel': 0,
-		'width': '50%'
+		'width': u'50%'
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'description': 'Create a price list from Price List master and enter standard ref rates against each of them. On selection of a price list in Quotation, Sales Order or Delivery Note, corresponding ref rate will be fetched for this item.',
-		'doctype': 'DocField',
-		'fieldname': 'ref_rate_details',
-		'fieldtype': 'Table',
-		'label': 'Ref Rate Details',
-		'oldfieldname': 'ref_rate_details',
-		'oldfieldtype': 'Table',
-		'options': 'Ref Rate Detail',
+		'colour': u'White:FFF',
+		'description': u'Create a price list from Price List master and enter standard ref rates against each of them. On selection of a price list in Quotation, Sales Order or Delivery Note, corresponding ref rate will be fetched for this item.',
+		'doctype': u'DocField',
+		'fieldname': u'ref_rate_details',
+		'fieldtype': u'Table',
+		'label': u'Ref Rate Details',
+		'oldfieldname': u'ref_rate_details',
+		'oldfieldtype': u'Table',
+		'options': u'Ref Rate Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'description': 'For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes',
-		'doctype': 'DocField',
-		'fieldname': 'item_customer_details',
-		'fieldtype': 'Table',
-		'label': 'Customer Codes',
-		'options': 'Item Customer Detail',
+		'description': u'For the convenience of customers, these codes can be used in print formats like Invoices and Delivery Notes',
+		'doctype': u'DocField',
+		'fieldname': u'item_customer_details',
+		'fieldtype': u'Table',
+		'label': u'Customer Codes',
+		'options': u'Item Customer Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Item Tax',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Item Tax',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_tax',
-		'fieldtype': 'Table',
-		'label': 'Item Tax1',
-		'oldfieldname': 'item_tax',
-		'oldfieldtype': 'Table',
-		'options': 'Item Tax',
+		'doctype': u'DocField',
+		'fieldname': u'item_tax',
+		'fieldtype': u'Table',
+		'label': u'Item Tax1',
+		'oldfieldname': u'item_tax',
+		'oldfieldtype': u'Table',
+		'options': u'Item Tax',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Inspection Criteria',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Inspection Criteria',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'default': 'No',
-		'doctype': 'DocField',
-		'fieldname': 'inspection_required',
-		'fieldtype': 'Select',
-		'label': 'Inspection Required',
+		'default': u'No',
+		'doctype': u'DocField',
+		'fieldname': u'inspection_required',
+		'fieldtype': u'Select',
+		'label': u'Inspection Required',
 		'no_copy': 0,
-		'oldfieldname': 'inspection_required',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'oldfieldname': u'inspection_required',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'item_specification_details',
-		'fieldtype': 'Table',
-		'label': 'Item Specification Detail',
-		'oldfieldname': 'item_specification_details',
-		'oldfieldtype': 'Table',
-		'options': 'Item Specification Detail',
+		'doctype': u'DocField',
+		'fieldname': u'item_specification_details',
+		'fieldtype': u'Table',
+		'label': u'Item Specification Detail',
+		'oldfieldname': u'item_specification_details',
+		'oldfieldtype': u'Table',
+		'options': u'Item Specification Detail',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldtype': 'Section Break',
-		'label': 'Manufacturing',
-		'oldfieldtype': 'Section Break',
+		'doctype': u'DocField',
+		'fieldtype': u'Section Break',
+		'label': u'Manufacturing',
+		'oldfieldtype': u'Section Break',
 		'permlevel': 0
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Selecting "Yes" will allow you to create Bill of Material showing raw material and operational costs incurred to manufacture this item.',
-		'doctype': 'DocField',
-		'fieldname': 'is_manufactured_item',
-		'fieldtype': 'Select',
-		'label': 'Allow Bill of Materials',
-		'oldfieldname': 'is_manufactured_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Selecting "Yes" will allow you to create Bill of Material showing raw material and operational costs incurred to manufacture this item.',
+		'doctype': u'DocField',
+		'fieldname': u'is_manufactured_item',
+		'fieldtype': u'Select',
+		'label': u'Allow Bill of Materials',
+		'oldfieldname': u'is_manufactured_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'doctype': 'DocField',
-		'fieldname': 'default_bom',
-		'fieldtype': 'Link',
-		'label': 'Default BOM',
+		'colour': u'White:FFF',
+		'doctype': u'DocField',
+		'fieldname': u'default_bom',
+		'fieldtype': u'Link',
+		'label': u'Default BOM',
 		'no_copy': 1,
-		'oldfieldname': 'default_bom',
-		'oldfieldtype': 'Link',
-		'options': 'Bill Of Materials',
+		'oldfieldname': u'default_bom',
+		'oldfieldtype': u'Link',
+		'options': u'Bill Of Materials',
 		'permlevel': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Selecting "Yes" will allow you to make a Production Order for this item.',
-		'doctype': 'DocField',
-		'fieldname': 'is_pro_applicable',
-		'fieldtype': 'Select',
-		'label': 'Allow Production Order',
-		'oldfieldname': 'is_pro_applicable',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Selecting "Yes" will allow you to make a Production Order for this item.',
+		'doctype': u'DocField',
+		'fieldname': u'is_pro_applicable',
+		'fieldtype': u'Select',
+		'label': u'Allow Production Order',
+		'oldfieldname': u'is_pro_applicable',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': 'No',
-		'description': 'Select "Yes" if you supply raw materials to your supplier to manufacture this item.',
-		'doctype': 'DocField',
-		'fieldname': 'is_sub_contracted_item',
-		'fieldtype': 'Select',
-		'label': 'Is Sub Contracted Item',
-		'oldfieldname': 'is_sub_contracted_item',
-		'oldfieldtype': 'Select',
-		'options': '\nYes\nNo',
+		'colour': u'White:FFF',
+		'default': u'No',
+		'description': u'Select "Yes" if you supply raw materials to your supplier to manufacture this item.',
+		'doctype': u'DocField',
+		'fieldname': u'is_sub_contracted_item',
+		'fieldtype': u'Select',
+		'label': u'Is Sub Contracted Item',
+		'oldfieldname': u'is_sub_contracted_item',
+		'oldfieldtype': u'Select',
+		'options': u'\nYes\nNo',
 		'permlevel': 0,
 		'reqd': 1
 	},
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'file_list',
-		'fieldtype': 'Text',
+		'doctype': u'DocField',
+		'fieldname': u'file_list',
+		'fieldtype': u'Text',
 		'hidden': 1,
-		'label': 'File List',
+		'label': u'File List',
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
@@ -891,14 +932,14 @@
 
 	# DocField
 	{
-		'doctype': 'DocField',
-		'fieldname': 'customer_code',
-		'fieldtype': 'Data',
+		'doctype': u'DocField',
+		'fieldname': u'customer_code',
+		'fieldtype': u'Data',
 		'hidden': 1,
 		'in_filter': 1,
-		'label': 'Customer Code',
+		'label': u'Customer Code',
 		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	}
-]
+]
\ No newline at end of file
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.js b/erpnext/stock/doctype/packing_slip/packing_slip.js
index 2e728f6..7359ffa 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.js
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.js
@@ -1,12 +1,12 @@
 cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) {
-	return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=1 AND %(key)s LIKE "%s"';
+	return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"';
 }
 
 
 cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
 	return 'SELECT name, description FROM `tabItem` WHERE name IN ( \
-		SELECT item_code FROM `tabDelivery Note Detail` \
-		WHERE parent="'	+ doc.delivery_note + '") AND %(key)s LIKE "%s" LIMIT 50';
+		SELECT item_code FROM `tabDelivery Note Detail` dnd \
+		WHERE parent="'	+ doc.delivery_note + '" AND qty > packed_qty) AND %(key)s LIKE "%s" LIMIT 50';
 }
 
 
@@ -39,8 +39,7 @@
 		if(r.exc) {
 			msgprint(r.exc);
 		} else {
-			refresh_field('item_details');
-			refresh_field('naming_series');
+			refresh_many(['item_details', 'naming_series', 'from_case_no', 'to_case_no'])
 		}
 	});
 }
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index 33ec2b5..23367c7 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -28,9 +28,10 @@
 			WHERE name=%(delivery_note)s
 			""", self.doc.fields)
 
-		if not(res and res[0][0]==1):
+		if not(res and res[0][0]==0):
 			webnotes.msgprint("""Invalid Delivery Note. Delivery Note should exist 
-				and should be submitted. Please rectify and try again.""", raise_exception=1)
+				and should be in draft state. Please rectify and try again.""", 
+				raise_exception=1)
 
 
 	def validate_case_nos(self):
@@ -46,12 +47,8 @@
 			""", self.doc.fields)
 
 		if res:
-			recommended_case_no = webnotes.conn.sql("""\
-				SELECT MAX(to_case_no) FROM `tabPacking Slip`
-				WHERE delivery_note = %(delivery_note)s AND docstatus=1""", self.doc.fields)
-			
 			webnotes.msgprint("""Case No(s). already in use. Please rectify and try again.
-				Recommended <b>From Case No. = %s</b>""" % (cint(recommended_case_no[0][0]) + 1),
+				Recommended <b>From Case No. = %s</b>""" % self.get_recommended_case_no(),
 				raise_exception=1)
 
 
@@ -75,13 +72,18 @@
 			* Item Quantity dict of current packing slip doc
 			* No. of Cases of this packing slip
 		"""
-		item_codes = ", ".join([('"' + d.item_code + '"') for d in self.doclist])
+		item_codes = ", ".join([('"' + d.item_code + '"') for d in
+			self.doclist])
+		
+		if not item_codes: webnotes.msgprint("No Items to Pack",
+				raise_exception=1)
 
 		res = webnotes.conn.sql("""\
 			SELECT item_code, IFNULL(SUM(qty), 0) as qty, IFNULL(packed_qty, 0) as packed_qty, stock_uom
 			FROM `tabDelivery Note Detail`
 			WHERE parent = "%s" AND item_code IN (%s)
-			GROUP BY item_code""" % (self.doc.delivery_note, item_codes), as_dict=1)
+			GROUP BY item_code""" % (self.doc.delivery_note, item_codes),
+			as_dict=1)
 
 		ps_item_qty = dict([[d.item_code, d.qty] for d in self.doclist])
 
@@ -150,7 +152,23 @@
 		"""
 			Fill empty columns in Packing Slip Detail
 		"""
+		self.doc.from_case_no = self.get_recommended_case_no()
+
 		from webnotes.model.code import get_obj
 		for d in self.doclist:
 			psd_obj = get_obj(doc=d)
 			psd_obj.get_item_details(self.doc.delivery_note)
+
+
+	def get_recommended_case_no(self):
+		"""
+			Returns the next case no. for a new packing slip for a delivery
+			note
+		"""
+		recommended_case_no = webnotes.conn.sql("""\
+			SELECT MAX(to_case_no) FROM `tabPacking Slip`
+			WHERE delivery_note = %(delivery_note)s AND docstatus=1""", self.doc.fields)
+
+		return cint(recommended_case_no[0][0]) + 1
+		
+