-webnotes +frappe :boom:
diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
index 761be67..4f20ac2 100644
--- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
+++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<html>\n\t<head>\n\n\t\t<!-- Style Settings -->\n\t\t<style>\n\t\t\ttable, tr, td, div, p {\n\t\t\t\tfont-family: Monospace;\n\t\t\t\tline-height: 200%;\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t\t@media screen {\n\t\t\t\tbody {\n\t\t\t\t\twidth: 4in;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\n\t\t<!-- Javascript -->\n\t\t<script>\n\t\t\tfunction print_header() {\n\t\t\t\tvar header = '<table width=\"100%\" cellpadding=\"4\">';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td colspan=\"2\" align=\"center\"><h3>' + (doc.select_print_heading || \"Invoice\") + '</h3></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td align=\"left\"><b>RECEIPT NO:</b> ' + doc.name + '</td>\\\n\t\t\t\t\t<td align=\"right\"><b>DATE:</b> ' + date.str_to_user(doc.posting_date) + '</td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"2\"><b>M/s.</b> ' + doc.customer + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn header + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_items() {\n\t\t\t\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">';\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td width=\"60%\" align=\"left\"><b>ITEM CODE / DESC.</b></td>\\\n\t\t\t\t\t<td width=\"10%\" align=\"right\"><b>QTY</b></td>\\\n\t\t\t\t\t<td width=\"30%\" align=\"right\"><b>RATE</b></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print items\n\t\t\t\tvar items = getchildren('Sales Invoice Item', doc.name, 'entries');\n\t\t\t\tfor (var x=0; x<items.length; x++) {\n\t\t\t\t\trows += '<tr>\\\n\t\t\t\t\t\t<td align=\"left\">' + items[x].item_code + '<br>' + items[x].item_name + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + items[x].qty + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + format_currency(items[x].amount) + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn rows + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_other_charges_and_totals() {\n\t\t\t\tvar totals = '<table width=\"100%\">';\n\t\t\t\t// print net total\n\t\t\t\ttotals +='<tr>\\\n\t\t\t\t\t<td align=\"right\" width=\"70%\">Net Total</td>\\\n\t\t\t\t\t<td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print exclusive taxes\n\t\t\t\tvar taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (!d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// show discount amount\n\t\t\t\tif (doc.discount_amount) {\n\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t<td align=\"right\">Discount Amount</td>\\\n\t\t\t\t\t\t<td align=\"right\">' + format_currency(doc.discount_amount) + '</td>\\\n\t\t\t\t\t<tr>';\n\t\t\t\t}\n\n\t\t\t\t// print grand total\n\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t<td align=\"right\">Grand Total</td>\\\n\t\t\t\t\t<td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export) + '<br>\\\n\t\t\t\t\t<hr width=\"90%\" align=\"right\"></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn totals + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_inclusive_taxes() {\n\t\t\t\tvar count = 0;\n\t\t\t\tvar inc_tax = '';\n\t\t\t\tvar taxes = wn.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\tif (count == 0) {\n\t\t\t\t\t\t\t\tinc_tax = '<table width=\"100%\">\\\n\t\t\t\t\t\t\t\t\t<tr>\\\n\t\t\t\t\t\t\t\t\t\t<td colspan=\"2\"><b>Inclusive Taxes</b></td>\\\n\t\t\t\t\t\t\t\t\t</tr>';\n\t\t\t\t\t\t\t\tcount += 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t\t\t<td width=\"60%\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td>' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (inc_tax) {\n\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t<td colspan=\"2\"><hr></td>\\\n\t\t\t\t\t</tr></table>';\n\t\t\t\t}\n\n\t\t\t\treturn inc_tax;\n\t\t\t}\n\n\t\t\tfunction print_footer() {\n\t\t\t\tvar footer = '<table width=\"100%\">';\n\n\t\t\t\t// print terms\n\t\t\t\tif (doc.terms) {\n\t\t\t\t\tfooter += '<tr>\\\n\t\t\t\t\t\t<td align=\"center\">' + doc.terms + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\tfooter +='<tr>\\\n\t\t\t\t\t<td align=\"center\">Thank You. Please visit again.</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn footer + '</table>';\n\t\t\t}\n\t\t</script>\n\t</head>\n\n\t<body>\n\t\t<!--Headers, Item Table, Totals & Footer-->\n\t\t<div><script>print_header();</script></div>\n\t\t<div><script>print_items();</script></div>\n\t\t<div><script>print_inclusive_taxes();</script></div>\n\t\t<div><script>print_other_charges_and_totals();</script></div>\n\t\t<div><script>print_footer();</script></div>\n\t</body>\n</html>", 
+  "html": "<html>\n\t<head>\n\n\t\t<!-- Style Settings -->\n\t\t<style>\n\t\t\ttable, tr, td, div, p {\n\t\t\t\tfont-family: Monospace;\n\t\t\t\tline-height: 200%;\n\t\t\t\tvertical-align: middle;\n\t\t\t}\n\t\t\t@media screen {\n\t\t\t\tbody {\n\t\t\t\t\twidth: 4in;\n\t\t\t\t}\n\t\t\t}\n\t\t</style>\n\n\t\t<!-- Javascript -->\n\t\t<script>\n\t\t\tfunction print_header() {\n\t\t\t\tvar header = '<table width=\"100%\" cellpadding=\"4\">';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td colspan=\"2\" align=\"center\"><h3>' + (doc.select_print_heading || \"Invoice\") + '</h3></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\theader += '<tr>\\\n\t\t\t\t\t<td align=\"left\"><b>RECEIPT NO:</b> ' + doc.name + '</td>\\\n\t\t\t\t\t<td align=\"right\"><b>DATE:</b> ' + date.str_to_user(doc.posting_date) + '</td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"2\"><b>M/s.</b> ' + doc.customer + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn header + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_items() {\n\t\t\t\tvar rows = '<table width=\"100%\" cellpadding=\"0\" class=\"cart\">';\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td width=\"60%\" align=\"left\"><b>ITEM CODE / DESC.</b></td>\\\n\t\t\t\t\t<td width=\"10%\" align=\"right\"><b>QTY</b></td>\\\n\t\t\t\t\t<td width=\"30%\" align=\"right\"><b>RATE</b></td>\\\n\t\t\t\t</tr>\\\n\t\t\t\t<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print items\n\t\t\t\tvar items = getchildren('Sales Invoice Item', doc.name, 'entries');\n\t\t\t\tfor (var x=0; x<items.length; x++) {\n\t\t\t\t\trows += '<tr>\\\n\t\t\t\t\t\t<td align=\"left\">' + items[x].item_code + '<br>' + items[x].item_name + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + items[x].qty + '</td>\\\n\t\t\t\t\t\t<td align=\"right\" style=\"vertical-align:top;\">' + format_currency(items[x].amount) + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\trows += '<tr>\\\n\t\t\t\t\t<td colspan=\"3\"><hr></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn rows + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_other_charges_and_totals() {\n\t\t\t\tvar totals = '<table width=\"100%\">';\n\t\t\t\t// print net total\n\t\t\t\ttotals +='<tr>\\\n\t\t\t\t\t<td align=\"right\" width=\"70%\">Net Total</td>\\\n\t\t\t\t\t<td align=\"right\">' + format_currency(doc.net_total_export) + '</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\t// print exclusive taxes\n\t\t\t\tvar taxes = frappe.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (!d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td align=\"right\">' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// show discount amount\n\t\t\t\tif (doc.discount_amount) {\n\t\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t\t<td align=\"right\">Discount Amount</td>\\\n\t\t\t\t\t\t<td align=\"right\">' + format_currency(doc.discount_amount) + '</td>\\\n\t\t\t\t\t<tr>';\n\t\t\t\t}\n\n\t\t\t\t// print grand total\n\t\t\t\ttotals += '<tr>\\\n\t\t\t\t\t<td align=\"right\">Grand Total</td>\\\n\t\t\t\t\t<td align=\"right\"><hr width=\"90%\" align=\"right\">' + format_currency(doc.grand_total_export) + '<br>\\\n\t\t\t\t\t<hr width=\"90%\" align=\"right\"></td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn totals + '</table>';\n\t\t\t}\n\n\t\t\tfunction print_inclusive_taxes() {\n\t\t\t\tvar count = 0;\n\t\t\t\tvar inc_tax = '';\n\t\t\t\tvar taxes = frappe.model.get_children(\"Sales Taxes and Charges\", doc.name, \"other_charges\", \"Sales Invoice\");\n\t\t\t\tif (taxes) {\n\t\t\t\t\t$.each(taxes, function(i, d) {\n\t\t\t\t\t\tif (d.included_in_print_rate && d.tax_amount) {\n\t\t\t\t\t\t\tif (count == 0) {\n\t\t\t\t\t\t\t\tinc_tax = '<table width=\"100%\">\\\n\t\t\t\t\t\t\t\t\t<tr>\\\n\t\t\t\t\t\t\t\t\t\t<td colspan=\"2\"><b>Inclusive Taxes</b></td>\\\n\t\t\t\t\t\t\t\t\t</tr>';\n\t\t\t\t\t\t\t\tcount += 1;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t\t\t<td width=\"60%\">' + d.description + '</td>\\\n\t\t\t\t\t\t\t\t<td>' + format_currency(d.tax_amount) + '</td>\\\n\t\t\t\t\t\t\t<tr>';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (inc_tax) {\n\t\t\t\t\tinc_tax += '<tr>\\\n\t\t\t\t\t\t<td colspan=\"2\"><hr></td>\\\n\t\t\t\t\t</tr></table>';\n\t\t\t\t}\n\n\t\t\t\treturn inc_tax;\n\t\t\t}\n\n\t\t\tfunction print_footer() {\n\t\t\t\tvar footer = '<table width=\"100%\">';\n\n\t\t\t\t// print terms\n\t\t\t\tif (doc.terms) {\n\t\t\t\t\tfooter += '<tr>\\\n\t\t\t\t\t\t<td align=\"center\">' + doc.terms + '</td>\\\n\t\t\t\t\t</tr>';\n\t\t\t\t}\n\n\t\t\t\tfooter +='<tr>\\\n\t\t\t\t\t<td align=\"center\">Thank You. Please visit again.</td>\\\n\t\t\t\t</tr>';\n\n\t\t\t\treturn footer + '</table>';\n\t\t\t}\n\t\t</script>\n\t</head>\n\n\t<body>\n\t\t<!--Headers, Item Table, Totals & Footer-->\n\t\t<div><script>print_header();</script></div>\n\t\t<div><script>print_items();</script></div>\n\t\t<div><script>print_inclusive_taxes();</script></div>\n\t\t<div><script>print_other_charges_and_totals();</script></div>\n\t\t<div><script>print_footer();</script></div>\n\t</body>\n</html>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
index 3dcf7f2..5bf9bf3 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Classic/Sales Invoice Classic.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n    \t\t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n    \t\t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
index 4194acf..f36f4a5 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Modern/Sales Invoice Modern.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Invoice No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Invoice No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
index 56a4901..e60f8a0 100644
--- a/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
+++ b/erpnext/accounts/Print Format/Sales Invoice Spartan/Sales Invoice Spartan.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Invoice", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Invoice',\n\t\t\t\tdoc.name,\n\t\t\t\t'entries',\n\t\t\t\t'Sales Invoice Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Invoice') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=40%><b>Invoice Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.posting_date)</script></td>\n\t\t\t\t\t<tr>\n                    <tr>\n        \t\t\t\t<td width=40%><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?\"<b>Invoice Period</b>\"\n                            :\"\";\n    \t\t\t\t\t</script></td>\n\t\t\t\t\t\t<td><script>\n                            (doc.convert_into_recurring_invoice && doc.recurring_id)\n                            ?(date.str_to_user(doc.invoice_period_from_date) +\n                                ' to ' + date.str_to_user(doc.invoice_period_to_date))\n                            :\"\";\n                        </script></td>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Due Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.due_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Accounts", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html b/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html
index 9375b04..874d84c 100644
--- a/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html
+++ b/erpnext/accounts/Print Format/SalesInvoice/SalesInvoice.html
@@ -1,5 +1,5 @@
 {%- if doc.letter_head -%}
-	{{ webnotes.conn.get_value("Letter Head", doc.letter_head, "content") }}
+	{{ frappe.conn.get_value("Letter Head", doc.letter_head, "content") }}
 {%- endif -%}
 <!-- Page Layout Settings -->
 <div class='common page-header'>
diff --git a/erpnext/accounts/doctype/account/account.js b/erpnext/accounts/doctype/account/account.js
index 407b2d4..f4ec79b 100644
--- a/erpnext/accounts/doctype/account/account.js
+++ b/erpnext/accounts/doctype/account/account.js
@@ -11,7 +11,7 @@
 // -----------------------------------------
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
 	if(doc.__islocal) {
-		msgprint(wn._("Please create new account from Chart of Accounts."));
+		msgprint(frappe._("Please create new account from Chart of Accounts."));
 		throw "cannot create";
 	}
 
@@ -26,8 +26,8 @@
 		'is_pl_account', 'company'], false);
 	
 	if(doc.group_or_ledger=='Ledger') {
-		wn.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
-			var accounts_settings = wn.model.get_doc("Accounts Settings", name);
+		frappe.model.with_doc("Accounts Settings", "Accounts Settings", function (name) {
+			var accounts_settings = frappe.model.get_doc("Accounts Settings", name);
 			var display = accounts_settings["frozen_accounts_modifier"] 
 				&& in_list(user_roles, accounts_settings["frozen_accounts_modifier"]);
 			
@@ -38,7 +38,7 @@
 	// read-only for root accounts
 	if(!doc.parent_account) {
 		cur_frm.set_read_only();
-		cur_frm.set_intro(wn._("This is a root account and cannot be edited."));
+		cur_frm.set_intro(frappe._("This is a root account and cannot be edited."));
 	} else {
 		// credit days and type if customer or supplier
 		cur_frm.set_intro(null);
@@ -81,24 +81,24 @@
 // Hide/unhide group or ledger
 // -----------------------------------------
 cur_frm.cscript.add_toolbar_buttons = function(doc) {
-	cur_frm.appframe.add_button(wn._('Chart of Accounts'), 
-		function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
+	cur_frm.appframe.add_button(frappe._('Chart of Accounts'), 
+		function() { frappe.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
 
 	if (cstr(doc.group_or_ledger) == 'Group') {
-		cur_frm.add_custom_button(wn._('Convert to Ledger'), 
+		cur_frm.add_custom_button(frappe._('Convert to Ledger'), 
 			function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
 	} else if (cstr(doc.group_or_ledger) == 'Ledger') {
-		cur_frm.add_custom_button(wn._('Convert to Group'), 
+		cur_frm.add_custom_button(frappe._('Convert to Group'), 
 			function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
 			
-		cur_frm.appframe.add_button(wn._('View Ledger'), function() {
-			wn.route_options = {
+		cur_frm.appframe.add_button(frappe._('View Ledger'), function() {
+			frappe.route_options = {
 				"account": doc.name,
 				"from_date": sys_defaults.year_start_date,
 				"to_date": sys_defaults.year_end_date,
 				"company": doc.company
 			};
-			wn.set_route("query-report", "General Ledger");
+			frappe.set_route("query-report", "General Ledger");
 		}, "icon-table");
 	}
 }
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index 64d2798..dcb12c1 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt, fmt_money, cstr, cint
-from webnotes import msgprint, throw, _
+from frappe.utils import flt, fmt_money, cstr, cint
+from frappe import msgprint, throw, _
 
-get_value = webnotes.conn.get_value
+get_value = frappe.conn.get_value
 
 class DocType:
 	def __init__(self,d,dl):
@@ -16,11 +16,11 @@
 
 	def autoname(self):
 		self.doc.name = self.doc.account_name.strip() + ' - ' + \
-			webnotes.conn.get_value("Company", self.doc.company, "abbr")
+			frappe.conn.get_value("Company", self.doc.company, "abbr")
 
 	def get_address(self):
 		return {
-			'address': webnotes.conn.get_value(self.doc.master_type, 
+			'address': frappe.conn.get_value(self.doc.master_type, 
 				self.doc.master_name, "address")
 		}
 		
@@ -41,14 +41,14 @@
 		if self.doc.master_type in ('Customer', 'Supplier') or self.doc.account_type == "Warehouse":
 			if not self.doc.master_name:
 				msgprint(_("Please enter Master Name once the account is created."))
-			elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type, 
+			elif not frappe.conn.exists(self.doc.master_type or self.doc.account_type, 
 					self.doc.master_name):
 				throw(_("Invalid Master Name"))
 			
 	def validate_parent(self):
 		"""Fetch Parent Details and validation for account not to be created under ledger"""
 		if self.doc.parent_account:
-			par = webnotes.conn.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit 
+			par = frappe.conn.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit 
 				from tabAccount where name =%s""", self.doc.parent_account)
 			if not par:
 				throw(_("Parent account does not exists"))
@@ -72,15 +72,15 @@
 
 	def validate_max_root_accounts(self):
 		"""Raise exception if there are more than 4 root accounts"""
-		if webnotes.conn.sql("""select count(*) from tabAccount where
+		if frappe.conn.sql("""select count(*) from tabAccount where
 			company=%s and ifnull(parent_account,'')='' and docstatus != 2""",
 			self.doc.company)[0][0] > 4:
 			throw(_("One company cannot have more than 4 root Accounts"))
 	
 	def validate_duplicate_account(self):
 		if self.doc.fields.get('__islocal') or not self.doc.name:
-			company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
-			if webnotes.conn.sql("""select name from tabAccount where name=%s""", 
+			company_abbr = frappe.conn.get_value("Company", self.doc.company, "abbr")
+			if frappe.conn.sql("""select name from tabAccount where name=%s""", 
 				(self.doc.account_name + " - " + company_abbr)):
 					throw("{name}: {acc_name} {exist}, {rename}".format(**{
 						"name": _("Account Name"),
@@ -91,17 +91,17 @@
 				
 	def validate_root_details(self):
 		#does not exists parent
-		if webnotes.conn.exists("Account", self.doc.name):
-			if not webnotes.conn.get_value("Account", self.doc.name, "parent_account"):
+		if frappe.conn.exists("Account", self.doc.name):
+			if not frappe.conn.get_value("Account", self.doc.name, "parent_account"):
 				throw(_("Root cannot be edited."))
 				
 	def validate_frozen_accounts_modifier(self):
-		old_value = webnotes.conn.get_value("Account", self.doc.name, "freeze_account")
+		old_value = frappe.conn.get_value("Account", self.doc.name, "freeze_account")
 		if old_value and old_value != self.doc.freeze_account:
-			frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None, 
+			frozen_accounts_modifier = frappe.conn.get_value( 'Accounts Settings', None, 
 				'frozen_accounts_modifier')
 			if not frozen_accounts_modifier or \
-				frozen_accounts_modifier not in webnotes.user.get_roles():
+				frozen_accounts_modifier not in frappe.user.get_roles():
 					throw(_("You are not authorized to set Frozen value"))
 			
 	def convert_group_to_ledger(self):
@@ -131,10 +131,10 @@
 
 	# Check if any previous balance exists
 	def check_gle_exists(self):
-		return webnotes.conn.get_value("GL Entry", {"account": self.doc.name})
+		return frappe.conn.get_value("GL Entry", {"account": self.doc.name})
 
 	def check_if_child_exists(self):
-		return webnotes.conn.sql("""select name from `tabAccount` where parent_account = %s 
+		return frappe.conn.sql("""select name from `tabAccount` where parent_account = %s 
 			and docstatus != 2""", self.doc.name)
 	
 	def validate_mandatory(self):
@@ -144,11 +144,11 @@
 			throw(_("Is PL Account field is mandatory"))
 			
 	def validate_warehouse_account(self):
-		if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
+		if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
 			return
 			
 		if self.doc.account_type == "Warehouse":
-			old_warehouse = cstr(webnotes.conn.get_value("Account", self.doc.name, "master_name"))
+			old_warehouse = cstr(frappe.conn.get_value("Account", self.doc.name, "master_name"))
 			if old_warehouse != cstr(self.doc.master_name):
 				if old_warehouse:
 					self.validate_warehouse(old_warehouse)
@@ -158,15 +158,15 @@
 					throw(_("Master Name is mandatory if account type is Warehouse"))
 		
 	def validate_warehouse(self, warehouse):
-		if webnotes.conn.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
+		if frappe.conn.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
 			throw(_("Stock transactions exist against warehouse ") + warehouse + 
 				_(" .You can not assign / modify / remove Master Name"))
 
 	def update_nsm_model(self):
 		"""update lft, rgt indices for nested set model"""
-		import webnotes
-		import webnotes.utils.nestedset
-		webnotes.utils.nestedset.update_nsm(self)
+		import frappe
+		import frappe.utils.nestedset
+		frappe.utils.nestedset.update_nsm(self)
 			
 	def on_update(self):
 		self.validate_max_root_accounts()
@@ -174,19 +174,19 @@
 
 	def get_authorized_user(self):
 		# Check logged-in user is authorized
-		if webnotes.conn.get_value('Accounts Settings', None, 'credit_controller') \
-				in webnotes.user.get_roles():
+		if frappe.conn.get_value('Accounts Settings', None, 'credit_controller') \
+				in frappe.user.get_roles():
 			return 1
 			
 	def check_credit_limit(self, total_outstanding):
 		# Get credit limit
 		credit_limit_from = 'Customer'
 
-		cr_limit = webnotes.conn.sql("""select t1.credit_limit from tabCustomer t1, `tabAccount` t2 
+		cr_limit = frappe.conn.sql("""select t1.credit_limit from tabCustomer t1, `tabAccount` t2 
 			where t2.name=%s and t1.name = t2.master_name""", self.doc.name)
 		credit_limit = cr_limit and flt(cr_limit[0][0]) or 0
 		if not credit_limit:
-			credit_limit = webnotes.conn.get_value('Company', self.doc.company, 'credit_limit')
+			credit_limit = frappe.conn.get_value('Company', self.doc.company, 'credit_limit')
 			credit_limit_from = 'Company'
 		
 		# If outstanding greater than credit limit and not authorized person raise exception
@@ -219,10 +219,10 @@
 		
 		# Validate properties before merging
 		if merge:
-			if not webnotes.conn.exists("Account", new):
+			if not frappe.conn.exists("Account", new):
 				throw(_("Account ") + new +_(" does not exists"))
 				
-			val = list(webnotes.conn.get_value("Account", new_account, 
+			val = list(frappe.conn.get_value("Account", new_account, 
 				["group_or_ledger", "debit_or_credit", "is_pl_account", "company"]))
 			
 			if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account, self.doc.company]:
@@ -234,22 +234,22 @@
 
 	def after_rename(self, old, new, merge=False):
 		if not merge:
-			webnotes.conn.set_value("Account", new, "account_name", 
+			frappe.conn.set_value("Account", new, "account_name", 
 				" - ".join(new.split(" - ")[:-1]))
 		else:
-			from webnotes.utils.nestedset import rebuild_tree
+			from frappe.utils.nestedset import rebuild_tree
 			rebuild_tree("Account", "parent_account")
 
 def get_master_name(doctype, txt, searchfield, start, page_len, filters):
 	conditions = (" and company='%s'"% filters["company"]) if doctype == "Warehouse" else ""
 		
-	return webnotes.conn.sql("""select name from `tab%s` where %s like %s %s
+	return frappe.conn.sql("""select name from `tab%s` where %s like %s %s
 		order by name limit %s, %s""" %
 		(filters["master_type"], searchfield, "%s", conditions, "%s", "%s"), 
 		("%%%s%%" % txt, start, page_len), as_list=1)
 		
 def get_parent_account(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select name from tabAccount 
+	return frappe.conn.sql("""select name from tabAccount 
 		where group_or_ledger = 'Group' and docstatus != 2 and company = %s
 		and %s like %s order by name limit %s, %s""" % 
 		("%s", searchfield, "%s", "%s", "%s"), 
diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py
index 3221901..10883d9 100644
--- a/erpnext/accounts/doctype/account/test_account.py
+++ b/erpnext/accounts/doctype/account/test_account.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def _make_test_records(verbose):
-	from webnotes.test_runner import make_test_objects
+	from frappe.test_runner import make_test_objects
 		
 	accounts = [
 		# [account_name, parent_account, group_or_ledger]
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index 2475fda..ae4aa55 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -4,28 +4,28 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import cint
+import frappe
+from frappe import _
+from frappe.utils import cint
 
 class DocType:
 	def __init__(self, d, dl):
 		self.doc, self.doclist = d, dl
 
 	def on_update(self):
-		webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
+		frappe.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
 		
 		if cint(self.doc.auto_accounting_for_stock):
 			# set default perpetual account in company
-			for company in webnotes.conn.sql("select name from tabCompany"):
-				webnotes.bean("Company", company[0]).save()
+			for company in frappe.conn.sql("select name from tabCompany"):
+				frappe.bean("Company", company[0]).save()
 			
 			# Create account head for warehouses
-			warehouse_list = webnotes.conn.sql("select name, company from tabWarehouse", as_dict=1)
+			warehouse_list = frappe.conn.sql("select name, company from tabWarehouse", as_dict=1)
 			warehouse_with_no_company = [d.name for d in warehouse_list if not d.company]
 			if warehouse_with_no_company:
-				webnotes.throw(_("Company is missing in following warehouses") + ": \n" + 
+				frappe.throw(_("Company is missing in following warehouses") + ": \n" + 
 					"\n".join(warehouse_with_no_company))
 			for wh in warehouse_list:
-				wh_bean = webnotes.bean("Warehouse", wh.name)
+				wh_bean = frappe.bean("Warehouse", wh.name)
 				wh_bean.save()
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
index 1edacd6..aea996a 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -4,5 +4,5 @@
 cur_frm.add_fetch("bank_account", "company", "company");
 cur_frm.cscript.onload = function(doc, cdt, cdn){
 	cur_frm.set_intro('<i class="icon-question" /> ' + 
-		wn._("Update clearance date of Journal Entries marked as 'Bank Vouchers'"))
+		frappe._("Update clearance date of Journal Entries marked as 'Bank Vouchers'"))
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index 6814333..aa91e5c 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, getdate, now, nowdate
-from webnotes.model import db_exists
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist, copy_doclist
-from webnotes import msgprint
+from frappe.utils import cstr, flt, getdate, now, nowdate
+from frappe.model import db_exists
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist, copy_doclist
+from frappe import msgprint
 
 	
 
@@ -22,7 +22,7 @@
 			msgprint("Bank Account, From Date and To Date are Mandatory")
 			return
 	
-		dl = webnotes.conn.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
+		dl = frappe.conn.sql("select t1.name, t1.cheque_no, t1.cheque_date, t2.debit, t2.credit, t1.posting_date, t2.against_account from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 where t2.parent = t1.name and t2.account = %s and (clearance_date is null or clearance_date = '0000-00-00' or clearance_date = '') and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1", (self.doc.bank_account, self.doc.from_date, self.doc.to_date))
 		
 		self.doclist = self.doc.clear_table(self.doclist, 'entries')
 		self.doc.total_amount = 0.0
@@ -46,7 +46,7 @@
 					msgprint("Clearance Date can not be before Cheque Date (Row #%s)" % 
 						d.idx, raise_exception=1)
 					
-				webnotes.conn.sql("""update `tabJournal Voucher` 
+				frappe.conn.sql("""update `tabJournal Voucher` 
 					set clearance_date = %s, modified = %s where name=%s""",
 					(d.clearance_date, nowdate(), d.voucher_id))
 				vouchers.append(d.voucher_id)
diff --git a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py
+++ b/erpnext/accounts/doctype/bank_reconciliation_detail/bank_reconciliation_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.py b/erpnext/accounts/doctype/budget_detail/budget_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/budget_detail/budget_detail.py
+++ b/erpnext/accounts/doctype/budget_detail/budget_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
index ddaecdd..c256374 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.js
@@ -8,7 +8,7 @@
     }
     
     return $c('runserverobj',args={'method' : 'get_months', 'docs' : 
-		wn.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
+		frappe.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
   }
 }
 
diff --git a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
index c1ac2f9..5173097 100644
--- a/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
+++ b/erpnext/accounts/doctype/budget_distribution/budget_distribution.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes import msgprint, _
+from frappe.utils import flt
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe import msgprint, _
 
 class DocType:
 	def __init__(self,doc,doclist=[]):
diff --git a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py
+++ b/erpnext/accounts/doctype/budget_distribution_detail/budget_distribution_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index 80a9f44..b60f303 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt, getdate
-from webnotes.model.bean import getlist
+import frappe
+from frappe.utils import flt, getdate
+from frappe.model.bean import getlist
 
 class DocType:
 	def __init__(self,d,dl):
@@ -16,19 +16,19 @@
 
 		for d in getlist(self.doclist, 'invoice_details'):
 			if d.invoice_no:
-				inv = webnotes.conn.sql("""select c_form_applicable, c_form_no from
+				inv = frappe.conn.sql("""select c_form_applicable, c_form_no from
 					`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
 				
 				if not inv:
-					webnotes.msgprint("""Invoice: %s is not exists in the system or 
+					frappe.msgprint("""Invoice: %s is not exists in the system or 
 						is not submitted, please check.""" % d.invoice_no, raise_exception=1)
 					
 				elif inv[0][0] != 'Yes':
-					webnotes.msgprint("C-form is not applicable for Invoice: %s" % 
+					frappe.msgprint("C-form is not applicable for Invoice: %s" % 
 						d.invoice_no, raise_exception=1)
 					
 				elif inv[0][1] and inv[0][1] != self.doc.name:
-					webnotes.msgprint("""Invoice %s is tagged in another C-form: %s.
+					frappe.msgprint("""Invoice %s is tagged in another C-form: %s.
 						If you want to change C-form no for this invoice,
 						please remove invoice no from the previous c-form and then try again""" % 
 						(d.invoice_no, inv[0][1]), raise_exception=1)
@@ -42,31 +42,31 @@
 		
 	def before_cancel(self):
 		# remove cform reference
-		webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=null
+		frappe.conn.sql("""update `tabSales Invoice` set c_form_no=null
 			where c_form_no=%s""", self.doc.name)
 		
 	def set_cform_in_sales_invoices(self):
 		inv = [d.invoice_no for d in getlist(self.doclist, 'invoice_details')]
 		if inv:
-			webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s 
+			frappe.conn.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s 
 				where name in (%s)""" % ('%s', '%s', ', '.join(['%s'] * len(inv))), 
 				tuple([self.doc.name, self.doc.modified] + inv))
 				
-			webnotes.conn.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s 
+			frappe.conn.sql("""update `tabSales Invoice` set c_form_no = null, modified = %s 
 				where name not in (%s) and ifnull(c_form_no, '') = %s""" % 
 				('%s', ', '.join(['%s']*len(inv)), '%s'),
 				tuple([self.doc.modified] + inv + [self.doc.name]))
 		else:
-			webnotes.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1)
+			frappe.msgprint("Please enter atleast 1 invoice in the table", raise_exception=1)
 
 	def set_total_invoiced_amount(self):
 		total = sum([flt(d.grand_total) for d in getlist(self.doclist, 'invoice_details')])
-		webnotes.conn.set(self.doc, 'total_invoiced_amount', total)
+		frappe.conn.set(self.doc, 'total_invoiced_amount', total)
 
 	def get_invoice_details(self, invoice_no):
 		"""	Pull details from invoices for referrence """
 
-		inv = webnotes.conn.sql("""select posting_date, territory, net_total, grand_total 
+		inv = frappe.conn.sql("""select posting_date, territory, net_total, grand_total 
 			from `tabSales Invoice` where name = %s""", invoice_no)	
 		return {
 			'invoice_date' : inv and getdate(inv[0][0]).strftime('%Y-%m-%d') or '',
@@ -79,7 +79,7 @@
 	from erpnext.utilities import build_filter_conditions
 	conditions, filter_values = build_filter_conditions(filters)
 	
-	return webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1 
+	return frappe.conn.sql("""select name from `tabSales Invoice` where docstatus = 1 
 		and c_form_applicable = 'Yes' and ifnull(c_form_no, '') = '' %s 
 		and %s like %s order by name limit %s, %s""" % 
 		(conditions, searchfield, "%s", "%s", "%s"), 
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index a18efaa..7fb4afe 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.accounts");
-erpnext.accounts.CostCenterController = wn.ui.form.Controller.extend({
+frappe.provide("erpnext.accounts");
+erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
 	onload: function() {
 		this.setup_queries();
 	},
@@ -41,8 +41,8 @@
 	cur_frm.toggle_enable(['group_or_ledger', 'company'], doc.__islocal);
 
 	if(!doc.__islocal && doc.group_or_ledger=='Group') {
-		intro_txt += '<p><b>'+wn._('Note:')+'</b>'+ wn._('This Cost Center is a')+ '<i>'+wn._('Group')+'</i>, '+ 
-		wn._('Accounting Entries are not allowed against groups.')+'</p>';
+		intro_txt += '<p><b>'+frappe._('Note:')+'</b>'+ frappe._('This Cost Center is a')+ '<i>'+frappe._('Group')+'</i>, '+ 
+		frappe._('Accounting Entries are not allowed against groups.')+'</p>';
 	}
 
 	cur_frm.cscript.hide_unhide_group_ledger(doc);
@@ -50,22 +50,22 @@
 	cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
 	cur_frm.set_intro(intro_txt);
 	
-	cur_frm.appframe.add_button(wn._('Chart of Cost Centers'), 
-		function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
+	cur_frm.appframe.add_button(frappe._('Chart of Cost Centers'), 
+		function() { frappe.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
 }
 
 cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) {
 	if(!doc.company){
-		msgprint(wn._('Please enter company name first'));
+		msgprint(frappe._('Please enter company name first'));
 	}
 }
 
 cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
 	if (cstr(doc.group_or_ledger) == 'Group') {
-		cur_frm.add_custom_button(wn._('Convert to Ledger'), 
+		cur_frm.add_custom_button(frappe._('Convert to Ledger'), 
 			function() { cur_frm.cscript.convert_to_ledger(); }, 'icon-retweet')
 	} else if (cstr(doc.group_or_ledger) == 'Ledger') {
-		cur_frm.add_custom_button(wn._('Convert to Group'), 
+		cur_frm.add_custom_button(frappe._('Convert to Group'), 
 			function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
 	}
 }
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 0d38cc8..6665039 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.model.bean import getlist
-from webnotes import msgprint, _
+import frappe
+from frappe.model.bean import getlist
+from frappe import msgprint, _
 
-from webnotes.utils.nestedset import DocTypeNestedSet
+from frappe.utils.nestedset import DocTypeNestedSet
 
 class DocType(DocTypeNestedSet):
 	def __init__(self,d,dl):
@@ -14,7 +14,7 @@
 		self.nsm_parent_field = 'parent_cost_center'
 				
 	def autoname(self):
-		company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s", 
+		company_abbr = frappe.conn.sql("select abbr from tabCompany where name=%s", 
 			self.doc.company)[0][0]
 		self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
 		
@@ -46,10 +46,10 @@
 			return 1
 
 	def check_gle_exists(self):
-		return webnotes.conn.get_value("GL Entry", {"cost_center": self.doc.name})
+		return frappe.conn.get_value("GL Entry", {"cost_center": self.doc.name})
 		
 	def check_if_child_exists(self):
-		return webnotes.conn.sql("select name from `tabCost Center` where \
+		return frappe.conn.sql("select name from `tabCost Center` where \
 			parent_cost_center = %s and docstatus != 2", self.doc.name)
 
 	def validate_budget_details(self):
@@ -67,7 +67,7 @@
 		"""
 			Cost Center name must be unique
 		"""
-		if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.doc.cost_center_name, self.doc.company)):
+		if (self.doc.fields.get("__islocal") or not self.doc.name) and frappe.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company=%s", (self.doc.cost_center_name, self.doc.company)):
 			msgprint("Cost Center Name already exists, please rename", raise_exception=1)
 			
 		self.validate_mandatory()
@@ -85,7 +85,7 @@
 		
 	def after_rename(self, olddn, newdn, merge=False):
 		if not merge:
-			webnotes.conn.set_value("Cost Center", newdn, "cost_center_name", 
+			frappe.conn.set_value("Cost Center", newdn, "cost_center_name", 
 				" - ".join(newdn.split(" - ")[:-1]))
 		else:
 			super(DocType, self).after_rename(olddn, newdn, merge)
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
index 6bf7129..6aa5ae8 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
@@ -8,12 +8,12 @@
 		this.frm.toggle_enable('year_end_date', doc.__islocal)
 	
 		if (!doc.__islocal && (doc.name != sys_defaults.fiscal_year)) {
-			this.frm.add_custom_button(wn._("Set as Default"), this.frm.cscript.set_as_default);
-			this.frm.set_intro(wn._("To set this Fiscal Year as Default, click on 'Set as Default'"));
+			this.frm.add_custom_button(frappe._("Set as Default"), this.frm.cscript.set_as_default);
+			this.frm.set_intro(frappe._("To set this Fiscal Year as Default, click on 'Set as Default'"));
 		} else this.frm.set_intro("");
 	},
 	set_as_default: function() {
-		return wn.call({
+		return frappe.call({
 			doc: cur_frm.doc,
 			method: "set_as_default"
 		});
@@ -22,7 +22,7 @@
 		var me = this;
 
 		year_end_date = 
-			wn.datetime.add_days(wn.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
+			frappe.datetime.add_days(frappe.datetime.add_months(this.frm.doc.year_start_date, 12), -1);
 		this.frm.set_value("year_end_date", year_end_date);
 	},
 });
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index a09e973..381acf3 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -2,44 +2,44 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
-from webnotes.utils import getdate
+import frappe
+from frappe import msgprint, _
+from frappe.utils import getdate
 
 class DocType:
 	def __init__(self, d, dl):
 		self.doc, self.doclist = d, dl
 		
 	def set_as_default(self):
-		webnotes.conn.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
-		webnotes.get_obj("Global Defaults").on_update()
+		frappe.conn.set_value("Global Defaults", None, "current_fiscal_year", self.doc.name)
+		frappe.get_obj("Global Defaults").on_update()
 		
 		# clear cache
-		webnotes.clear_cache()
+		frappe.clear_cache()
 		
 		msgprint(self.doc.name + _(""" is now the default Fiscal Year. \
 			Please refresh your browser for the change to take effect."""))
 
 	def validate(self):
-		year_start_end_dates = webnotes.conn.sql("""select year_start_date, year_end_date 
+		year_start_end_dates = frappe.conn.sql("""select year_start_date, year_end_date 
 			from `tabFiscal Year` where name=%s""", (self.doc.name))
 
 		if year_start_end_dates:
 			if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
-				webnotes.throw(_("Cannot change Year Start Date and Year End Date once the Fiscal Year is saved."))
+				frappe.throw(_("Cannot change Year Start Date and Year End Date once the Fiscal Year is saved."))
 
 	def on_update(self):
 		# validate year start date and year end date
 		if getdate(self.doc.year_start_date) > getdate(self.doc.year_end_date):
-			webnotes.throw(_("Year Start Date should not be greater than Year End Date"))
+			frappe.throw(_("Year Start Date should not be greater than Year End Date"))
 
 		if (getdate(self.doc.year_end_date) - getdate(self.doc.year_start_date)).days > 366:
-			webnotes.throw(_("Year Start Date and Year End Date are not within Fiscal Year."))
+			frappe.throw(_("Year Start Date and Year End Date are not within Fiscal Year."))
 
-		year_start_end_dates = webnotes.conn.sql("""select name, year_start_date, year_end_date 
+		year_start_end_dates = frappe.conn.sql("""select name, year_start_date, year_end_date 
 			from `tabFiscal Year` where name!=%s""", (self.doc.name))
 
 		for fiscal_year, ysd, yed in year_start_end_dates:
 			if (getdate(self.doc.year_start_date) == ysd and getdate(self.doc.year_end_date) == yed) \
-				and (not webnotes.flags.in_test):
-					webnotes.throw(_("Year Start Date and Year End Date are already set in Fiscal Year: ") + fiscal_year)
\ No newline at end of file
+				and (not frappe.flags.in_test):
+					frappe.throw(_("Year Start Date and Year End Date are already set in Fiscal Year: ") + fiscal_year)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 20cd899..e3eff9b 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt, fmt_money, getdate
-from webnotes import _
+from frappe.utils import flt, fmt_money, getdate
+from frappe import _
 	
 class DocType:
 	def __init__(self,d,dl):
@@ -34,17 +34,17 @@
 		mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
 		for k in mandatory:
 			if not self.doc.fields.get(k):
-				webnotes.throw(k + _(" is mandatory for GL Entry"))
+				frappe.throw(k + _(" is mandatory for GL Entry"))
 
 		# Zero value transaction is not allowed
 		if not (flt(self.doc.debit) or flt(self.doc.credit)):
-			webnotes.throw(_("GL Entry: Debit or Credit amount is mandatory for ") + 
+			frappe.throw(_("GL Entry: Debit or Credit amount is mandatory for ") + 
 				self.doc.account)
 			
 	def pl_must_have_cost_center(self):
-		if webnotes.conn.get_value("Account", self.doc.account, "is_pl_account") == "Yes":
+		if frappe.conn.get_value("Account", self.doc.account, "is_pl_account") == "Yes":
 			if not self.doc.cost_center and self.doc.voucher_type != 'Period Closing Voucher':
-				webnotes.throw(_("Cost Center must be specified for PL Account: ") + 
+				frappe.throw(_("Cost Center must be specified for PL Account: ") + 
 					self.doc.account)
 		elif self.doc.cost_center:
 			self.doc.cost_center = None
@@ -55,23 +55,23 @@
 
 	def check_pl_account(self):
 		if self.doc.is_opening=='Yes' and \
-				webnotes.conn.get_value("Account", self.doc.account, "is_pl_account") == "Yes":
-			webnotes.throw(_("For opening balance entry account can not be a PL account"))			
+				frappe.conn.get_value("Account", self.doc.account, "is_pl_account") == "Yes":
+			frappe.throw(_("For opening balance entry account can not be a PL account"))			
 
 	def validate_account_details(self, adv_adj):
 		"""Account must be ledger, active and not freezed"""
 		
-		ret = webnotes.conn.sql("""select group_or_ledger, docstatus, company 
+		ret = frappe.conn.sql("""select group_or_ledger, docstatus, company 
 			from tabAccount where name=%s""", self.doc.account, as_dict=1)[0]
 		
 		if ret.group_or_ledger=='Group':
-			webnotes.throw(_("Account") + ": " + self.doc.account + _(" is not a ledger"))
+			frappe.throw(_("Account") + ": " + self.doc.account + _(" is not a ledger"))
 
 		if ret.docstatus==2:
-			webnotes.throw(_("Account") + ": " + self.doc.account + _(" is not active"))
+			frappe.throw(_("Account") + ": " + self.doc.account + _(" is not active"))
 			
 		if ret.company != self.doc.company:
-			webnotes.throw(_("Account") + ": " + self.doc.account + 
+			frappe.throw(_("Account") + ": " + self.doc.account + 
 				_(" does not belong to the company") + ": " + self.doc.company)
 				
 	def validate_cost_center(self):
@@ -80,27 +80,27 @@
 		
 		def _get_cost_center_company():
 			if not self.cost_center_company.get(self.doc.cost_center):
-				self.cost_center_company[self.doc.cost_center] = webnotes.conn.get_value(
+				self.cost_center_company[self.doc.cost_center] = frappe.conn.get_value(
 					"Cost Center", self.doc.cost_center, "company")
 			
 			return self.cost_center_company[self.doc.cost_center]
 			
 		if self.doc.cost_center and _get_cost_center_company() != self.doc.company:
-				webnotes.throw(_("Cost Center") + ": " + self.doc.cost_center + 
+				frappe.throw(_("Cost Center") + ": " + self.doc.cost_center + 
 					_(" does not belong to the company") + ": " + self.doc.company)
 						
 def check_negative_balance(account, adv_adj=False):
 	if not adv_adj and account:
-		account_details = webnotes.conn.get_value("Account", account, 
+		account_details = frappe.conn.get_value("Account", account, 
 				["allow_negative_balance", "debit_or_credit"], as_dict=True)
 		if not account_details["allow_negative_balance"]:
-			balance = webnotes.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry` 
+			balance = frappe.conn.sql("""select sum(debit) - sum(credit) from `tabGL Entry` 
 				where account = %s""", account)
 			balance = account_details["debit_or_credit"] == "Debit" and \
 				flt(balance[0][0]) or -1*flt(balance[0][0])
 		
 			if flt(balance) < 0:
-				webnotes.throw(_("Negative balance is not allowed for account ") + account)
+				frappe.throw(_("Negative balance is not allowed for account ") + account)
 
 def check_freezing_date(posting_date, adv_adj=False):
 	"""
@@ -108,17 +108,17 @@
 		except authorized person
 	"""
 	if not adv_adj:
-		acc_frozen_upto = webnotes.conn.get_value('Accounts Settings', None, 'acc_frozen_upto')
+		acc_frozen_upto = frappe.conn.get_value('Accounts Settings', None, 'acc_frozen_upto')
 		if acc_frozen_upto:
-			bde_auth_role = webnotes.conn.get_value( 'Accounts Settings', None,'bde_auth_role')
+			bde_auth_role = frappe.conn.get_value( 'Accounts Settings', None,'bde_auth_role')
 			if getdate(posting_date) <= getdate(acc_frozen_upto) \
-					and not bde_auth_role in webnotes.user.get_roles():
-				webnotes.throw(_("You are not authorized to do/modify back dated entries before ")
+					and not bde_auth_role in frappe.user.get_roles():
+				frappe.throw(_("You are not authorized to do/modify back dated entries before ")
 					+ getdate(acc_frozen_upto).strftime('%d-%m-%Y'))
 
 def update_outstanding_amt(account, against_voucher_type, against_voucher, on_cancel=False):
 	# get final outstanding amt
-	bal = flt(webnotes.conn.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
+	bal = flt(frappe.conn.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
 		from `tabGL Entry` 
 		where against_voucher_type=%s and against_voucher=%s and account = %s""", 
 		(against_voucher_type, against_voucher, account))[0][0] or 0.0)
@@ -126,7 +126,7 @@
 	if against_voucher_type == 'Purchase Invoice':
 		bal = -bal
 	elif against_voucher_type == "Journal Voucher":
-		against_voucher_amount = flt(webnotes.conn.sql("""
+		against_voucher_amount = flt(frappe.conn.sql("""
 			select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
 			from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
 			and account = %s and ifnull(against_voucher, '') = ''""", 
@@ -137,23 +137,23 @@
 	
 	# Validation : Outstanding can not be negative
 	if bal < 0 and not on_cancel:
-		webnotes.throw(_("Outstanding for Voucher ") + against_voucher + _(" will become ") + 
+		frappe.throw(_("Outstanding for Voucher ") + against_voucher + _(" will become ") + 
 			fmt_money(bal) + _(". Outstanding cannot be less than zero. \
 			 	Please match exact outstanding."))
 		
 	# Update outstanding amt on against voucher
 	if against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
-		webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
+		frappe.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" %
 		 	(against_voucher_type, bal, against_voucher))
 			
 def validate_frozen_account(account, adv_adj=None):
-	frozen_account = webnotes.conn.get_value("Account", account, "freeze_account")
+	frozen_account = frappe.conn.get_value("Account", account, "freeze_account")
 	if frozen_account == 'Yes' and not adv_adj:
-		frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None, 
+		frozen_accounts_modifier = frappe.conn.get_value( 'Accounts Settings', None, 
 			'frozen_accounts_modifier')
 		
 		if not frozen_accounts_modifier:
-			webnotes.throw(account + _(" is a frozen account. Either make the account active or assign role in Accounts Settings who can create / modify entries against this account"))
-		elif frozen_accounts_modifier not in webnotes.user.get_roles():
-			webnotes.throw(account + _(" is a frozen account. To create / edit transactions against this account, you need role") \
+			frappe.throw(account + _(" is a frozen account. Either make the account active or assign role in Accounts Settings who can create / modify entries against this account"))
+		elif frozen_accounts_modifier not in frappe.user.get_roles():
+			frappe.throw(account + _(" is a frozen account. To create / edit transactions against this account, you need role") \
 				+ ": " +  frozen_accounts_modifier)
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
index 342fa23..1107ba4 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js
@@ -1,9 +1,9 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.accounts");
+frappe.provide("erpnext.accounts");
 
-erpnext.accounts.JournalVoucher = wn.ui.form.Controller.extend({
+erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({
 	onload: function() {
 		this.load_defaults();
 		this.setup_queries();
@@ -11,10 +11,10 @@
 	
 	load_defaults: function() {
 		if(this.frm.doc.__islocal && this.frm.doc.company) {
-			wn.model.set_default_values(this.frm.doc);
-			$.each(wn.model.get_doclist(this.frm.doc.doctype, 
+			frappe.model.set_default_values(this.frm.doc);
+			$.each(frappe.model.get_doclist(this.frm.doc.doctype, 
 				this.frm.doc.name, {parentfield: "entries"}), function(i, jvd) {
-					wn.model.set_default_values(jvd);
+					frappe.model.set_default_values(jvd);
 				}
 			);
 			
@@ -27,7 +27,7 @@
 		
 		$.each(["account", "cost_center"], function(i, fieldname) {
 			me.frm.set_query(fieldname, "entries", function() {
-				wn.model.validate_missing(me.frm.doc, "company");
+				frappe.model.validate_missing(me.frm.doc, "company");
 				return {
 					filters: {
 						company: me.frm.doc.company,
@@ -40,8 +40,8 @@
 		$.each([["against_voucher", "Purchase Invoice", "credit_to"], 
 			["against_invoice", "Sales Invoice", "debit_to"]], function(i, opts) {
 				me.frm.set_query(opts[0], "entries", function(doc, cdt, cdn) {
-					var jvd = wn.model.get_doc(cdt, cdn);
-					wn.model.validate_missing(jvd, "account");
+					var jvd = frappe.model.get_doc(cdt, cdn);
+					frappe.model.validate_missing(jvd, "account");
 					return {
 						filters: [
 							[opts[1], opts[2], "=", jvd.account],
@@ -53,8 +53,8 @@
 		});
 		
 		this.frm.set_query("against_jv", "entries", function(doc, cdt, cdn) {
-			var jvd = wn.model.get_doc(cdt, cdn);
-			wn.model.validate_missing(jvd, "account");
+			var jvd = frappe.model.get_doc(cdt, cdn);
+			frappe.model.validate_missing(jvd, "account");
 			
 			return {
 				query: "accounts.doctype.journal_voucher.journal_voucher.get_against_jv",
@@ -64,7 +64,7 @@
 	},
 	
 	against_voucher: function(doc, cdt, cdn) {
-		var d = wn.model.get_doc(cdt, cdn);
+		var d = frappe.model.get_doc(cdt, cdn);
 		if (d.against_voucher && !flt(d.debit)) {
 			this.get_outstanding({
 				'doctype': 'Purchase Invoice', 
@@ -74,7 +74,7 @@
 	},
 	
 	against_invoice: function(doc, cdt, cdn) {
-		var d = wn.model.get_doc(cdt, cdn);
+		var d = frappe.model.get_doc(cdt, cdn);
 		if (d.against_invoice && !flt(d.credit)) {
 			this.get_outstanding({
 				'doctype': 'Sales Invoice', 
@@ -84,7 +84,7 @@
 	},
 	
 	against_jv: function(doc, cdt, cdn) {
-		var d = wn.model.get_doc(cdt, cdn);
+		var d = frappe.model.get_doc(cdt, cdn);
 		if (d.against_jv && !flt(d.credit) && !flt(d.debit)) {
 			this.get_outstanding({
 				'doctype': 'Journal Voucher', 
@@ -115,15 +115,15 @@
 	erpnext.hide_naming_series();
 	cur_frm.cscript.voucher_type(doc);
 	if(doc.docstatus==1) { 
-		cur_frm.appframe.add_button(wn._('View Ledger'), function() {
-			wn.route_options = {
+		cur_frm.appframe.add_button(frappe._('View Ledger'), function() {
+			frappe.route_options = {
 				"voucher_no": doc.name,
 				"from_date": doc.posting_date,
 				"to_date": doc.posting_date,
 				"company": doc.company,
 				group_by_voucher: 0
 			};
-			wn.set_route("query-report", "General Ledger");
+			frappe.set_route("query-report", "General Ledger");
 		}, "icon-table");
 	}
 }
@@ -166,7 +166,7 @@
 cur_frm.cscript.account = function(doc,dt,dn) {
 	var d = locals[dt][dn];
 	if(d.account) {
-		return wn.call({
+		return frappe.call({
 			method: "erpnext.accounts.utils.get_balance_on",
 			args: {account: d.account, date: doc.posting_date},
 			callback: function(r) {
@@ -187,20 +187,20 @@
 		cur_frm.pformat.print_heading = doc.select_print_heading;
 	}
 	else
-		cur_frm.pformat.print_heading = wn._("Journal Voucher");
+		cur_frm.pformat.print_heading = frappe._("Journal Voucher");
 }
 
 cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
 	cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
 	cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");
 
-	if(wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
+	if(frappe.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
 		|| !doc.company) // too early
 		return;
 	
 	var update_jv_details = function(doc, r) {
 		$.each(r.message, function(i, d) {
-			var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
+			var jvdetail = frappe.model.add_child(doc, "Journal Voucher Detail", "entries");
 			jvdetail.account = d.account;
 			jvdetail.balance = d.balance;
 		});
@@ -208,7 +208,7 @@
 	}
 	
 	if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
-		return wn.call({
+		return frappe.call({
 			type: "GET",
 			method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
 			args: {
@@ -222,14 +222,14 @@
 			}
 		})
 	} else if(doc.voucher_type=="Opening Entry") {
-		return wn.call({
+		return frappe.call({
 			type:"GET",
 			method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
 			args: {
 				"company": doc.company
 			},
 			callback: function(r) {
-				wn.model.clear_table("Journal Voucher Detail", "Journal Voucher", 
+				frappe.model.clear_table("Journal Voucher Detail", "Journal Voucher", 
 					doc.name, "entries");
 				if(r.message) {
 					update_jv_details(doc, r);
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
index c9ca0c2..f02188b 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes import msgprint, _
+from frappe.utils import cint, cstr, flt, fmt_money, formatdate, getdate
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe import msgprint, _
 from erpnext.setup.utils import get_company_currency
 
 from erpnext.controllers.accounts_controller import AccountsController
@@ -54,7 +54,7 @@
 	def on_trash(self):
 		pass
 		#if self.doc.amended_from:
-		#	webnotes.delete_doc("Journal Voucher", self.doc.amended_from)
+		#	frappe.delete_doc("Journal Voucher", self.doc.amended_from)
 
 	def validate_debit_credit(self):
 		for d in getlist(self.doclist, 'entries'):
@@ -75,7 +75,7 @@
 		for d in getlist(self.doclist,'entries'):
 			if not d.is_advance and not d.against_voucher and \
 					not d.against_invoice and not d.against_jv:
-				master_type = webnotes.conn.get_value("Account", d.account, "master_type")
+				master_type = frappe.conn.get_value("Account", d.account, "master_type")
 				if (master_type == 'Customer' and flt(d.credit) > 0) or \
 						(master_type == 'Supplier' and flt(d.debit) > 0):
 					msgprint("Message: Please check Is Advance as 'Yes' against \
@@ -87,7 +87,7 @@
 				if d.against_jv == self.doc.name:
 					msgprint("You can not enter current voucher in 'Against JV' column",
 						raise_exception=1)
-				elif not webnotes.conn.sql("""select name from `tabJournal Voucher Detail` 
+				elif not frappe.conn.sql("""select name from `tabJournal Voucher Detail` 
 						where account = '%s' and docstatus = 1 and parent = '%s'""" % 
 						(d.account, d.against_jv)):
 					msgprint("Against JV: %s is not valid." % d.against_jv, raise_exception=1)
@@ -125,12 +125,12 @@
 		
 		for d in getlist(self.doclist, 'entries'):
 			if d.against_invoice and d.credit:
-				currency = webnotes.conn.get_value("Sales Invoice", d.against_invoice, "currency")
+				currency = frappe.conn.get_value("Sales Invoice", d.against_invoice, "currency")
 				r.append('%s %s against Invoice: %s' % 
 					(cstr(currency), fmt_money(flt(d.credit)), d.against_invoice))
 					
 			if d.against_voucher and d.debit:
-				bill_no = webnotes.conn.sql("""select bill_no, bill_date, currency 
+				bill_no = frappe.conn.sql("""select bill_no, bill_date, currency 
 					from `tabPurchase Invoice` where name=%s""", d.against_voucher)
 				if bill_no and bill_no[0][0] and bill_no[0][0].lower().strip() \
 						not in ['na', 'not applicable', 'none']:
@@ -144,7 +144,7 @@
 		if r:
 			self.doc.remark = ("\n").join(r)
 		else:
-			webnotes.msgprint("User Remarks is mandatory", raise_exception=1)
+			frappe.msgprint("User Remarks is mandatory", raise_exception=1)
 
 	def set_aging_date(self):
 		if self.doc.is_opening != 'Yes':
@@ -153,7 +153,7 @@
 			# check account type whether supplier or customer
 			exists = False
 			for d in getlist(self.doclist, 'entries'):
-				account_type = webnotes.conn.get_value("Account", d.account, "account_type")
+				account_type = frappe.conn.get_value("Account", d.account, "account_type")
 				if account_type in ["Supplier", "Customer"]:
 					exists = True
 					break
@@ -166,12 +166,12 @@
 
 	def set_print_format_fields(self):
 		for d in getlist(self.doclist, 'entries'):
-			account_type, master_type = webnotes.conn.get_value("Account", d.account, 
+			account_type, master_type = frappe.conn.get_value("Account", d.account, 
 				["account_type", "master_type"])
 				
 			if master_type in ['Supplier', 'Customer']:
 				if not self.doc.pay_to_recd_from:
-					self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, 
+					self.doc.pay_to_recd_from = frappe.conn.get_value(master_type, 
 						' - '.join(d.account.split(' - ')[:-1]), 
 						master_type == 'Customer' and 'customer_name' or 'supplier_name')
 			
@@ -179,7 +179,7 @@
 				company_currency = get_company_currency(self.doc.company)
 				amt = flt(d.debit) and d.debit or d.credit	
 				self.doc.total_amount = company_currency + ' ' + cstr(amt)
-				from webnotes.utils import money_in_words
+				from frappe.utils import money_in_words
 				self.doc.total_amount_in_words = money_in_words(amt, company_currency)
 
 	def check_credit_days(self):
@@ -190,7 +190,7 @@
 		if date_diff <= 0: return
 		
 		# Get List of Customer Account
-		acc_list = filter(lambda d: webnotes.conn.get_value("Account", d.account, 
+		acc_list = filter(lambda d: frappe.conn.get_value("Account", d.account, 
 		 	"master_type")=='Customer', getlist(self.doclist,'entries'))
 		
 		for d in acc_list:
@@ -202,11 +202,11 @@
 					
 	def get_credit_days_for(self, ac):
 		if not self.credit_days_for.has_key(ac):
-			self.credit_days_for[ac] = cint(webnotes.conn.get_value("Account", ac, "credit_days"))
+			self.credit_days_for[ac] = cint(frappe.conn.get_value("Account", ac, "credit_days"))
 
 		if not self.credit_days_for[ac]:
 			if self.credit_days_global==-1:
-				self.credit_days_global = cint(webnotes.conn.get_value("Company", 
+				self.credit_days_global = cint(frappe.conn.get_value("Company", 
 					self.doc.company, "credit_days"))
 					
 			return self.credit_days_global
@@ -218,25 +218,25 @@
 			self.is_approving_authority = 0
 
 			# Fetch credit controller role
-			approving_authority = webnotes.conn.get_value("Global Defaults", None, 
+			approving_authority = frappe.conn.get_value("Global Defaults", None, 
 				"credit_controller")
 			
 			# Check logged-in user is authorized
-			if approving_authority in webnotes.user.get_roles():
+			if approving_authority in frappe.user.get_roles():
 				self.is_approving_authority = 1
 				
 		return self.is_approving_authority
 
 	def check_account_against_entries(self):
 		for d in self.doclist.get({"parentfield": "entries"}):
-			if d.against_invoice and webnotes.conn.get_value("Sales Invoice", 
+			if d.against_invoice and frappe.conn.get_value("Sales Invoice", 
 					d.against_invoice, "debit_to") != d.account:
-				webnotes.throw(_("Row #") + cstr(d.idx) +  ": " +
+				frappe.throw(_("Row #") + cstr(d.idx) +  ": " +
 					_("Account is not matching with Debit To account of Sales Invoice"))
 			
-			if d.against_voucher and webnotes.conn.get_value("Purchase Invoice", 
+			if d.against_voucher and frappe.conn.get_value("Purchase Invoice", 
 					d.against_voucher, "credit_to") != d.account:
-				webnotes.throw(_("Row #") + cstr(d.idx) + ": " +
+				frappe.throw(_("Row #") + cstr(d.idx) + ": " +
 					_("Account is not matching with Credit To account of Purchase Invoice"))
 
 	def make_gl_entries(self, cancel=0, adv_adj=0):
@@ -267,7 +267,7 @@
 			
 	def check_credit_limit(self):
 		for d in self.doclist.get({"parentfield": "entries"}):
-			master_type, master_name = webnotes.conn.get_value("Account", d.account, 
+			master_type, master_name = frappe.conn.get_value("Account", d.account, 
 				["master_type", "master_name"])
 			if master_type == "Customer" and master_name:
 				super(DocType, self).check_credit_limit(d.account)
@@ -328,18 +328,18 @@
 		cond = (flt(self.doc.write_off_amount) > 0) and \
 			' and outstanding_amount <= '+ self.doc.write_off_amount or ''
 		if self.doc.write_off_based_on == 'Accounts Receivable':
-			return webnotes.conn.sql("""select name, debit_to, outstanding_amount 
+			return frappe.conn.sql("""select name, debit_to, outstanding_amount 
 				from `tabSales Invoice` where docstatus = 1 and company = %s 
 				and outstanding_amount > 0 %s""" % ('%s', cond), self.doc.company)
 		elif self.doc.write_off_based_on == 'Accounts Payable':
-			return webnotes.conn.sql("""select name, credit_to, outstanding_amount 
+			return frappe.conn.sql("""select name, credit_to, outstanding_amount 
 				from `tabPurchase Invoice` where docstatus = 1 and company = %s 
 				and outstanding_amount > 0 %s""" % ('%s', cond), self.doc.company)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_default_bank_cash_account(company, voucher_type):
 	from erpnext.accounts.utils import get_balance_on
-	account = webnotes.conn.get_value("Company", company,
+	account = frappe.conn.get_value("Company", company,
 		voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
 	if account:
 		return {
@@ -347,10 +347,10 @@
 			"balance": get_balance_on(account)
 		}
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_payment_entry_from_sales_invoice(sales_invoice):
 	from erpnext.accounts.utils import get_balance_on
-	si = webnotes.bean("Sales Invoice", sales_invoice)
+	si = frappe.bean("Sales Invoice", sales_invoice)
 	jv = get_payment_entry(si.doc)
 	jv.doc.remark = 'Payment received against Sales Invoice %(name)s. %(remarks)s' % si.doc.fields
 
@@ -365,10 +365,10 @@
 	
 	return [d.fields for d in jv.doclist]
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_payment_entry_from_purchase_invoice(purchase_invoice):
 	from erpnext.accounts.utils import get_balance_on
-	pi = webnotes.bean("Purchase Invoice", purchase_invoice)
+	pi = frappe.bean("Purchase Invoice", purchase_invoice)
 	jv = get_payment_entry(pi.doc)
 	jv.doc.remark = 'Payment against Purchase Invoice %(name)s. %(remarks)s' % pi.doc.fields
 	
@@ -386,7 +386,7 @@
 def get_payment_entry(doc):
 	bank_account = get_default_bank_cash_account(doc.company, "Bank Voucher")
 	
-	jv = webnotes.new_bean('Journal Voucher')
+	jv = frappe.new_bean('Journal Voucher')
 	jv.doc.voucher_type = 'Bank Voucher'
 
 	jv.doc.company = doc.company
@@ -408,42 +408,42 @@
 	
 	return jv
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_opening_accounts(company):
 	"""get all balance sheet accounts for opening entry"""
 	from erpnext.accounts.utils import get_balance_on
-	accounts = webnotes.conn.sql_list("""select name from tabAccount 
+	accounts = frappe.conn.sql_list("""select name from tabAccount 
 		where group_or_ledger='Ledger' and is_pl_account='No' and company=%s""", company)
 	
 	return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
 	
 def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date 
+	return frappe.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date 
 		from `tabPurchase Invoice` where credit_to = %s and docstatus = 1 
 		and outstanding_amount > 0 and %s like %s order by name desc limit %s, %s""" %
 		("%s", searchfield, "%s", "%s", "%s"), 
 		(filters["account"], "%%%s%%" % txt, start, page_len))
 		
 def get_against_sales_invoice(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select name, debit_to, outstanding_amount 
+	return frappe.conn.sql("""select name, debit_to, outstanding_amount 
 		from `tabSales Invoice` where debit_to = %s and docstatus = 1 
 		and outstanding_amount > 0 and `%s` like %s order by name desc limit %s, %s""" %
 		("%s", searchfield, "%s", "%s", "%s"), 
 		(filters["account"], "%%%s%%" % txt, start, page_len))
 		
 def get_against_jv(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select jv.name, jv.posting_date, jv.user_remark 
+	return frappe.conn.sql("""select jv.name, jv.posting_date, jv.user_remark 
 		from `tabJournal Voucher` jv, `tabJournal Voucher Detail` jv_detail 
 		where jv_detail.parent = jv.name and jv_detail.account = %s and jv.docstatus = 1 
 		and jv.%s like %s order by jv.name desc limit %s, %s""" % 
 		("%s", searchfield, "%s", "%s", "%s"), 
 		(filters["account"], "%%%s%%" % txt, start, page_len))
 
-@webnotes.whitelist()		
+@frappe.whitelist()		
 def get_outstanding(args):
 	args = eval(args)
 	if args.get("doctype") == "Journal Voucher" and args.get("account"):
-		against_jv_amount = webnotes.conn.sql("""
+		against_jv_amount = frappe.conn.sql("""
 			select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
 			from `tabJournal Voucher Detail` where parent=%s and account=%s 
 			and ifnull(against_invoice, '')='' and ifnull(against_voucher, '')=''
@@ -457,11 +457,11 @@
 		
 	elif args.get("doctype") == "Sales Invoice":
 		return {
-			"credit": flt(webnotes.conn.get_value("Sales Invoice", args["docname"], 
+			"credit": flt(frappe.conn.get_value("Sales Invoice", args["docname"], 
 				"outstanding_amount"))
 		}
 	elif args.get("doctype") == "Purchase Invoice":
 		return {
-			"debit": flt(webnotes.conn.get_value("Purchase Invoice", args["docname"], 
+			"debit": flt(frappe.conn.get_value("Purchase Invoice", args["docname"], 
 				"outstanding_amount"))
 		}
diff --git a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
index 587445f..4497726 100644
--- a/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/test_journal_voucher.py
@@ -4,40 +4,40 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
 class TestJournalVoucher(unittest.TestCase):
 	def test_journal_voucher_with_against_jv(self):
 		self.clear_account_balance()
-		jv_invoice = webnotes.bean(copy=test_records[2])
+		jv_invoice = frappe.bean(copy=test_records[2])
 		jv_invoice.insert()
 		jv_invoice.submit()
 		
-		self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(not frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_jv=%s""", jv_invoice.doc.name))
 		
-		jv_payment = webnotes.bean(copy=test_records[0])
+		jv_payment = frappe.bean(copy=test_records[0])
 		jv_payment.doclist[1].against_jv = jv_invoice.doc.name
 		jv_payment.insert()
 		jv_payment.submit()
 		
-		self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_jv=%s""", jv_invoice.doc.name))
 			
-		self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_jv=%s and credit=400""", jv_invoice.doc.name))
 		
 		# cancel jv_invoice
 		jv_invoice.cancel()
 		
-		self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(not frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_jv=%s""", jv_invoice.doc.name))
 	
 	def test_jv_against_stock_account(self):
 		from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 		set_perpetual_inventory()
 		
-		jv = webnotes.bean(copy=test_records[0])
+		jv = frappe.bean(copy=test_records[0])
 		jv.doclist[1].account = "_Test Warehouse - _TC"
 		jv.insert()
 		
@@ -47,25 +47,25 @@
 		set_perpetual_inventory(0)
 			
 	def test_monthly_budget_crossed_ignore(self):
-		webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
+		frappe.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
 		self.clear_account_balance()
 		
-		jv = webnotes.bean(copy=test_records[0])
+		jv = frappe.bean(copy=test_records[0])
 		jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
 		jv.doclist[2].cost_center = "_Test Cost Center - _TC"
 		jv.doclist[2].debit = 20000.0
 		jv.doclist[1].credit = 20000.0
 		jv.insert()
 		jv.submit()
-		self.assertTrue(webnotes.conn.get_value("GL Entry", 
+		self.assertTrue(frappe.conn.get_value("GL Entry", 
 			{"voucher_type": "Journal Voucher", "voucher_no": jv.doc.name}))
 			
 	def test_monthly_budget_crossed_stop(self):
 		from erpnext.accounts.utils import BudgetError
-		webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
+		frappe.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
 		self.clear_account_balance()
 		
-		jv = webnotes.bean(copy=test_records[0])
+		jv = frappe.bean(copy=test_records[0])
 		jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
 		jv.doclist[2].cost_center = "_Test Cost Center - _TC"
 		jv.doclist[2].debit = 20000.0
@@ -74,16 +74,16 @@
 		
 		self.assertRaises(BudgetError, jv.submit)
 		
-		webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
+		frappe.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
 		
 	def test_yearly_budget_crossed_stop(self):
 		from erpnext.accounts.utils import BudgetError
 		self.clear_account_balance()
 		self.test_monthly_budget_crossed_ignore()
 		
-		webnotes.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Stop")
+		frappe.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Stop")
 		
-		jv = webnotes.bean(copy=test_records[0])
+		jv = frappe.bean(copy=test_records[0])
 		jv.doc.posting_date = "2013-08-12"
 		jv.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
 		jv.doclist[2].cost_center = "_Test Cost Center - _TC"
@@ -93,39 +93,39 @@
 		
 		self.assertRaises(BudgetError, jv.submit)
 		
-		webnotes.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Ignore")
+		frappe.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Ignore")
 		
 	def test_monthly_budget_on_cancellation(self):
 		from erpnext.accounts.utils import BudgetError
-		webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
+		frappe.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
 		self.clear_account_balance()
 		
-		jv = webnotes.bean(copy=test_records[0])
+		jv = frappe.bean(copy=test_records[0])
 		jv.doclist[1].account = "_Test Account Cost for Goods Sold - _TC"
 		jv.doclist[1].cost_center = "_Test Cost Center - _TC"
 		jv.doclist[1].credit = 30000.0
 		jv.doclist[2].debit = 30000.0
 		jv.submit()
 		
-		self.assertTrue(webnotes.conn.get_value("GL Entry", 
+		self.assertTrue(frappe.conn.get_value("GL Entry", 
 			{"voucher_type": "Journal Voucher", "voucher_no": jv.doc.name}))
 		
-		jv1 = webnotes.bean(copy=test_records[0])
+		jv1 = frappe.bean(copy=test_records[0])
 		jv1.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
 		jv1.doclist[2].cost_center = "_Test Cost Center - _TC"
 		jv1.doclist[2].debit = 40000.0
 		jv1.doclist[1].credit = 40000.0
 		jv1.submit()
 		
-		self.assertTrue(webnotes.conn.get_value("GL Entry", 
+		self.assertTrue(frappe.conn.get_value("GL Entry", 
 			{"voucher_type": "Journal Voucher", "voucher_no": jv1.doc.name}))
 		
 		self.assertRaises(BudgetError, jv.cancel)
 		
-		webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
+		frappe.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
 		
 	def clear_account_balance(self):
-		webnotes.conn.sql("""delete from `tabGL Entry`""")
+		frappe.conn.sql("""delete from `tabGL Entry`""")
 		
 
 test_records = [
diff --git a/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.py b/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.py
+++ b/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/mis_control/mis_control.py b/erpnext/accounts/doctype/mis_control/mis_control.py
index d2c0961..102fb01 100644
--- a/erpnext/accounts/doctype/mis_control/mis_control.py
+++ b/erpnext/accounts/doctype/mis_control/mis_control.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt, get_first_day, get_last_day, has_common
-import webnotes.defaults
+import frappe
+from frappe.utils import flt, get_first_day, get_last_day, has_common
+import frappe.defaults
 from erpnext.accounts.utils import get_balance_on
 
 class DocType:
@@ -33,7 +33,7 @@
 		ret['company'] = get_companies()
 
 		#--- to get fiscal year and start_date of that fiscal year -----
-		res = webnotes.conn.sql("select name, year_start_date from `tabFiscal Year`")
+		res = frappe.conn.sql("select name, year_start_date from `tabFiscal Year`")
 		ret['fiscal_year'] = [r[0] for r in res]
 		ret['start_dates'] = {}
 		for r in res:
@@ -41,7 +41,7 @@
 			
 		#--- from month and to month (for MIS - Comparison Report) -------
 		month_list = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-		fiscal_start_month = webnotes.conn.sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(webnotes.defaults.get_global_default("fiscal_year")))
+		fiscal_start_month = frappe.conn.sql("select MONTH(year_start_date) from `tabFiscal Year` where name = %s",(frappe.defaults.get_global_default("fiscal_year")))
 		fiscal_start_month = fiscal_start_month and fiscal_start_month[0][0] or 1
 		mon = ['']
 		for i in range(fiscal_start_month,13): mon.append(month_list[i-1])
@@ -49,7 +49,7 @@
 		ret['month'] = mon
 
 		# get MIS Type on basis of roles of session user
-		self.roles = webnotes.user.get_roles()
+		self.roles = frappe.user.get_roles()
 		if has_common(self.roles, ['Sales Manager']):
 			type.append('Sales')
 		if has_common(self.roles, ['Purchase Manager']):
@@ -76,7 +76,7 @@
 		return self.return_data
 
 	def get_children(self, parent_account, level, pl, company, fy):
-		cl = webnotes.conn.sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
+		cl = frappe.conn.sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where ifnull(parent_account, '') = %s and ifnull(is_pl_account, 'No')=%s and company=%s and docstatus != 2 order by name asc", (parent_account, pl, company))
 		level0_diff = [0 for p in self.period_list]
 		if pl=='Yes' and level==0: # switch for income & expenses
 			cl = [c for c in cl]
@@ -123,7 +123,7 @@
 							self.return_data.append([4, 'Total '+c[0]] + totals)
 
 	def define_periods(self, year, period):	
-		ysd = webnotes.conn.sql("select year_start_date from `tabFiscal Year` where name=%s", year)
+		ysd = frappe.conn.sql("select year_start_date from `tabFiscal Year` where name=%s", year)
 		ysd = ysd and ysd[0][0] or ''
 
 		self.ysd = ysd
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
index 6f7d515..48cb789 100644
--- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
@@ -13,15 +13,15 @@
 cur_frm.cscript.refresh = function(doc) {
 	cur_frm.set_intro("");
 	if(!doc.voucher_no) {
-		cur_frm.set_intro(wn._("Select the Invoice against which you want to allocate payments."));
+		cur_frm.set_intro(frappe._("Select the Invoice against which you want to allocate payments."));
 	} else {
-		cur_frm.set_intro(wn._("Set allocated amount against each Payment Entry and click 'Allocate'."));
+		cur_frm.set_intro(frappe._("Set allocated amount against each Payment Entry and click 'Allocate'."));
 	}
 }
 
 cur_frm.fields_dict.voucher_no.get_query = function(doc) {
 	// TO-do: check for pos, it should not come
-	if (!doc.account) msgprint(wn._("Please select Account first"));
+	if (!doc.account) msgprint(frappe._("Please select Account first"));
 	else {
 		return {
 			doctype: doc.voucher_type,
@@ -40,7 +40,7 @@
 }
 
 cur_frm.cscript.account = function(doc, cdt, cdn) {
-	return wn.call({
+	return frappe.call({
 		doc: this.frm.doc,
 		method: "set_account_type",
 		callback: function(r) {
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
index 2904c7d..ceea672 100644
--- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes import msgprint
+from frappe.utils import flt
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe import msgprint
 
 class DocType:
 	def __init__(self, doc, doclist):
@@ -16,17 +16,17 @@
 	
 	def set_account_type(self):
 		self.doc.account_type = self.doc.account and \
-			webnotes.conn.get_value("Account", self.doc.account, "debit_or_credit").lower() or ""
+			frappe.conn.get_value("Account", self.doc.account, "debit_or_credit").lower() or ""
 		
 	def get_voucher_details(self):
-		total_amount = webnotes.conn.sql("""select sum(%s) from `tabGL Entry` 
+		total_amount = frappe.conn.sql("""select sum(%s) from `tabGL Entry` 
 			where voucher_type = %s and voucher_no = %s 
 			and account = %s""" % 
 			(self.doc.account_type, '%s', '%s', '%s'), 
 			(self.doc.voucher_type, self.doc.voucher_no, self.doc.account))
 			
 		total_amount = total_amount and flt(total_amount[0][0]) or 0
-		reconciled_payment = webnotes.conn.sql("""
+		reconciled_payment = frappe.conn.sql("""
 			select sum(ifnull(%s, 0)) - sum(ifnull(%s, 0)) from `tabGL Entry` where 
 			against_voucher = %s and voucher_no != %s
 			and account = %s""" % 
@@ -63,7 +63,7 @@
 		cond += self.doc.amt_less_than and \
 			' and t2.' + dc+' <= ' + self.doc.amt_less_than or ''
 
-		gle = webnotes.conn.sql("""
+		gle = frappe.conn.sql("""
 			select t1.name as voucher_no, t1.posting_date, t1.total_debit as total_amt, 
 			 	sum(ifnull(t2.credit, 0)) - sum(ifnull(t2.debit, 0)) as amt_due, t1.remark,
 			 	t2.against_account, t2.name as voucher_detail_no
@@ -99,7 +99,7 @@
 			2. split into multiple rows if partially adjusted, assign against voucher
 			3. submit payment voucher
 		"""
-		if not self.doc.voucher_no or not webnotes.conn.sql("""select name from `tab%s` 
+		if not self.doc.voucher_no or not frappe.conn.sql("""select name from `tab%s` 
 				where name = %s""" % (self.doc.voucher_type, '%s'), self.doc.voucher_no):
 			msgprint("Please select valid Voucher No to proceed", raise_exception=1)
 		
@@ -130,7 +130,7 @@
 def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
 	from erpnext.controllers.queries import get_match_cond
 	
-	return webnotes.conn.sql("""select gle.voucher_no, gle.posting_date, 
+	return frappe.conn.sql("""select gle.voucher_no, gle.posting_date, 
 		gle.%(account_type)s from `tabGL Entry` gle
 	    where gle.account = '%(acc)s' 
 	    	and gle.voucher_type = '%(dt)s'
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py
index 7cf8c06..fed0252 100644
--- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool/test_payment_to_invoice_matching_tool.py
@@ -3,6 +3,6 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
 test_records = []
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.py b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.py
+++ b/erpnext/accounts/doctype/payment_to_invoice_matching_tool_detail/payment_to_invoice_matching_tool_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 5a37d84..753b7db 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, flt, getdate
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import cstr, flt, getdate
+from frappe import msgprint, _
 from erpnext.controllers.accounts_controller import AccountsController
 
 class DocType(AccountsController):
@@ -21,30 +21,30 @@
 		self.make_gl_entries()
 
 	def on_cancel(self):
-		webnotes.conn.sql("""delete from `tabGL Entry` 
+		frappe.conn.sql("""delete from `tabGL Entry` 
 			where voucher_type = 'Period Closing Voucher' and voucher_no=%s""", self.doc.name)
 
 	def validate_account_head(self):
-		debit_or_credit, is_pl_account = webnotes.conn.get_value("Account", 
+		debit_or_credit, is_pl_account = frappe.conn.get_value("Account", 
 			self.doc.closing_account_head, ["debit_or_credit", "is_pl_account"])
 			
 		if debit_or_credit != 'Credit' or is_pl_account != 'No':
-			webnotes.throw(_("Account") + ": " + self.doc.closing_account_head + 
+			frappe.throw(_("Account") + ": " + self.doc.closing_account_head + 
 				_("must be a Liability account"))
 
 	def validate_posting_date(self):
 		from erpnext.accounts.utils import get_fiscal_year
 		self.year_start_date = get_fiscal_year(self.doc.posting_date, self.doc.fiscal_year)[1]
 
-		pce = webnotes.conn.sql("""select name from `tabPeriod Closing Voucher`
+		pce = frappe.conn.sql("""select name from `tabPeriod Closing Voucher`
 			where posting_date > %s and fiscal_year = %s and docstatus = 1""", 
 			(self.doc.posting_date, self.doc.fiscal_year))
 		if pce and pce[0][0]:
-			webnotes.throw(_("Another Period Closing Entry") + ": " + cstr(pce[0][0]) + 
+			frappe.throw(_("Another Period Closing Entry") + ": " + cstr(pce[0][0]) + 
 				  _("has been made after posting date") + ": " + self.doc.posting_date)
 		 
 	def validate_pl_balances(self):
-		income_bal = webnotes.conn.sql("""
+		income_bal = frappe.conn.sql("""
 			select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) 
 			from `tabGL Entry` t1, tabAccount t2 
 			where t1.account = t2.name and t1.posting_date between %s and %s 
@@ -52,7 +52,7 @@
 			and t2.docstatus < 2 and t2.company = %s""", 
 			(self.year_start_date, self.doc.posting_date, self.doc.company))
 			
-		expense_bal = webnotes.conn.sql("""
+		expense_bal = frappe.conn.sql("""
 			select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0))
 			from `tabGL Entry` t1, tabAccount t2 
 			where t1.account = t2.name and t1.posting_date between %s and %s
@@ -64,11 +64,11 @@
 		expense_bal = expense_bal and expense_bal[0][0] or 0
 		
 		if not income_bal and not expense_bal:
-			webnotes.throw(_("Both Income and Expense balances are zero. No Need to make Period Closing Entry."))
+			frappe.throw(_("Both Income and Expense balances are zero. No Need to make Period Closing Entry."))
 		
 	def get_pl_balances(self):
 		"""Get balance for pl accounts"""
-		return webnotes.conn.sql("""
+		return frappe.conn.sql("""
 			select t1.account, sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) as balance
 			from `tabGL Entry` t1, `tabAccount` t2 
 			where t1.account = t2.name and ifnull(t2.is_pl_account, 'No') = 'Yes'
diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
index c779d9b..5039e88 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
@@ -4,30 +4,30 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
 class TestPeriodClosingVoucher(unittest.TestCase):
 	def test_closing_entry(self):
 		# clear GL Entries
-		webnotes.conn.sql("""delete from `tabGL Entry`""")
+		frappe.conn.sql("""delete from `tabGL Entry`""")
 		
 		from erpnext.accounts.doctype.journal_voucher.test_journal_voucher import test_records as jv_records
-		jv = webnotes.bean(copy=jv_records[2])
+		jv = frappe.bean(copy=jv_records[2])
 		jv.insert()
 		jv.submit()
 		
-		jv1 = webnotes.bean(copy=jv_records[0])
+		jv1 = frappe.bean(copy=jv_records[0])
 		jv1.doclist[2].account = "_Test Account Cost for Goods Sold - _TC"
 		jv1.doclist[2].debit = 600.0
 		jv1.doclist[1].credit = 600.0
 		jv1.insert()
 		jv1.submit()
 		
-		pcv = webnotes.bean(copy=test_record)
+		pcv = frappe.bean(copy=test_record)
 		pcv.insert()
 		pcv.submit()
 		
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Period Closing Voucher' and voucher_no=%s
 			order by account asc, debit asc""", pcv.doc.name, as_dict=1)
 
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.js b/erpnext/accounts/doctype/pos_setting/pos_setting.js
index 5c291b4..f7fcdfe 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.js
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.js
@@ -74,5 +74,5 @@
 
 
 cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
-	return{	query:"webnotes.core.doctype.profile.profile.profile_query"}
+	return{	query:"frappe.core.doctype.profile.profile.profile_query"}
 }
diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.py b/erpnext/accounts/doctype/pos_setting/pos_setting.py
index 3198859..e743fb3 100755
--- a/erpnext/accounts/doctype/pos_setting/pos_setting.py
+++ b/erpnext/accounts/doctype/pos_setting/pos_setting.py
@@ -2,17 +2,17 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
-from webnotes.utils import cint
+import frappe
+from frappe import msgprint, _
+from frappe.utils import cint
 
 class DocType:
 	def __init__(self,doc,doclist):
 		self.doc, self.doclist = doc,doclist
 
 	def get_series(self):
-		import webnotes.model.doctype
-		docfield = webnotes.model.doctype.get('Sales Invoice')
+		import frappe.model.doctype
+		docfield = frappe.model.doctype.get('Sales Invoice')
 		series = [d.options for d in docfield 
 			if d.doctype == 'DocField' and d.fieldname == 'naming_series']
 		return series and series[0] or ''
@@ -23,7 +23,7 @@
 		self.validate_all_link_fields()
 		
 	def check_for_duplicate(self):
-		res = webnotes.conn.sql("""select name, user from `tabPOS Setting` 
+		res = frappe.conn.sql("""select name, user from `tabPOS Setting` 
 			where ifnull(user, '') = %s and name != %s and company = %s""", 
 			(self.doc.user, self.doc.name, self.doc.company))
 		if res:
@@ -35,7 +35,7 @@
 					(res[0][0], self.doc.company), raise_exception=1)
 
 	def validate_expense_account(self):
-		if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
+		if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \
 				and not self.doc.expense_account:
 			msgprint(_("Expense Account is mandatory"), raise_exception=1)
 
@@ -46,19 +46,19 @@
 		
 		for link_dt, dn_list in accounts.items():
 			for link_dn in dn_list:
-				if link_dn and not webnotes.conn.exists({"doctype": link_dt, 
+				if link_dn and not frappe.conn.exists({"doctype": link_dt, 
 						"company": self.doc.company, "name": link_dn}):
-					webnotes.throw(link_dn +_(" does not belong to ") + self.doc.company)
+					frappe.throw(link_dn +_(" does not belong to ") + self.doc.company)
 
 	def on_update(self):
-		webnotes.defaults.clear_default("is_pos")
+		frappe.defaults.clear_default("is_pos")
 
-		pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
+		pos_view_users = frappe.conn.sql_list("""select user from `tabPOS Setting`""")
 		for user in pos_view_users:
 			if user:
-				webnotes.defaults.set_user_default("is_pos", 1, user)
+				frappe.defaults.set_user_default("is_pos", 1, user)
 			else:
-				webnotes.defaults.set_global_default("is_pos", 1)
+				frappe.defaults.set_global_default("is_pos", 1)
 
 	def on_trash(self):
 		self.on_update()
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index deece75..202179d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -5,7 +5,7 @@
 cur_frm.cscript.fname = "entries";
 cur_frm.cscript.other_fname = "other_charges";
 
-wn.provide("erpnext.accounts");
+frappe.provide("erpnext.accounts");
 {% include 'buying/doctype/purchase_common/purchase_common.js' %};
 {% include 'accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js' %}
 {% include 'accounts/doctype/sales_invoice/pos.js' %}
@@ -27,25 +27,25 @@
 		
 		// Show / Hide button
 		if(doc.docstatus==1 && doc.outstanding_amount > 0)
-			this.frm.add_custom_button(wn._('Make Payment Entry'), this.make_bank_voucher);
+			this.frm.add_custom_button(frappe._('Make Payment Entry'), this.make_bank_voucher);
 
 		if(doc.docstatus==1) { 
-			cur_frm.appframe.add_button(wn._('View Ledger'), function() {
-				wn.route_options = {
+			cur_frm.appframe.add_button(frappe._('View Ledger'), function() {
+				frappe.route_options = {
 					"voucher_no": doc.name,
 					"from_date": doc.posting_date,
 					"to_date": doc.posting_date,
 					"company": doc.company,
 					group_by_voucher: 0
 				};
-				wn.set_route("query-report", "General Ledger");
+				frappe.set_route("query-report", "General Ledger");
 			}, "icon-table");
 		}
 
 		if(doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Purchase Order'), 
+			cur_frm.add_custom_button(frappe._('From Purchase Order'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
 						source_doctype: "Purchase Order",
 						get_query_filters: {
@@ -58,9 +58,9 @@
 					})
 				});
 
-			cur_frm.add_custom_button(wn._('From Purchase Receipt'), 
+			cur_frm.add_custom_button(frappe._('From Purchase Receipt'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
 						source_doctype: "Purchase Receipt",
 						get_query_filters: {
@@ -108,7 +108,7 @@
 	},
 	
 	entries_add: function(doc, cdt, cdn) {
-		var row = wn.model.get_doc(cdt, cdn);
+		var row = frappe.model.get_doc(cdt, cdn);
 		this.frm.script_manager.copy_from_first_row("entries", row, ["expense_account", "cost_center"]);
 	}
 });
@@ -121,14 +121,14 @@
 }
 
 cur_frm.cscript.make_bank_voucher = function() {
-	return wn.call({
+	return frappe.call({
 		method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_payment_entry_from_purchase_invoice",
 		args: {
 			"purchase_invoice": cur_frm.doc.name,
 		},
 		callback: function(r) {
-			var doclist = wn.model.sync(r.message);
-			wn.set_route("Form", doclist[0].doctype, doclist[0].name);
+			var doclist = frappe.model.sync(r.message);
+			frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
 		}
 	});
 }
@@ -229,5 +229,5 @@
 		cur_frm.pformat.print_heading = doc.select_print_heading;
 	}
 	else
-		cur_frm.pformat.print_heading = wn._("Purchase Invoice");
+		cur_frm.pformat.print_heading = frappe._("Purchase Invoice");
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index ab7b5b1..450fdc3 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -2,15 +2,15 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import add_days, cint, cstr, flt, formatdate
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import add_days, cint, cstr, flt, formatdate
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 from erpnext.setup.utils import get_company_currency
 
-import webnotes.defaults
+import frappe.defaults
 
 from erpnext.controllers.buying_controller import BuyingController
 from erpnext.accounts.party import get_party_account, get_due_date
@@ -73,7 +73,7 @@
 	def check_active_purchase_items(self):
 		for d in getlist(self.doclist, 'entries'):
 			if d.item_code:		# extra condn coz item_code is not mandatory in PV
-				valid_item = webnotes.conn.sql("select docstatus,is_purchase_item from tabItem where name = %s",d.item_code)
+				valid_item = frappe.conn.sql("select docstatus,is_purchase_item from tabItem where name = %s",d.item_code)
 				if valid_item[0][0] == 2:
 					msgprint("Item : '%s' is Inactive, you can restore it from Trash" %(d.item_code))
 					raise Exception
@@ -93,7 +93,7 @@
 	def validate_bill_no(self):
 		if self.doc.bill_no and self.doc.bill_no.lower().strip() \
 				not in ['na', 'not applicable', 'none']:
-			b_no = webnotes.conn.sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` 
+			b_no = frappe.conn.sql("""select bill_no, name, ifnull(is_opening,'') from `tabPurchase Invoice` 
 				where bill_no = %s and credit_to = %s and docstatus = 1 and name != %s""", 
 				(self.doc.bill_no, self.doc.credit_to, self.doc.name))
 			if b_no and cstr(b_no[0][2]) == cstr(self.doc.is_opening):
@@ -109,7 +109,7 @@
 			self.doc.remarks = "No Remarks"
 
 	def validate_credit_acc(self):
-		acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = %s", 
+		acc = frappe.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = %s", 
 			self.doc.credit_to)
 		if not acc:
 			msgprint("Account: "+ self.doc.credit_to + "does not exist")
@@ -125,7 +125,7 @@
 	# ------------------------------------------------------------
 	def check_for_acc_head_of_supplier(self): 
 		if self.doc.supplier and self.doc.credit_to:
-			acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s", self.doc.credit_to)
+			acc_head = frappe.conn.sql("select master_name from `tabAccount` where name = %s", self.doc.credit_to)
 			
 			if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.supplier)) or (not acc_head and (self.doc.credit_to != cstr(self.doc.supplier) + " - " + self.company_abbr)):
 				msgprint("Credit To: %s do not match with Supplier: %s for Company: %s.\n If both correctly entered, please select Master Type and Master Name in account master." %(self.doc.credit_to,self.doc.supplier,self.doc.company), raise_exception=1)
@@ -137,7 +137,7 @@
 		for d in getlist(self.doclist,'entries'):
 			if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
 				check_list.append(d.purhcase_order)
-				stopped = webnotes.conn.sql("select name from `tabPurchase Order` where status = 'Stopped' and name = '%s'" % d.purchase_order)
+				stopped = frappe.conn.sql("select name from `tabPurchase Order` where status = 'Stopped' and name = '%s'" % d.purchase_order)
 				if stopped:
 					msgprint("One cannot do any transaction against 'Purchase Order' : %s, it's status is 'Stopped'" % (d.purhcase_order))
 					raise Exception
@@ -165,7 +165,7 @@
 			}
 		})
 		
-		if cint(webnotes.defaults.get_global_default('maintain_same_rate')):
+		if cint(frappe.defaults.get_global_default('maintain_same_rate')):
 			super(DocType, self).validate_with_previous_doc(self.tname, {
 				"Purchase Order Item": {
 					"ref_dn_field": "po_detail",
@@ -189,7 +189,7 @@
 			raise Exception
 			
 	def set_against_expense_account(self):
-		auto_accounting_for_stock = cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
+		auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
 
 		if auto_accounting_for_stock:
 			stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
@@ -218,14 +218,14 @@
 		self.doc.against_expense_account = ",".join(against_accounts)
 
 	def po_required(self):
-		if webnotes.conn.get_value("Buying Settings", None, "po_required") == 'Yes':
+		if frappe.conn.get_value("Buying Settings", None, "po_required") == 'Yes':
 			 for d in getlist(self.doclist,'entries'):
 				 if not d.purchase_order:
 					 msgprint("Purchse Order No. required against item %s"%d.item_code)
 					 raise Exception
 
 	def pr_required(self):
-		if webnotes.conn.get_value("Buying Settings", None, "pr_required") == 'Yes':
+		if frappe.conn.get_value("Buying Settings", None, "pr_required") == 'Yes':
 			 for d in getlist(self.doclist,'entries'):
 				 if not d.purchase_receipt:
 					 msgprint("Purchase Receipt No. required against item %s"%d.item_code)
@@ -238,13 +238,13 @@
 	def check_prev_docstatus(self):
 		for d in getlist(self.doclist,'entries'):
 			if d.purchase_order:
-				submitted = webnotes.conn.sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
+				submitted = frappe.conn.sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order)
 				if not submitted:
-					webnotes.throw("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
+					frappe.throw("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted")
 			if d.purchase_receipt:
-				submitted = webnotes.conn.sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
+				submitted = frappe.conn.sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt)
 				if not submitted:
-					webnotes.throw("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
+					frappe.throw("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted")
 					
 					
 	def update_against_document_in_jv(self):
@@ -289,7 +289,7 @@
 
 	def make_gl_entries(self):
 		auto_accounting_for_stock = \
-			cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
+			cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
 		
 		gl_entries = []
 		
@@ -324,7 +324,7 @@
 			# accumulate valuation tax
 			if tax.category in ("Valuation", "Valuation and Total") and flt(tax.tax_amount):
 				if auto_accounting_for_stock and not tax.cost_center:
-					webnotes.throw(_("Row %(row)s: Cost Center is mandatory \
+					frappe.throw(_("Row %(row)s: Cost Center is mandatory \
 						if tax/charges category is Valuation or Valuation and Total" % 
 						{"row": tax.idx}))
 				valuation_tax.setdefault(tax.cost_center, 0)
@@ -414,25 +414,25 @@
 	def update_raw_material_cost(self):
 		if self.sub_contracted_items:
 			for d in self.doclist.get({"parentfield": "entries"}):
-				rm_cost = webnotes.conn.sql("""select raw_material_cost / quantity 
+				rm_cost = frappe.conn.sql("""select raw_material_cost / quantity 
 					from `tabBOM` where item = %s and is_default = 1 and docstatus = 1 
 					and is_active = 1 """, (d.item_code,))
 				rm_cost = rm_cost and flt(rm_cost[0][0]) or 0
 				
-				d.conversion_factor = d.conversion_factor or flt(webnotes.conn.get_value(
+				d.conversion_factor = d.conversion_factor or flt(frappe.conn.get_value(
 					"UOM Conversion Detail", {"parent": d.item_code, "uom": d.uom}, 
 					"conversion_factor")) or 1
 		
 				d.rm_supp_cost = rm_cost * flt(d.qty) * flt(d.conversion_factor)
 				
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
 	from erpnext.controllers.queries import get_match_cond
 	
 	# expense account can be any Debit account, 
 	# but can also be a Liability account with account_type='Expense Account' in special circumstances. 
 	# Hence the first condition is an "OR"
-	return webnotes.conn.sql("""select tabAccount.name from `tabAccount` 
+	return frappe.conn.sql("""select tabAccount.name from `tabAccount` 
 			where (tabAccount.debit_or_credit="Debit" 
 					or tabAccount.account_type = "Expense Account")
 				and tabAccount.group_or_ledger="Ledger" 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
index 96bcbb4..61d2750 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 // render
-wn.listview_settings['Purchase Invoice'] = {
+frappe.listview_settings['Purchase Invoice'] = {
 	add_fields: ["`tabPurchase Invoice`.grand_total", "`tabPurchase Invoice`.outstanding_amount"],
 	add_columns: [{"content":"paid_amount", width:"10%", type:"bar-graph", label: "Paid"}],
 	prepare_data: function(data) {
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 6cca6e4..0398e4b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -4,11 +4,11 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-import webnotes.model
+import frappe
+import frappe.model
 import json	
-from webnotes.utils import cint
-import webnotes.defaults
+from frappe.utils import cint
+import frappe.defaults
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 
 test_dependencies = ["Item", "Cost Center"]
@@ -17,9 +17,9 @@
 class TestPurchaseInvoice(unittest.TestCase):
 	def test_gl_entries_without_auto_accounting_for_stock(self):
 		set_perpetual_inventory(0)
-		self.assertTrue(not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")))
+		self.assertTrue(not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")))
 		
-		wrapper = webnotes.bean(copy=test_records[0])
+		wrapper = frappe.bean(copy=test_records[0])
 		wrapper.run_method("calculate_taxes_and_totals")
 		wrapper.insert()
 		wrapper.submit()
@@ -37,21 +37,21 @@
 			"_Test Account VAT - _TC": [156.25, 0],
 			"_Test Account Discount - _TC": [0, 168.03],
 		}
-		gl_entries = webnotes.conn.sql("""select account, debit, credit from `tabGL Entry`
+		gl_entries = frappe.conn.sql("""select account, debit, credit from `tabGL Entry`
 			where voucher_type = 'Purchase Invoice' and voucher_no = %s""", dl[0].name, as_dict=1)
 		for d in gl_entries:
 			self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
 			
 	def test_gl_entries_with_auto_accounting_for_stock(self):
 		set_perpetual_inventory(1)
-		self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
+		self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
 		
-		pi = webnotes.bean(copy=test_records[1])
+		pi = frappe.bean(copy=test_records[1])
 		pi.run_method("calculate_taxes_and_totals")
 		pi.insert()
 		pi.submit()
 		
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
 			order by account asc""", pi.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
@@ -73,9 +73,9 @@
 
 	def test_gl_entries_with_aia_for_non_stock_items(self):
 		set_perpetual_inventory()
-		self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
+		self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
 		
-		pi = webnotes.bean(copy=test_records[1])
+		pi = frappe.bean(copy=test_records[1])
 		pi.doclist[1].item_code = "_Test Non Stock Item"
 		pi.doclist[1].expense_account = "_Test Account Cost for Goods Sold - _TC"
 		pi.doclist.pop(2)
@@ -84,7 +84,7 @@
 		pi.insert()
 		pi.submit()
 		
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
 			order by account asc""", pi.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
@@ -102,7 +102,7 @@
 		set_perpetual_inventory(0)
 			
 	def test_purchase_invoice_calculation(self):
-		wrapper = webnotes.bean(copy=test_records[0])
+		wrapper = frappe.bean(copy=test_records[0])
 		wrapper.run_method("calculate_taxes_and_totals")
 		wrapper.insert()
 		wrapper.load_from_db()
@@ -136,7 +136,7 @@
 			self.assertEqual(tax.total, expected_values[i][2])
 			
 	def test_purchase_invoice_with_subcontracted_item(self):
-		wrapper = webnotes.bean(copy=test_records[0])
+		wrapper = frappe.bean(copy=test_records[0])
 		wrapper.doclist[1].item_code = "_Test FG Item"
 		wrapper.run_method("calculate_taxes_and_totals")
 		wrapper.insert()
@@ -174,11 +174,11 @@
 		from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \
 			import test_records as jv_test_records
 			
-		jv = webnotes.bean(copy=jv_test_records[1])
+		jv = frappe.bean(copy=jv_test_records[1])
 		jv.insert()
 		jv.submit()
 		
-		pi = webnotes.bean(copy=test_records[0])
+		pi = frappe.bean(copy=test_records[0])
 		pi.doclist.append({
 			"doctype": "Purchase Invoice Advance",
 			"parentfield": "advance_allocation_details",
@@ -193,17 +193,17 @@
 		pi.submit()
 		pi.load_from_db()
 		
-		self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_voucher=%s""", pi.doc.name))
 		
-		self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_voucher=%s and debit=300""", pi.doc.name))
 			
 		self.assertEqual(pi.doc.outstanding_amount, 1212.30)
 		
 		pi.cancel()
 		
-		self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(not frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_voucher=%s""", pi.doc.name))
 	
 test_records = [
diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
+++ b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
index 933382e..b87915a 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
@@ -4,7 +4,7 @@
 {% include "public/js/controllers/accounts.js" %}
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-	cur_frm.set_footnote(wn.markdown(cur_frm.meta.description));
+	cur_frm.set_footnote(frappe.markdown(cur_frm.meta.description));
 }
 
 // For customizing print
@@ -37,7 +37,7 @@
 	}
 
 	function print_hide(fieldname) {
-		var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name);
+		var doc_field = frappe.meta.get_docfield(doc.doctype, fieldname, doc.name);
 		return doc_field.print_hide;
 	}
 
@@ -78,11 +78,11 @@
 	var d = locals[cdt][cdn];
 
 	if(!d.category && d.add_deduct_tax) {
-		msgprint(wn._("Please select Category first"));
+		msgprint(frappe._("Please select Category first"));
 		d.add_deduct_tax = '';
 	}
 	else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') {
-		msgprint(wn._("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
+		msgprint(frappe._("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'"));
 		d.add_deduct_tax = '';
 	}
 }
@@ -91,15 +91,15 @@
 	var d = locals[cdt][cdn];
 
 	if(!d.category && d.charge_type) {
-		msgprint(wn._("Please select Category first"));
+		msgprint(frappe._("Please select Category first"));
 		d.charge_type = '';
 	}
 	else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')) {
-		msgprint(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"));
+		msgprint(frappe._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"));
 		d.charge_type = '';
 	}
 	else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')) {
-		msgprint(wn._("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total"));
+		msgprint(frappe._("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total"));
 		d.charge_type = '';
 	}
 
@@ -116,16 +116,16 @@
 	var d = locals[cdt][cdn];
 
 	if(!d.charge_type && d.row_id) {
-		msgprint(wn._("Please select Charge Type first"));
+		msgprint(frappe._("Please select Charge Type first"));
 		d.row_id = '';
 	}
 	else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
-		msgprint(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'"));
+		msgprint(frappe._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'"));
 		d.row_id = '';
 	}
 	else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id) {
 		if(d.row_id >= d.idx){
-			msgprint(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type"));
+			msgprint(frappe._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type"));
 			d.row_id = '';
 		}
 	}
@@ -157,7 +157,7 @@
 	var d = locals[cdt][cdn];
 
 	if(!d.charge_type && d.rate) {
-		msgprint(wn._("Please select Charge Type first"));
+		msgprint(frappe._("Please select Charge Type first"));
 		d.rate = '';
 	}
 	validated = false;
@@ -168,11 +168,11 @@
 	var d = locals[cdt][cdn];
 
 	if(!d.charge_type && d.tax_amount) {
-		msgprint(wn._("Please select Charge Type first"));
+		msgprint(frappe._("Please select Charge Type first"));
 		d.tax_amount = '';
 	}
 	else if(d.charge_type && d.tax_amount) {
-		msgprint(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate"));
+		msgprint(frappe._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate"));
 		d.tax_amount = '';
 	}
 
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
index 09eb4d8..eee6e9a 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
-from webnotes.model.code import get_obj
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
+from frappe.model.code import get_obj
 
 	
 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.js b/erpnext/accounts/doctype/sales_invoice/pos.js
index 673b35b..480ce02 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.js
+++ b/erpnext/accounts/doctype/sales_invoice/pos.js
@@ -105,7 +105,7 @@
 		});
 
 		this.wrapper.find('input.discount-amount').on("change", function() {
-			wn.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", this.value);
+			frappe.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", this.value);
 		});
 
 		this.call_function("remove-items", function() {me.remove_selected_items();});
@@ -115,10 +115,10 @@
 		var me = this;
 
 		// Check whether the transaction is "Sales" or "Purchase"
-		if (wn.meta.has_field(cur_frm.doc.doctype, "customer")) {
+		if (frappe.meta.has_field(cur_frm.doc.doctype, "customer")) {
 			this.set_transaction_defaults("Customer", "export");
 		}
-		else if (wn.meta.has_field(cur_frm.doc.doctype, "supplier")) {
+		else if (frappe.meta.has_field(cur_frm.doc.doctype, "supplier")) {
 			this.set_transaction_defaults("Supplier", "import");
 		}
 	},
@@ -146,7 +146,7 @@
 	},
 	make_party: function() {
 		var me = this;
-		this.party_field = wn.ui.form.make_control({
+		this.party_field = frappe.ui.form.make_control({
 			df: {
 				"fieldtype": "Link",
 				"options": this.party,
@@ -160,13 +160,13 @@
 		this.party_field.make_input();
 		this.party_field.$input.on("change", function() {
 			if(!me.party_field.autocomplete_open)
-				wn.model.set_value(me.frm.doctype, me.frm.docname, 
+				frappe.model.set_value(me.frm.doctype, me.frm.docname, 
 					me.party.toLowerCase(), this.value);
 		});
 	},
 	make_barcode: function() {
 		var me = this;
-		this.barcode = wn.ui.form.make_control({
+		this.barcode = frappe.ui.form.make_control({
 			df: {
 				"fieldtype": "Data",
 				"label": "Barcode",
@@ -185,7 +185,7 @@
 	},
 	make_search: function() {
 		var me = this;
-		this.search = wn.ui.form.make_control({
+		this.search = frappe.ui.form.make_control({
 			df: {
 				"fieldtype": "Data",
 				"label": "Item",
@@ -205,7 +205,7 @@
 	},
 	make_item_group: function() {
 		var me = this;
-		this.item_group = wn.ui.form.make_control({
+		this.item_group = frappe.ui.form.make_control({
 			df: {
 				"fieldtype": "Link",
 				"options": "Item Group",
@@ -225,7 +225,7 @@
 	make_item_list: function() {
 		var me = this;
 		me.item_timeout = null;
-		wn.call({
+		frappe.call({
 			method: 'erpnext.accounts.doctype.sales_invoice.pos.get_items',
 			args: {
 				sales_or_purchase: this.sales_or_purchase,
@@ -284,14 +284,14 @@
 		
 		// check whether the item is already added
 		if (no_of_items != 0) {
-			$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
+			$.each(frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
 				this.frm.cscript.fname,	this.frm.doctype), function(i, d) {
 				if (d.item_code == item_code) {
 					caught = true;
 					if (serial_no)
-						wn.model.set_value(d.doctype, d.name, "serial_no", d.serial_no + '\n' + serial_no);
+						frappe.model.set_value(d.doctype, d.name, "serial_no", d.serial_no + '\n' + serial_no);
 					else
-						wn.model.set_value(d.doctype, d.name, "qty", d.qty + 1);
+						frappe.model.set_value(d.doctype, d.name, "qty", d.qty + 1);
 				}
 			});
 		}
@@ -306,7 +306,7 @@
 	add_new_item_to_grid: function(item_code, serial_no) {
 		var me = this;
 
-		var child = wn.model.add_child(me.frm.doc, this.frm.doctype + " Item", 
+		var child = frappe.model.add_child(me.frm.doc, this.frm.doctype + " Item", 
 			this.frm.cscript.fname);
 		child.item_code = item_code;
 
@@ -326,14 +326,14 @@
 	},
 	update_qty: function(item_code, qty) {
 		var me = this;
-		$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
+		$.each(frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
 			this.frm.cscript.fname, this.frm.doctype), function(i, d) {
 			if (d.item_code == item_code) {
 				if (qty == 0) {
-					wn.model.clear_doc(d.doctype, d.name);
+					frappe.model.clear_doc(d.doctype, d.name);
 					me.refresh_grid();
 				} else {
-					wn.model.set_value(d.doctype, d.name, "qty", qty);
+					frappe.model.set_value(d.doctype, d.name, "qty", qty);
 				}
 			}
 		});
@@ -378,7 +378,7 @@
 		var me = this;
 		var $items = this.wrapper.find("#cart tbody").empty();
 
-		$.each(wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
+		$.each(frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
 			this.frm.cscript.fname, this.frm.doctype), function(i, d) {
 
 			$(repl('<tr id="%(item_code)s" data-selected="false">\
@@ -413,7 +413,7 @@
 	},
 	show_taxes: function() {
 		var me = this;
-		var taxes = wn.model.get_children(this.sales_or_purchase + " Taxes and Charges", 
+		var taxes = frappe.model.get_children(this.sales_or_purchase + " Taxes and Charges", 
 			this.frm.doc.name, this.frm.cscript.other_fname, this.frm.doctype);
 		$(this.wrapper).find(".tax-table")
 			.toggle((taxes && taxes.length) ? true : false)
@@ -510,7 +510,7 @@
 	add_item_thru_barcode: function() {
 		var me = this;
 		me.barcode_timeout = null;
-		wn.call({
+		frappe.call({
 			method: 'erpnext.accounts.doctype.sales_invoice.pos.get_item_code',
 			args: {barcode_serial_no: this.barcode.$input.val()},
 			callback: function(r) {
@@ -521,7 +521,7 @@
 						me.add_to_cart(r.message[0][0].name);
 				}
 				else
-					msgprint(wn._("Invalid Barcode"));
+					msgprint(frappe._("Invalid Barcode"));
 
 				me.refresh();
 			}
@@ -538,13 +538,13 @@
 			}
 		}
 
-		var child = wn.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
+		var child = frappe.model.get_children(this.frm.doctype + " Item", this.frm.doc.name, 
 			this.frm.cscript.fname, this.frm.doctype);
 
 		$.each(child, function(i, d) {
 			for (var i in selected_items) {
 				if (d.item_code == selected_items[i]) {
-					wn.model.clear_doc(d.doctype, d.name);
+					frappe.model.clear_doc(d.doctype, d.name);
 				}
 			}
 		});
@@ -563,9 +563,9 @@
 		var mode_of_payment = [];
 		
 		if (no_of_items == 0)
-			msgprint(wn._("Payment cannot be made for empty cart"));
+			msgprint(frappe._("Payment cannot be made for empty cart"));
 		else {
-			wn.call({
+			frappe.call({
 				method: 'erpnext.accounts.doctype.sales_invoice.pos.get_mode_of_payment',
 				callback: function(r) {
 					for (x=0; x<=r.message.length - 1; x++) {
@@ -573,7 +573,7 @@
 					}
 
 					// show payment wizard
-					var dialog = new wn.ui.Dialog({
+					var dialog = new frappe.ui.Dialog({
 						width: 400,
 						title: 'Payment', 
 						fields: [
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index aba7ad8..593996b 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_items(price_list, sales_or_purchase, item=None, item_group=None):
 	condition = ""
 	args = {"price_list": price_list}
@@ -21,7 +21,7 @@
 		condition += " and CONCAT(i.name, i.item_name) like %(name)s"
 		args["name"] = "%%%s%%" % item
 
-	return webnotes.conn.sql("""select i.name, i.item_name, i.image, 
+	return frappe.conn.sql("""select i.name, i.item_name, i.image, 
 		item_det.price_list_rate, item_det.currency 
 		from `tabItem` i LEFT JOIN 
 			(select item_code, price_list_rate, currency from 
@@ -31,22 +31,22 @@
 		where
 			%s""" % ('%(price_list)s', condition), args, as_dict=1)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_item_code(barcode_serial_no):
 	input_via = "serial_no"
-	item_code = webnotes.conn.sql("""select name, item_code from `tabSerial No` where 
+	item_code = frappe.conn.sql("""select name, item_code from `tabSerial No` where 
 		name=%s""", (barcode_serial_no), as_dict=1)
 
 	if not item_code:
 		input_via = "barcode"
-		item_code = webnotes.conn.sql("""select name from `tabItem` where barcode=%s""",
+		item_code = frappe.conn.sql("""select name from `tabItem` where barcode=%s""",
 			(barcode_serial_no), as_dict=1)
 
 	if item_code:
 		return item_code, input_via
 	else:
-		webnotes.throw("Invalid Barcode / Serial No")
+		frappe.throw("Invalid Barcode / Serial No")
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_mode_of_payment():
-	return webnotes.conn.sql("""select name from `tabMode of Payment`""", as_dict=1)
\ No newline at end of file
+	return frappe.conn.sql("""select name from `tabMode of Payment`""", as_dict=1)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 2b33bf0..ac9768b 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -14,7 +14,7 @@
 {% include 'utilities/doctype/sms_control/sms_control.js' %}
 {% include 'accounts/doctype/sales_invoice/pos.js' %}
 
-wn.provide("erpnext.accounts");
+frappe.provide("erpnext.accounts");
 erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.extend({
 	onload: function() {
 		this._super();
@@ -25,11 +25,11 @@
 		}
 		
 		// toggle to pos view if is_pos is 1 in user_defaults
-		if ((cint(wn.defaults.get_user_defaults("is_pos"))===1 || this.frm.doc.is_pos)) {
+		if ((cint(frappe.defaults.get_user_defaults("is_pos"))===1 || this.frm.doc.is_pos)) {
 			if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) {
 				this.frm.set_value("is_pos", 1);
 				this.is_pos(function() {
-					if (cint(wn.defaults.get_user_defaults("fs_pos_view"))===1)
+					if (cint(frappe.defaults.get_user_defaults("fs_pos_view"))===1)
 						cur_frm.cscript.toggle_pos(true);
 				});
 			}
@@ -50,20 +50,20 @@
 
 		if(doc.docstatus==1) {
 			cur_frm.appframe.add_button('View Ledger', function() {
-				wn.route_options = {
+				frappe.route_options = {
 					"voucher_no": doc.name,
 					"from_date": doc.posting_date,
 					"to_date": doc.posting_date,
 					"company": doc.company,
 					group_by_voucher: 0
 				};
-				wn.set_route("query-report", "General Ledger");
+				frappe.set_route("query-report", "General Ledger");
 			}, "icon-table");
 			
 			var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100);
 			cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid);
 
-			cur_frm.appframe.add_button(wn._('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone');
+			cur_frm.appframe.add_button(frappe._('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone');
 
 			if(cint(doc.update_stock)!=1) {
 				// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
@@ -74,11 +74,11 @@
 					});
 				
 				if(!from_delivery_note)
-					cur_frm.appframe.add_primary_action(wn._('Make Delivery'), cur_frm.cscript['Make Delivery Note'])
+					cur_frm.appframe.add_primary_action(frappe._('Make Delivery'), cur_frm.cscript['Make Delivery Note'])
 			}
 
 			if(doc.outstanding_amount!=0)
-				cur_frm.appframe.add_primary_action(wn._('Make Payment Entry'), cur_frm.cscript.make_bank_voucher);
+				cur_frm.appframe.add_primary_action(frappe._('Make Payment Entry'), cur_frm.cscript.make_bank_voucher);
 		}
 
 		// Show buttons only when pos view is active
@@ -89,9 +89,9 @@
 	},
 
 	sales_order_btn: function() {
-		this.$sales_order_btn = cur_frm.appframe.add_primary_action(wn._('From Sales Order'), 
+		this.$sales_order_btn = cur_frm.appframe.add_primary_action(frappe._('From Sales Order'), 
 			function() {
-				wn.model.map_current_doc({
+				frappe.model.map_current_doc({
 					method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
 					source_doctype: "Sales Order",
 					get_query_filters: {
@@ -106,9 +106,9 @@
 	},
 
 	delivery_note_btn: function() {
-		this.$delivery_note_btn = cur_frm.appframe.add_primary_action(wn._('From Delivery Note'), 
+		this.$delivery_note_btn = cur_frm.appframe.add_primary_action(frappe._('From Delivery Note'), 
 			function() {
-				wn.model.map_current_doc({
+				frappe.model.map_current_doc({
 					method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
 					source_doctype: "Delivery Note",
 					get_query: function() {
@@ -134,7 +134,7 @@
 		if(cint(this.frm.doc.is_pos)) {
 			if(!this.frm.doc.company) {
 				this.frm.set_value("is_pos", 0);
-				msgprint(wn._("Please specify Company to proceed"));
+				msgprint(frappe._("Please specify Company to proceed"));
 			} else {
 				var me = this;
 				return this.frm.call({
@@ -179,7 +179,7 @@
 	
 	write_off_outstanding_amount_automatically: function() {
 		if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
-			wn.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
+			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
 			// this will make outstanding amount 0
 			this.frm.set_value("write_off_amount", 
 				flt(this.frm.doc.grand_total - this.frm.doc.paid_amount), precision("write_off_amount"));
@@ -198,7 +198,7 @@
 	},
 	
 	entries_add: function(doc, cdt, cdn) {
-		var row = wn.model.get_doc(cdt, cdn);
+		var row = frappe.model.get_doc(cdt, cdn);
 		this.frm.script_manager.copy_from_first_row("entries", row, ["income_account", "cost_center"]);
 	},
 	
@@ -233,7 +233,7 @@
 	} else {
 		hide_field('payments_section');
 		for (i in par_flds) {
-			var docfield = wn.meta.docfield_map[doc.doctype][par_flds[i]];
+			var docfield = frappe.meta.docfield_map[doc.doctype][par_flds[i]];
 			if(!docfield.hidden) unhide_field(par_flds[i]);
 		}
 		cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, true);
@@ -244,7 +244,7 @@
 		(cint(doc.update_stock)==1 ? true : false));
 	
 	// India related fields
-	var cp = wn.control_panel;
+	var cp = frappe.control_panel;
 	if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
 	else hide_field(['c_form_applicable', 'c_form_no']);
 	
@@ -269,21 +269,21 @@
 }
 
 cur_frm.cscript['Make Delivery Note'] = function() {
-	wn.model.open_mapped_doc({
+	frappe.model.open_mapped_doc({
 		method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_delivery_note",
 		source_name: cur_frm.doc.name
 	})
 }
 
 cur_frm.cscript.make_bank_voucher = function() {
-	return wn.call({
+	return frappe.call({
 		method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_payment_entry_from_sales_invoice",
 		args: {
 			"sales_invoice": cur_frm.doc.name
 		},
 		callback: function(r) {
-			var doclist = wn.model.sync(r.message);
-			wn.set_route("Form", doclist[0].doctype, doclist[0].name);
+			var doclist = frappe.model.sync(r.message);
+			frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
 		}
 	});
 }
@@ -400,8 +400,8 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings.sales_invoice)) {
-		cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message);
+	if(cint(frappe.boot.notification_settings.sales_invoice)) {
+		cur_frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
 	}
 }
 
@@ -409,12 +409,12 @@
 	// set default values for recurring invoices
 	if(doc.convert_into_recurring_invoice) {
 		var owner_email = doc.owner=="Administrator"
-			? wn.user_info("Administrator").email
+			? frappe.user_info("Administrator").email
 			: doc.owner;
 		
 		doc.notification_email_address = $.map([cstr(owner_email),
 			cstr(doc.contact_email)], function(v) { return v || null; }).join(", ");
-		doc.repeat_on_day_of_month = wn.datetime.str_to_obj(doc.posting_date).getDate();
+		doc.repeat_on_day_of_month = frappe.datetime.str_to_obj(doc.posting_date).getDate();
 	}
 		
 	refresh_many(["notification_email_address", "repeat_on_day_of_month"]);
@@ -428,9 +428,9 @@
 
 		var months = recurring_type_map[doc.recurring_type];
 		if(months) {
-			var to_date = wn.datetime.add_months(doc.invoice_period_from_date,
+			var to_date = frappe.datetime.add_months(doc.invoice_period_from_date,
 				months);
-			doc.invoice_period_to_date = wn.datetime.add_days(to_date, -1);
+			doc.invoice_period_to_date = frappe.datetime.add_days(to_date, -1);
 			refresh_field('invoice_period_to_date');
 		}
 	}
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 165d483..bd82a3c 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -2,17 +2,17 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.defaults
+import frappe
+import frappe.defaults
 
-from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \
+from frappe.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, \
 	get_first_day, get_last_day
 
-from webnotes.utils import comma_and, get_url
-from webnotes.model.doc import make_autoname
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import _, msgprint
+from frappe.utils import comma_and, get_url
+from frappe.model.doc import make_autoname
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import _, msgprint
 
 from erpnext.accounts.party import get_party_account, get_due_date
 
@@ -160,16 +160,16 @@
 	def update_time_log_batch(self, sales_invoice):
 		for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
 			if d.time_log_batch:
-				tlb = webnotes.bean("Time Log Batch", d.time_log_batch)
+				tlb = frappe.bean("Time Log Batch", d.time_log_batch)
 				tlb.doc.sales_invoice = sales_invoice
 				tlb.update_after_submit()
 
 	def validate_time_logs_are_submitted(self):
 		for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
 			if d.time_log_batch:
-				status = webnotes.conn.get_value("Time Log Batch", d.time_log_batch, "status")
+				status = frappe.conn.get_value("Time Log Batch", d.time_log_batch, "status")
 				if status!="Submitted":
-					webnotes.msgprint(_("Time Log Batch status must be 'Submitted'") + ":" + d.time_log_batch,
+					frappe.msgprint(_("Time Log Batch status must be 'Submitted'") + ":" + d.time_log_batch,
 						raise_exception=True)
 
 	def set_pos_fields(self, for_validate=False):
@@ -202,7 +202,7 @@
 
 			# fetch terms	
 			if self.doc.tc_name and not self.doc.terms:
-				self.doc.terms = webnotes.conn.get_value("Terms and Conditions", self.doc.tc_name, "terms")
+				self.doc.terms = frappe.conn.get_value("Terms and Conditions", self.doc.tc_name, "terms")
 			
 			# fetch charges
 			if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})):
@@ -213,7 +213,7 @@
 			"Sales Invoice Advance", "advance_adjustment_details", "credit")
 		
 	def get_company_abbr(self):
-		return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+		return frappe.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
 
 	def update_against_document_in_jv(self):
 		"""
@@ -246,7 +246,7 @@
 	def validate_customer_account(self):
 		"""Validates Debit To Account and Customer Matches"""
 		if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
-			acc_head = webnotes.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
+			acc_head = frappe.conn.sql("select master_name from `tabAccount` where name = %s and docstatus != 2", self.doc.debit_to)
 			
 			if (acc_head and cstr(acc_head[0][0]) != cstr(self.doc.customer)) or \
 				(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
@@ -255,7 +255,7 @@
 
 
 	def validate_debit_acc(self):
-		acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
+		acc = frappe.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
 		if not acc:
 			msgprint("Account: "+ self.doc.debit_to + " does not exist")
 			raise Exception
@@ -270,8 +270,8 @@
 	def validate_fixed_asset_account(self):
 		"""Validate Fixed Asset Account and whether Income Account Entered Exists"""
 		for d in getlist(self.doclist,'entries'):
-			item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())"% d.item_code)
-			acc =	webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
+			item = frappe.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life >	now())"% d.item_code)
+			acc =	frappe.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
 			if not acc:
 				msgprint("Account: "+d.income_account+" does not exist in the system", raise_exception=True)
 			elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
@@ -291,7 +291,7 @@
 			},
 		})
 		
-		if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
+		if cint(frappe.defaults.get_global_default('maintain_same_sales_rate')):
 			super(DocType, self).validate_with_previous_doc(self.tname, {
 				"Sales Order Item": {
 					"ref_dn_field": "so_detail",
@@ -332,9 +332,9 @@
 		"""check in manage account if sales order / delivery note required or not."""
 		dic = {'Sales Order':'so_required','Delivery Note':'dn_required'}
 		for i in dic:
-			if webnotes.conn.get_value('Selling Settings', None, dic[i]) == 'Yes':
+			if frappe.conn.get_value('Selling Settings', None, dic[i]) == 'Yes':
 				for d in getlist(self.doclist,'entries'):
-					if webnotes.conn.get_value('Item', d.item_code, 'is_stock_item') == 'Yes' \
+					if frappe.conn.get_value('Item', d.item_code, 'is_stock_item') == 'Yes' \
 						and not d.fields[i.lower().replace(' ','_')]:
 						msgprint("%s is mandatory for stock item which is not mentioed against item: %s"%(i,d.item_code), raise_exception=1)
 
@@ -342,7 +342,7 @@
 	def validate_proj_cust(self):
 		"""check for does customer belong to same project as entered.."""
 		if self.doc.project_name and self.doc.customer:
-			res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+			res = frappe.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
 			if not res:
 				msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in that project."%(self.doc.customer,self.doc.project_name))
 				raise Exception
@@ -353,7 +353,7 @@
 			raise Exception
 		if flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) \
 				- flt(self.doc.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
-			webnotes.throw(_("""(Paid amount + Write Off Amount) can not be \
+			frappe.throw(_("""(Paid amount + Write Off Amount) can not be \
 				greater than Grand Total"""))
 
 
@@ -377,28 +377,28 @@
 	def validate_c_form(self):
 		""" Blank C-form no if C-form applicable marked as 'No'"""
 		if self.doc.amended_from and self.doc.c_form_applicable == 'No' and self.doc.c_form_no:
-			webnotes.conn.sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
+			frappe.conn.sql("""delete from `tabC-Form Invoice Detail` where invoice_no = %s
 					and parent = %s""", (self.doc.amended_from,	self.doc.c_form_no))
 
-			webnotes.conn.set(self.doc, 'c_form_no', '')
+			frappe.conn.set(self.doc, 'c_form_no', '')
 			
 	def update_current_stock(self):
 		for d in getlist(self.doclist, 'entries'):
 			if d.item_code and d.warehouse:
-				bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+				bin = frappe.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
 				d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
 
 		for d in getlist(self.doclist, 'packing_details'):
-			bin = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code =	%s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+			bin = frappe.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code =	%s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
 			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
 			d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
 	 
 	
 	def get_warehouse(self):
-		w = webnotes.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (webnotes.session['user'], self.doc.company))
+		w = frappe.conn.sql("select warehouse from `tabPOS Setting` where ifnull(user,'') = '%s' and company = '%s'" % (frappe.session['user'], self.doc.company))
 		w = w and w[0][0] or ''
 		if not w:
-			ps = webnotes.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
+			ps = frappe.conn.sql("select name, warehouse from `tabPOS Setting` where ifnull(user,'') = '' and company = '%s'" % self.doc.company)
 			if not ps:
 				msgprint("To make POS entry, please create POS Setting from Accounts --> POS Setting page and refresh the system.", raise_exception=True)
 			elif not ps[0][1]:
@@ -425,25 +425,25 @@
 		if cint(self.doc.is_pos) == 1:
 			if flt(self.doc.paid_amount) == 0:
 				if self.doc.cash_bank_account: 
-					webnotes.conn.set(self.doc, 'paid_amount', 
+					frappe.conn.set(self.doc, 'paid_amount', 
 						(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
 				else:
 					# show message that the amount is not paid
-					webnotes.conn.set(self.doc,'paid_amount',0)
-					webnotes.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.")
+					frappe.conn.set(self.doc,'paid_amount',0)
+					frappe.msgprint("Note: Payment Entry will not be created since 'Cash/Bank Account' was not specified.")
 		else:
-			webnotes.conn.set(self.doc,'paid_amount',0)
+			frappe.conn.set(self.doc,'paid_amount',0)
 		
 	def check_prev_docstatus(self):
 		for d in getlist(self.doclist,'entries'):
 			if d.sales_order:
-				submitted = webnotes.conn.sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
+				submitted = frappe.conn.sql("select name from `tabSales Order` where docstatus = 1 and name = '%s'" % d.sales_order)
 				if not submitted:
 					msgprint("Sales Order : "+ cstr(d.sales_order) +" is not submitted")
 					raise Exception , "Validation Error."
 
 			if d.delivery_note:
-				submitted = webnotes.conn.sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
+				submitted = frappe.conn.sql("select name from `tabDelivery Note` where docstatus = 1 and name = '%s'" % d.delivery_note)
 				if not submitted:
 					msgprint("Delivery Note : "+ cstr(d.delivery_note) +" is not submitted")
 					raise Exception , "Validation Error."
@@ -451,11 +451,11 @@
 	def update_stock_ledger(self):
 		sl_entries = []
 		for d in self.get_item_list():
-			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
+			if frappe.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
 					and d.warehouse:
 				sl_entries.append(self.get_sl_entries(d, {
 					"actual_qty": -1*flt(d.qty),
-					"stock_uom": webnotes.conn.get_value("Item", d.item_code, "stock_uom")
+					"stock_uom": frappe.conn.get_value("Item", d.item_code, "stock_uom")
 				}))
 		
 		self.make_sl_entries(sl_entries)
@@ -472,7 +472,7 @@
 				update_outstanding=update_outstanding, merge_entries=False)
 			
 			if update_gl_entries_after and cint(self.doc.update_stock) \
-				and cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
+				and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
 					self.update_gl_entries_after()
 				
 	def get_gl_entries(self, warehouse_account=None):
@@ -534,7 +534,7 @@
 				)
 				
 		# expense account gl entries
-		if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
+		if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \
 				and cint(self.doc.update_stock):
 			gl_entries += super(DocType, self).get_gl_entries()
 				
@@ -584,7 +584,7 @@
 	def update_c_form(self):
 		"""Update amended id in C-form"""
 		if self.doc.c_form_no and self.doc.amended_from:
-			webnotes.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
+			frappe.conn.sql("""update `tabC-Form Invoice Detail` set invoice_no = %s,
 				invoice_date = %s, territory = %s, net_total = %s,
 				grand_total = %s where invoice_no = %s and parent = %s""", 
 				(self.doc.name, self.doc.amended_from, self.doc.c_form_no))
@@ -592,7 +592,7 @@
 	@property
 	def meta(self):
 		if not hasattr(self, "_meta"):
-			self._meta = webnotes.get_doctype(self.doc.doctype)
+			self._meta = frappe.get_doctype(self.doc.doctype)
 		return self._meta
 	
 	def validate_recurring_invoice(self):
@@ -613,13 +613,13 @@
 	def convert_to_recurring(self):
 		if self.doc.convert_into_recurring_invoice:
 			if not self.doc.recurring_id:
-				webnotes.conn.set(self.doc, "recurring_id",
+				frappe.conn.set(self.doc, "recurring_id",
 					make_autoname("RECINV/.#####"))
 			
 			self.set_next_date()
 
 		elif self.doc.recurring_id:
-			webnotes.conn.sql("""update `tabSales Invoice`
+			frappe.conn.sql("""update `tabSales Invoice`
 				set convert_into_recurring_invoice = 0
 				where recurring_id = %s""", (self.doc.recurring_id,))
 			
@@ -628,7 +628,7 @@
 			email_list = filter(None, [cstr(email).strip() for email in
 				self.doc.notification_email_address.replace("\n", "").split(",")])
 			
-			from webnotes.utils import validate_email_add
+			from frappe.utils import validate_email_add
 			for email in email_list:
 				if not validate_email_add(email):
 					msgprint(self.meta.get_label("notification_email_address") \
@@ -649,7 +649,7 @@
 		next_date = get_next_date(self.doc.posting_date,
 			month_map[self.doc.recurring_type], cint(self.doc.repeat_on_day_of_month))
 		
-		webnotes.conn.set(self.doc, 'next_date', next_date)
+		frappe.conn.set(self.doc, 'next_date', next_date)
 	
 def get_next_date(dt, mcount, day=None):
 	dt = getdate(dt)
@@ -665,43 +665,43 @@
 		and notify the concerned people
 	"""
 	next_date = next_date or nowdate()
-	recurring_invoices = webnotes.conn.sql("""select name, recurring_id
+	recurring_invoices = frappe.conn.sql("""select name, recurring_id
 		from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0)=1
 		and docstatus=1 and next_date=%s
 		and next_date <= ifnull(end_date, '2199-12-31')""", next_date)
 	
 	exception_list = []
 	for ref_invoice, recurring_id in recurring_invoices:
-		if not webnotes.conn.sql("""select name from `tabSales Invoice`
+		if not frappe.conn.sql("""select name from `tabSales Invoice`
 				where posting_date=%s and recurring_id=%s and docstatus=1""",
 				(next_date, recurring_id)):
 			try:
-				ref_wrapper = webnotes.bean('Sales Invoice', ref_invoice)
+				ref_wrapper = frappe.bean('Sales Invoice', ref_invoice)
 				new_invoice_wrapper = make_new_invoice(ref_wrapper, next_date)
 				send_notification(new_invoice_wrapper)
 				if commit:
-					webnotes.conn.commit()
+					frappe.conn.commit()
 			except:
 				if commit:
-					webnotes.conn.rollback()
+					frappe.conn.rollback()
 
-					webnotes.conn.begin()
-					webnotes.conn.sql("update `tabSales Invoice` set \
+					frappe.conn.begin()
+					frappe.conn.sql("update `tabSales Invoice` set \
 						convert_into_recurring_invoice = 0 where name = %s", ref_invoice)
 					notify_errors(ref_invoice, ref_wrapper.doc.customer, ref_wrapper.doc.owner)
-					webnotes.conn.commit()
+					frappe.conn.commit()
 
-				exception_list.append(webnotes.get_traceback())
+				exception_list.append(frappe.get_traceback())
 			finally:
 				if commit:
-					webnotes.conn.begin()
+					frappe.conn.begin()
 			
 	if exception_list:
 		exception_message = "\n\n".join([cstr(d) for d in exception_list])
 		raise Exception, exception_message
 
 def make_new_invoice(ref_wrapper, posting_date):
-	from webnotes.model.bean import clone
+	from frappe.model.bean import clone
 	from erpnext.accounts.utils import get_fiscal_year
 	new_invoice = clone(ref_wrapper)
 	
@@ -738,17 +738,17 @@
 def send_notification(new_rv):
 	"""Notify concerned persons about recurring invoice generation"""
 	
-	from webnotes.core.doctype.print_format.print_format import get_html
-	webnotes.sendmail(new_rv.doc.notification_email_address, 
+	from frappe.core.doctype.print_format.print_format import get_html
+	frappe.sendmail(new_rv.doc.notification_email_address, 
 		subject="New Invoice : " + new_rv.doc.name, 
 		message = get_html(new_rv.doc, new_rv.doclist, "SalesInvoice"))
 		
 def notify_errors(inv, customer, owner):
-	from webnotes.profile import get_system_managers
+	from frappe.profile import get_system_managers
 	
-	webnotes.sendmail(recipients=get_system_managers() + [webnotes.conn.get_value("Profile", owner, "email")],
+	frappe.sendmail(recipients=get_system_managers() + [frappe.conn.get_value("Profile", owner, "email")],
 		subject="[Urgent] Error while creating recurring invoice for %s" % inv,
-		message = webnotes.get_template("template/emails/recurring_invoice_failed.html").render({
+		message = frappe.get_template("template/emails/recurring_invoice_failed.html").render({
 			"name": inv,
 			"customer": customer
 		}))
@@ -757,7 +757,7 @@
 
 def assign_task_to_owner(inv, msg, users):
 	for d in users:
-		from webnotes.widgets.form import assign_to
+		from frappe.widgets.form import assign_to
 		args = {
 			'assign_to' 	:	d,
 			'doctype'		:	'Sales Invoice',
@@ -767,23 +767,23 @@
 		}
 		assign_to.add(args)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_bank_cash_account(mode_of_payment):
-	val = webnotes.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
+	val = frappe.conn.get_value("Mode of Payment", mode_of_payment, "default_account")
 	if not val:
-		webnotes.msgprint("Default Bank / Cash Account not set in Mode of Payment: %s. Please add a Default Account in Mode of Payment master." % mode_of_payment)
+		frappe.msgprint("Default Bank / Cash Account not set in Mode of Payment: %s. Please add a Default Account in Mode of Payment master." % mode_of_payment)
 	return {
 		"cash_bank_account": val
 	}
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_income_account(doctype, txt, searchfield, start, page_len, filters):
 	from erpnext.controllers.queries import get_match_cond
 
 	# income account can be any Credit account, 
 	# but can also be a Asset account with account_type='Income Account' in special circumstances. 
 	# Hence the first condition is an "OR"
-	return webnotes.conn.sql("""select tabAccount.name from `tabAccount` 
+	return frappe.conn.sql("""select tabAccount.name from `tabAccount` 
 			where (tabAccount.debit_or_credit="Credit" 
 					or tabAccount.account_type = "Income Account") 
 				and tabAccount.group_or_ledger="Ledger" 
@@ -796,12 +796,12 @@
 			'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
 
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_delivery_note(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
-		bean = webnotes.bean(target)
+		bean = frappe.bean(target)
 		bean.run_method("onload_post_render")
 		
 	def update_item(source_doc, target_doc, source_parent):
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
index 4f32619..2f7727e 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 // render
-wn.listview_settings['Sales Invoice'] = {
+frappe.listview_settings['Sales Invoice'] = {
 	add_fields: ["`tabSales Invoice`.grand_total", "`tabSales Invoice`.outstanding_amount"],
 	add_columns: [{"content":"Percent Paid", width:"10%", type:"bar-graph",
 		label: "Payment Received"}],
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js
index 71bbdb6..79036f9 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_map.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.model.map_info["Sales Invoice"] = {
+frappe.model.map_info["Sales Invoice"] = {
 	"Time Log Batch": {
 		table_map: {
 			"Sales Invoice Item": "Time Log Batch",
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index d2aac03..f6a67f9 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -1,38 +1,38 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
+import frappe
 import unittest, json
-from webnotes.utils import flt
-from webnotes.model.bean import DocstatusTransitionError, TimestampMismatchError
+from frappe.utils import flt
+from frappe.model.bean import DocstatusTransitionError, TimestampMismatchError
 from erpnext.accounts.utils import get_stock_and_account_difference
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 
 class TestSalesInvoice(unittest.TestCase):
 	def make(self):
-		w = webnotes.bean(copy=test_records[0])
+		w = frappe.bean(copy=test_records[0])
 		w.doc.is_pos = 0
 		w.insert()
 		w.submit()
 		return w
 		
 	def test_double_submission(self):
-		w = webnotes.bean(copy=test_records[0])
+		w = frappe.bean(copy=test_records[0])
 		w.doc.docstatus = '0'
 		w.insert()
 		
 		w2 = [d for d in w.doclist]
 		w.submit()
 		
-		w = webnotes.bean(w2)
+		w = frappe.bean(w2)
 		self.assertRaises(DocstatusTransitionError, w.submit)
 		
 	def test_timestamp_change(self):
-		w = webnotes.bean(copy=test_records[0])
+		w = frappe.bean(copy=test_records[0])
 		w.doc.docstatus = '0'
 		w.insert()
 
-		w2 = webnotes.bean([d.fields.copy() for d in w.doclist])
+		w2 = frappe.bean([d.fields.copy() for d in w.doclist])
 		
 		import time
 		time.sleep(1)
@@ -43,7 +43,7 @@
 		self.assertRaises(TimestampMismatchError, w2.save)
 		
 	def test_sales_invoice_calculation_base_currency(self):
-		si = webnotes.bean(copy=test_records[2])
+		si = frappe.bean(copy=test_records[2])
 		si.insert()
 		
 		expected_values = {
@@ -87,7 +87,7 @@
 		self.assertEquals(si.doc.grand_total_export, 1627.05)
 		
 	def test_sales_invoice_calculation_export_currency(self):
-		si = webnotes.bean(copy=test_records[2])
+		si = frappe.bean(copy=test_records[2])
 		si.doc.currency = "USD"
 		si.doc.conversion_rate = 50
 		si.doclist[1].rate = 1
@@ -137,7 +137,7 @@
 		self.assertEquals(si.doc.grand_total_export, 32.54)
 
 	def test_sales_invoice_discount_amount(self):
-		si = webnotes.bean(copy=test_records[3])
+		si = frappe.bean(copy=test_records[3])
 		si.doc.discount_amount = 104.95
 		si.doclist.append({
 			"doctype": "Sales Taxes and Charges",
@@ -194,7 +194,7 @@
 		self.assertEquals(si.doc.grand_total_export, 1500)
 
 	def test_discount_amount_gl_entry(self):
-		si = webnotes.bean(copy=test_records[3])
+		si = frappe.bean(copy=test_records[3])
 		si.doc.discount_amount = 104.95
 		si.doclist.append({
 			"doctype": "Sales Taxes and Charges",
@@ -210,7 +210,7 @@
 		si.insert()
 		si.submit()
 
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc""", si.doc.name, as_dict=1)
 
@@ -238,13 +238,13 @@
 		# cancel
 		si.cancel()
 
-		gle = webnotes.conn.sql("""select * from `tabGL Entry` 
+		gle = frappe.conn.sql("""select * from `tabGL Entry` 
 			where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
 
 		self.assertFalse(gle)
 
 	def test_inclusive_rate_validations(self):
-		si = webnotes.bean(copy=test_records[2])
+		si = frappe.bean(copy=test_records[2])
 		for i, tax in enumerate(si.doclist.get({"parentfield": "other_charges"})):
 			tax.idx = i+1
 		
@@ -254,15 +254,15 @@
 			si.doclist[i].included_in_print_rate = 1
 		
 		# tax type "Actual" cannot be inclusive
-		self.assertRaises(webnotes.ValidationError, si.insert)
+		self.assertRaises(frappe.ValidationError, si.insert)
 		
 		# taxes above included type 'On Previous Row Total' should also be included
 		si.doclist[3].included_in_print_rate = 0
-		self.assertRaises(webnotes.ValidationError, si.insert)
+		self.assertRaises(frappe.ValidationError, si.insert)
 		
 	def test_sales_invoice_calculation_base_currency_with_tax_inclusive_price(self):
 		# prepare
-		si = webnotes.bean(copy=test_records[3])
+		si = frappe.bean(copy=test_records[3])
 		si.insert()
 		
 		expected_values = {
@@ -307,7 +307,7 @@
 		
 	def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self):
 		# prepare
-		si = webnotes.bean(copy=test_records[3])
+		si = frappe.bean(copy=test_records[3])
 		si.doc.currency = "USD"
 		si.doc.conversion_rate = 50
 		si.doclist[1].price_list_rate = 55.56
@@ -363,55 +363,55 @@
 		self.assertEquals(w.doc.outstanding_amount, w.doc.grand_total)
 		
 	def test_payment(self):
-		webnotes.conn.sql("""delete from `tabGL Entry`""")
+		frappe.conn.sql("""delete from `tabGL Entry`""")
 		w = self.make()
 		
 		from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \
 			import test_records as jv_test_records
 			
-		jv = webnotes.bean(webnotes.copy_doclist(jv_test_records[0]))
+		jv = frappe.bean(frappe.copy_doclist(jv_test_records[0]))
 		jv.doclist[1].against_invoice = w.doc.name
 		jv.insert()
 		jv.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Sales Invoice", w.doc.name, "outstanding_amount"),
+		self.assertEquals(frappe.conn.get_value("Sales Invoice", w.doc.name, "outstanding_amount"),
 			161.8)
 	
 		jv.cancel()
-		self.assertEquals(webnotes.conn.get_value("Sales Invoice", w.doc.name, "outstanding_amount"),
+		self.assertEquals(frappe.conn.get_value("Sales Invoice", w.doc.name, "outstanding_amount"),
 			561.8)
 			
 	def test_time_log_batch(self):
-		tlb = webnotes.bean("Time Log Batch", "_T-Time Log Batch-00001")
+		tlb = frappe.bean("Time Log Batch", "_T-Time Log Batch-00001")
 		tlb.submit()
 		
-		si = webnotes.bean(webnotes.copy_doclist(test_records[0]))
+		si = frappe.bean(frappe.copy_doclist(test_records[0]))
 		si.doclist[1].time_log_batch = "_T-Time Log Batch-00001"
 		si.insert()
 		si.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Time Log Batch", "_T-Time Log Batch-00001",
+		self.assertEquals(frappe.conn.get_value("Time Log Batch", "_T-Time Log Batch-00001",
 		 	"status"), "Billed")
 
-		self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), 
+		self.assertEquals(frappe.conn.get_value("Time Log", "_T-Time Log-00001", "status"), 
 			"Billed")
 
 		si.cancel()
 
-		self.assertEquals(webnotes.conn.get_value("Time Log Batch", "_T-Time Log Batch-00001", 
+		self.assertEquals(frappe.conn.get_value("Time Log Batch", "_T-Time Log Batch-00001", 
 			"status"), "Submitted")
 
-		self.assertEquals(webnotes.conn.get_value("Time Log", "_T-Time Log-00001", "status"), 
+		self.assertEquals(frappe.conn.get_value("Time Log", "_T-Time Log-00001", "status"), 
 			"Batched for Billing")
 			
 	def test_sales_invoice_gl_entry_without_aii(self):
 		self.clear_stock_account_balance()
 		set_perpetual_inventory(0)
-		si = webnotes.bean(copy=test_records[1])
+		si = frappe.bean(copy=test_records[1])
 		si.insert()
 		si.submit()
 		
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc""", si.doc.name, as_dict=1)
 		
@@ -432,7 +432,7 @@
 		# cancel
 		si.cancel()
 		
-		gle = webnotes.conn.sql("""select * from `tabGL Entry` 
+		gle = frappe.conn.sql("""select * from `tabGL Entry` 
 			where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
 		
 		self.assertFalse(gle)
@@ -444,19 +444,19 @@
 		self._insert_purchase_receipt()
 		self._insert_pos_settings()
 		
-		pos = webnotes.copy_doclist(test_records[1])
+		pos = frappe.copy_doclist(test_records[1])
 		pos[0]["is_pos"] = 1
 		pos[0]["update_stock"] = 1
 		pos[0]["posting_time"] = "12:05"
 		pos[0]["cash_bank_account"] = "_Test Account Bank Account - _TC"
 		pos[0]["paid_amount"] = 600.0
 
-		si = webnotes.bean(copy=pos)
+		si = frappe.bean(copy=pos)
 		si.insert()
 		si.submit()
 		
 		# check stock ledger entries
-		sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry` 
+		sle = frappe.conn.sql("""select * from `tabStock Ledger Entry` 
 			where voucher_type = 'Sales Invoice' and voucher_no = %s""", 
 			si.doc.name, as_dict=1)[0]
 		self.assertTrue(sle)
@@ -464,12 +464,12 @@
 			["_Test Item", "_Test Warehouse - _TC", -1.0])
 		
 		# check gl entries
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc, debit asc""", si.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
 		
-		stock_in_hand = webnotes.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"})
+		stock_in_hand = frappe.conn.get_value("Account", {"master_name": "_Test Warehouse - _TC"})
 				
 		expected_gl_entries = sorted([
 			[si.doc.debit_to, 630.0, 0.0],
@@ -487,7 +487,7 @@
 			self.assertEquals(expected_gl_entries[i][2], gle.credit)
 		
 		si.cancel()
-		gle = webnotes.conn.sql("""select * from `tabGL Entry` 
+		gle = frappe.conn.sql("""select * from `tabGL Entry` 
 			where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
 		
 		self.assertFalse(gle)
@@ -499,28 +499,28 @@
 	def test_si_gl_entry_with_aii_and_update_stock_with_warehouse_but_no_account(self):
 		self.clear_stock_account_balance()
 		set_perpetual_inventory()
-		webnotes.delete_doc("Account", "_Test Warehouse No Account - _TC")
+		frappe.delete_doc("Account", "_Test Warehouse No Account - _TC")
 		
 		# insert purchase receipt
 		from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
 			as pr_test_records
-		pr = webnotes.bean(copy=pr_test_records[0])
+		pr = frappe.bean(copy=pr_test_records[0])
 		pr.doc.naming_series = "_T-Purchase Receipt-"
 		pr.doclist[1].warehouse = "_Test Warehouse No Account - _TC"
 		pr.insert()
 		pr.submit()
 		
-		si_doclist = webnotes.copy_doclist(test_records[1])
+		si_doclist = frappe.copy_doclist(test_records[1])
 		si_doclist[0]["update_stock"] = 1
 		si_doclist[0]["posting_time"] = "12:05"
 		si_doclist[1]["warehouse"] = "_Test Warehouse No Account - _TC"
 
-		si = webnotes.bean(copy=si_doclist)
+		si = frappe.bean(copy=si_doclist)
 		si.insert()
 		si.submit()
 		
 		# check stock ledger entries
-		sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry` 
+		sle = frappe.conn.sql("""select * from `tabStock Ledger Entry` 
 			where voucher_type = 'Sales Invoice' and voucher_no = %s""", 
 			si.doc.name, as_dict=1)[0]
 		self.assertTrue(sle)
@@ -528,7 +528,7 @@
 			["_Test Item", "_Test Warehouse No Account - _TC", -1.0])
 		
 		# check gl entries
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc, debit asc""", si.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
@@ -545,7 +545,7 @@
 			self.assertEquals(expected_gl_entries[i][2], gle.credit)
 				
 		si.cancel()
-		gle = webnotes.conn.sql("""select * from `tabGL Entry` 
+		gle = frappe.conn.sql("""select * from `tabGL Entry` 
 			where voucher_type='Sales Invoice' and voucher_no=%s""", si.doc.name)
 		
 		self.assertFalse(gle)
@@ -555,13 +555,13 @@
 		self.clear_stock_account_balance()
 		set_perpetual_inventory()
 				
-		si_copy = webnotes.copy_doclist(test_records[1])
+		si_copy = frappe.copy_doclist(test_records[1])
 		si_copy[1]["item_code"] = None
-		si = webnotes.bean(si_copy)		
+		si = frappe.bean(si_copy)		
 		si.insert()
 		si.submit()
 		
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc""", si.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
@@ -582,13 +582,13 @@
 	def test_sales_invoice_gl_entry_with_aii_non_stock_item(self):
 		self.clear_stock_account_balance()
 		set_perpetual_inventory()
-		si_copy = webnotes.copy_doclist(test_records[1])
+		si_copy = frappe.copy_doclist(test_records[1])
 		si_copy[1]["item_code"] = "_Test Non Stock Item"
-		si = webnotes.bean(si_copy)
+		si = frappe.bean(si_copy)
 		si.insert()
 		si.submit()
 		
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Sales Invoice' and voucher_no=%s
 			order by account asc""", si.doc.name, as_dict=1)
 		self.assertTrue(gl_entries)
@@ -609,7 +609,7 @@
 	def _insert_purchase_receipt(self):
 		from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
 			as pr_test_records
-		pr = webnotes.bean(copy=pr_test_records[0])
+		pr = frappe.bean(copy=pr_test_records[0])
 		pr.doc.naming_series = "_T-Purchase Receipt-"
 		pr.insert()
 		pr.submit()
@@ -617,7 +617,7 @@
 	def _insert_delivery_note(self):
 		from erpnext.stock.doctype.delivery_note.test_delivery_note import test_records \
 			as dn_test_records
-		dn = webnotes.bean(copy=dn_test_records[0])
+		dn = frappe.bean(copy=dn_test_records[0])
 		dn.doc.naming_series = "_T-Delivery Note-"
 		dn.insert()
 		dn.submit()
@@ -626,20 +626,20 @@
 	def _insert_pos_settings(self):
 		from erpnext.accounts.doctype.pos_setting.test_pos_setting \
 			import test_records as pos_setting_test_records
-		webnotes.conn.sql("""delete from `tabPOS Setting`""")
+		frappe.conn.sql("""delete from `tabPOS Setting`""")
 		
-		ps = webnotes.bean(copy=pos_setting_test_records[0])
+		ps = frappe.bean(copy=pos_setting_test_records[0])
 		ps.insert()
 		
 	def test_sales_invoice_with_advance(self):
 		from erpnext.accounts.doctype.journal_voucher.test_journal_voucher \
 			import test_records as jv_test_records
 			
-		jv = webnotes.bean(copy=jv_test_records[0])
+		jv = frappe.bean(copy=jv_test_records[0])
 		jv.insert()
 		jv.submit()
 		
-		si = webnotes.bean(copy=test_records[0])
+		si = frappe.bean(copy=test_records[0])
 		si.doclist.append({
 			"doctype": "Sales Invoice Advance",
 			"parentfield": "advance_adjustment_details",
@@ -653,24 +653,24 @@
 		si.submit()
 		si.load_from_db()
 		
-		self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_invoice=%s""", si.doc.name))
 		
-		self.assertTrue(webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_invoice=%s and credit=300""", si.doc.name))
 			
 		self.assertEqual(si.doc.outstanding_amount, 261.8)
 		
 		si.cancel()
 		
-		self.assertTrue(not webnotes.conn.sql("""select name from `tabJournal Voucher Detail`
+		self.assertTrue(not frappe.conn.sql("""select name from `tabJournal Voucher Detail`
 			where against_invoice=%s""", si.doc.name))
 			
 	def test_recurring_invoice(self):
-		from webnotes.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
+		from frappe.utils import get_first_day, get_last_day, add_to_date, nowdate, getdate
 		from erpnext.accounts.utils import get_fiscal_year
 		today = nowdate()
-		base_si = webnotes.bean(copy=test_records[0])
+		base_si = frappe.bean(copy=test_records[0])
 		base_si.doc.fields.update({
 			"convert_into_recurring_invoice": 1,
 			"recurring_type": "Monthly",
@@ -683,13 +683,13 @@
 		})
 		
 		# monthly
-		si1 = webnotes.bean(copy=base_si.doclist)
+		si1 = frappe.bean(copy=base_si.doclist)
 		si1.insert()
 		si1.submit()
 		self._test_recurring_invoice(si1, True)
 		
 		# monthly without a first and last day period
-		si2 = webnotes.bean(copy=base_si.doclist)
+		si2 = frappe.bean(copy=base_si.doclist)
 		si2.doc.fields.update({
 			"invoice_period_from_date": today,
 			"invoice_period_to_date": add_to_date(today, days=30)
@@ -699,7 +699,7 @@
 		self._test_recurring_invoice(si2, False)
 		
 		# quarterly
-		si3 = webnotes.bean(copy=base_si.doclist)
+		si3 = frappe.bean(copy=base_si.doclist)
 		si3.doc.fields.update({
 			"recurring_type": "Quarterly",
 			"invoice_period_from_date": get_first_day(today),
@@ -710,7 +710,7 @@
 		self._test_recurring_invoice(si3, True)
 		
 		# quarterly without a first and last day period
-		si4 = webnotes.bean(copy=base_si.doclist)
+		si4 = frappe.bean(copy=base_si.doclist)
 		si4.doc.fields.update({
 			"recurring_type": "Quarterly",
 			"invoice_period_from_date": today,
@@ -721,7 +721,7 @@
 		self._test_recurring_invoice(si4, False)
 		
 		# yearly
-		si5 = webnotes.bean(copy=base_si.doclist)
+		si5 = frappe.bean(copy=base_si.doclist)
 		si5.doc.fields.update({
 			"recurring_type": "Yearly",
 			"invoice_period_from_date": get_first_day(today),
@@ -732,7 +732,7 @@
 		self._test_recurring_invoice(si5, True)
 		
 		# yearly without a first and last day period
-		si6 = webnotes.bean(copy=base_si.doclist)
+		si6 = frappe.bean(copy=base_si.doclist)
 		si6.doc.fields.update({
 			"recurring_type": "Yearly",
 			"invoice_period_from_date": today,
@@ -743,7 +743,7 @@
 		self._test_recurring_invoice(si6, False)
 		
 		# change posting date but keep recuring day to be today
-		si7 = webnotes.bean(copy=base_si.doclist)
+		si7 = frappe.bean(copy=base_si.doclist)
 		si7.doc.fields.update({
 			"posting_date": add_to_date(today, days=-1)
 		})
@@ -755,14 +755,14 @@
 		self._test_recurring_invoice(si7, True)
 
 	def _test_recurring_invoice(self, base_si, first_and_last_day):
-		from webnotes.utils import add_months, get_last_day
+		from frappe.utils import add_months, get_last_day
 		from erpnext.accounts.doctype.sales_invoice.sales_invoice \
 			import manage_recurring_invoices, get_next_date
 		
 		no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_si.doc.recurring_type]
 		
 		def _test(i):
-			self.assertEquals(i+1, webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+			self.assertEquals(i+1, frappe.conn.sql("""select count(*) from `tabSales Invoice`
 				where recurring_id=%s and docstatus=1""", base_si.doc.recurring_id)[0][0])
 			
 			next_date = get_next_date(base_si.doc.posting_date, no_of_months, 
@@ -770,13 +770,13 @@
 
 			manage_recurring_invoices(next_date=next_date, commit=False)
 			
-			recurred_invoices = webnotes.conn.sql("""select name from `tabSales Invoice`
+			recurred_invoices = frappe.conn.sql("""select name from `tabSales Invoice`
 				where recurring_id=%s and docstatus=1 order by name desc""",
 				base_si.doc.recurring_id)
 			
 			self.assertEquals(i+2, len(recurred_invoices))
 			
-			new_si = webnotes.bean("Sales Invoice", recurred_invoices[0][0])
+			new_si = frappe.bean("Sales Invoice", recurred_invoices[0][0])
 			
 			for fieldname in ["convert_into_recurring_invoice", "recurring_type",
 				"repeat_on_day_of_month", "notification_email_address"]:
@@ -805,9 +805,9 @@
 			base_si = _test(i)
 			
 	def clear_stock_account_balance(self):
-		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
-		webnotes.conn.sql("delete from tabBin")
-		webnotes.conn.sql("delete from `tabGL Entry`")
+		frappe.conn.sql("delete from `tabStock Ledger Entry`")
+		frappe.conn.sql("delete from tabBin")
+		frappe.conn.sql("delete from `tabGL Entry`")
 
 	def test_serialized(self):
 		from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
@@ -816,7 +816,7 @@
 		se = make_serialized_item()
 		serial_nos = get_serial_nos(se.doclist[1].serial_no)
 		
-		si = webnotes.bean(copy=test_records[0])
+		si = frappe.bean(copy=test_records[0])
 		si.doc.update_stock = 1
 		si.doclist[1].item_code = "_Test Serialized Item With Series"
 		si.doclist[1].qty = 1
@@ -824,9 +824,9 @@
 		si.insert()
 		si.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], "status"), "Delivered")
-		self.assertFalse(webnotes.conn.get_value("Serial No", serial_nos[0], "warehouse"))
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], 
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], "status"), "Delivered")
+		self.assertFalse(frappe.conn.get_value("Serial No", serial_nos[0], "warehouse"))
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], 
 			"delivery_document_no"), si.doc.name)
 			
 		return si
@@ -838,9 +838,9 @@
 
 		serial_nos = get_serial_nos(si.doclist[1].serial_no)
 
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], "status"), "Available")
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
-		self.assertFalse(webnotes.conn.get_value("Serial No", serial_nos[0], 
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], "status"), "Available")
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
+		self.assertFalse(frappe.conn.get_value("Serial No", serial_nos[0], 
 			"delivery_document_no"))
 
 	def test_serialize_status(self):
@@ -850,11 +850,11 @@
 		se = make_serialized_item()
 		serial_nos = get_serial_nos(se.doclist[1].serial_no)
 		
-		sr = webnotes.bean("Serial No", serial_nos[0])
+		sr = frappe.bean("Serial No", serial_nos[0])
 		sr.doc.status = "Not Available"
 		sr.save()
 		
-		si = webnotes.bean(copy=test_records[0])
+		si = frappe.bean(copy=test_records[0])
 		si.doc.update_stock = 1
 		si.doclist[1].item_code = "_Test Serialized Item With Series"
 		si.doclist[1].qty = 1
diff --git a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
+++ b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
index cb6190f..26c87f1 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
index 6234563..f33eb27 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js
@@ -9,7 +9,7 @@
 }
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-	cur_frm.set_footnote(wn.markdown(cur_frm.meta.description));
+	cur_frm.set_footnote(frappe.markdown(cur_frm.meta.description));
 }
 
 // For customizing print
@@ -48,7 +48,7 @@
 	}
 	
 	function print_hide(fieldname) {
-		var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name);
+		var doc_field = frappe.meta.get_docfield(doc.doctype, fieldname, doc.name);
 		return doc_field.print_hide;
 	}
 	
@@ -100,7 +100,7 @@
 cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')) {
-		msgprint(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"));
+		msgprint(frappe._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"));
 		d.charge_type = '';
 	}
 	validated = false;
@@ -113,16 +113,16 @@
 cur_frm.cscript.row_id = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if(!d.charge_type && d.row_id) {
-		msgprint(wn._("Please select Charge Type first"));
+		msgprint(frappe._("Please select Charge Type first"));
 		d.row_id = '';
 	}
 	else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
-		msgprint(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'"));
+		msgprint(frappe._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'"));
 		d.row_id = '';
 	}
 	else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id) {
 		if(d.row_id >= d.idx){
-			msgprint(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type"));
+			msgprint(frappe._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type"));
 			d.row_id = '';
 		}
 	}
@@ -153,7 +153,7 @@
 cur_frm.cscript.rate = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if(!d.charge_type && d.rate) {
-		msgprint(wn._("Please select Charge Type first"));
+		msgprint(frappe._("Please select Charge Type first"));
 		d.rate = '';
 	}
 	validated = false;
@@ -163,11 +163,11 @@
 cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if(!d.charge_type && d.tax_amount) {
-		msgprint(wn._("Please select Charge Type first"));
+		msgprint(frappe._("Please select Charge Type first"));
 		d.tax_amount = '';
 	}
 	else if(d.charge_type && d.tax_amount) {
-		msgprint(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate"));
+		msgprint(frappe._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate"));
 		d.tax_amount = '';
 	}
 	validated = false;
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py
index 82412c6..6c1a877 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py
@@ -2,14 +2,14 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint
-from webnotes.model.controller import DocListController
+import frappe
+from frappe.utils import cint
+from frappe.model.controller import DocListController
 
 class DocType(DocListController):		
 	def validate(self):
 		if self.doc.is_default == 1:
-			webnotes.conn.sql("""update `tabSales Taxes and Charges Master` set is_default = 0 
+			frappe.conn.sql("""update `tabSales Taxes and Charges Master` set is_default = 0 
 				where ifnull(is_default,0) = 1 and name != %s and company = %s""", 
 				(self.doc.name, self.doc.company))
 				
diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py
index 5c084f3..fe5d7f9 100644
--- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py
+++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py
@@ -4,15 +4,15 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.utils import flt, fmt_money
-from webnotes.model.controller import DocListController
+import frappe
+from frappe import _, msgprint
+from frappe.utils import flt, fmt_money
+from frappe.model.controller import DocListController
 from erpnext.setup.utils import get_company_currency
 
-class OverlappingConditionError(webnotes.ValidationError): pass
-class FromGreaterThanToError(webnotes.ValidationError): pass
-class ManyBlankToValuesError(webnotes.ValidationError): pass
+class OverlappingConditionError(frappe.ValidationError): pass
+class FromGreaterThanToError(frappe.ValidationError): pass
+class ManyBlankToValuesError(frappe.ValidationError): pass
 
 class DocType(DocListController):
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
index ad99a51..4085347 100644
--- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
+++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
@@ -1,18 +1,18 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
+import frappe
 import unittest
 from erpnext.accounts.doctype.shipping_rule.shipping_rule import FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError
 
 class TestShippingRule(unittest.TestCase):
 	def test_from_greater_than_to(self):
-		shipping_rule = webnotes.bean(copy=test_records[0])
+		shipping_rule = frappe.bean(copy=test_records[0])
 		shipping_rule.doclist[1].from_value = 101
 		self.assertRaises(FromGreaterThanToError, shipping_rule.insert)
 		
 	def test_many_zero_to_values(self):
-		shipping_rule = webnotes.bean(copy=test_records[0])
+		shipping_rule = frappe.bean(copy=test_records[0])
 		shipping_rule.doclist[1].to_value = 0
 		self.assertRaises(ManyBlankToValuesError, shipping_rule.insert)
 		
@@ -24,7 +24,7 @@
 			((50, 150), (25, 175)),
 			((50, 150), (50, 150)),
 		]:
-			shipping_rule = webnotes.bean(copy=test_records[0])
+			shipping_rule = frappe.bean(copy=test_records[0])
 			shipping_rule.doclist[1].from_value = range_a[0]
 			shipping_rule.doclist[1].to_value = range_a[1]
 			shipping_rule.doclist[2].from_value = range_b[0]
diff --git a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
index e5468e5..968a25b 100644
--- a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
+++ b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 5451642..d0c8aaf 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt, cstr
-from webnotes import _
+import frappe
+from frappe.utils import flt, cstr
+from frappe import _
 from erpnext.accounts.utils import validate_expense_against_budget
 
 
-class StockAccountInvalidTransaction(webnotes.ValidationError): pass
+class StockAccountInvalidTransaction(frappe.ValidationError): pass
 
 def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, 
 		update_outstanding='Yes'):
@@ -77,7 +77,7 @@
 	
 def make_entry(args, adv_adj, update_outstanding):
 	args.update({"doctype": "GL Entry"})
-	gle = webnotes.bean([args])
+	gle = frappe.bean([args])
 	gle.ignore_permissions = 1
 	gle.insert()
 	gle.run_method("on_update_with_args", adv_adj, update_outstanding)
@@ -85,17 +85,17 @@
 	
 def validate_total_debit_credit(total_debit, total_credit):
 	if abs(total_debit - total_credit) > 0.005:
-		webnotes.throw(_("Debit and Credit not equal for this voucher: Diff (Debit) is ") +
+		frappe.throw(_("Debit and Credit not equal for this voucher: Diff (Debit) is ") +
 		 	cstr(total_debit - total_credit))
 			
 def validate_account_for_auto_accounting_for_stock(gl_map):
 	if gl_map[0].voucher_type=="Journal Voucher":
-		aii_accounts = [d[0] for d in webnotes.conn.sql("""select name from tabAccount 
+		aii_accounts = [d[0] for d in frappe.conn.sql("""select name from tabAccount 
 			where account_type = 'Warehouse' and ifnull(master_name, '')!=''""")]
 		
 		for entry in gl_map:
 			if entry.account in aii_accounts:
-				webnotes.throw(_("Account") + ": " + entry.account + 
+				frappe.throw(_("Account") + ": " + entry.account + 
 					_(" can only be debited/credited through Stock transactions"), 
 					StockAccountInvalidTransaction)
 	
@@ -107,12 +107,12 @@
 		check_freezing_date, update_outstanding_amt, validate_frozen_account
 		
 	if not gl_entries:
-		gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` 
+		gl_entries = frappe.conn.sql("""select * from `tabGL Entry` 
 			where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no), as_dict=True)
 	if gl_entries:
 		check_freezing_date(gl_entries[0]["posting_date"], adv_adj)
 	
-	webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", 
+	frappe.conn.sql("""delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", 
 		(voucher_type or gl_entries[0]["voucher_type"], voucher_no or gl_entries[0]["voucher_no"]))
 	
 	for entry in gl_entries:
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index c421332..9500a70 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -8,7 +8,7 @@
 // see ledger
 
 pscript['onload_Accounts Browser'] = function(wrapper){
-	wn.ui.make_app_page({
+	frappe.ui.make_app_page({
 		parent: wrapper,
 		single_column: true
 	})
@@ -20,30 +20,30 @@
 			.css({"margin-bottom": "15px", "min-height": "200px"})
 			.appendTo(main),
 		help_area = $('<div class="well">'+
-		'<h4>'+wn._('Quick Help')+'</h4>'+
+		'<h4>'+frappe._('Quick Help')+'</h4>'+
 		'<ol>'+
-			'<li>'+wn._('To add child nodes, explore tree and click on the node under which you want to add more nodes.')+'</li>'+
+			'<li>'+frappe._('To add child nodes, explore tree and click on the node under which you want to add more nodes.')+'</li>'+
 			'<li>'+
-			      wn._('Accounting Entries can be made against leaf nodes, called')+
-				 '<b>' +wn._('Ledgers')+'</b>.'+ wn._('Entries against') +
-				 '<b>' +wn._('Groups') + '</b>'+ wn._('are not allowed.')+
+			      frappe._('Accounting Entries can be made against leaf nodes, called')+
+				 '<b>' +frappe._('Ledgers')+'</b>.'+ frappe._('Entries against') +
+				 '<b>' +frappe._('Groups') + '</b>'+ frappe._('are not allowed.')+
 		    '</li>'+
-			'<li>'+wn._('Please do NOT create Account (Ledgers) for Customers and Suppliers. They are created directly from the Customer / Supplier masters.')+'</li>'+
+			'<li>'+frappe._('Please do NOT create Account (Ledgers) for Customers and Suppliers. They are created directly from the Customer / Supplier masters.')+'</li>'+
 			'<li>'+
-			     '<b>'+wn._('To create a Bank Account:')+'</b>'+ 
-			      wn._('Go to the appropriate group (usually Application of Funds > Current Assets > Bank Accounts)')+
-			      wn._('and create a new Account Ledger (by clicking on Add Child) of type "Bank or Cash"')+
+			     '<b>'+frappe._('To create a Bank Account:')+'</b>'+ 
+			      frappe._('Go to the appropriate group (usually Application of Funds > Current Assets > Bank Accounts)')+
+			      frappe._('and create a new Account Ledger (by clicking on Add Child) of type "Bank or Cash"')+
 			'</li>'+
 			'<li>'+
-			      '<b>'+wn._('To create a Tax Account:')+'</b>'+
-			      wn._('Go to the appropriate group (usually Source of Funds > Current Liabilities > Taxes and Duties)')+
-			      wn._('and create a new Account Ledger (by clicking on Add Child) of type "Tax" and do mention the Tax rate.')+
+			      '<b>'+frappe._('To create a Tax Account:')+'</b>'+
+			      frappe._('Go to the appropriate group (usually Source of Funds > Current Liabilities > Taxes and Duties)')+
+			      frappe._('and create a new Account Ledger (by clicking on Add Child) of type "Tax" and do mention the Tax rate.')+
 			'</li>'+
 		'</ol>'+
-		'<p>'+wn._('Please setup your chart of accounts before you start Accounting Entries')+'</p></div>').appendTo(main);
+		'<p>'+frappe._('Please setup your chart of accounts before you start Accounting Entries')+'</p></div>').appendTo(main);
 	
-	if (wn.boot.profile.can_create.indexOf("Company") !== -1) {
-		wrapper.appframe.add_button(wn._('New Company'), function() { newdoc('Company'); },
+	if (frappe.boot.profile.can_create.indexOf("Company") !== -1) {
+		wrapper.appframe.add_button(frappe._('New Company'), function() { newdoc('Company'); },
 			'icon-plus');
 	}
 	
@@ -54,21 +54,21 @@
 	// company-select
 	wrapper.$company_select = wrapper.appframe.add_select("Company", [])
 		.change(function() {
-			var ctype = wn.get_route()[1] || 'Account';
+			var ctype = frappe.get_route()[1] || 'Account';
 			erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(), 
 				chart_area.get(0));
 			pscript.set_title(wrapper, ctype, $(this).val());
 		})
 		
 	// load up companies
-	return wn.call({
+	return frappe.call({
 		method: 'erpnext.accounts.page.accounts_browser.accounts_browser.get_companies',
 		callback: function(r) {
 			wrapper.$company_select.empty();
 			$.each(r.message, function(i, v) {
 				$('<option>').html(v).attr('value', v).appendTo(wrapper.$company_select);
 			});
-			wrapper.$company_select.val(wn.defaults.get_default("company") || r[0]).change();
+			wrapper.$company_select.val(frappe.defaults.get_default("company") || r[0]).change();
 		}
 	});
 }
@@ -83,7 +83,7 @@
 
 pscript['onshow_Accounts Browser'] = function(wrapper){
 	// set route
-	var ctype = wn.get_route()[1] || 'Account';
+	var ctype = frappe.get_route()[1] || 'Account';
 
 	if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
 		wrapper.$company_select.change();
@@ -97,13 +97,13 @@
 		$(wrapper).empty();
 		var me = this;
 		me.ctype = ctype;
-		me.can_create = wn.model.can_create(this.ctype);
-		me.can_delete = wn.model.can_delete(this.ctype);
-		me.can_write = wn.model.can_write(this.ctype);
+		me.can_create = frappe.model.can_create(this.ctype);
+		me.can_delete = frappe.model.can_delete(this.ctype);
+		me.can_write = frappe.model.can_write(this.ctype);
 		
 		
 		me.company = company;
-		this.tree = new wn.ui.Tree({
+		this.tree = new frappe.ui.Tree({
 			parent: $(wrapper), 
 			label: ctype==="Account" ? "Accounts" : "Cost Centers",
 			args: {ctype: ctype, comp: company},
@@ -145,49 +145,49 @@
 		
 		var node_links = [];
 		// edit
-		if (wn.model.can_read(this.ctype) !== -1) {
-			node_links.push('<a onclick="erpnext.account_chart.open();">'+wn._('Edit')+'</a>');
+		if (frappe.model.can_read(this.ctype) !== -1) {
+			node_links.push('<a onclick="erpnext.account_chart.open();">'+frappe._('Edit')+'</a>');
 		}
-		if (data.expandable && wn.boot.profile.in_create.indexOf(this.ctype) !== -1) {
-			node_links.push('<a onclick="erpnext.account_chart.new_node();">'+wn._('Add Child')+'</a>');
-		} else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) {
-			node_links.push('<a onclick="erpnext.account_chart.show_ledger();">'+wn._('View Ledger')+'</a>');
+		if (data.expandable && frappe.boot.profile.in_create.indexOf(this.ctype) !== -1) {
+			node_links.push('<a onclick="erpnext.account_chart.new_node();">'+frappe._('Add Child')+'</a>');
+		} else if (this.ctype === 'Account' && frappe.boot.profile.can_read.indexOf("GL Entry") !== -1) {
+			node_links.push('<a onclick="erpnext.account_chart.show_ledger();">'+frappe._('View Ledger')+'</a>');
 		}
 
 		if (this.can_write) {
-			node_links.push('<a onclick="erpnext.account_chart.rename()">'+wn._('Rename')+'</a>');
+			node_links.push('<a onclick="erpnext.account_chart.rename()">'+frappe._('Rename')+'</a>');
 		};
 	
 		if (this.can_delete) {
-			node_links.push('<a onclick="erpnext.account_chart.delete()">'+wn._('Delete')+'</a>');
+			node_links.push('<a onclick="erpnext.account_chart.delete()">'+frappe._('Delete')+'</a>');
 		};
 		
 		link.toolbar.append(node_links.join(" | "));
 	},
 	open: function() {
 		var node = this.selected_node();
-		wn.set_route("Form", this.ctype, node.data("label"));
+		frappe.set_route("Form", this.ctype, node.data("label"));
 	},
 	show_ledger: function() {
 		var me = this;
 		var node = me.selected_node();
-		wn.route_options = {
+		frappe.route_options = {
 			"account": node.data('label'),
 			"from_date": sys_defaults.year_start_date,
 			"to_date": sys_defaults.year_end_date,
 			"company": me.company
 		};
-		wn.set_route("query-report", "General Ledger");
+		frappe.set_route("query-report", "General Ledger");
 	},
 	rename: function() {
 		var node = this.selected_node();
-		wn.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
+		frappe.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
 			node.parents("ul:first").parent().find(".tree-link:first").trigger("reload");
 		});
 	},
 	delete: function() {
 		var node = this.selected_node();
-		wn.model.delete_doc(this.ctype, node.data('label'), function() {
+		frappe.model.delete_doc(this.ctype, node.data('label'), function() {
 			node.parent().remove();
 		});
 	},
@@ -205,21 +205,21 @@
 		var me = this;
 		
 		// the dialog
-		var d = new wn.ui.Dialog({
-			title:wn._('New Account'),
+		var d = new frappe.ui.Dialog({
+			title:frappe._('New Account'),
 			fields: [
-				{fieldtype:'Data', fieldname:'account_name', label:wn._('New Account Name'), reqd:true, 
-					description: wn._("Name of new Account. Note: Please don't create accounts for Customers and Suppliers,")+
-					wn._("they are created automatically from the Customer and Supplier master")},
-				{fieldtype:'Select', fieldname:'group_or_ledger', label:wn._('Group or Ledger'),
-					options:'Group\nLedger', description: wn._('Further accounts can be made under Groups,')+
-					 	wn._('but entries can be made against Ledger')},
-				{fieldtype:'Select', fieldname:'account_type', label:wn._('Account Type'),
+				{fieldtype:'Data', fieldname:'account_name', label:frappe._('New Account Name'), reqd:true, 
+					description: frappe._("Name of new Account. Note: Please don't create accounts for Customers and Suppliers,")+
+					frappe._("they are created automatically from the Customer and Supplier master")},
+				{fieldtype:'Select', fieldname:'group_or_ledger', label:frappe._('Group or Ledger'),
+					options:'Group\nLedger', description: frappe._('Further accounts can be made under Groups,')+
+					 	frappe._('but entries can be made against Ledger')},
+				{fieldtype:'Select', fieldname:'account_type', label:frappe._('Account Type'),
 					options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax',
 						'Income Account', 'Chargeable'].join('\n'),
-					description: wn._("Optional. This setting will be used to filter in various transactions.") },
-				{fieldtype:'Float', fieldname:'tax_rate', label:wn._('Tax Rate')},
-				{fieldtype:'Button', fieldname:'create_new', label:wn._('Create New') }
+					description: frappe._("Optional. This setting will be used to filter in various transactions.") },
+				{fieldtype:'Float', fieldname:'tax_rate', label:frappe._('Tax Rate')},
+				{fieldtype:'Button', fieldname:'create_new', label:frappe._('Create New') }
 			]
 		})
 
@@ -259,7 +259,7 @@
 			v.master_type = '';
 			v.company = me.company;
 			
-			return wn.call({
+			return frappe.call({
 				args: v,
 				method: 'erpnext.accounts.utils.add_ac',
 				callback: function(r) {
@@ -283,14 +283,14 @@
 	new_cost_center: function(){
 		var me = this;
 		// the dialog
-		var d = new wn.ui.Dialog({
-			title:wn._('New Cost Center'),
+		var d = new frappe.ui.Dialog({
+			title:frappe._('New Cost Center'),
 			fields: [
-				{fieldtype:'Data', fieldname:'cost_center_name', label:wn._('New Cost Center Name'), reqd:true},
-				{fieldtype:'Select', fieldname:'group_or_ledger', label:wn._('Group or Ledger'),
-					options:'Group\nLedger', description:wn._('Further accounts can be made under Groups,')+
-					 	wn._('but entries can be made against Ledger')},
-				{fieldtype:'Button', fieldname:'create_new', label:wn._('Create New') }
+				{fieldtype:'Data', fieldname:'cost_center_name', label:frappe._('New Cost Center Name'), reqd:true},
+				{fieldtype:'Select', fieldname:'group_or_ledger', label:frappe._('Group or Ledger'),
+					options:'Group\nLedger', description:frappe._('Further accounts can be made under Groups,')+
+					 	frappe._('but entries can be made against Ledger')},
+				{fieldtype:'Button', fieldname:'create_new', label:frappe._('Create New') }
 			]
 		});
 	
@@ -306,7 +306,7 @@
 			v.parent_cost_center = node.data('label');
 			v.company = me.company;
 			
-			return wn.call({
+			return frappe.call({
 				args: v,
 				method: 'erpnext.accounts.utils.add_cc',
 				callback: function(r) {
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.py b/erpnext/accounts/page/accounts_browser/accounts_browser.py
index 6dfbf4a..594150c 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.py
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.py
@@ -2,25 +2,25 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.defaults
-from webnotes.utils import flt
+import frappe
+import frappe.defaults
+from frappe.utils import flt
 from erpnext.accounts.utils import get_balance_on
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_companies():
 	"""get a list of companies based on permission"""
-	return [d.name for d in webnotes.get_list("Company", fields=["name"], 
+	return [d.name for d in frappe.get_list("Company", fields=["name"], 
 		order_by="name")]
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_children():
-	args = webnotes.local.form_dict
+	args = frappe.local.form_dict
 	ctype, company = args['ctype'], args['comp']
 	
 	# root
 	if args['parent'] in ("Accounts", "Cost Centers"):
-		acc = webnotes.conn.sql(""" select 
+		acc = frappe.conn.sql(""" select 
 			name as value, if(group_or_ledger='Group', 1, 0) as expandable
 			from `tab%s`
 			where ifnull(parent_%s,'') = ''
@@ -29,7 +29,7 @@
 				company, as_dict=1)
 	else:	
 		# other
-		acc = webnotes.conn.sql("""select 
+		acc = frappe.conn.sql("""select 
 			name as value, if(group_or_ledger='Group', 1, 0) as expandable
 	 		from `tab%s` 
 			where ifnull(parent_%s,'') = %s
@@ -38,7 +38,7 @@
 				args['parent'], as_dict=1)
 				
 	if ctype == 'Account':
-		currency = webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", company)[0][0]
+		currency = frappe.conn.sql("select default_currency from `tabCompany` where name = %s", company)[0][0]
 		for each in acc:
 			bal = get_balance_on(each.get("value"))
 			each["currency"] = currency
diff --git a/erpnext/accounts/page/accounts_home/accounts_home.js b/erpnext/accounts/page/accounts_home/accounts_home.js
index db7a20c..f3c3098 100644
--- a/erpnext/accounts/page/accounts_home/accounts_home.js
+++ b/erpnext/accounts/page/accounts_home/accounts_home.js
@@ -1,288 +1,288 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Accounts"] = [
+frappe.module_page["Accounts"] = [
 	{
 		top: true,
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Journal Voucher"),
-				description: wn._("Accounting journal entries."),
+				label: frappe._("Journal Voucher"),
+				description: frappe._("Accounting journal entries."),
 				doctype:"Journal Voucher"
 			},
 			{
-				label: wn._("Sales Invoice"),
-				description: wn._("Bills raised to Customers."),
+				label: frappe._("Sales Invoice"),
+				description: frappe._("Bills raised to Customers."),
 				doctype:"Sales Invoice"
 			},
 			{
-				label: wn._("Purchase Invoice"),
-				description: wn._("Bills raised by Suppliers."),
+				label: frappe._("Purchase Invoice"),
+				description: frappe._("Bills raised by Suppliers."),
 				doctype:"Purchase Invoice"
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Chart of Accounts"),
+				label: frappe._("Chart of Accounts"),
 				route: "Accounts Browser/Account",
-				description: wn._("Structure of books of accounts."),
+				description: frappe._("Structure of books of accounts."),
 				doctype:"Account"
 			},
 			{
-				label: wn._("Chart of Cost Centers"),
+				label: frappe._("Chart of Cost Centers"),
 				route: "Accounts Browser/Cost Center",
-				description: wn._("Structure cost centers for budgeting."),
+				description: frappe._("Structure cost centers for budgeting."),
 				doctype:"Cost Center"
 			},
 			{
-				label: wn._("Customer"),
-				description: wn._("Customer database."),
+				label: frappe._("Customer"),
+				description: frappe._("Customer database."),
 				doctype:"Customer"
 			},
 			{
-				label: wn._("Supplier"),
-				description: wn._("Supplier database."),
+				label: frappe._("Supplier"),
+				description: frappe._("Supplier database."),
 				doctype:"Supplier"
 			},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-wrench",
 		items: [
 			{
-				label: wn._("Company"),
-				description: wn._("Company Master."),
+				label: frappe._("Company"),
+				description: frappe._("Company Master."),
 				doctype:"Company"
 			},
 			{
-				label: wn._("Fiscal Year"),
-				description: wn._("Accounting Year."),
+				label: frappe._("Fiscal Year"),
+				description: frappe._("Accounting Year."),
 				doctype:"Fiscal Year"
 			},
 		]
 	},
 	{
-		title: wn._("Tools"),
+		title: frappe._("Tools"),
 		icon: "icon-wrench",
 		items: [
 			{
 				"route":"Form/Bank Reconciliation/Bank Reconciliation",
-				"label": wn._("Bank Reconciliation"),
-				"description": wn._("Update bank payment dates with journals."),
+				"label": frappe._("Bank Reconciliation"),
+				"description": frappe._("Update bank payment dates with journals."),
 				doctype: "Bank Reconciliation"
 			},
 			{
 				"route":"Form/Payment to Invoice Matching Tool/Payment to Invoice Matching Tool",
-				"label": wn._("Payment Reconciliation"),
-				"description": wn._("Match non-linked Invoices and Payments."),
+				"label": frappe._("Payment Reconciliation"),
+				"description": frappe._("Match non-linked Invoices and Payments."),
 				doctype: "Payment to Invoice Matching Tool"
 				
 			},
 			{
-				"label": wn._("Period Closing Voucher"),
+				"label": frappe._("Period Closing Voucher"),
 				"doctype": "Period Closing Voucher",
-				description: wn._("Close Balance Sheet and book Profit or Loss.")
+				description: frappe._("Close Balance Sheet and book Profit or Loss.")
 			},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				"label": wn._("Accounts Settings"),
+				"label": frappe._("Accounts Settings"),
 				"route": "Form/Accounts Settings",
 				"doctype":"Accounts Settings",
-				"description": wn._("Settings for Accounts")
+				"description": frappe._("Settings for Accounts")
 			},
 			{
-				"label": wn._("Sales Taxes and Charges Master"),
+				"label": frappe._("Sales Taxes and Charges Master"),
 				"doctype":"Sales Taxes and Charges Master",
-				"description": wn._("Tax Template for Sales")
+				"description": frappe._("Tax Template for Sales")
 			},
 			{
-				"label": wn._("Purchase Taxes and Charges Master"),
+				"label": frappe._("Purchase Taxes and Charges Master"),
 				"doctype":"Purchase Taxes and Charges Master",
-				"description": wn._("Tax Template for Purchase")
+				"description": frappe._("Tax Template for Purchase")
 			},
 			{
-				"label": wn._("Shipping Rules"),
+				"label": frappe._("Shipping Rules"),
 				"doctype":"Shipping Rule",
-				"description": wn._("Rules to calculate shipping amount for a sale")
+				"description": frappe._("Rules to calculate shipping amount for a sale")
 			},
 			{
-				"label": wn._("Currency Exchange"),
+				"label": frappe._("Currency Exchange"),
 				"doctype":"Currency Exchange",
-				"description": wn._("Manage exchange rates for currency conversion")
+				"description": frappe._("Manage exchange rates for currency conversion")
 			},
 			{
-				"label": wn._("Point-of-Sale Setting"),
+				"label": frappe._("Point-of-Sale Setting"),
 				"doctype":"POS Setting",
-				"description": wn._("User settings for Point-of-sale (POS)")
+				"description": frappe._("User settings for Point-of-sale (POS)")
 			},
 			{
 				"doctype":"Budget Distribution",
-				"label": wn._("Budget Distribution"),
-				"description": wn._("Seasonality for setting budgets.")
+				"label": frappe._("Budget Distribution"),
+				"description": frappe._("Seasonality for setting budgets.")
 			},
 			{
 				"doctype":"Terms and Conditions",
-				"label": wn._("Terms and Conditions Template"),
-				description: wn._("Template of terms or contract.")
+				"label": frappe._("Terms and Conditions Template"),
+				description: frappe._("Template of terms or contract.")
 			},
 			{
 				"doctype":"Mode of Payment",
-				"label": wn._("Mode of Payment"),
-				description: wn._("e.g. Bank, Cash, Credit Card")
+				"label": frappe._("Mode of Payment"),
+				description: frappe._("e.g. Bank, Cash, Credit Card")
 			},
 			{
 				"doctype":"C-Form",
-				"label": wn._("C-Form"),
-				description: wn._("C-Form records"),
+				"label": frappe._("C-Form"),
+				description: frappe._("C-Form records"),
 				country: "India"
 			}
 		]
 	},
 	{
-		title: wn._("Main Reports"),
+		title: frappe._("Main Reports"),
 		right: true,
 		icon: "icon-table",
 		items: [
 			{
-				"label":wn._("General Ledger"),
+				"label":frappe._("General Ledger"),
 				doctype: "GL Entry",
 				route: "query-report/General Ledger"
 			},
 			{
-				"label":wn._("Trial Balance"),
+				"label":frappe._("Trial Balance"),
 				page: "trial-balance"
 			},
 			{
 				"page":"Financial Statements",
-				"label": wn._("Financial Statements")
+				"label": frappe._("Financial Statements")
 			},
 			{
-				"label":wn._("Accounts Receivable"),
+				"label":frappe._("Accounts Receivable"),
 				route: "query-report/Accounts Receivable",
 				doctype: "Sales Invoice"
 			},
 			{
-				"label":wn._("Accounts Payable"),
+				"label":frappe._("Accounts Payable"),
 				route: "query-report/Accounts Payable",
 				doctype: "Purchase Invoice"
 			},
 			{
-				"label":wn._("Sales Register"),
+				"label":frappe._("Sales Register"),
 				route: "query-report/Sales Register",
 				doctype: "Sales Invoice"
 			},
 			{
-				"label":wn._("Purchase Register"),
+				"label":frappe._("Purchase Register"),
 				route: "query-report/Purchase Register",
 				doctype: "Purchase Invoice"
 			},
 		]
 	},
 	{
-		title: wn._("Analytics"),
+		title: frappe._("Analytics"),
 		right: true,
 		icon: "icon-bar-chart",
 		items: [
 			{
-				"label":wn._("Financial Analytics"),
+				"label":frappe._("Financial Analytics"),
 				page: "financial-analytics"
 			},
 			{
-				"label":wn._("Gross Profit"),
+				"label":frappe._("Gross Profit"),
 				route: "query-report/Gross Profit",
 				doctype: "Sales Invoice"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Bank Reconciliation Statement"),
+				"label":frappe._("Bank Reconciliation Statement"),
 				route: "query-report/Bank Reconciliation Statement",
 				doctype: "Journal Voucher"
 			},
 			{
-				"label":wn._("Ordered Items To Be Billed"),
+				"label":frappe._("Ordered Items To Be Billed"),
 				route: "query-report/Ordered Items To Be Billed",
 				doctype: "Sales Invoice"
 			},
 			{
-				"label":wn._("Delivered Items To Be Billed"),
+				"label":frappe._("Delivered Items To Be Billed"),
 				route: "query-report/Delivered Items To Be Billed",
 				doctype: "Sales Invoice"
 			},
 			{
-				"label":wn._("Purchase Order Items To Be Billed"),
+				"label":frappe._("Purchase Order Items To Be Billed"),
 				route: "query-report/Purchase Order Items To Be Billed",
 				doctype: "Purchase Invoice"
 			},
 			{
-				"label":wn._("Received Items To Be Billed"),
+				"label":frappe._("Received Items To Be Billed"),
 				route: "query-report/Received Items To Be Billed",
 				doctype: "Purchase Invoice"
 			},
 			{
-				"label":wn._("Bank Clearance Summary"),
+				"label":frappe._("Bank Clearance Summary"),
 				route: "query-report/Bank Clearance Summary",
 				doctype: "Journal Voucher"
 			},
 			{
-				"label":wn._("Payment Period Based On Invoice Date"),
+				"label":frappe._("Payment Period Based On Invoice Date"),
 				route: "query-report/Payment Period Based On Invoice Date",
 				doctype: "Journal Voucher"
 			},
 			{
-				"label":wn._("Sales Partners Commission"),
+				"label":frappe._("Sales Partners Commission"),
 				route: "query-report/Sales Partners Commission",
 				doctype: "Sales Invoice"
 			},
 			{
-				"label":wn._("Customer Account Head"),
+				"label":frappe._("Customer Account Head"),
 				route: "query-report/Customer Account Head",
 				doctype: "Account"
 			},
 			{
-				"label":wn._("Supplier Account Head"),
+				"label":frappe._("Supplier Account Head"),
 				route: "query-report/Supplier Account Head",
 				doctype: "Account"
 			},
 			{
-				"label":wn._("Item-wise Sales Register"),
+				"label":frappe._("Item-wise Sales Register"),
 				route: "query-report/Item-wise Sales Register",
 				doctype: "Sales Invoice"
 			},
 			{
-				"label":wn._("Item-wise Purchase Register"),
+				"label":frappe._("Item-wise Purchase Register"),
 				route: "query-report/Item-wise Purchase Register",
 				doctype: "Purchase Invoice"
 			},
 			{
-				"label":wn._("Budget Variance Report"),
+				"label":frappe._("Budget Variance Report"),
 				route: "query-report/Budget Variance Report",
 				doctype: "Cost Center"
 			},
 			{
-				"label":wn._("Purchase Invoice Trends"),
+				"label":frappe._("Purchase Invoice Trends"),
 				route: "query-report/Purchase Invoice Trends",
 				doctype: "Purchase Invoice"
 			},
 			{
-				"label":wn._("Sales Invoice Trends"),
+				"label":frappe._("Sales Invoice Trends"),
 				route: "query-report/Sales Invoice Trends",
 				doctype: "Sales Invoice"
 			},
@@ -291,5 +291,5 @@
 ]
 
 pscript['onload_accounts-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Accounts");
+	frappe.views.moduleview.make(wrapper, "Accounts");
 }
\ No newline at end of file
diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.js b/erpnext/accounts/page/financial_analytics/financial_analytics.js
index 4c7c644..470b384 100644
--- a/erpnext/accounts/page/financial_analytics/financial_analytics.js
+++ b/erpnext/accounts/page/financial_analytics/financial_analytics.js
@@ -1,12 +1,12 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/account_tree_grid.js");
+frappe.require("assets/erpnext/js/account_tree_grid.js");
 
-wn.pages['financial-analytics'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['financial-analytics'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Financial Analytics'),
+		title: frappe._('Financial Analytics'),
 		single_column: true
 	});
 	erpnext.trial_balance = new erpnext.FinancialAnalytics(wrapper, 'Financial Analytics');
@@ -16,7 +16,7 @@
 
 erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
 	filters: [
-		{fieldtype:"Select", label: wn._("PL or BS"), options:["Profit and Loss", "Balance Sheet"],
+		{fieldtype:"Select", label: frappe._("PL or BS"), options:["Profit and Loss", "Balance Sheet"],
 			filter: function(val, item, opts, me) {
 				if(item._show) return true;
 				
@@ -26,27 +26,27 @@
 				
 				return me.apply_zero_filter(val, item, opts, me);
 			}},
-		{fieldtype:"Select", label: wn._("Company"), link:"Company", default_value: "Select Company...",
+		{fieldtype:"Select", label: frappe._("Company"), link:"Company", default_value: "Select Company...",
 			filter: function(val, item, opts) {
 				return item.company == val || val == opts.default_value || item._show;
 			}},
-		{fieldtype:"Select", label: wn._("Fiscal Year"), link:"Fiscal Year", 
+		{fieldtype:"Select", label: frappe._("Fiscal Year"), link:"Fiscal Year", 
 			default_value: "Select Fiscal Year..."},
-		{fieldtype:"Date", label: wn._("From Date")},
-		{fieldtype:"Label", label: wn._("To")},
-		{fieldtype:"Date", label: wn._("To Date")},
-		{fieldtype:"Select", label: wn._("Range"), 
+		{fieldtype:"Date", label: frappe._("From Date")},
+		{fieldtype:"Label", label: frappe._("To")},
+		{fieldtype:"Date", label: frappe._("To Date")},
+		{fieldtype:"Select", label: frappe._("Range"), 
 			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	setup_columns: function() {
 		var std_columns = [
-			{id: "check", name: wn._("Plot"), field: "check", width: 30,
+			{id: "check", name: frappe._("Plot"), field: "check", width: 30,
 				formatter: this.check_formatter},
-			{id: "name", name: wn._("Account"), field: "name", width: 300,
+			{id: "name", name: frappe._("Account"), field: "name", width: 300,
 				formatter: this.tree_formatter},
-			{id: "opening", name: wn._("Opening"), field: "opening", hidden: true,
+			{id: "opening", name: frappe._("Opening"), field: "opening", hidden: true,
 				formatter: this.currency_formatter}
 		];
 		
@@ -59,7 +59,7 @@
 		this.trigger_refresh_on_change(["pl_or_bs"]);
 		
 		this.filter_inputs.pl_or_bs
-			.add_options($.map(wn.report_dump.data["Cost Center"], function(v) {return v.name;}));
+			.add_options($.map(frappe.report_dump.data["Cost Center"], function(v) {return v.name;}));
 
 		this.setup_plot_check();
 	},
@@ -72,13 +72,13 @@
 		
 		// setup cost center map
 		if(!this.cost_center_by_name) {
-			this.cost_center_by_name = this.make_name_map(wn.report_dump.data["Cost Center"]);
+			this.cost_center_by_name = this.make_name_map(frappe.report_dump.data["Cost Center"]);
 		}
 		
 		var cost_center = inList(["Balance Sheet", "Profit and Loss"], this.pl_or_bs) 
 			? null : this.cost_center_by_name[this.pl_or_bs];
 		
-		$.each(wn.report_dump.data['GL Entry'], function(i, gl) {
+		$.each(frappe.report_dump.data['GL Entry'], function(i, gl) {
 			var filter_by_cost_center = (function() {
 				if(cost_center) {
 					if(gl.cost_center) {
diff --git a/erpnext/accounts/page/financial_statements/financial_statements.js b/erpnext/accounts/page/financial_statements/financial_statements.js
index 8562707..82cebd2 100644
--- a/erpnext/accounts/page/financial_statements/financial_statements.js
+++ b/erpnext/accounts/page/financial_statements/financial_statements.js
@@ -4,9 +4,9 @@
 erpnext.fs = {}
 
 pscript['onload_Financial Statements'] = function(wrapper) {
-	wn.ui.make_app_page({
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		"title": wn._("Financial Statements"),
+		"title": frappe._("Financial Statements"),
 		"single_column": true,
 	});
 	
@@ -34,18 +34,18 @@
 		options: ['Loading...']
 	})
 
-	wrapper.appframe.add_button(wn._("Create"), function() {
+	wrapper.appframe.add_button(frappe._("Create"), function() {
 		pscript.stmt_new();
 	}, "icon-refresh")
 
-	wrapper.appframe.add_button(wn._("Print"), function() {
+	wrapper.appframe.add_button(frappe._("Print"), function() {
 		_p.go($i('print_html').innerHTML);
 	}, "icon-print")
 		
 	$(wrapper).find(".layout-main").html('<div id="print_html">\
 		<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>\
 		<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>\
-		<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto;">'+wn._('Please select options and click on Create')+'</div>\
+		<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto;">'+frappe._('Please select options and click on Create')+'</div>\
 	</div>').css({"min-height": "400px"});
 
   // load companies
@@ -61,7 +61,7 @@
 
 pscript.stmt_new = function(stmt,company_name,level,period,year) {
     
-  $i('stmt_tree').innerHTML = wn._('Refreshing....');
+  $i('stmt_tree').innerHTML = frappe._('Refreshing....');
   $i('stmt_tree').style.display = 'block';
   
   var company =erpnext.fs.stmt_company.get_value();
diff --git a/erpnext/accounts/page/trial_balance/trial_balance.js b/erpnext/accounts/page/trial_balance/trial_balance.js
index 34a0695..80a4aa8 100644
--- a/erpnext/accounts/page/trial_balance/trial_balance.js
+++ b/erpnext/accounts/page/trial_balance/trial_balance.js
@@ -1,12 +1,12 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/account_tree_grid.js");
+frappe.require("assets/erpnext/js/account_tree_grid.js");
 
-wn.pages['trial-balance'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['trial-balance'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Trial Balance'),
+		title: frappe._('Trial Balance'),
 		single_column: true
 	});
 	var TrialBalance = erpnext.AccountTreeGrid.extend({
@@ -18,7 +18,7 @@
 			this.wrapper.bind("make", function() {
 				$('<div style="margin: 10px 0px; "\
 				 	class="with_period_closing_entry"><input type="checkbox" checked="checked">' + 
-						wn._("With period closing entry") + '</div>')
+						frappe._("With period closing entry") + '</div>')
 					.appendTo(me.wrapper)
 					.find("input").click(function() { me.refresh(); });
 			});
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index c9ffd0e..c216e27 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -3,23 +3,23 @@
 
 from __future__ import unicode_literals
 
-import webnotes
-from webnotes import _
-from webnotes.defaults import get_restrictions
+import frappe
+from frappe import _
+from frappe.defaults import get_restrictions
 from erpnext.utilities.doctype.address.address import get_address_display
 from erpnext.utilities.doctype.contact.contact import get_contact_details
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_party_details(party=None, account=None, party_type="Customer", company=None, 
 	posting_date=None, price_list=None, currency=None):
-	out = webnotes._dict(set_account_and_due_date(party, account, party_type, company, posting_date))
+	out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date))
 	
 	party = out[party_type.lower()]
 
-	if not webnotes.has_permission(party_type, "read", party):
-		webnotes.throw("Not Permitted", webnotes.PermissionError)
+	if not frappe.has_permission(party_type, "read", party):
+		frappe.throw("Not Permitted", frappe.PermissionError)
 
-	party_bean = webnotes.bean(party_type, party)
+	party_bean = frappe.bean(party_type, party)
 	party = party_bean.doc
 
 	set_address_and_contact(out, party, party_type)
@@ -40,9 +40,9 @@
 
 def set_address_and_contact(out, party, party_type):
 	out.update({
-		party_type.lower() + "_address": webnotes.conn.get_value("Address", 
+		party_type.lower() + "_address": frappe.conn.get_value("Address", 
 			{party_type.lower(): party.name, "is_primary_address":1}, "name"),
-		"contact_person": webnotes.conn.get_value("Contact", 
+		"contact_person": frappe.conn.get_value("Contact", 
 			{party_type.lower(): party.name, "is_primary_contact":1}, "name")
 	})
 	
@@ -78,14 +78,14 @@
 		price_list = party.default_price_list
 		
 	if not price_list and party.party_type=="Customer":
-		price_list =  webnotes.conn.get_value("Customer Group", 
+		price_list =  frappe.conn.get_value("Customer Group", 
 			party.customer_group, "default_price_list")
 
 	if not price_list:
 		price_list = given_price_list
 
 	if price_list:
-		out.price_list_currency = webnotes.conn.get_value("Price List", price_list, "currency")
+		out.price_list_currency = frappe.conn.get_value("Price List", price_list, "currency")
 		
 	out["selling_price_list" if party.doctype=="Customer" else "buying_price_list"] = price_list
 	
@@ -100,7 +100,7 @@
 	if party:
 		account = get_party_account(company, party, party_type)
 	elif account:
-		party = webnotes.conn.get_value('Account', account, 'master_name')
+		party = frappe.conn.get_value('Account', account, 'master_name')
 
 	account_fieldname = "debit_to" if party_type=="Customer" else "credit_to" 
 
@@ -113,10 +113,10 @@
 
 def get_party_account(company, party, party_type):
 	if not company:
-		webnotes.throw(_("Please select company first."))
+		frappe.throw(_("Please select company first."))
 
 	if party:
-		acc_head = webnotes.conn.get_value("Account", {"master_name":party,
+		acc_head = frappe.conn.get_value("Account", {"master_name":party,
 			"master_type": party_type, "company": company})
 
 		if not acc_head:
@@ -130,11 +130,11 @@
 	if posting_date:
 		credit_days = 0
 		if account:
-			credit_days = webnotes.conn.get_value("Account", account, "credit_days")
+			credit_days = frappe.conn.get_value("Account", account, "credit_days")
 		if party and not credit_days:
-			credit_days = webnotes.conn.get_value(party_type, party, "credit_days")
+			credit_days = frappe.conn.get_value(party_type, party, "credit_days")
 		if company and not credit_days:
-			credit_days = webnotes.conn.get_value("Company", company, "credit_days")
+			credit_days = frappe.conn.get_value("Company", company, "credit_days")
 			
 		due_date = add_days(posting_date, credit_days) if credit_days else posting_date
 
@@ -142,16 +142,16 @@
 
 def create_party_account(party, party_type, company):
 	if not company:
-		webnotes.throw(_("Company is required"))
+		frappe.throw(_("Company is required"))
 		
-	company_details = webnotes.conn.get_value("Company", company, 
+	company_details = frappe.conn.get_value("Company", company, 
 		["abbr", "receivables_group", "payables_group"], as_dict=True)
-	if not webnotes.conn.exists("Account", (party + " - " + company_details.abbr)):
+	if not frappe.conn.exists("Account", (party + " - " + company_details.abbr)):
 		parent_account = company_details.receivables_group \
 			if party_type=="Customer" else company_details.payables_group
 
 		# create
-		account = webnotes.bean({
+		account = frappe.bean({
 			"doctype": "Account",
 			'account_name': party,
 			'parent_account': parent_account, 
@@ -162,4 +162,4 @@
 			"freeze_account": "No"
 		}).insert(ignore_permissions=True)
 		
-		webnotes.msgprint(_("Account Created") + ": " + account.doc.name)
+		frappe.msgprint(_("Account Created") + ": " + account.doc.name)
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 575f05e..855aae1 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -1,22 +1,22 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Accounts Payable"] = {
+frappe.query_reports["Accounts Payable"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
@@ -30,13 +30,13 @@
 		},
 		{
 			"fieldname":"report_date",
-			"label": wn._("Date"),
+			"label": frappe._("Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname":"ageing_based_on",
-			"label": wn._("Ageing Based On"),
+			"label": frappe._("Ageing Based On"),
 			"fieldtype": "Select",
 			"options": 'Posting Date' + NEWLINE + 'Due Date',
 			"default": "Posting Date"
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.py b/erpnext/accounts/report/accounts_payable/accounts_payable.py
index a7858fe..57bdf9f 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.py
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.py
@@ -2,17 +2,17 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import getdate, nowdate, flt, cstr
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import getdate, nowdate, flt, cstr
+from frappe import msgprint, _
 from erpnext.accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
 
 def execute(filters=None):
 	if not filters: filters = {}
-	supplier_naming_by = webnotes.conn.get_value("Buying Settings", None, "supp_master_name")
+	supplier_naming_by = frappe.conn.get_value("Buying Settings", None, "supp_master_name")
 	columns = get_columns(supplier_naming_by)
 	entries = get_gl_entries(filters)
-	account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select acc.name, 
+	account_map = dict(((r.name, r) for r in frappe.conn.sql("""select acc.name, 
 		supp.supplier_name, supp.name as supplier 
 		from `tabAccount` acc, `tabSupplier` supp 
 		where acc.master_type="Supplier" and supp.name=acc.master_name""", as_dict=1)))
@@ -85,7 +85,7 @@
 def get_gl_entries(filters, before_report_date=True):
 	conditions, supplier_accounts = get_conditions(filters, before_report_date)
 	gl_entries = []
-	gl_entries = webnotes.conn.sql("""select * from `tabGL Entry` 
+	gl_entries = frappe.conn.sql("""select * from `tabGL Entry` 
 		where docstatus < 2 %s order by posting_date, account""" % 
 		(conditions), tuple(supplier_accounts), as_dict=1)
 	return gl_entries
@@ -99,7 +99,7 @@
 	if filters.get("account"):
 		supplier_accounts = [filters["account"]]
 	else:
-		supplier_accounts = webnotes.conn.sql_list("""select name from `tabAccount` 
+		supplier_accounts = frappe.conn.sql_list("""select name from `tabAccount` 
 			where ifnull(master_type, '') = 'Supplier' and docstatus < 2 %s""" % 
 			conditions, filters)
 	
@@ -118,7 +118,7 @@
 	
 def get_account_supplier_type_map():
 	account_supplier_type_map = {}
-	for each in webnotes.conn.sql("""select acc.name, supp.supplier_type from `tabSupplier` supp, 
+	for each in frappe.conn.sql("""select acc.name, supp.supplier_type from `tabSupplier` supp, 
 			`tabAccount` acc where supp.name = acc.master_name group by acc.name"""):
 		account_supplier_type_map[each[0]] = each[1]
 
@@ -127,15 +127,15 @@
 def get_voucher_details():
 	voucher_details = {}
 	for dt in ["Purchase Invoice", "Journal Voucher"]:
-		voucher_details.setdefault(dt, webnotes._dict())
-		for t in webnotes.conn.sql("""select name, due_date, bill_no, bill_date 
+		voucher_details.setdefault(dt, frappe._dict())
+		for t in frappe.conn.sql("""select name, due_date, bill_no, bill_date 
 				from `tab%s`""" % dt, as_dict=1):
 			voucher_details[dt].setdefault(t.name, t)
 		
 	return voucher_details
 
 def get_outstanding_amount(gle, report_date):
-	payment_amount = webnotes.conn.sql("""
+	payment_amount = frappe.conn.sql("""
 		select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
 		from `tabGL Entry` 
 		where account = %s and posting_date <= %s and against_voucher_type = %s 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index 6f9822e..bb3bf5b 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -1,22 +1,22 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Accounts Receivable"] = {
+frappe.query_reports["Accounts Receivable"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
@@ -30,13 +30,13 @@
 		},
 		{
 			"fieldname":"report_date",
-			"label": wn._("Date"),
+			"label": frappe._("Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname":"ageing_based_on",
-			"label": wn._("Ageing Based On"),
+			"label": frappe._("Ageing Based On"),
 			"fieldtype": "Select",
 			"options": 'Posting Date' + NEWLINE + 'Due Date',
 			"default": "Posting Date"
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 3be33ba..9b2caf0 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -2,20 +2,20 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import getdate, nowdate, flt
+import frappe
+from frappe import _
+from frappe.utils import getdate, nowdate, flt
 
 class AccountsReceivableReport(object):
 	def __init__(self, filters=None):
-		self.filters = webnotes._dict(filters or {})
+		self.filters = frappe._dict(filters or {})
 		self.filters.report_date = getdate(self.filters.report_date or nowdate())
 		self.age_as_on = getdate(nowdate()) \
 			if self.filters.report_date > getdate(nowdate()) \
 			else self.filters.report_date
 			
 	def run(self):
-		customer_naming_by = webnotes.conn.get_value("Selling Settings", None, "cust_master_name")
+		customer_naming_by = frappe.conn.get_value("Selling Settings", None, "cust_master_name")
 		return self.get_columns(customer_naming_by), self.get_data(customer_naming_by)
 		
 	def get_columns(self, customer_naming_by):
@@ -111,7 +111,7 @@
 		
 	def get_account_map(self):
 		if not hasattr(self, "account_map"):
-			self.account_map = dict(((r.name, r) for r in webnotes.conn.sql("""select 
+			self.account_map = dict(((r.name, r) for r in frappe.conn.sql("""select 
 				acc.name, cust.name as customer, cust.customer_name, cust.territory
 				from `tabAccount` acc left join `tabCustomer` cust 
 				on cust.name=acc.master_name where acc.master_type="Customer" """, as_dict=True)))
@@ -121,7 +121,7 @@
 	def get_due_date(self, gle):
 		if not hasattr(self, "invoice_due_date_map"):
 			# TODO can be restricted to posting date
-			self.invoice_due_date_map = dict(webnotes.conn.sql("""select name, due_date
+			self.invoice_due_date_map = dict(frappe.conn.sql("""select name, due_date
 				from `tabSales Invoice` where docstatus=1"""))
 				
 		return gle.voucher_type == "Sales Invoice" \
@@ -130,7 +130,7 @@
 	def get_gl_entries(self):
 		if not hasattr(self, "gl_entries"):
 			conditions, values = self.prepare_conditions()
-			self.gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
+			self.gl_entries = frappe.conn.sql("""select * from `tabGL Entry`
 				where docstatus < 2 {0} order by posting_date, account""".format(conditions),
 				values, as_dict=True)
 		return self.gl_entries
@@ -149,7 +149,7 @@
 		else:
 			account_map = self.get_account_map()
 			if not account_map:
-				webnotes.throw(_("No Customer Accounts found."))
+				frappe.throw(_("No Customer Accounts found."))
 			else:
 				accounts_list = ['"{0}"'.format(ac) for ac in account_map]
 				conditions.append("account in ({0})".format(", ".join(accounts_list)))
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
index ab98bf7..5f692e3 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
@@ -1,24 +1,24 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Bank Clearance Summary"] = {
+frappe.query_reports["Bank Clearance Summary"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_start_date"),
+			"default": frappe.defaults.get_user_default("year_start_date"),
 			"width": "80"
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Bank Account"),
+			"label": frappe._("Bank Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
index c2d7439..1ed3d73 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
+import frappe
+from frappe import _, msgprint
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -33,7 +33,7 @@
 	
 def get_entries(filters):
 	conditions = get_conditions(filters)
-	entries =  webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
+	entries =  frappe.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
 		jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit
 		from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv 
 		where jvd.parent = jv.name and jv.docstatus=1 %s
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
index 7f32e26..1d355cc 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -1,11 +1,11 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Bank Reconciliation Statement"] = {
+frappe.query_reports["Bank Reconciliation Statement"] = {
 	"filters": [
 		{
 			"fieldname":"account",
-			"label": wn._("Bank Account"),
+			"label": frappe._("Bank Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"reqd": 1,
@@ -21,7 +21,7 @@
 		},
 		{
 			"fieldname":"report_date",
-			"label": wn._("Date"),
+			"label": frappe._("Date"),
 			"fieldtype": "Date",
 			"default": get_today(),
 			"reqd": 1
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 646906f..fed9170 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
 	
-	debit_or_credit = webnotes.conn.get_value("Account", filters["account"], "debit_or_credit")
+	debit_or_credit = frappe.conn.get_value("Account", filters["account"], "debit_or_credit")
 	
 	columns = get_columns()
 	data = get_entries(filters)
@@ -41,7 +41,7 @@
 	]
 	
 def get_entries(filters):
-	entries = webnotes.conn.sql("""select 
+	entries = frappe.conn.sql("""select 
 			jv.name, jv.posting_date, jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit
 		from 
 			`tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv 
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
index b8e28f3..4bf5d22 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
@@ -1,28 +1,28 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Budget Variance Report"] = {
+frappe.query_reports["Budget Variance Report"] = {
 	"filters": [
 		{
 			fieldname: "fiscal_year",
-			label: wn._("Fiscal Year"),
+			label: frappe._("Fiscal Year"),
 			fieldtype: "Link",
 			options: "Fiscal Year",
 			default: sys_defaults.fiscal_year
 		},
 		{
 			fieldname: "period",
-			label: wn._("Period"),
+			label: frappe._("Period"),
 			fieldtype: "Select",
 			options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
 			default: "Monthly"
 		},
 		{
 			fieldname: "company",
-			label: wn._("Company"),
+			label: frappe._("Company"),
 			fieldtype: "Link",
 			options: "Company",
-			default: wn.defaults.get_default("company")
+			default: frappe.defaults.get_default("company")
 		},
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
index 8d164f8..0a7abef 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.utils import flt
+import frappe
+from frappe import _, msgprint
+from frappe.utils import flt
 import time
 from erpnext.accounts.utils import get_fiscal_year
 from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
@@ -62,7 +62,7 @@
 
 #Get cost center & target details
 def get_costcenter_target_details(filters):
-	return webnotes.conn.sql("""select cc.name, cc.distribution_id, 
+	return frappe.conn.sql("""select cc.name, cc.distribution_id, 
 		cc.parent_cost_center, bd.account, bd.budget_allocated 
 		from `tabCost Center` cc, `tabBudget Detail` bd 
 		where bd.parent=cc.name and bd.fiscal_year=%s and 
@@ -73,7 +73,7 @@
 def get_target_distribution_details(filters):
 	target_details = {}
 
-	for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation  
+	for d in frappe.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation  
 		from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd
 		where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
 			target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
@@ -82,7 +82,7 @@
 
 #Get actual details from gl entry
 def get_actual_details(filters):
-	ac_details = webnotes.conn.sql("""select gl.account, gl.debit, gl.credit, 
+	ac_details = frappe.conn.sql("""select gl.account, gl.debit, gl.credit, 
 		gl.cost_center, MONTHNAME(gl.posting_date) as month_name 
 		from `tabGL Entry` gl, `tabBudget Detail` bd 
 		where gl.fiscal_year=%s and company=%s
@@ -108,7 +108,7 @@
 			month = datetime.date(2013, month_id, 1).strftime('%B')
 			
 			cam_map.setdefault(ccd.name, {}).setdefault(ccd.account, {})\
-				.setdefault(month, webnotes._dict({
+				.setdefault(month, frappe._dict({
 					"target": 0.0, "actual": 0.0
 				}))
 
diff --git a/erpnext/accounts/report/customer_account_head/customer_account_head.py b/erpnext/accounts/report/customer_account_head/customer_account_head.py
index 560b6fd..34303e5 100644
--- a/erpnext/accounts/report/customer_account_head/customer_account_head.py
+++ b/erpnext/accounts/report/customer_account_head/customer_account_head.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute(filters=None):
 	account_map = get_account_map()
 	columns = get_columns(account_map)
 	data = []
-	customers = webnotes.conn.sql("select name from tabCustomer where docstatus < 2")
+	customers = frappe.conn.sql("select name from tabCustomer where docstatus < 2")
 	for cust in customers:
 		row = [cust[0]]
 		for company in sorted(account_map):
@@ -18,7 +18,7 @@
 	return columns, data
 
 def get_account_map():
-	accounts = webnotes.conn.sql("""select name, company, master_name 
+	accounts = frappe.conn.sql("""select name, company, master_name 
 		from `tabAccount` where master_type = 'Customer' 
 		and ifnull(master_name, '') != '' and docstatus < 2""", as_dict=1)
 
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js
index 96682f9..48b1f85 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.js
+++ b/erpnext/accounts/report/general_ledger/general_ledger.js
@@ -1,29 +1,29 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["General Ledger"] = {
+frappe.query_reports["General Ledger"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company"),
+			"default": frappe.defaults.get_user_default("company"),
 			"reqd": 1
 		},
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.add_months(wn.datetime.get_today(), -1),
+			"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
 			"reqd": 1,
 			"width": "60px"
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.get_today(),
+			"default": frappe.datetime.get_today(),
 			"reqd": 1,
 			"width": "60px"
 		},
@@ -32,11 +32,11 @@
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"doctype": "Account", 
 					"filters": {
@@ -47,18 +47,18 @@
 		},
 		{
 			"fieldname":"voucher_no",
-			"label": wn._("Voucher No"),
+			"label": frappe._("Voucher No"),
 			"fieldtype": "Data",
 		},
 		{
 			"fieldname":"group_by_voucher",
-			"label": wn._("Group by Voucher"),
+			"label": frappe._("Group by Voucher"),
 			"fieldtype": "Check",
 			"default": 1
 		},
 		{
 			"fieldname":"group_by_account",
-			"label": wn._("Group by Account"),
+			"label": frappe._("Group by Account"),
 			"fieldtype": "Check",
 		}
 	]
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index ccdba06..4cfda3a 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, flt
-from webnotes import _
+import frappe
+from frappe.utils import cstr, flt
+from frappe import _
 
 def execute(filters=None):
 	account_details = {}
-	for acc in webnotes.conn.sql("""select name, debit_or_credit, group_or_ledger 
+	for acc in frappe.conn.sql("""select name, debit_or_credit, group_or_ledger 
 		from tabAccount""", as_dict=1):
 			account_details.setdefault(acc.name, acc)
 	
@@ -23,13 +23,13 @@
 def validate_filters(filters, account_details):
 	if filters.get("account") and filters.get("group_by_account") \
 			and account_details[filters.account].group_or_ledger == "Ledger":
-		webnotes.throw(_("Can not filter based on Account, if grouped by Account"))
+		frappe.throw(_("Can not filter based on Account, if grouped by Account"))
 		
 	if filters.get("voucher_no") and filters.get("group_by_voucher"):
-		webnotes.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
+		frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
 		
 	if filters.from_date > filters.to_date:
-		webnotes.throw(_("From Date must be before To Date"))
+		frappe.throw(_("From Date must be before To Date"))
 	
 def get_columns():
 	return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Float:100", 
@@ -49,7 +49,7 @@
 	group_by_condition = "group by voucher_type, voucher_no, account" \
 		if filters.get("group_by_voucher") else "group by name"
 		
-	gl_entries = webnotes.conn.sql("""select posting_date, account, 
+	gl_entries = frappe.conn.sql("""select posting_date, account, 
 			sum(ifnull(debit, 0)) as debit, sum(ifnull(credit, 0)) as credit, 
 			voucher_type, voucher_no, cost_center, remarks, is_opening, against 
 		from `tabGL Entry`
@@ -64,7 +64,7 @@
 def get_conditions(filters):
 	conditions = []
 	if filters.get("account"):
-		lft, rgt = webnotes.conn.get_value("Account", filters["account"], ["lft", "rgt"])
+		lft, rgt = frappe.conn.get_value("Account", filters["account"], ["lft", "rgt"])
 		conditions.append("""account in (select name from tabAccount 
 			where lft>=%s and rgt<=%s and docstatus<2)""" % (lft, rgt))
 	else:
@@ -74,7 +74,7 @@
 		conditions.append("voucher_no=%(voucher_no)s")
 		
 		
-	from webnotes.widgets.reportview import build_match_conditions
+	from frappe.widgets.reportview import build_match_conditions
 	match_conditions = build_match_conditions("GL Entry")
 	if match_conditions: conditions.append(match_conditions)
 	
@@ -121,9 +121,9 @@
 	return data
 
 def initialize_gle_map(gl_entries):
-	gle_map = webnotes._dict()
+	gle_map = frappe._dict()
 	for gle in gl_entries:
-		gle_map.setdefault(gle.account, webnotes._dict({
+		gle_map.setdefault(gle.account, frappe._dict({
 			"opening": 0,
 			"entries": [],
 			"total_debit": 0,
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js
index b01c40f..f135616 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.js
+++ b/erpnext/accounts/report/gross_profit/gross_profit.js
@@ -1,26 +1,26 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Gross Profit"] = {
+frappe.query_reports["Gross Profit"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company")
+			"default": frappe.defaults.get_user_default("company")
 		},
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_start_date")
+			"default": frappe.defaults.get_user_default("year_start_date")
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_end_date")
+			"default": frappe.defaults.get_user_default("year_end_date")
 		},
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 800f0b9..6b915d1 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 from erpnext.stock.utils import get_buying_amount, get_sales_bom_buying_amount
 
 def execute(filters=None):
@@ -22,7 +22,7 @@
 	for row in source:
 		selling_amount = flt(row.base_amount)
 		
-		item_sales_bom_map = item_sales_bom.get(row.parenttype, {}).get(row.name, webnotes._dict())
+		item_sales_bom_map = item_sales_bom.get(row.parenttype, {}).get(row.name, frappe._dict())
 		
 		if item_sales_bom_map.get(row.item_code):
 			buying_amount = get_sales_bom_buying_amount(row.item_code, row.warehouse, 
@@ -59,7 +59,7 @@
 	
 	query += " order by item_code desc, warehouse desc, posting_date desc, posting_time desc, name desc"
 	
-	res = webnotes.conn.sql(query, filters, as_dict=True)
+	res = frappe.conn.sql(query, filters, as_dict=True)
 	
 	out = {}
 	for r in res:
@@ -73,11 +73,11 @@
 def get_item_sales_bom():
 	item_sales_bom = {}
 	
-	for d in webnotes.conn.sql("""select parenttype, parent, parent_item,
+	for d in frappe.conn.sql("""select parenttype, parent, parent_item,
 		item_code, warehouse, -1*qty as total_qty, parent_detail_docname
 		from `tabPacked Item` where docstatus=1""", as_dict=True):
-		item_sales_bom.setdefault(d.parenttype, webnotes._dict()).setdefault(d.parent,
-			webnotes._dict()).setdefault(d.parent_item, []).append(d)
+		item_sales_bom.setdefault(d.parenttype, frappe._dict()).setdefault(d.parent,
+			frappe._dict()).setdefault(d.parent_item, []).append(d)
 
 	return item_sales_bom
 	
@@ -90,7 +90,7 @@
 	if filters.get("to_date"):
 		conditions += " and posting_date<=%(to_date)s"
 	
-	delivery_note_items = webnotes.conn.sql("""select item.parenttype, dn.name, 
+	delivery_note_items = frappe.conn.sql("""select item.parenttype, dn.name, 
 		dn.posting_date, dn.posting_time, dn.project_name, 
 		item.item_code, item.item_name, item.description, item.warehouse,
 		item.qty, item.base_rate, item.base_amount, item.name as "item_row",
@@ -99,7 +99,7 @@
 		where item.parent = dn.name and dn.docstatus = 1 %s
 		order by dn.posting_date desc, dn.posting_time desc""" % (conditions,), filters, as_dict=1)
 
-	sales_invoice_items = webnotes.conn.sql("""select item.parenttype, si.name, 
+	sales_invoice_items = frappe.conn.sql("""select item.parenttype, si.name, 
 		si.posting_date, si.posting_time, si.project_name,
 		item.item_code, item.item_name, item.description, item.warehouse,
 		item.qty, item.base_rate, item.base_amount, item.name as "item_row",
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
index df9d7af..4196c85 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
@@ -1,34 +1,34 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Item-wise Purchase Register"] = {
+frappe.query_reports["Item-wise Purchase Register"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_start_date"),
+			"default": frappe.defaults.get_user_default("year_start_date"),
 			"width": "80"
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname": "item_code",
-			"label": wn._("Item"),
+			"label": frappe._("Item"),
 			"fieldtype": "Link",
 			"options": "Item",
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
@@ -42,10 +42,10 @@
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index d70e28e..a9bcbba 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -55,9 +55,9 @@
 	
 def get_items(filters):
 	conditions = get_conditions(filters)
-	match_conditions = webnotes.build_match_conditions("Purchase Invoice")
+	match_conditions = frappe.build_match_conditions("Purchase Invoice")
 	
-	return webnotes.conn.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company, 
+	return frappe.conn.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company, 
 		pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group, 
 		pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, 
 		pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
@@ -66,14 +66,14 @@
 		order by pi.posting_date desc, pi_item.item_code desc""" % (conditions, match_conditions), filters, as_dict=1)
 		
 def get_aii_accounts():
-	return dict(webnotes.conn.sql("select name, stock_received_but_not_billed from tabCompany"))
+	return dict(frappe.conn.sql("select name, stock_received_but_not_billed from tabCompany"))
 	
 def get_tax_accounts(item_list, columns):
 	import json
 	item_tax = {}
 	tax_accounts = []
 	
-	tax_details = webnotes.conn.sql("""select parent, account_head, item_wise_tax_detail
+	tax_details = frappe.conn.sql("""select parent, account_head, item_wise_tax_detail
 		from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice' 
 		and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total') 
 		and parent in (%s)""" % ', '.join(['%s']*len(item_list)), tuple([item.parent for item in item_list]))
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
index 361ac54..1828f694 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
@@ -1,28 +1,28 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Item-wise Sales Register"] = wn.query_reports["Sales Register"] = {
+frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales Register"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_default("year_start_date"),
+			"default": frappe.defaults.get_default("year_start_date"),
 			"width": "80"
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
@@ -36,10 +36,10 @@
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 0eb6761..421a517 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -55,7 +55,7 @@
 		
 def get_items(filters):
 	conditions = get_conditions(filters)
-	return webnotes.conn.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name, 
+	return frappe.conn.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name, 
 		si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name, 
 		si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account, 
 		si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name
@@ -68,7 +68,7 @@
 	item_tax = {}
 	tax_accounts = []
 	
-	tax_details = webnotes.conn.sql("""select parent, account_head, item_wise_tax_detail
+	tax_details = frappe.conn.sql("""select parent, account_head, item_wise_tax_detail
 		from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice' 
 		and docstatus = 1 and ifnull(account_head, '') != ''
 		and parent in (%s)""" % ', '.join(['%s']*len(item_list)), 
diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
index 57d8931..f2e9a9d 100644
--- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
+++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
@@ -1,30 +1,30 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Payment Period Based On Invoice Date"] = {
+frappe.query_reports["Payment Period Based On Invoice Date"] = {
 	"filters": [
 		{
 			fieldname: "from_date",
-			label: wn._("From Date"),
+			label: frappe._("From Date"),
 			fieldtype: "Date",
-			default: wn.defaults.get_user_default("year_start_date"),
+			default: frappe.defaults.get_user_default("year_start_date"),
 		},
 		{
 			fieldname:"to_date",
-			label: wn._("To Date"),
+			label: frappe._("To Date"),
 			fieldtype: "Date",
 			default: get_today()
 		},
 		{
 			fieldname:"payment_type",
-			label: wn._("Payment Type"),
+			label: frappe._("Payment Type"),
 			fieldtype: "Select",
 			options: "Incoming\nOutgoing",
 			default: "Incoming"
 		},
 		{
 			fieldname:"account",
-			label: wn._("Account"),
+			label: frappe._("Account"),
 			fieldtype: "Link",
 			options: "Account",
 			get_query: function() {
@@ -32,17 +32,17 @@
 					query: "accounts.utils.get_account_list", 
 					filters: {
 						is_pl_account: "No",
-						company: wn.query_report.filters_by_name.company.get_value()
+						company: frappe.query_report.filters_by_name.company.get_value()
 					}
 				}
 			}
 		},
 		{
 			fieldname:"company",
-			label: wn._("Company"),
+			label: frappe._("Company"),
 			fieldtype: "Link",
 			options: "Company",
-			default: wn.defaults.get_default("company")
+			default: frappe.defaults.get_default("company")
 		},
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
index 4662462..5754dd1 100644
--- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
+++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
+import frappe
+from frappe import msgprint, _
 from erpnext.accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
 
 def execute(filters=None):
@@ -58,7 +58,7 @@
 		else:
 			cond += " and master_type = 'Supplier'"
 
-		party_accounts = webnotes.conn.sql_list("""select name from `tabAccount` 
+		party_accounts = frappe.conn.sql_list("""select name from `tabAccount` 
 			where ifnull(master_name, '')!='' and docstatus < 2 %s""" % cond)
 	
 	if party_accounts:
@@ -74,7 +74,7 @@
 	
 def get_entries(filters):
 	conditions, party_accounts = get_conditions(filters)
-	entries =  webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
+	entries =  frappe.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
 		jvd.against_voucher, jvd.against_invoice, jvd.debit, jvd.credit, 
 		jv.cheque_no, jv.cheque_date, jv.remark 
 		from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv 
@@ -86,10 +86,10 @@
 def get_invoice_posting_date_map(filters):
 	invoice_posting_date_map = {}
 	if filters.get("payment_type") == "Incoming":
-		for t in webnotes.conn.sql("""select name, posting_date from `tabSales Invoice`"""):
+		for t in frappe.conn.sql("""select name, posting_date from `tabSales Invoice`"""):
 			invoice_posting_date_map[t[0]] = t[1]
 	else:
-		for t in webnotes.conn.sql("""select name, posting_date from `tabPurchase Invoice`"""):
+		for t in frappe.conn.sql("""select name, posting_date from `tabPurchase Invoice`"""):
 			invoice_posting_date_map[t[0]] = t[1]
 
 	return invoice_posting_date_map
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
index 7ab4ffa..e72d8a7 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/purchase_trends_filters.js");
+frappe.require("assets/erpnext/js/purchase_trends_filters.js");
 
-wn.query_reports["Purchase Invoice Trends"] = {
+frappe.query_reports["Purchase Invoice Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
index 4587618..a9776ef 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns,get_data
 
 def execute(filters=None):
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.js b/erpnext/accounts/report/purchase_register/purchase_register.js
index b38dcba..78eb762 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.js
+++ b/erpnext/accounts/report/purchase_register/purchase_register.js
@@ -1,28 +1,28 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Purchase Register"] = {
+frappe.query_reports["Purchase Register"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_start_date"),
+			"default": frappe.defaults.get_user_default("year_start_date"),
 			"width": "80"
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
@@ -36,10 +36,10 @@
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index a3f42da..b60b70d 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import flt
+from frappe import msgprint, _
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -72,12 +72,12 @@
 	expense_accounts = tax_accounts = expense_columns = tax_columns = []
 	
 	if invoice_list:	
-		expense_accounts = webnotes.conn.sql_list("""select distinct expense_account 
+		expense_accounts = frappe.conn.sql_list("""select distinct expense_account 
 			from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_account, '') != '' 
 			and parent in (%s) order by expense_account""" % 
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 		
-		tax_accounts = 	webnotes.conn.sql_list("""select distinct account_head 
+		tax_accounts = 	frappe.conn.sql_list("""select distinct account_head 
 			from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice' 
 			and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total') 
 			and parent in (%s) order by account_head""" % 
@@ -109,26 +109,26 @@
 	
 def get_invoices(filters):
 	conditions = get_conditions(filters)
-	return webnotes.conn.sql("""select name, posting_date, credit_to, supplier, supplier_name, 
+	return frappe.conn.sql("""select name, posting_date, credit_to, supplier, supplier_name, 
 		bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount 
 		from `tabPurchase Invoice` where docstatus = 1 %s 
 		order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
 	
 	
 def get_invoice_expense_map(invoice_list):
-	expense_details = webnotes.conn.sql("""select parent, expense_account, sum(base_amount) as amount
+	expense_details = frappe.conn.sql("""select parent, expense_account, sum(base_amount) as amount
 		from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_account""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 	
 	invoice_expense_map = {}
 	for d in expense_details:
-		invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_account, [])
+		invoice_expense_map.setdefault(d.parent, frappe._dict()).setdefault(d.expense_account, [])
 		invoice_expense_map[d.parent][d.expense_account] = flt(d.amount)
 	
 	return invoice_expense_map
 	
 def get_invoice_tax_map(invoice_list, invoice_expense_map, expense_accounts):
-	tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
+	tax_details = frappe.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
 		from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 	
@@ -140,13 +140,13 @@
 			else:
 				invoice_expense_map[d.parent][d.account_head] = flt(d.tax_amount)
 		else:
-			invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(d.account_head, [])
+			invoice_tax_map.setdefault(d.parent, frappe._dict()).setdefault(d.account_head, [])
 			invoice_tax_map[d.parent][d.account_head] = flt(d.tax_amount)
 	
 	return invoice_expense_map, invoice_tax_map
 	
 def get_invoice_po_pr_map(invoice_list):
-	pi_items = webnotes.conn.sql("""select parent, purchase_order, purchase_receipt, 
+	pi_items = frappe.conn.sql("""select parent, purchase_order, purchase_receipt, 
 		project_name from `tabPurchase Invoice Item` where parent in (%s) 
 		and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
@@ -154,13 +154,13 @@
 	invoice_po_pr_map = {}
 	for d in pi_items:
 		if d.purchase_order:
-			invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
+			invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault(
 				"purchase_order", []).append(d.purchase_order)
 		if d.purchase_receipt:
-			invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
+			invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault(
 				"purchase_receipt", []).append(d.purchase_receipt)
 		if d.project_name:
-			invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
+			invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault(
 				"project_name", []).append(d.project_name)
 				
 	return invoice_po_pr_map
@@ -168,7 +168,7 @@
 def get_account_details(invoice_list):
 	account_map = {}
 	accounts = list(set([inv.credit_to for inv in invoice_list]))
-	for acc in webnotes.conn.sql("""select name, parent_account from tabAccount 
+	for acc in frappe.conn.sql("""select name, parent_account from tabAccount 
 		where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1):
 			account_map[acc.name] = acc.parent_account
 						
diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
index 0ffb6e0..3c98ab0 100644
--- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
+++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/sales_trends_filters.js");
+frappe.require("assets/erpnext/js/sales_trends_filters.js");
 
-wn.query_reports["Sales Invoice Trends"] = {
+frappe.query_reports["Sales Invoice Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py
index da70623..4e90168 100644
--- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py
+++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns,get_data
 
 def execute(filters=None):
diff --git a/erpnext/accounts/report/sales_register/sales_register.js b/erpnext/accounts/report/sales_register/sales_register.js
index 4238e31..f0d00ce 100644
--- a/erpnext/accounts/report/sales_register/sales_register.js
+++ b/erpnext/accounts/report/sales_register/sales_register.js
@@ -1,28 +1,28 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Sales Register"] = {
+frappe.query_reports["Sales Register"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_default("year_start_date"),
+			"default": frappe.defaults.get_default("year_start_date"),
 			"width": "80"
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		},
 		{
 			"fieldname":"account",
-			"label": wn._("Account"),
+			"label": frappe._("Account"),
 			"fieldtype": "Link",
 			"options": "Account",
 			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
+				var company = frappe.query_report.filters_by_name.company.get_value();
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
@@ -36,10 +36,10 @@
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index 4ed1cdd..23e491d 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import flt
+from frappe import msgprint, _
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -72,12 +72,12 @@
 	income_accounts = tax_accounts = income_columns = tax_columns = []
 	
 	if invoice_list:
-		income_accounts = webnotes.conn.sql_list("""select distinct income_account 
+		income_accounts = frappe.conn.sql_list("""select distinct income_account 
 			from `tabSales Invoice Item` where docstatus = 1 and parent in (%s) 
 			order by income_account""" % 
 			', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
 	
-		tax_accounts = 	webnotes.conn.sql_list("""select distinct account_head 
+		tax_accounts = 	frappe.conn.sql_list("""select distinct account_head 
 			from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice' 
 			and docstatus = 1 and ifnull(tax_amount_after_discount_amount, 0) != 0 
 			and parent in (%s) order by account_head""" % 
@@ -107,26 +107,26 @@
 	
 def get_invoices(filters):
 	conditions = get_conditions(filters)
-	return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer, 
+	return frappe.conn.sql("""select name, posting_date, debit_to, project_name, customer, 
 		customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount 
 		from `tabSales Invoice` 
 		where docstatus = 1 %s order by posting_date desc, name desc""" % 
 		conditions, filters, as_dict=1)
 	
 def get_invoice_income_map(invoice_list):
-	income_details = webnotes.conn.sql("""select parent, income_account, sum(base_amount) as amount
+	income_details = frappe.conn.sql("""select parent, income_account, sum(base_amount) as amount
 		from `tabSales Invoice Item` where parent in (%s) group by parent, income_account""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
 	
 	invoice_income_map = {}
 	for d in income_details:
-		invoice_income_map.setdefault(d.parent, webnotes._dict()).setdefault(d.income_account, [])
+		invoice_income_map.setdefault(d.parent, frappe._dict()).setdefault(d.income_account, [])
 		invoice_income_map[d.parent][d.income_account] = flt(d.amount)
 	
 	return invoice_income_map
 	
 def get_invoice_tax_map(invoice_list, invoice_income_map, income_accounts):
-	tax_details = webnotes.conn.sql("""select parent, account_head, 
+	tax_details = frappe.conn.sql("""select parent, account_head, 
 		sum(tax_amount_after_discount_amount) as tax_amount 
 		from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
@@ -139,13 +139,13 @@
 			else:
 				invoice_income_map[d.parent][d.account_head] = flt(d.tax_amount)
 		else:
-			invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(d.account_head, [])
+			invoice_tax_map.setdefault(d.parent, frappe._dict()).setdefault(d.account_head, [])
 			invoice_tax_map[d.parent][d.account_head] = flt(d.tax_amount)
 	
 	return invoice_income_map, invoice_tax_map
 	
 def get_invoice_so_dn_map(invoice_list):
-	si_items = webnotes.conn.sql("""select parent, sales_order, delivery_note
+	si_items = frappe.conn.sql("""select parent, sales_order, delivery_note
 		from `tabSales Invoice Item` where parent in (%s) 
 		and (ifnull(sales_order, '') != '' or ifnull(delivery_note, '') != '')""" % 
 		', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
@@ -153,10 +153,10 @@
 	invoice_so_dn_map = {}
 	for d in si_items:
 		if d.sales_order:
-			invoice_so_dn_map.setdefault(d.parent, webnotes._dict()).setdefault(
+			invoice_so_dn_map.setdefault(d.parent, frappe._dict()).setdefault(
 				"sales_order", []).append(d.sales_order)
 		if d.delivery_note:
-			invoice_so_dn_map.setdefault(d.parent, webnotes._dict()).setdefault(
+			invoice_so_dn_map.setdefault(d.parent, frappe._dict()).setdefault(
 				"delivery_note", []).append(d.delivery_note)
 				
 	return invoice_so_dn_map
@@ -164,7 +164,7 @@
 def get_customer_deatils(invoice_list):
 	customer_map = {}
 	customers = list(set([inv.customer for inv in invoice_list]))
-	for cust in webnotes.conn.sql("""select name, territory from `tabCustomer` 
+	for cust in frappe.conn.sql("""select name, territory from `tabCustomer` 
 		where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1):
 			customer_map[cust.name] = cust.territory
 	
@@ -173,7 +173,7 @@
 def get_account_details(invoice_list):
 	account_map = {}
 	accounts = list(set([inv.debit_to for inv in invoice_list]))
-	for acc in webnotes.conn.sql("""select name, parent_account from tabAccount 
+	for acc in frappe.conn.sql("""select name, parent_account from tabAccount 
 		where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1):
 			account_map[acc.name] = acc.parent_account
 						
diff --git a/erpnext/accounts/report/supplier_account_head/supplier_account_head.py b/erpnext/accounts/report/supplier_account_head/supplier_account_head.py
index 741e07f..c015462 100644
--- a/erpnext/accounts/report/supplier_account_head/supplier_account_head.py
+++ b/erpnext/accounts/report/supplier_account_head/supplier_account_head.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute(filters=None):
 	account_map = get_account_map()
 	columns = get_columns(account_map)
 	data = []
-	suppliers = webnotes.conn.sql("select name from tabSupplier where docstatus < 2")
+	suppliers = frappe.conn.sql("select name from tabSupplier where docstatus < 2")
 	for supplier in suppliers:
 		row = [supplier[0]]
 		for company in sorted(account_map):
@@ -18,7 +18,7 @@
 	return columns, data
 
 def get_account_map():
-	accounts = webnotes.conn.sql("""select name, company, master_name 
+	accounts = frappe.conn.sql("""select name, company, master_name 
 		from `tabAccount` where master_type = 'Supplier' 
 		and ifnull(master_name, '') != '' and docstatus < 2""", as_dict=1)
 
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index c3f1243..1a5af8e 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -3,16 +3,16 @@
 
 from __future__ import unicode_literals
 
-import webnotes
-from webnotes.utils import nowdate, cstr, flt, now, getdate, add_months
-from webnotes.model.doc import addchild
-from webnotes import msgprint, throw, _
-from webnotes.utils import formatdate
+import frappe
+from frappe.utils import nowdate, cstr, flt, now, getdate, add_months
+from frappe.model.doc import addchild
+from frappe import msgprint, throw, _
+from frappe.utils import formatdate
 from erpnext.utilities import build_filter_conditions
 
 
-class FiscalYearError(webnotes.ValidationError): pass
-class BudgetError(webnotes.ValidationError): pass
+class FiscalYearError(frappe.ValidationError): pass
+class BudgetError(frappe.ValidationError): pass
 
 
 def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1):
@@ -26,14 +26,14 @@
 	else:
 		cond = "'%s' >= year_start_date and '%s' <= year_end_date" % \
 			(date, date)
-	fy = webnotes.conn.sql("""select name, year_start_date, year_end_date
+	fy = frappe.conn.sql("""select name, year_start_date, year_end_date
 		from `tabFiscal Year` where %s order by year_start_date desc""" % cond)
 	
 	if not fy:
 		error_msg = """%s %s not in any Fiscal Year""" % (label, formatdate(date))
 		error_msg = """{msg}: {date}""".format(msg=_("Fiscal Year does not exist for date"), 
 			date=formatdate(date))
-		if verbose: webnotes.msgprint(error_msg)
+		if verbose: frappe.msgprint(error_msg)
 		raise FiscalYearError, error_msg
 	
 	return fy
@@ -48,11 +48,11 @@
 				"fiscal_year": fiscal_year
 			})
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_balance_on(account=None, date=None):
-	if not account and webnotes.form_dict.get("account"):
-		account = webnotes.form_dict.get("account")
-		date = webnotes.form_dict.get("date")
+	if not account and frappe.form_dict.get("account"):
+		account = frappe.form_dict.get("account")
+		date = frappe.form_dict.get("date")
 	
 	cond = []
 	if date:
@@ -73,7 +73,7 @@
 			# hence, assuming balance as 0.0
 			return 0.0
 		
-	acc = webnotes.conn.get_value('Account', account, \
+	acc = frappe.conn.get_value('Account', account, \
 		['lft', 'rgt', 'debit_or_credit', 'is_pl_account', 'group_or_ledger'], as_dict=1)
 	
 	# for pl accounts, get balance within a fiscal year
@@ -90,7 +90,7 @@
 	else:
 		cond.append("""gle.account = "%s" """ % (account, ))
 	
-	bal = webnotes.conn.sql("""
+	bal = frappe.conn.sql("""
 		SELECT sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
 		FROM `tabGL Entry` gle
 		WHERE %s""" % " and ".join(cond))[0][0]
@@ -102,26 +102,26 @@
 	# if bal is None, return 0
 	return flt(bal)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def add_ac(args=None):
 	if not args:
-		args = webnotes.local.form_dict
+		args = frappe.local.form_dict
 		args.pop("cmd")
 		
-	ac = webnotes.bean(args)
+	ac = frappe.bean(args)
 	ac.doc.doctype = "Account"
 	ac.doc.old_parent = ""
 	ac.doc.freeze_account = "No"
 	ac.insert()
 	return ac.doc.name
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def add_cc(args=None):
 	if not args:
-		args = webnotes.local.form_dict
+		args = frappe.local.form_dict
 		args.pop("cmd")
 		
-	cc = webnotes.bean(args)
+	cc = frappe.bean(args)
 	cc.doc.doctype = "Cost Center"
 	cc.doc.old_parent = ""
 	cc.insert()
@@ -143,14 +143,14 @@
 		d['against_fld'] = against_fld[d['against_voucher_type']]
 
 		# cancel JV
-		jv_obj = webnotes.get_obj('Journal Voucher', d['voucher_no'], with_children=1)
+		jv_obj = frappe.get_obj('Journal Voucher', d['voucher_no'], with_children=1)
 		jv_obj.make_gl_entries(cancel=1, adv_adj=1)
 		
 		# update ref in JV Detail
 		update_against_doc(d, jv_obj)
 
 		# re-submit JV
-		jv_obj = webnotes.get_obj('Journal Voucher', d['voucher_no'], with_children =1)
+		jv_obj = frappe.get_obj('Journal Voucher', d['voucher_no'], with_children =1)
 		jv_obj.make_gl_entries(cancel = 0, adv_adj =1)
 
 
@@ -160,7 +160,7 @@
 		check if amount is same
 		check if jv is submitted
 	"""
-	ret = webnotes.conn.sql("""
+	ret = frappe.conn.sql("""
 		select t2.%(dr_or_cr)s from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 
 		where t1.name = t2.parent and t2.account = '%(account)s' 
 		and ifnull(t2.against_voucher, '')='' 
@@ -176,14 +176,14 @@
 		Updates against document, if partial amount splits into rows
 	"""
 
-	webnotes.conn.sql("""
+	frappe.conn.sql("""
 		update `tabJournal Voucher Detail` t1, `tabJournal Voucher` t2	
 		set t1.%(dr_or_cr)s = '%(allocated_amt)s', 
 		t1.%(against_fld)s = '%(against_voucher)s', t2.modified = now() 
 		where t1.name = '%(voucher_detail_no)s' and t1.parent = t2.name""" % d)
 	
 	if d['allocated_amt'] < d['unadjusted_amt']:
-		jvd = webnotes.conn.sql("""select cost_center, balance, against_account, is_advance 
+		jvd = frappe.conn.sql("""select cost_center, balance, against_account, is_advance 
 			from `tabJournal Voucher Detail` where name = %s""", d['voucher_detail_no'])
 		# new entry with balance amount
 		ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail')
@@ -203,7 +203,7 @@
 
 	conditions, filter_values = build_filter_conditions(filters)
 		
-	return webnotes.conn.sql("""select name, parent_account from `tabAccount` 
+	return frappe.conn.sql("""select name, parent_account from `tabAccount` 
 		where docstatus < 2 %s and %s like %s order by name limit %s, %s""" % 
 		(conditions, searchfield, "%s", "%s", "%s"), 
 		tuple(filter_values + ["%%%s%%" % txt, start, page_len]))
@@ -214,46 +214,46 @@
 
 	conditions, filter_values = build_filter_conditions(filters)
 	
-	return webnotes.conn.sql("""select name, parent_cost_center from `tabCost Center` 
+	return frappe.conn.sql("""select name, parent_cost_center from `tabCost Center` 
 		where docstatus < 2 %s and %s like %s order by name limit %s, %s""" % 
 		(conditions, searchfield, "%s", "%s", "%s"), 
 		tuple(filter_values + ["%%%s%%" % txt, start, page_len]))
 		
 def remove_against_link_from_jv(ref_type, ref_no, against_field):
-	linked_jv = webnotes.conn.sql_list("""select parent from `tabJournal Voucher Detail` 
+	linked_jv = frappe.conn.sql_list("""select parent from `tabJournal Voucher Detail` 
 		where `%s`=%s and docstatus < 2""" % (against_field, "%s"), (ref_no))
 		
 	if linked_jv:	
-		webnotes.conn.sql("""update `tabJournal Voucher Detail` set `%s`=null,
+		frappe.conn.sql("""update `tabJournal Voucher Detail` set `%s`=null,
 			modified=%s, modified_by=%s
 			where `%s`=%s and docstatus < 2""" % (against_field, "%s", "%s", against_field, "%s"), 
-			(now(), webnotes.session.user, ref_no))
+			(now(), frappe.session.user, ref_no))
 	
-		webnotes.conn.sql("""update `tabGL Entry`
+		frappe.conn.sql("""update `tabGL Entry`
 			set against_voucher_type=null, against_voucher=null,
 			modified=%s, modified_by=%s
 			where against_voucher_type=%s and against_voucher=%s
 			and voucher_no != ifnull(against_voucher, '')""",
-			(now(), webnotes.session.user, ref_type, ref_no))
+			(now(), frappe.session.user, ref_type, ref_no))
 			
-		webnotes.msgprint("{msg} {linked_jv}".format(msg = _("""Following linked Journal Vouchers \
+		frappe.msgprint("{msg} {linked_jv}".format(msg = _("""Following linked Journal Vouchers \
 			made against this transaction has been unlinked. You can link them again with other \
 			transactions via Payment Reconciliation Tool."""), linked_jv="\n".join(linked_jv)))
 		
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_company_default(company, fieldname):
-	value = webnotes.conn.get_value("Company", company, fieldname)
+	value = frappe.conn.get_value("Company", company, fieldname)
 	
 	if not value:
 		throw(_("Please mention default value for '") + 
-			_(webnotes.get_doctype("company").get_label(fieldname) + 
+			_(frappe.get_doctype("company").get_label(fieldname) + 
 			_("' in Company: ") + company))
 			
 	return value
 
 def fix_total_debit_credit():
-	vouchers = webnotes.conn.sql("""select voucher_type, voucher_no, 
+	vouchers = frappe.conn.sql("""select voucher_type, voucher_no, 
 		sum(debit) - sum(credit) as diff 
 		from `tabGL Entry` 
 		group by voucher_type, voucher_no
@@ -263,7 +263,7 @@
 		if abs(d.diff) > 0:
 			dr_or_cr = d.voucher_type == "Sales Invoice" and "credit" or "debit"
 			
-			webnotes.conn.sql("""update `tabGL Entry` set %s = %s + %s
+			frappe.conn.sql("""update `tabGL Entry` set %s = %s + %s
 				where voucher_type = %s and voucher_no = %s and %s > 0 limit 1""" %
 				(dr_or_cr, dr_or_cr, '%s', '%s', '%s', dr_or_cr), 
 				(d.diff, d.voucher_type, d.voucher_no))
@@ -275,7 +275,7 @@
 	
 	difference = {}
 	
-	account_warehouse = dict(webnotes.conn.sql("""select name, master_name from tabAccount 
+	account_warehouse = dict(frappe.conn.sql("""select name, master_name from tabAccount 
 		where account_type = 'Warehouse' and ifnull(master_name, '') != '' 
 		and name in (%s)""" % ', '.join(['%s']*len(account_list)), account_list))
 			
@@ -288,17 +288,17 @@
 	return difference
 
 def validate_expense_against_budget(args):
-	args = webnotes._dict(args)
-	if webnotes.conn.get_value("Account", {"name": args.account, "is_pl_account": "Yes", 
+	args = frappe._dict(args)
+	if frappe.conn.get_value("Account", {"name": args.account, "is_pl_account": "Yes", 
 		"debit_or_credit": "Debit"}):
-			budget = webnotes.conn.sql("""
+			budget = frappe.conn.sql("""
 				select bd.budget_allocated, cc.distribution_id 
 				from `tabCost Center` cc, `tabBudget Detail` bd
 				where cc.name=bd.parent and cc.name=%s and account=%s and bd.fiscal_year=%s
 			""", (args.cost_center, args.account, args.fiscal_year), as_dict=True)
 			
 			if budget and budget[0].budget_allocated:
-				yearly_action, monthly_action = webnotes.conn.get_value("Company", args.company, 
+				yearly_action, monthly_action = frappe.conn.get_value("Company", args.company, 
 					["yearly_bgt_flag", "monthly_bgt_flag"])
 				action_for = action = ""
 
@@ -306,7 +306,7 @@
 					budget_amount = get_allocated_budget(budget[0].distribution_id, 
 						args.posting_date, args.fiscal_year, budget[0].budget_allocated)
 					
-					args["month_end_date"] = webnotes.conn.sql("select LAST_DAY(%s)", 
+					args["month_end_date"] = frappe.conn.sql("select LAST_DAY(%s)", 
 						args.posting_date)[0][0]
 					action_for, action = "Monthly", monthly_action
 					
@@ -326,12 +326,12 @@
 def get_allocated_budget(distribution_id, posting_date, fiscal_year, yearly_budget):
 	if distribution_id:
 		distribution = {}
-		for d in webnotes.conn.sql("""select bdd.month, bdd.percentage_allocation 
+		for d in frappe.conn.sql("""select bdd.month, bdd.percentage_allocation 
 			from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd
 			where bdd.parent=bd.name and bd.fiscal_year=%s""", fiscal_year, as_dict=1):
 				distribution.setdefault(d.month, d.percentage_allocation)
 
-	dt = webnotes.conn.get_value("Fiscal Year", fiscal_year, "year_start_date")
+	dt = frappe.conn.get_value("Fiscal Year", fiscal_year, "year_start_date")
 	budget_percentage = 0.0
 	
 	while(dt <= getdate(posting_date)):
@@ -348,7 +348,7 @@
 	args["condition"] = " and posting_date<='%s'" % args.month_end_date \
 		if args.get("month_end_date") else ""
 		
-	return webnotes.conn.sql("""
+	return frappe.conn.sql("""
 		select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
 		from `tabGL Entry`
 		where account='%(account)s' and cost_center='%(cost_center)s' 
@@ -361,13 +361,13 @@
 		new_account = None
 		if not merge:
 			if old_account == add_abbr_if_missing(olddn, company):
-				new_account = webnotes.rename_doc("Account", old_account, newdn)
+				new_account = frappe.rename_doc("Account", old_account, newdn)
 		else:
 			existing_new_account = get_account_for(dt, newdn)
-			new_account = webnotes.rename_doc("Account", old_account, 
+			new_account = frappe.rename_doc("Account", old_account, 
 				existing_new_account or newdn, merge=True if existing_new_account else False)
 
-		webnotes.conn.set_value("Account", new_account or old_account, "master_name", newdn)
+		frappe.conn.set_value("Account", new_account or old_account, "master_name", newdn)
 		
 def add_abbr_if_missing(dn, company):
 	from erpnext.setup.doctype.company.company import get_name_with_abbr
@@ -379,14 +379,14 @@
 	elif account_for_doctype == "Warehouse":
 		account_for_field = "account_type"
 		
-	return webnotes.conn.get_value("Account", {account_for_field: account_for_doctype, 
+	return frappe.conn.get_value("Account", {account_for_field: account_for_doctype, 
 		"master_name": account_for})
 		
 def get_currency_precision(currency=None):
 	if not currency:
-		currency = webnotes.conn.get_value("Company", 
-			webnotes.conn.get_default("company"), "default_currency")
-	currency_format = webnotes.conn.get_value("Currency", currency, "number_format")
+		currency = frappe.conn.get_value("Company", 
+			frappe.conn.get_default("company"), "default_currency")
+	currency_format = frappe.conn.get_value("Currency", currency, "number_format")
 	
-	from webnotes.utils import get_number_format_info
+	from frappe.utils import get_number_format_info
 	return get_number_format_info(currency_format)[2]
diff --git a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
index 508dfd0..88d750e 100644
--- a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
+++ b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Purchase Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
   "module": "Buying", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
index ddeb99a..73f850a 100644
--- a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
+++ b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Purchase Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n    Sample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Purchase Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n", 
+  "html": "<!--\n    Sample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Purchase Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>\n", 
   "module": "Buying", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
index 632305b..1d6168e 100644
--- a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
+++ b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Purchase Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Purchase Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'po_details',\n\t\t\t\t'Purchase Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t]\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\trows +=\n\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount / (doc.conversion_rate || 1), doc.currency) + '</td>\\n' +\n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Purchase Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.supplier_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Purchase Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_import, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_import</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n", 
   "module": "Buying", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.py b/erpnext/buying/doctype/buying_settings/buying_settings.py
index 25d0f72..e53e195 100644
--- a/erpnext/buying/doctype/buying_settings/buying_settings.py
+++ b/erpnext/buying/doctype/buying_settings/buying_settings.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
@@ -12,7 +12,7 @@
 		
 	def validate(self):
 		for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
-			webnotes.conn.set_default(key, self.doc.fields.get(key, ""))
+			frappe.conn.set_default(key, self.doc.fields.get(key, ""))
 
 		from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
 		set_by_naming_series("Supplier", "supplier_name", 
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 937e60d..6afcd95 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -6,8 +6,8 @@
 // cur_frm.cscript.tname - Details table name
 // cur_frm.cscript.fname - Details fieldname
 
-wn.provide("erpnext.buying");
-wn.require("assets/erpnext/js/transaction.js");
+frappe.provide("erpnext.buying");
+frappe.require("assets/erpnext/js/transaction.js");
 {% include "public/js/controllers/accounts.js" %}
 
 erpnext.buying.BuyingController = erpnext.TransactionController.extend({
@@ -78,8 +78,8 @@
 	},
 	
 	price_list_rate: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
 		
 		item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
 			precision("rate", item));
@@ -92,8 +92,8 @@
 	},
 	
 	rate: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["rate", "discount_percentage"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["rate", "discount_percentage"]);
 		
 		if(item.price_list_rate) {
 			item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
@@ -107,7 +107,7 @@
 	
 	uom: function(doc, cdt, cdn) {
 		var me = this;
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(item.item_code && item.uom) {
 			return this.frm.call({
 				method: "erpnext.buying.utils.get_conversion_factor",
@@ -131,16 +131,16 @@
 	},
 	
 	conversion_factor: function(doc, cdt, cdn) {
-		if(wn.meta.get_docfield(cdt, "stock_qty", cdn)) {
-			var item = wn.model.get_doc(cdt, cdn);
-			wn.model.round_floats_in(item, ["qty", "conversion_factor"]);
+		if(frappe.meta.get_docfield(cdt, "stock_qty", cdn)) {
+			var item = frappe.model.get_doc(cdt, cdn);
+			frappe.model.round_floats_in(item, ["qty", "conversion_factor"]);
 			item.stock_qty = flt(item.qty * item.conversion_factor, precision("stock_qty", item));
 			refresh_field("stock_qty", item.name, item.parentfield);
 		}
 	},
 	
 	warehouse: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(item.item_code && item.warehouse) {
 			return this.frm.call({
 				method: "erpnext.buying.utils.get_projected_qty",
@@ -154,9 +154,9 @@
 	},
 	
 	project_name: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(item.project_name) {
-			$.each(wn.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, {parentfield: this.fname}),
+			$.each(frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, {parentfield: this.fname}),
 				function(i, other_item) { 
 					if(!other_item.project_name) {
 						other_item.project_name = item.project_name;
@@ -183,7 +183,7 @@
 		var me = this;
 		
 		$.each(this.frm.item_doclist, function(i, item) {
-			wn.model.round_floats_in(item);
+			frappe.model.round_floats_in(item);
 			item.amount = flt(item.rate * item.qty, precision("amount", item));
 			item.item_tax_amount = 0.0;
 			
@@ -203,7 +203,7 @@
 			me.frm.doc.net_total_import += item.amount;
 		});
 		
-		wn.model.round_floats_in(this.frm.doc, ["net_total", "net_total_import"]);
+		frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_import"]);
 	},
 	
 	calculate_totals: function() {
@@ -218,11 +218,11 @@
 			precision("total_tax"));
 		
 		// rounded totals
-		if(wn.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
+		if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
 			this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
 		}
 		
-		if(wn.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
+		if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
 			this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
 		}
 		
@@ -230,17 +230,17 @@
 		this.frm.doc.other_charges_added = 0.0
 		this.frm.doc.other_charges_deducted = 0.0
 		if(tax_count) {
-			this.frm.doc.other_charges_added = wn.utils.sum($.map(this.frm.tax_doclist, 
+			this.frm.doc.other_charges_added = frappe.utils.sum($.map(this.frm.tax_doclist, 
 				function(tax) { return (tax.add_deduct_tax == "Add" 
 					&& in_list(["Valuation and Total", "Total"], tax.category)) ? 
 					tax.tax_amount : 0.0; }));
 		
-			this.frm.doc.other_charges_deducted = wn.utils.sum($.map(this.frm.tax_doclist, 
+			this.frm.doc.other_charges_deducted = frappe.utils.sum($.map(this.frm.tax_doclist, 
 				function(tax) { return (tax.add_deduct_tax == "Deduct" 
 					&& in_list(["Valuation and Total", "Total"], tax.category)) ? 
 					tax.tax_amount : 0.0; }));
 			
-			wn.model.round_floats_in(this.frm.doc,
+			frappe.model.round_floats_in(this.frm.doc,
 				["other_charges_added", "other_charges_deducted"]);
 		}
 		this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added /
@@ -254,7 +254,7 @@
 		this.frm.doc.in_words = this.frm.doc.in_words_import = "";
 		
 		if(this.frm.item_doclist.length) {
-			if(!wn.meta.get_docfield(this.frm.item_doclist[0].doctype, "item_tax_amount", this.frm.doctype)) {
+			if(!frappe.meta.get_docfield(this.frm.item_doclist[0].doctype, "item_tax_amount", this.frm.doctype)) {
 				$.each(this.frm.item_doclist, function(i, item) {
 					delete item["item_tax_amount"];
 				});
@@ -262,7 +262,7 @@
 		}
 
 		if(this.frm.tax_doclist.length) {
-			if(!wn.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_discount_amount", this.frm.doctype)) {
+			if(!frappe.meta.get_docfield(this.frm.tax_doclist[0].doctype, "tax_amount_after_discount_amount", this.frm.doctype)) {
 				$.each(this.frm.tax_doclist, function(i, tax) {
 					delete tax["tax_amount_after_discount_amount"];
 				});
@@ -272,7 +272,7 @@
 	
 	calculate_outstanding_amount: function() {
 		if(this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.docstatus < 2) {
-			wn.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]);
+			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]);
 			this.frm.doc.total_amount_to_pay = flt(this.frm.doc.grand_total - this.frm.doc.write_off_amount,
 				precision("total_amount_to_pay"));
 			this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance,
@@ -286,7 +286,7 @@
 		// 
 		// TODO: rename item_tax_amount to valuation_tax_amount
 		if(["Valuation", "Valuation and Total"].indexOf(tax.category) != -1 &&
-			wn.meta.get_docfield(item.doctype, "item_tax_amount", item.parent || item.name)) {
+			frappe.meta.get_docfield(item.doctype, "item_tax_amount", item.parent || item.name)) {
 				// accumulate only if tax is for Valuation / Valuation and Total
 				item.item_tax_amount += flt(current_tax_amount, precision("item_tax_amount", item));
 		}
@@ -298,9 +298,9 @@
 		
 		var setup_field_label_map = function(fields_list, currency) {
 			$.each(fields_list, function(i, fname) {
-				var docfield = wn.meta.docfield_map[me.frm.doc.doctype][fname];
+				var docfield = frappe.meta.docfield_map[me.frm.doc.doctype][fname];
 				if(docfield) {
-					var label = wn._(docfield.label || "").replace(/\([^\)]*\)/g, "");
+					var label = frappe._(docfield.label || "").replace(/\([^\)]*\)/g, "");
 					field_label_map[fname] = label.trim() + " (" + currency + ")";
 				}
 			});
@@ -345,9 +345,9 @@
 		var setup_field_label_map = function(fields_list, currency, parentfield) {
 			var grid_doctype = me.frm.fields_dict[parentfield].grid.doctype;
 			$.each(fields_list, function(i, fname) {
-				var docfield = wn.meta.docfield_map[grid_doctype][fname];
+				var docfield = frappe.meta.docfield_map[grid_doctype][fname];
 				if(docfield) {
-					var label = wn._(docfield.label || "").replace(/\([^\)]*\)/g, "");
+					var label = frappe._(docfield.label || "").replace(/\([^\)]*\)/g, "");
 					field_label_map[grid_doctype + "-" + fname] = 
 						label.trim() + " (" + currency + ")";
 				}
@@ -372,7 +372,7 @@
 		// toggle columns
 		var item_grid = this.frm.fields_dict[this.fname].grid;
 		var fieldnames = $.map(["base_rate", "base_price_list_rate", "base_amount", "base_rate"], function(fname) {
-			return wn.meta.get_docfield(item_grid.doctype, fname, me.frm.docname) ? fname : null;
+			return frappe.meta.get_docfield(item_grid.doctype, fname, me.frm.docname) ? fname : null;
 		});
 		
 		item_grid.set_column_disp(fieldnames, this.frm.doc.currency != company_currency);
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 49c8793..356ef39 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt
-from webnotes.model.utils import getlist
-from webnotes import msgprint, _
+from frappe.utils import cstr, flt
+from frappe.model.utils import getlist
+from frappe import msgprint, _
 
 from erpnext.stock.doctype.item.item import get_last_purchase_details
 from erpnext.controllers.buying_controller import BuyingController
@@ -19,8 +19,8 @@
 	def update_last_purchase_rate(self, obj, is_submit):
 		"""updates last_purchase_rate in item table for each item"""
 		
-		import webnotes.utils
-		this_purchase_date = webnotes.utils.getdate(obj.doc.fields.get('posting_date') or obj.doc.fields.get('transaction_date'))
+		import frappe.utils
+		this_purchase_date = frappe.utils.getdate(obj.doc.fields.get('posting_date') or obj.doc.fields.get('transaction_date'))
 		
 		for d in getlist(obj.doclist,obj.fname):
 			# get last purchase details
@@ -37,12 +37,12 @@
 				if flt(d.conversion_factor):
 					last_purchase_rate = flt(d.base_rate) / flt(d.conversion_factor)
 				else:
-					webnotes.throw(_("Row ") + cstr(d.idx) + ": " + 
+					frappe.throw(_("Row ") + cstr(d.idx) + ": " + 
 						_("UOM Conversion Factor is mandatory"))
 
 			# update last purchsae rate
 			if last_purchase_rate:
-				webnotes.conn.sql("""update `tabItem` set last_purchase_rate = %s where name = %s""",
+				frappe.conn.sql("""update `tabItem` set last_purchase_rate = %s where name = %s""",
 					(flt(last_purchase_rate), d.item_code))
 	
 	def get_last_purchase_rate(self, obj):
@@ -64,7 +64,7 @@
 					# if no last purchase found, reset all values to 0
 					d.base_price_list_rate = d.base_rate = d.price_list_rate = d.rate = d.discount_percentage = 0
 					
-					item_last_purchase_rate = webnotes.conn.get_value("Item",
+					item_last_purchase_rate = frappe.conn.get_value("Item",
 						d.item_code, "last_purchase_rate")
 					if item_last_purchase_rate:
 						d.base_price_list_rate = d.base_rate = d.price_list_rate \
@@ -75,10 +75,10 @@
 		for d in getlist( obj.doclist, obj.fname):
 			# validation for valid qty	
 			if flt(d.qty) < 0 or (d.parenttype != 'Purchase Receipt' and not flt(d.qty)):
-				webnotes.throw("Please enter valid qty for item %s" % cstr(d.item_code))
+				frappe.throw("Please enter valid qty for item %s" % cstr(d.item_code))
 			
 			# udpate with latest quantities
-			bin = webnotes.conn.sql("""select projected_qty from `tabBin` where 
+			bin = frappe.conn.sql("""select projected_qty from `tabBin` where 
 				item_code = %s and warehouse = %s""", (d.item_code, d.warehouse), as_dict=1)
 			
 			f_lst ={'projected_qty': bin and flt(bin[0]['projected_qty']) or 0, 'ordered_qty': 0, 'received_qty' : 0}
@@ -88,21 +88,21 @@
 				if d.fields.has_key(x):
 					d.fields[x] = f_lst[x]
 			
-			item = webnotes.conn.sql("""select is_stock_item, is_purchase_item, 
+			item = frappe.conn.sql("""select is_stock_item, is_purchase_item, 
 				is_sub_contracted_item, end_of_life from `tabItem` where name=%s""", d.item_code)
 			if not item:
-				webnotes.throw("Item %s does not exist in Item Master." % cstr(d.item_code))
+				frappe.throw("Item %s does not exist in Item Master." % cstr(d.item_code))
 			
 			from erpnext.stock.doctype.item.item import validate_end_of_life
 			validate_end_of_life(d.item_code, item[0][3])
 			
 			# validate stock item
 			if item[0][0]=='Yes' and d.qty and not d.warehouse:
-				webnotes.throw("Warehouse is mandatory for %s, since it is a stock item" % d.item_code)
+				frappe.throw("Warehouse is mandatory for %s, since it is a stock item" % d.item_code)
 			
 			# validate purchase item
 			if item[0][1] != 'Yes' and item[0][2] != 'Yes':
-				webnotes.throw("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code))
+				frappe.throw("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code))
 			
 			# list criteria that should not repeat if item is stock item
 			e = [d.schedule_date, d.item_code, d.description, d.warehouse, d.uom, 
@@ -113,12 +113,12 @@
 			# if is not stock item
 			f = [d.schedule_date, d.item_code, d.description]
 			
-			ch = webnotes.conn.sql("""select is_stock_item from `tabItem` where name = %s""", d.item_code)
+			ch = frappe.conn.sql("""select is_stock_item from `tabItem` where name = %s""", d.item_code)
 			
 			if ch and ch[0][0] == 'Yes':	
 				# check for same items
 				if e in check_list:
-					webnotes.throw("""Item %s has been entered more than once with same description, schedule date, warehouse and uom.\n 
+					frappe.throw("""Item %s has been entered more than once with same description, schedule date, warehouse and uom.\n 
 						Please change any of the field value to enter the item twice""" % d.item_code)
 				else:
 					check_list.append(e)
@@ -126,7 +126,7 @@
 			elif ch and ch[0][0] == 'No':
 				# check for same items
 				if f in chk_dupl_itm:
-					webnotes.throw("""Item %s has been entered more than once with same description, schedule date.\n 
+					frappe.throw("""Item %s has been entered more than once with same description, schedule date.\n 
 						Please change any of the field value to enter the item twice.""" % d.item_code)
 				else:
 					chk_dupl_itm.append(f)
@@ -139,37 +139,37 @@
 		# but if in Material Request uom KG it can change in PO
 		
 		get_qty = (transaction == 'Material Request - Purchase Order') and 'qty * conversion_factor' or 'qty'
-		qty = webnotes.conn.sql("""select sum(%s) from `tab%s` where %s = %s and 
+		qty = frappe.conn.sql("""select sum(%s) from `tab%s` where %s = %s and 
 			docstatus = 1 and parent != %s""" % (get_qty, curr_doctype, ref_tab_fname, '%s', '%s'), 
 			(ref_tab_dn, curr_parent_name))
 		qty = qty and flt(qty[0][0]) or 0 
 		
 		# get total qty of ref doctype
 		#--------------------
-		max_qty = webnotes.conn.sql("""select qty from `tab%s` where name = %s 
+		max_qty = frappe.conn.sql("""select qty from `tab%s` where name = %s 
 			and docstatus = 1""" % (ref_doc_tname, '%s'), ref_tab_dn)
 		max_qty = max_qty and flt(max_qty[0][0]) or 0
 		
 		return cstr(qty)+'~~~'+cstr(max_qty)
 
 	def check_for_stopped_status(self, doctype, docname):
-		stopped = webnotes.conn.sql("""select name from `tab%s` where name = %s and 
+		stopped = frappe.conn.sql("""select name from `tab%s` where name = %s and 
 			status = 'Stopped'""" % (doctype, '%s'), docname)
 		if stopped:
-			webnotes.throw("One cannot do any transaction against %s : %s, it's status is 'Stopped'" % 
+			frappe.throw("One cannot do any transaction against %s : %s, it's status is 'Stopped'" % 
 				(doctype, docname))
 	
 	def check_docstatus(self, check, doctype, docname, detail_doctype = ''):
 		if check == 'Next':
-			submitted = webnotes.conn.sql("""select t1.name from `tab%s` t1,`tab%s` t2 
+			submitted = frappe.conn.sql("""select t1.name from `tab%s` t1,`tab%s` t2 
 				where t1.name = t2.parent and t2.prevdoc_docname = %s and t1.docstatus = 1""" 
 				% (doctype, detail_doctype, '%s'), docname)
 			if submitted:
-				webnotes.throw(cstr(doctype) + ": " + cstr(submitted[0][0]) 
+				frappe.throw(cstr(doctype) + ": " + cstr(submitted[0][0]) 
 					+ _("has already been submitted."))
 
 		if check == 'Previous':
-			submitted = webnotes.conn.sql("""select name from `tab%s` 
+			submitted = frappe.conn.sql("""select name from `tab%s` 
 				where docstatus = 1 and name = %s""" % (doctype, '%s'), docname)
 			if not submitted:
-				webnotes.throw(cstr(doctype) + ": " + cstr(submitted[0][0]) + _("not submitted"))
+				frappe.throw(cstr(doctype) + ": " + cstr(submitted[0][0]) + _("not submitted"))
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 5213885..0db8d6f 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.buying");
+frappe.provide("erpnext.buying");
 
 cur_frm.cscript.tname = "Purchase Order Item";
 cur_frm.cscript.fname = "po_details";
@@ -18,46 +18,46 @@
 		this.frm.dashboard.reset();
 		
 		if(doc.docstatus == 1 && doc.status != 'Stopped'){
-			cur_frm.dashboard.add_progress(cint(doc.per_received) + wn._("% Received"), 
+			cur_frm.dashboard.add_progress(cint(doc.per_received) + frappe._("% Received"), 
 				doc.per_received);
-			cur_frm.dashboard.add_progress(cint(doc.per_billed) + wn._("% Billed"), 
+			cur_frm.dashboard.add_progress(cint(doc.per_billed) + frappe._("% Billed"), 
 				doc.per_billed);
 
 			cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 
 			if(flt(doc.per_received, 2) < 100) 
-				cur_frm.add_custom_button(wn._('Make Purchase Receipt'), this.make_purchase_receipt);	
+				cur_frm.add_custom_button(frappe._('Make Purchase Receipt'), this.make_purchase_receipt);	
 			if(flt(doc.per_billed, 2) < 100) 
-				cur_frm.add_custom_button(wn._('Make Invoice'), this.make_purchase_invoice);
+				cur_frm.add_custom_button(frappe._('Make Invoice'), this.make_purchase_invoice);
 			if(flt(doc.per_billed, 2) < 100 || doc.per_received < 100) 
-				cur_frm.add_custom_button(wn._('Stop'), cur_frm.cscript['Stop Purchase Order'], "icon-exclamation");
+				cur_frm.add_custom_button(frappe._('Stop'), cur_frm.cscript['Stop Purchase Order'], "icon-exclamation");
 		} else if(doc.docstatus===0) {
 			cur_frm.cscript.add_from_mappers();
 		}
 
 		if(doc.docstatus == 1 && doc.status == 'Stopped')
-			cur_frm.add_custom_button(wn._('Unstop Purchase Order'), 
+			cur_frm.add_custom_button(frappe._('Unstop Purchase Order'), 
 				cur_frm.cscript['Unstop Purchase Order'], "icon-check");
 	},
 		
 	make_purchase_receipt: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
 			source_name: cur_frm.doc.name
 		})
 	},
 	
 	make_purchase_invoice: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
 			source_name: cur_frm.doc.name
 		})
 	},
 	
 	add_from_mappers: function() {
-		cur_frm.add_custom_button(wn._('From Material Request'), 
+		cur_frm.add_custom_button(frappe._('From Material Request'), 
 			function() {
-				wn.model.map_current_doc({
+				frappe.model.map_current_doc({
 					method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
 					source_doctype: "Material Request",
 					get_query_filters: {
@@ -71,9 +71,9 @@
 			}
 		);
 
-		cur_frm.add_custom_button(wn._('From Supplier Quotation'), 
+		cur_frm.add_custom_button(frappe._('From Supplier Quotation'), 
 			function() {
-				wn.model.map_current_doc({
+				frappe.model.map_current_doc({
 					method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
 					source_doctype: "Supplier Quotation",
 					get_query_filters: {
@@ -85,9 +85,9 @@
 			}
 		);	
 			
-		cur_frm.add_custom_button(wn._('For Supplier'), 
+		cur_frm.add_custom_button(frappe._('For Supplier'), 
 			function() {
-				wn.model.map_current_doc({
+				frappe.model.map_current_doc({
 					method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order_based_on_supplier",
 					source_doctype: "Supplier",
 					get_query_filters: {
@@ -137,10 +137,10 @@
 
 cur_frm.cscript['Stop Purchase Order'] = function() {
 	var doc = cur_frm.doc;
-	var check = confirm(wn._("Do you really want to STOP ") + doc.name);
+	var check = confirm(frappe._("Do you really want to STOP ") + doc.name);
 
 	if (check) {
-		return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+		return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
 			cur_frm.refresh();
 		});	
 	}
@@ -148,10 +148,10 @@
 
 cur_frm.cscript['Unstop Purchase Order'] = function() {
 	var doc = cur_frm.doc;
-	var check = confirm(wn._("Do you really want to UNSTOP ") + doc.name);
+	var check = confirm(frappe._("Do you really want to UNSTOP ") + doc.name);
 
 	if (check) {
-		return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+		return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
 			cur_frm.refresh();
 		});	
 	}
@@ -198,7 +198,7 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings.purchase_order)) {
-		cur_frm.email_doc(wn.boot.notification_settings.purchase_order_message);
+	if(cint(frappe.boot.notification_settings.purchase_order)) {
+		cur_frm.email_doc(frappe.boot.notification_settings.purchase_order_message);
 	}
 }
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index b35b388..1f5583f 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint
+from frappe.utils import cstr, flt
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint
 
 	
 from erpnext.controllers.buying_controller import BuyingController
@@ -67,7 +67,7 @@
 	def get_schedule_dates(self):
 		for d in getlist(self.doclist, 'po_details'):
 			if d.prevdoc_detail_docname and not d.schedule_date:
-				d.schedule_date = webnotes.conn.get_value("Material Request Item",
+				d.schedule_date = frappe.conn.get_value("Material Request Item",
 						d.prevdoc_detail_docname, "schedule_date")
 	
 	def get_last_purchase_rate(self):
@@ -87,7 +87,7 @@
 		pc_obj = get_obj('Purchase Common')
 		for d in getlist(self.doclist, 'po_details'):
 			#1. Check if is_stock_item == 'Yes'
-			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes":
+			if frappe.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes":
 				# this happens when item is changed from non-stock to stock item
 				if not d.warehouse:
 					continue
@@ -127,8 +127,8 @@
 				update_bin(args)
 				
 	def check_modified_date(self):
-		mod_db = webnotes.conn.sql("select modified from `tabPurchase Order` where name = '%s'" % self.doc.name)
-		date_diff = webnotes.conn.sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
+		mod_db = frappe.conn.sql("select modified from `tabPurchase Order` where name = '%s'" % self.doc.name)
+		date_diff = frappe.conn.sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
 		
 		if date_diff and date_diff[0][0]:
 			msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
@@ -137,7 +137,7 @@
 	def update_status(self, status):
 		self.check_modified_date()
 		# step 1:=> Set Status
-		webnotes.conn.set(self.doc,'status',cstr(status))
+		frappe.conn.set(self.doc,'status',cstr(status))
 
 		# step 2:=> Update Bin
 		self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
@@ -146,7 +146,7 @@
 		msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)))
 
 	def on_submit(self):
-		purchase_controller = webnotes.get_obj("Purchase Common")
+		purchase_controller = frappe.get_obj("Purchase Common")
 		
 		self.update_prevdoc_status()
 		self.update_bin(is_submit = 1, is_stopped = 0)
@@ -156,7 +156,7 @@
 		
 		purchase_controller.update_last_purchase_rate(self, is_submit = 1)
 		
-		webnotes.conn.set(self.doc,'status','Submitted')
+		frappe.conn.set(self.doc,'status','Submitted')
 	 
 	def on_cancel(self):
 		pc_obj = get_obj(dt = 'Purchase Common')		
@@ -166,12 +166,12 @@
 		pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Receipt', docname = self.doc.name, detail_doctype = 'Purchase Receipt Item')
 
 		# Check if Purchase Invoice has been submitted against current Purchase Order
-		submitted = webnotes.conn.sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_order = '%s' and t1.docstatus = 1" % self.doc.name)
+		submitted = frappe.conn.sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_order = '%s' and t1.docstatus = 1" % self.doc.name)
 		if submitted:
 			msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
 			raise Exception
 
-		webnotes.conn.set(self.doc,'status','Cancelled')
+		frappe.conn.set(self.doc,'status','Cancelled')
 		self.update_prevdoc_status()
 		self.update_bin( is_submit = 0, is_stopped = 0)
 		pc_obj.update_last_purchase_rate(self, is_submit = 0)
@@ -179,12 +179,12 @@
 	def on_update(self):
 		pass
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_purchase_receipt(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
-		bean = webnotes.bean(target)
+		bean = frappe.bean(target)
 		bean.run_method("set_missing_values")
 
 	def update_item(obj, target, source_parent):
@@ -218,12 +218,12 @@
 
 	return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_purchase_invoice(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
-		bean = webnotes.bean(target)
+		bean = frappe.bean(target)
 		bean.run_method("set_missing_values")
 
 	def update_item(obj, target, source_parent):
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index 5585080..5d49500 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -3,20 +3,20 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-import webnotes.defaults
-from webnotes.utils import flt
+import frappe
+import frappe.defaults
+from frappe.utils import flt
 
 class TestPurchaseOrder(unittest.TestCase):
 	def test_make_purchase_receipt(self):		
 		from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
 
-		po = webnotes.bean(copy=test_records[0]).insert()
+		po = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_purchase_receipt, 
+		self.assertRaises(frappe.ValidationError, make_purchase_receipt, 
 			po.doc.name)
 
-		po = webnotes.bean("Purchase Order", po.doc.name)
+		po = frappe.bean("Purchase Order", po.doc.name)
 		po.submit()
 		
 		pr = make_purchase_receipt(po.doc.name)
@@ -26,25 +26,25 @@
 		self.assertEquals(len(pr), len(test_records[0]))
 		
 		pr[0].naming_series = "_T-Purchase Receipt-"
-		pr_bean = webnotes.bean(pr)
+		pr_bean = frappe.bean(pr)
 		pr_bean.insert()
 			
 	def test_ordered_qty(self):
-		webnotes.conn.sql("delete from tabBin")
+		frappe.conn.sql("delete from tabBin")
 		
 		from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
 
-		po = webnotes.bean(copy=test_records[0]).insert()
+		po = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_purchase_receipt, 
+		self.assertRaises(frappe.ValidationError, make_purchase_receipt, 
 			po.doc.name)
 
-		po = webnotes.bean("Purchase Order", po.doc.name)
+		po = frappe.bean("Purchase Order", po.doc.name)
 		po.doc.is_subcontracted = "No"
 		po.doclist[1].item_code = "_Test Item"
 		po.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Bin", {"item_code": "_Test Item", 
+		self.assertEquals(frappe.conn.get_value("Bin", {"item_code": "_Test Item", 
 			"warehouse": "_Test Warehouse - _TC"}, "ordered_qty"), 10)
 		
 		pr = make_purchase_receipt(po.doc.name)
@@ -54,35 +54,35 @@
 		pr[0]["posting_date"] = "2013-05-12"
 		pr[0].naming_series = "_T-Purchase Receipt-"
 		pr[1].qty = 4.0
-		pr_bean = webnotes.bean(pr)
+		pr_bean = frappe.bean(pr)
 		pr_bean.insert()
 		pr_bean.submit()
 		
-		self.assertEquals(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item", 
+		self.assertEquals(flt(frappe.conn.get_value("Bin", {"item_code": "_Test Item", 
 			"warehouse": "_Test Warehouse - _TC"}, "ordered_qty")), 6.0)
 			
-		webnotes.conn.set_value('Item', '_Test Item', 'tolerance', 50)
+		frappe.conn.set_value('Item', '_Test Item', 'tolerance', 50)
 			
 		pr1 = make_purchase_receipt(po.doc.name)
 		pr1[0].naming_series = "_T-Purchase Receipt-"
 		pr1[0]["posting_date"] = "2013-05-12"
 		pr1[1].qty = 8
-		pr1_bean = webnotes.bean(pr1)
+		pr1_bean = frappe.bean(pr1)
 		pr1_bean.insert()
 		pr1_bean.submit()
 		
-		self.assertEquals(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item", 
+		self.assertEquals(flt(frappe.conn.get_value("Bin", {"item_code": "_Test Item", 
 			"warehouse": "_Test Warehouse - _TC"}, "ordered_qty")), 0.0)
 		
 	def test_make_purchase_invoice(self):
 		from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice
 
-		po = webnotes.bean(copy=test_records[0]).insert()
+		po = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_purchase_invoice, 
+		self.assertRaises(frappe.ValidationError, make_purchase_invoice, 
 			po.doc.name)
 
-		po = webnotes.bean("Purchase Order", po.doc.name)
+		po = frappe.bean("Purchase Order", po.doc.name)
 		po.submit()
 		pi = make_purchase_invoice(po.doc.name)
 		
@@ -90,23 +90,23 @@
 		self.assertEquals(len(pi), len(test_records[0]))
 		pi[0]["posting_date"] = "2013-05-12"
 		pi[0].bill_no = "NA"
-		webnotes.bean(pi).insert()
+		frappe.bean(pi).insert()
 		
 	def test_subcontracting(self):
-		po = webnotes.bean(copy=test_records[0])
+		po = frappe.bean(copy=test_records[0])
 		po.insert()
 		self.assertEquals(len(po.doclist.get({"parentfield": "po_raw_material_details"})), 2)
 
 	def test_warehouse_company_validation(self):
 		from erpnext.stock.utils import InvalidWarehouseCompany
-		po = webnotes.bean(copy=test_records[0])
+		po = frappe.bean(copy=test_records[0])
 		po.doc.company = "_Test Company 1"
 		po.doc.conversion_rate = 0.0167
 		self.assertRaises(InvalidWarehouseCompany, po.insert)
 
 	def test_uom_integer_validation(self):
 		from erpnext.utilities.transaction_base import UOMMustBeIntegerError
-		po = webnotes.bean(copy=test_records[0])
+		po = frappe.bean(copy=test_records[0])
 		po.doclist[1].qty = 3.4
 		self.assertRaises(UOMMustBeIntegerError, po.insert)
 
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
index cb6190f..26c87f1 100644
--- a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
+++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
index cb6190f..26c87f1 100644
--- a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
+++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
index f837d97..b6d4790 100644
--- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.model.doc import addchild
+from frappe.model.doc import addchild
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -13,7 +13,7 @@
 
 	def get_item_specification_details(self):
 		self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
-		specification = webnotes.conn.sql("select specification, value from `tabItem Quality Inspection Parameter` \
+		specification = frappe.conn.sql("select specification, value from `tabItem Quality Inspection Parameter` \
 			where parent = '%s' order by idx" % (self.doc.item_code))
 		for d in specification:
 			child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist)
@@ -23,27 +23,27 @@
 
 	def on_submit(self):
 		if self.doc.purchase_receipt_no:
-			webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
+			frappe.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
 				where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
 				% (self.doc.name, self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
 		
 
 	def on_cancel(self):
 		if self.doc.purchase_receipt_no:
-			webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
+			frappe.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
 				where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
 				% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
 
 
 def item_query(doctype, txt, searchfield, start, page_len, filters):
 	if filters.get("from"):
-		from webnotes.widgets.reportview import get_match_cond
+		from frappe.widgets.reportview import get_match_cond
 		filters.update({
 			"txt": txt,
 			"mcond": get_match_cond(filters["from"], searchfield),
 			"start": start,
 			"page_len": page_len
 		})
-		return webnotes.conn.sql("""select item_code from `tab%(from)s` 
+		return frappe.conn.sql("""select item_code from `tab%(from)s` 
 			where parent='%(parent)s' and docstatus < 2 and item_code like '%%%(txt)s%%' %(mcond)s
 			order by item_code limit %(start)s, %(page_len)s""" % filters)
\ No newline at end of file
diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py
index cb6190f..26c87f1 100644
--- a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py
+++ b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index 3f67c78..cfe526f 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -16,8 +16,8 @@
 		cur_frm.cscript.make_address(doc,dt,dn);
 		cur_frm.cscript.make_contact(doc,dt,dn);
 		
-		cur_frm.communication_view = new wn.views.CommunicationList({
-			list: wn.model.get("Communication", {"supplier": doc.name}),
+		cur_frm.communication_view = new frappe.views.CommunicationList({
+			list: frappe.model.get("Communication", {"supplier": doc.name}),
 			parent: cur_frm.fields_dict.communication_html.wrapper,
 			doc: doc
 		})		
@@ -36,7 +36,7 @@
 	cur_frm.dashboard.add_doctype_badge("Purchase Receipt", "supplier");
 	cur_frm.dashboard.add_doctype_badge("Purchase Invoice", "supplier");
 
-	return wn.call({
+	return frappe.call({
 		type: "GET",
 		method: "erpnext.buying.doctype.supplier.supplier.get_dashboard_info",
 		args: {
@@ -45,9 +45,9 @@
 		callback: function(r) {
 			if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
 				cur_frm.dashboard.set_headline(
-					wn._("Total Billing This Year: ") + "<b>" 
+					frappe._("Total Billing This Year: ") + "<b>" 
 					+ format_currency(r.message.total_billing, erpnext.get_currency(cur_frm.doc.company))
-					+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" 
+					+ '</b> / <span class="text-muted">' + frappe._("Unpaid") + ": <b>" 
 					+ format_currency(r.message.total_unpaid, erpnext.get_currency(cur_frm.doc.company)) 
 					+ '</b></span>');
 			}
@@ -59,7 +59,7 @@
 
 cur_frm.cscript.make_address = function() {
 	if(!cur_frm.address_list) {
-		cur_frm.address_list = new wn.ui.Listing({
+		cur_frm.address_list = new frappe.ui.Listing({
 			parent: cur_frm.fields_dict['address_html'].wrapper,
 			page_length: 5,
 			new_doctype: "Address",
@@ -67,7 +67,7 @@
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
 			as_dict: 1,
-			no_results_message: wn._('No addresses created'),
+			no_results_message: frappe._('No addresses created'),
 			render_row: cur_frm.cscript.render_address_row,
 		});
 		// note: render_address_row is defined in contact_control.js
@@ -77,7 +77,7 @@
 
 cur_frm.cscript.make_contact = function() {
 	if(!cur_frm.contact_list) {
-		cur_frm.contact_list = new wn.ui.Listing({
+		cur_frm.contact_list = new frappe.ui.Listing({
 			parent: cur_frm.fields_dict['contact_html'].wrapper,
 			page_length: 5,
 			new_doctype: "Contact",
@@ -85,7 +85,7 @@
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
 			as_dict: 1,
-			no_results_message: wn._('No contacts created'),
+			no_results_message: frappe._('No contacts created'),
 			render_row: cur_frm.cscript.render_contact_row,
 		});
 		// note: render_contact_row is defined in contact_control.js
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index 94a16f5..a22dd1c 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.defaults
+import frappe
+import frappe.defaults
 
-from webnotes.utils import cint
-from webnotes import msgprint, _
-from webnotes.model.doc import make_autoname
+from frappe.utils import cint
+from frappe import msgprint, _
+from frappe.model.doc import make_autoname
 from erpnext.accounts.party import create_party_account
 
 from erpnext.utilities.transaction_base import TransactionBase
@@ -18,25 +18,25 @@
 		self.doclist = doclist
 
 	def autoname(self):
-		supp_master_name = webnotes.defaults.get_global_default('supp_master_name')
+		supp_master_name = frappe.defaults.get_global_default('supp_master_name')
 		
 		if supp_master_name == 'Supplier Name':
-			if webnotes.conn.exists("Customer", self.doc.supplier_name):
-				webnotes.msgprint(_("A Customer exists with same name"), raise_exception=1)
+			if frappe.conn.exists("Customer", self.doc.supplier_name):
+				frappe.msgprint(_("A Customer exists with same name"), raise_exception=1)
 			self.doc.name = self.doc.supplier_name
 		else:
 			self.doc.name = make_autoname(self.doc.naming_series + '.#####')
 
 	def update_address(self):
-		webnotes.conn.sql("""update `tabAddress` set supplier_name=%s, modified=NOW() 
+		frappe.conn.sql("""update `tabAddress` set supplier_name=%s, modified=NOW() 
 			where supplier=%s""", (self.doc.supplier_name, self.doc.name))
 
 	def update_contact(self):
-		webnotes.conn.sql("""update `tabContact` set supplier_name=%s, modified=NOW() 
+		frappe.conn.sql("""update `tabContact` set supplier_name=%s, modified=NOW() 
 			where supplier=%s""", (self.doc.supplier_name, self.doc.name))
 
 	def update_credit_days_limit(self):
-		webnotes.conn.sql("""update tabAccount set credit_days = %s where name = %s""", 
+		frappe.conn.sql("""update tabAccount set credit_days = %s where name = %s""", 
 			(cint(self.doc.credit_days), self.doc.name + " - " + self.get_company_abbr()))
 
 	def on_update(self):
@@ -53,37 +53,37 @@
 		self.update_credit_days_limit()
 		
 	def get_company_abbr(self):
-		return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
+		return frappe.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
 	
 	def validate(self):
 		#validation for Naming Series mandatory field...
-		if webnotes.defaults.get_global_default('supp_master_name') == 'Naming Series':
+		if frappe.defaults.get_global_default('supp_master_name') == 'Naming Series':
 			if not self.doc.naming_series:
 				msgprint("Series is Mandatory.", raise_exception=1)
 			
 	def get_contacts(self,nm):
 		if nm:
-			contact_details =webnotes.conn.convert_to_lists(webnotes.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where supplier = '%s'"%nm))
+			contact_details =frappe.conn.convert_to_lists(frappe.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where supplier = '%s'"%nm))
 	 
 			return contact_details
 		else:
 			return ''
 			
 	def delete_supplier_address(self):
-		for rec in webnotes.conn.sql("select * from `tabAddress` where supplier=%s", (self.doc.name,), as_dict=1):
-			webnotes.conn.sql("delete from `tabAddress` where name=%s",(rec['name']))
+		for rec in frappe.conn.sql("select * from `tabAddress` where supplier=%s", (self.doc.name,), as_dict=1):
+			frappe.conn.sql("delete from `tabAddress` where name=%s",(rec['name']))
 	
 	def delete_supplier_contact(self):
-		for contact in webnotes.conn.sql_list("""select name from `tabContact` 
+		for contact in frappe.conn.sql_list("""select name from `tabContact` 
 			where supplier=%s""", self.doc.name):
-				webnotes.delete_doc("Contact", contact)
+				frappe.delete_doc("Contact", contact)
 	
 	def delete_supplier_account(self):
 		"""delete supplier's ledger if exist and check balance before deletion"""
-		acc = webnotes.conn.sql("select name from `tabAccount` where master_type = 'Supplier' \
+		acc = frappe.conn.sql("select name from `tabAccount` where master_type = 'Supplier' \
 			and master_name = %s and docstatus < 2", self.doc.name)
 		if acc:
-			webnotes.delete_doc('Account', acc[0][0])
+			frappe.delete_doc('Account', acc[0][0])
 			
 	def on_trash(self):
 		self.delete_supplier_address()
@@ -96,32 +96,32 @@
 
 	def after_rename(self, olddn, newdn, merge=False):
 		set_field = ''
-		if webnotes.defaults.get_global_default('supp_master_name') == 'Supplier Name':
-			webnotes.conn.set(self.doc, "supplier_name", newdn)
+		if frappe.defaults.get_global_default('supp_master_name') == 'Supplier Name':
+			frappe.conn.set(self.doc, "supplier_name", newdn)
 			self.update_contact()
 			set_field = ", supplier_name=%(newdn)s"
 		self.update_supplier_address(newdn, set_field)
 
 	def update_supplier_address(self, newdn, set_field):
-		webnotes.conn.sql("""update `tabAddress` set address_title=%(newdn)s 
+		frappe.conn.sql("""update `tabAddress` set address_title=%(newdn)s 
 			{set_field} where supplier=%(newdn)s"""\
 			.format(set_field=set_field), ({"newdn": newdn}))
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_dashboard_info(supplier):
-	if not webnotes.has_permission("Supplier", "read", supplier):
-		webnotes.msgprint("No Permission", raise_exception=True)
+	if not frappe.has_permission("Supplier", "read", supplier):
+		frappe.msgprint("No Permission", raise_exception=True)
 	
 	out = {}
 	for doctype in ["Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice"]:
-		out[doctype] = webnotes.conn.get_value(doctype, 
+		out[doctype] = frappe.conn.get_value(doctype, 
 			{"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)")
 	
-	billing = webnotes.conn.sql("""select sum(grand_total), sum(outstanding_amount) 
+	billing = frappe.conn.sql("""select sum(grand_total), sum(outstanding_amount) 
 		from `tabPurchase Invoice` 
 		where supplier=%s 
 			and docstatus = 1
-			and fiscal_year = %s""", (supplier, webnotes.conn.get_default("fiscal_year")))
+			and fiscal_year = %s""", (supplier, frappe.conn.get_default("fiscal_year")))
 	
 	out["total_billing"] = billing[0][0]
 	out["total_unpaid"] = billing[0][1]
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index 562e69d..b7802e8 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -16,12 +16,12 @@
 		this._super();
 
 		if (this.frm.doc.docstatus === 1) {
-			cur_frm.add_custom_button(wn._("Make Purchase Order"), this.make_purchase_order);
+			cur_frm.add_custom_button(frappe._("Make Purchase Order"), this.make_purchase_order);
 		} 
 		else if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Material Request'), 
+			cur_frm.add_custom_button(frappe._('From Material Request'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
 						source_doctype: "Material Request",
 						get_query_filters: {
@@ -37,7 +37,7 @@
 	},	
 		
 	make_purchase_order: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
 			source_name: cur_frm.doc.name
 		})
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index b4562e0..32a5010 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.model.code import get_obj
+import frappe
+from frappe.model.code import get_obj
 
 from erpnext.controllers.buying_controller import BuyingController
 class DocType(BuyingController):
@@ -26,10 +26,10 @@
 		self.validate_uom_is_integer("uom", "qty")
 
 	def on_submit(self):
-		webnotes.conn.set(self.doc, "status", "Submitted")
+		frappe.conn.set(self.doc, "status", "Submitted")
 
 	def on_cancel(self):
-		webnotes.conn.set(self.doc, "status", "Cancelled")
+		frappe.conn.set(self.doc, "status", "Cancelled")
 		
 	def on_trash(self):
 		pass
@@ -52,12 +52,12 @@
 		pc = get_obj('Purchase Common')
 		pc.validate_for_items(self)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_purchase_order(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
-		bean = webnotes.bean(target)
+		bean = frappe.bean(target)
 		bean.run_method("set_missing_values")
 		bean.run_method("get_schedule_dates")
 
diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
index 23d593e..a5374fb 100644
--- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
@@ -4,19 +4,19 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-import webnotes.defaults
+import frappe
+import frappe.defaults
 
 class TestPurchaseOrder(unittest.TestCase):
 	def test_make_purchase_order(self):
 		from erpnext.buying.doctype.supplier_quotation.supplier_quotation import make_purchase_order
 
-		sq = webnotes.bean(copy=test_records[0]).insert()
+		sq = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_purchase_order, 
+		self.assertRaises(frappe.ValidationError, make_purchase_order, 
 			sq.doc.name)
 
-		sq = webnotes.bean("Supplier Quotation", sq.doc.name)
+		sq = frappe.bean("Supplier Quotation", sq.doc.name)
 		sq.submit()
 		po = make_purchase_order(sq.doc.name)
 		
@@ -29,7 +29,7 @@
 			if doc.get("item_code"):
 				doc["schedule_date"] = "2013-04-12"
 
-		webnotes.bean(po).insert()
+		frappe.bean(po).insert()
 		
 test_records = [
 	[
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/buying/page/buying_home/buying_home.js b/erpnext/buying/page/buying_home/buying_home.js
index 811ed6f..2ba4761 100644
--- a/erpnext/buying/page/buying_home/buying_home.js
+++ b/erpnext/buying/page/buying_home/buying_home.js
@@ -1,162 +1,162 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Buying"] = [
+frappe.module_page["Buying"] = [
 	{
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		top: true,
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Supplier"),
-				description: wn._("Supplier database."),
+				label: frappe._("Supplier"),
+				description: frappe._("Supplier database."),
 				doctype:"Supplier"
 			},
 			{
-				label: wn._("Material Request"),
-				description: wn._("Request for purchase."),
+				label: frappe._("Material Request"),
+				description: frappe._("Request for purchase."),
 				doctype:"Material Request"
 			},
 			{
-				label: wn._("Supplier Quotation"),
-				description: wn._("Quotations received from Suppliers."),
+				label: frappe._("Supplier Quotation"),
+				description: frappe._("Quotations received from Suppliers."),
 				doctype:"Supplier Quotation"
 			},
 			{
-				label: wn._("Purchase Order"),
-				description: wn._("Purchase Orders given to Suppliers."),
+				label: frappe._("Purchase Order"),
+				description: frappe._("Purchase Orders given to Suppliers."),
 				doctype:"Purchase Order"
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 		{
-			label: wn._("Contact"),
-			description: wn._("All Contacts."),
+			label: frappe._("Contact"),
+			description: frappe._("All Contacts."),
 			doctype:"Contact"
 		},
 		{
-			label: wn._("Address"),
-			description: wn._("All Addresses."),
+			label: frappe._("Address"),
+			description: frappe._("All Addresses."),
 			doctype:"Address"
 		},
 		{
-			label: wn._("Item"),
-			description: wn._("All Products or Services."),
+			label: frappe._("Item"),
+			description: frappe._("All Products or Services."),
 			doctype:"Item"
 		},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				"label": wn._("Buying Settings"),
+				"label": frappe._("Buying Settings"),
 				"route": "Form/Buying Settings",
 				"doctype":"Buying Settings",
-				"description": wn._("Settings for Buying Module")
+				"description": frappe._("Settings for Buying Module")
 			},
 			{
-				"label": wn._("Purchase Taxes and Charges Master"),
+				"label": frappe._("Purchase Taxes and Charges Master"),
 				"doctype":"Purchase Taxes and Charges Master",
-				"description": wn._("Tax Template for Purchase")
+				"description": frappe._("Tax Template for Purchase")
 			},
 			{
-				label: wn._("Price List"),
-				description: wn._("Multiple Price list."),
+				label: frappe._("Price List"),
+				description: frappe._("Multiple Price list."),
 				doctype:"Price List"
 			},
 			{
-				label: wn._("Item Price"),
-				description: wn._("Multiple Item prices."),
+				label: frappe._("Item Price"),
+				description: frappe._("Multiple Item prices."),
 				doctype:"Item Price"
 			},
 			{
 				"doctype":"Supplier Type",
-				"label": wn._("Supplier Type"),
-				"description": wn._("Supplier classification.")
+				"label": frappe._("Supplier Type"),
+				"description": frappe._("Supplier classification.")
 			},
 			{
 				"route":"Sales Browser/Item Group",
-				"label":wn._("Item Group"),
-				"description": wn._("Tree of item classification"),
+				"label":frappe._("Item Group"),
+				"description": frappe._("Tree of item classification"),
 				doctype:"Item Group"
 			},
 			{
-				label: wn._("Terms and Conditions"),
-				description: wn._("Template of terms or contract."),
+				label: frappe._("Terms and Conditions"),
+				description: frappe._("Template of terms or contract."),
 				doctype:"Terms and Conditions"
 			},
 		]
 	},
 	{
-		title: wn._("Tools"),
+		title: frappe._("Tools"),
 		icon: "icon-wrench",
 		items: [
 		]
 	},
 	{
-		title: wn._("Analytics"),
+		title: frappe._("Analytics"),
 		right: true,
 		icon: "icon-bar-chart",
 		items: [
 			{
-				"label":wn._("Purchase Analytics"),
+				"label":frappe._("Purchase Analytics"),
 				page: "purchase-analytics"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Items To Be Requested"),
+				"label":frappe._("Items To Be Requested"),
 				route: "query-report/Items To Be Requested",
 				doctype: "Item"
 			},
 			{
-				"label":wn._("Requested Items To Be Ordered"),
+				"label":frappe._("Requested Items To Be Ordered"),
 				route: "query-report/Requested Items To Be Ordered",
 				doctype: "Material Request"
 			},
 			{
-				"label":wn._("Material Requests for which Supplier Quotations are not created"),
+				"label":frappe._("Material Requests for which Supplier Quotations are not created"),
 				route: "query-report/Material Requests for which Supplier Quotations are not created",
 				doctype: "Material Request"
 			},
 			{
-				"label":wn._("Purchase In Transit"),
+				"label":frappe._("Purchase In Transit"),
 				route: "query-report/Purchase In Transit",
 				doctype: "Purchase Order"
 			},
 			{
-				"label":wn._("Item-wise Purchase History"),
+				"label":frappe._("Item-wise Purchase History"),
 				route: "query-report/Item-wise Purchase History",
 				doctype: "Item"
 			},
 			{
-				"label":wn._("Item-wise Last Purchase Rate"),
+				"label":frappe._("Item-wise Last Purchase Rate"),
 				route: "query-report/Item-wise Last Purchase Rate",
 				doctype: "Item"
 			},
 			{
-				"label":wn._("Purchase Order Trends"),
+				"label":frappe._("Purchase Order Trends"),
 				route: "query-report/Purchase Order Trends",
 				doctype: "Purchase Order"
 			},
 			{
-				"label":wn._("Supplier Addresses And Contacts"),
+				"label":frappe._("Supplier Addresses And Contacts"),
 				route: "query-report/Supplier Addresses and Contacts",
 				doctype: "Supplier"
 			},
 			{
-				"label":wn._("Supplier-Wise Sales Analytics"),
+				"label":frappe._("Supplier-Wise Sales Analytics"),
 				route: "query-report/Supplier-Wise Sales Analytics",
 				doctype: "Stock Ledger Entry"
 			}
@@ -165,5 +165,5 @@
 ]
 
 pscript['onload_buying-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Buying");
+	frappe.views.moduleview.make(wrapper, "Buying");
 }
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
index 0df62c8..328345b 100644
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js
+++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
@@ -1,10 +1,10 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['purchase-analytics'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['purchase-analytics'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Purchase Analytics'),
+		title: frappe._('Purchase Analytics'),
 		single_column: true
 	});					
 	
@@ -15,10 +15,10 @@
 	
 }
 
-erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
+erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
 	init: function(wrapper) {
 		this._super({
-			title: wn._("Purchase Analytics"),
+			title: frappe._("Purchase Analytics"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -31,7 +31,7 @@
 		
 		this.tree_grids = {
 			"Supplier Type": {
-				label: wn._("Supplier Type / Supplier"),
+				label: frappe._("Supplier Type / Supplier"),
 				show: true, 
 				item_key: "supplier",
 				parent_field: "parent_supplier_type", 
@@ -44,7 +44,7 @@
 				}
 			},
 			"Supplier": {
-				label: wn._("Supplier"),
+				label: frappe._("Supplier"),
 				show: false, 
 				item_key: "supplier",
 				formatter: function(item) {
@@ -74,7 +74,7 @@
 		this.tree_grid = this.tree_grids[this.tree_type];
 
 		var std_columns = [
-			{id: "check", name: wn._("Plot"), field: "check", width: 30,
+			{id: "check", name: frappe._("Plot"), field: "check", width: 30,
 				formatter: this.check_formatter},
 			{id: "name", name: this.tree_grid.label, field: "name", width: 300,
 				formatter: this.tree_formatter},
@@ -86,23 +86,23 @@
 		this.columns = std_columns.concat(this.columns);
 	},
 	filters: [
-		{fieldtype:"Select", label: wn._("Tree Type"), options:["Supplier Type", "Supplier", 
+		{fieldtype:"Select", label: frappe._("Tree Type"), options:["Supplier Type", "Supplier", 
 			"Item Group", "Item"],
 			filter: function(val, item, opts, me) {
 				return me.apply_zero_filter(val, item, opts, me);
 			}},
-		{fieldtype:"Select", label: wn._("Based On"), options:["Purchase Invoice", 
+		{fieldtype:"Select", label: frappe._("Based On"), options:["Purchase Invoice", 
 			"Purchase Order", "Purchase Receipt"]},
-		{fieldtype:"Select", label: wn._("Value or Qty"), options:["Value", "Quantity"]},
-		{fieldtype:"Select", label: wn._("Company"), link:"Company", 
+		{fieldtype:"Select", label: frappe._("Value or Qty"), options:["Value", "Quantity"]},
+		{fieldtype:"Select", label: frappe._("Company"), link:"Company", 
 			default_value: "Select Company..."},
-		{fieldtype:"Date", label: wn._("From Date")},
-		{fieldtype:"Label", label: wn._("To")},
-		{fieldtype:"Date", label: wn._("To Date")},
-		{fieldtype:"Select", label: wn._("Range"), 
+		{fieldtype:"Date", label: frappe._("From Date")},
+		{fieldtype:"Label", label: frappe._("To")},
+		{fieldtype:"Date", label: frappe._("To Date")},
+		{fieldtype:"Select", label: frappe._("Range"), 
 			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	setup_filters: function() {
 		var me = this;
@@ -125,23 +125,23 @@
 			// (Supplier / Item are not mandatory!!)
 			// Set parent supplier type for tree view
 			
-			$.each(wn.report_dump.data["Supplier Type"], function(i, v) {
+			$.each(frappe.report_dump.data["Supplier Type"], function(i, v) {
 				v['parent_supplier_type'] = "All Supplier Types"
 			})
 			
-			wn.report_dump.data["Supplier Type"] = [{
-				name: wn._("All Supplier Types"), 
+			frappe.report_dump.data["Supplier Type"] = [{
+				name: frappe._("All Supplier Types"), 
 				id: "All Supplier Types",
-			}].concat(wn.report_dump.data["Supplier Type"]);
+			}].concat(frappe.report_dump.data["Supplier Type"]);
 			
-			wn.report_dump.data["Supplier"].push({
-				name: wn._("Not Set"), 
+			frappe.report_dump.data["Supplier"].push({
+				name: frappe._("Not Set"), 
 				parent_supplier_type: "All Supplier Types",
 				id: "Not Set",
 			});
 
-			wn.report_dump.data["Item"].push({
-				name: wn._("Not Set"), 
+			frappe.report_dump.data["Item"].push({
+				name: frappe._("Not Set"), 
 				parent_item_group: "All Item Groups",
 				id: "Not Set",
 			});
@@ -154,13 +154,13 @@
 		
 		if(!this.data || me.item_type != me.tree_type) {
 			if(me.tree_type=='Supplier') {
-				var items = wn.report_dump.data["Supplier"];
+				var items = frappe.report_dump.data["Supplier"];
 			} if(me.tree_type=='Supplier Type') {
 				var items = this.prepare_tree("Supplier", "Supplier Type");
 			} else if(me.tree_type=="Item Group") {
 				var items = this.prepare_tree("Item", "Item Group");
 			} else if(me.tree_type=="Item") {
-				var items = wn.report_dump.data["Item"];
+				var items = frappe.report_dump.data["Item"];
 			}
 
 			me.item_type = me.tree_type
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
index d5371d3..b8c0f94 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/purchase_trends_filters.js");
+frappe.require("assets/erpnext/js/purchase_trends_filters.js");
 
-wn.query_reports["Purchase Order Trends"] = {
+frappe.query_reports["Purchase Order Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
index 1ecdab2..04f79ff 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns,get_data
 
 def execute(filters=None):
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index d6a2093..7aeff66 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -1,4 +1,4 @@
-from webnotes import _
+from frappe import _
 
 data = {
 	"Accounts": {
diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py
index 59112db..be096d8 100644
--- a/erpnext/config/setup.py
+++ b/erpnext/config/setup.py
@@ -1,4 +1,4 @@
-from webnotes import _
+from frappe import _
 
 data = [
 	{
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 2bc3852..ecc8cf7 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, throw
-from webnotes.utils import flt, cint, today, cstr
-from webnotes.model.code import get_obj
+import frappe
+from frappe import _, throw
+from frappe.utils import flt, cint, today, cstr
+from frappe.model.code import get_obj
 from erpnext.setup.utils import get_company_currency
 from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
 from erpnext.utilities.transaction_base import TransactionBase
@@ -44,7 +44,7 @@
 	def validate_for_freezed_account(self):
 		for fieldname in ["customer", "supplier"]:
 			if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
-				accounts = webnotes.conn.get_values("Account", 
+				accounts = frappe.conn.get_values("Account", 
 					{"master_type": fieldname.title(), "master_name": self.doc.fields[fieldname], 
 					"company": self.doc.company}, "name")
 				if accounts:
@@ -60,7 +60,7 @@
 			fieldname = "selling_price_list" if buying_or_selling.lower() == "selling" \
 				else "buying_price_list"
 			if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
-				self.doc.price_list_currency = webnotes.conn.get_value("Price List",
+				self.doc.price_list_currency = frappe.conn.get_value("Price List",
 					self.doc.fields.get(fieldname), "currency")
 				
 				if self.doc.price_list_currency == company_currency:
@@ -82,7 +82,7 @@
 
 	def get_exchange_rate(self, from_currency, to_currency):
 		exchange = "%s-%s" % (from_currency, to_currency)
-		return flt(webnotes.conn.get_value("Currency Exchange", exchange, "exchange_rate"))
+		return flt(frappe.conn.get_value("Currency Exchange", exchange, "exchange_rate"))
 
 	def set_missing_item_details(self):
 		"""set missing item values"""
@@ -106,7 +106,7 @@
 			if not self.doc.fields.get(tax_master_field):
 				# get the default tax master
 				self.doc.fields[tax_master_field] = \
-					webnotes.conn.get_value(tax_master_doctype, {"is_default": 1})
+					frappe.conn.get_value(tax_master_doctype, {"is_default": 1})
 					
 			self.append_taxes_from_master(tax_parentfield, tax_master_field, tax_master_doctype)
 				
@@ -117,8 +117,8 @@
 			
 			tax_doctype = self.meta.get_field(tax_parentfield).options
 			
-			from webnotes.model import default_fields
-			tax_master = webnotes.bean(tax_master_doctype, self.doc.fields.get(tax_master_field))
+			from frappe.model import default_fields
+			tax_master = frappe.bean(tax_master_doctype, self.doc.fields.get(tax_master_field))
 			
 			for i, tax in enumerate(tax_master.doclist.get({"parentfield": tax_parentfield})):
 				for fieldname in default_fields:
@@ -375,7 +375,7 @@
 
 	def get_gl_dict(self, args):
 		"""this method populates the common properties of a gl entry record"""
-		gl_dict = webnotes._dict({
+		gl_dict = frappe._dict({
 			'company': self.doc.company, 
 			'posting_date': self.doc.posting_date,
 			'voucher_type': self.doc.doctype,
@@ -393,11 +393,11 @@
 	def clear_unallocated_advances(self, childtype, parentfield):
 		self.doclist.remove_items({"parentfield": parentfield, "allocated_amount": ["in", [0, None, ""]]})
 			
-		webnotes.conn.sql("""delete from `tab%s` where parentfield=%s and parent = %s 
+		frappe.conn.sql("""delete from `tab%s` where parentfield=%s and parent = %s 
 			and ifnull(allocated_amount, 0) = 0""" % (childtype, '%s', '%s'), (parentfield, self.doc.name))
 		
 	def get_advances(self, account_head, child_doctype, parentfield, dr_or_cr):
-		res = webnotes.conn.sql("""select t1.name as jv_no, t1.remark, 
+		res = frappe.conn.sql("""select t1.name as jv_no, t1.remark, 
 			t2.%s as amount, t2.name as jv_detail_no
 			from `tabJournal Voucher` t1, `tabJournal Voucher Detail` t2 
 			where t1.name = t2.parent and t2.account = %s and t2.is_advance = 'Yes' 
@@ -426,13 +426,13 @@
 		
 		for item in self.doclist.get({"parentfield": "entries"}):
 			if item.fields.get(item_ref_dn):
-				ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item", 
+				ref_amt = flt(frappe.conn.get_value(ref_dt + " Item", 
 					item.fields[item_ref_dn], based_on), self.precision(based_on, item))
 				if not ref_amt:
-					webnotes.msgprint(_("As amount for item") + ": " + item.item_code + _(" in ") + 
+					frappe.msgprint(_("As amount for item") + ": " + item.item_code + _(" in ") + 
 						ref_dt + _(" is zero, system will not check for over-billed"))
 				else:
-					already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` 
+					already_billed = frappe.conn.sql("""select sum(%s) from `tab%s` 
 						where %s=%s and docstatus=1 and parent != %s""" % 
 						(based_on, self.tname, item_ref_dn, '%s', '%s'), 
 						(item.fields[item_ref_dn], self.doc.name))[0][0]
@@ -448,7 +448,7 @@
 					if total_billed_amt - max_allowed_amt > 0.01:
 						reduce_by = total_billed_amt - max_allowed_amt
 					
-						webnotes.throw(_("Row #") + cstr(item.idx) + ": " + 
+						frappe.throw(_("Row #") + cstr(item.idx) + ": " + 
 							_(" Max amount allowed for Item ") + cstr(item.item_code) + 
 							_(" against ") + ref_dt + " " + 
 							cstr(item.fields[ref_dt.lower().replace(" ", "_")]) + _(" is ") + 
@@ -468,7 +468,7 @@
 		item_codes = list(set(item.item_code for item in 
 			self.doclist.get({"parentfield": self.fname})))
 		if item_codes:
-			stock_items = [r[0] for r in webnotes.conn.sql("""select name
+			stock_items = [r[0] for r in frappe.conn.sql("""select name
 				from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
 				(", ".join((["%s"]*len(item_codes))),), item_codes)]
 				
@@ -477,12 +477,12 @@
 	@property
 	def company_abbr(self):
 		if not hasattr(self, "_abbr"):
-			self._abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
+			self._abbr = frappe.conn.get_value("Company", self.doc.company, "abbr")
 			
 		return self._abbr
 
 	def check_credit_limit(self, account):
-		total_outstanding = webnotes.conn.sql("""
+		total_outstanding = frappe.conn.sql("""
 			select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
 			from `tabGL Entry` where account = %s""", account)
 		
@@ -491,6 +491,6 @@
 			get_obj('Account', account).check_credit_limit(total_outstanding)
 
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_tax_rate(account_head):
-	return webnotes.conn.get_value("Account", account_head, "tax_rate")
\ No newline at end of file
+	return frappe.conn.get_value("Account", account_head, "tax_rate")
\ No newline at end of file
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 7617685..21c85b7 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.utils import flt, _round
+import frappe
+from frappe import _, msgprint
+from frappe.utils import flt, _round
 from erpnext.setup.utils import get_company_currency
 from erpnext.accounts.party import get_party_details
 
@@ -18,7 +18,7 @@
 	def validate(self):
 		super(BuyingController, self).validate()
 		if self.doc.supplier and not self.doc.supplier_name:
-			self.doc.supplier_name = webnotes.conn.get_value("Supplier", 
+			self.doc.supplier_name = frappe.conn.get_value("Supplier", 
 				self.doc.supplier, "supplier_name")
 		self.is_item_table_empty()
 		self.validate_stock_or_nonstock_items()
@@ -41,7 +41,7 @@
 	def set_supplier_from_item_default(self):
 		if self.meta.get_field("supplier") and not self.doc.supplier:
 			for d in self.doclist.get({"doctype": self.tname}):
-				supplier = webnotes.conn.get_value("Item", d.item_code, "default_supplier")
+				supplier = frappe.conn.get_value("Item", d.item_code, "default_supplier")
 				if supplier:
 					self.doc.supplier = supplier
 					break
@@ -61,10 +61,10 @@
 				self.doclist.get({"parentfield": "other_charges"}) 
 				if d.category in ["Valuation", "Valuation and Total"]]
 			if tax_for_valuation:
-				webnotes.msgprint(_("""Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"""), raise_exception=1)
+				frappe.msgprint(_("""Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"""), raise_exception=1)
 			
 	def set_total_in_words(self):
-		from webnotes.utils import money_in_words
+		from frappe.utils import money_in_words
 		company_currency = get_company_currency(self.doc.company)
 		if self.meta.get_field("in_words"):
 			self.doc.in_words = money_in_words(self.doc.grand_total, company_currency)
@@ -198,7 +198,7 @@
 
 				self.round_floats_in(item)
 				
-				item.conversion_factor = item.conversion_factor or flt(webnotes.conn.get_value(
+				item.conversion_factor = item.conversion_factor or flt(frappe.conn.get_value(
 					"UOM Conversion Detail", {"parent": item.item_code, "uom": item.uom}, 
 					"conversion_factor")) or 1
 				qty_in_stock_uom = flt(item.qty * item.conversion_factor)
@@ -209,12 +209,12 @@
 				
 	def validate_for_subcontracting(self):
 		if not self.doc.is_subcontracted and self.sub_contracted_items:
-			webnotes.msgprint(_("""Please enter whether %s is made for subcontracting or purchasing,
+			frappe.msgprint(_("""Please enter whether %s is made for subcontracting or purchasing,
 			 	in 'Is Subcontracted' field""" % self.doc.doctype), raise_exception=1)
 			
 		if self.doc.doctype == "Purchase Receipt" and self.doc.is_subcontracted=="Yes" \
 			and not self.doc.supplier_warehouse:
-				webnotes.msgprint(_("Supplier Warehouse mandatory subcontracted purchase receipt"), 
+				frappe.msgprint(_("Supplier Warehouse mandatory subcontracted purchase receipt"), 
 					raise_exception=1)
 										
 	def update_raw_materials_supplied(self, raw_material_table):
@@ -256,7 +256,7 @@
 			d.rm_supp_cost = raw_materials_cost
 
 	def get_items_from_default_bom(self, item_code):
-		bom_items = webnotes.conn.sql("""select t2.item_code, t2.qty_consumed_per_unit, 
+		bom_items = frappe.conn.sql("""select t2.item_code, t2.qty_consumed_per_unit, 
 			t2.rate, t2.stock_uom, t2.name, t2.description 
 			from `tabBOM` t1, `tabBOM Item` t2 
 			where t2.parent = t1.name and t1.item = %s and t1.is_default = 1 
@@ -273,7 +273,7 @@
 			item_codes = list(set(item.item_code for item in 
 				self.doclist.get({"parentfield": self.fname})))
 			if item_codes:
-				self._sub_contracted_items = [r[0] for r in webnotes.conn.sql("""select name
+				self._sub_contracted_items = [r[0] for r in frappe.conn.sql("""select name
 					from `tabItem` where name in (%s) and is_sub_contracted_item='Yes'""" % \
 					(", ".join((["%s"]*len(item_codes))),), item_codes)]
 
@@ -286,7 +286,7 @@
 			item_codes = list(set(item.item_code for item in 
 				self.doclist.get({"parentfield": self.fname})))
 			if item_codes:
-				self._purchase_items = [r[0] for r in webnotes.conn.sql("""select name
+				self._purchase_items = [r[0] for r in frappe.conn.sql("""select name
 					from `tabItem` where name in (%s) and is_purchase_item='Yes'""" % \
 					(", ".join((["%s"]*len(item_codes))),), item_codes)]
 
@@ -295,4 +295,4 @@
 
 	def is_item_table_empty(self):
 		if not len(self.doclist.get({"parentfield": self.fname})):
-			webnotes.throw(_("Item table can not be blank"))
\ No newline at end of file
+			frappe.throw(_("Item table can not be blank"))
\ No newline at end of file
diff --git a/erpnext/controllers/js/contact_address_common.js b/erpnext/controllers/js/contact_address_common.js
index 7c938d7..6a66469 100644
--- a/erpnext/controllers/js/contact_address_common.js
+++ b/erpnext/controllers/js/contact_address_common.js
@@ -14,7 +14,7 @@
 	}
 	
 	if(doc.__islocal) {
-		var last_route = wn.route_history.slice(-2, -1)[0];
+		var last_route = frappe.route_history.slice(-2, -1)[0];
 		if(last_route && last_route[0]==="Form") {
 			var doctype = last_route[1],
 				docname = last_route.slice(2).join("/");
@@ -23,7 +23,7 @@
 				"Installation Note", "Opportunity", "Customer Issue", "Maintenance Visit",
 				"Maintenance Schedule"]
 				.indexOf(doctype)!==-1) {
-				var refdoc = wn.model.get_doc(doctype, docname);
+				var refdoc = frappe.model.get_doc(doctype, docname);
 
 				if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Customer" : true) {
 					cur_frm.set_value("customer", refdoc.customer || refdoc.name);
@@ -34,7 +34,7 @@
 			}
 			if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
 				.indexOf(doctype)!==-1) {
-				var refdoc = wn.model.get_doc(doctype, docname);
+				var refdoc = frappe.model.get_doc(doctype, docname);
 				cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
 				cur_frm.set_value("supplier_name", refdoc.supplier_name);
 				if(cur_frm.doc.doctype==="Address")
@@ -42,7 +42,7 @@
 			}
 			if(["Lead", "Quotation"]
 				.indexOf(doctype)!==-1) {
-				var refdoc = wn.model.get_doc(doctype, docname);
+				var refdoc = frappe.model.get_doc(doctype, docname);
 				
 				if(refdoc.doctype == "Quotation" ? refdoc.quotation_to=="Lead" : true) {
 					cur_frm.set_value("lead", refdoc.lead || refdoc.name);
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 535ca3b..93efd43 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.widgets.reportview import get_match_cond
+import frappe
+from frappe.widgets.reportview import get_match_cond
 
 def get_filters_cond(doctype, filters, conditions):
 	if filters:
@@ -16,7 +16,7 @@
 				else:
 					flt.append([doctype, f[0], '=', f[1]])
 		
-		from webnotes.widgets.reportview import build_filter_conditions
+		from frappe.widgets.reportview import build_filter_conditions
 		build_filter_conditions(flt, conditions)
 		cond = ' and ' + ' and '.join(conditions)	
 	else:
@@ -25,7 +25,7 @@
 
  # searches for active employees
 def employee_query(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select name, employee_name from `tabEmployee` 
+	return frappe.conn.sql("""select name, employee_name from `tabEmployee` 
 		where status = 'Active' 
 			and docstatus < 2 
 			and (%(key)s like "%(txt)s" 
@@ -40,7 +40,7 @@
 
  # searches for leads which are not converted
 def lead_query(doctype, txt, searchfield, start, page_len, filters): 
-	return webnotes.conn.sql("""select name, lead_name, company_name from `tabLead`
+	return frappe.conn.sql("""select name, lead_name, company_name from `tabLead`
 		where docstatus < 2 
 			and ifnull(status, '') != 'Converted' 
 			and (%(key)s like "%(txt)s" 
@@ -57,7 +57,7 @@
 
  # searches for customer
 def customer_query(doctype, txt, searchfield, start, page_len, filters):
-	cust_master_name = webnotes.defaults.get_user_default("cust_master_name")
+	cust_master_name = frappe.defaults.get_user_default("cust_master_name")
 
 	if cust_master_name == "Customer Name":
 		fields = ["name", "customer_group", "territory"]
@@ -66,7 +66,7 @@
 
 	fields = ", ".join(fields) 
 
-	return webnotes.conn.sql("""select %(field)s from `tabCustomer` 
+	return frappe.conn.sql("""select %(field)s from `tabCustomer` 
 		where docstatus < 2 
 			and (%(key)s like "%(txt)s" 
 				or customer_name like "%(txt)s") 
@@ -81,14 +81,14 @@
 
 # searches for supplier
 def supplier_query(doctype, txt, searchfield, start, page_len, filters):
-	supp_master_name = webnotes.defaults.get_user_default("supp_master_name")
+	supp_master_name = frappe.defaults.get_user_default("supp_master_name")
 	if supp_master_name == "Supplier Name":  
 		fields = ["name", "supplier_type"]
 	else: 
 		fields = ["name", "supplier_name", "supplier_type"]
 	fields = ", ".join(fields) 
 
-	return webnotes.conn.sql("""select %(field)s from `tabSupplier` 
+	return frappe.conn.sql("""select %(field)s from `tabSupplier` 
 		where docstatus < 2 
 			and (%(key)s like "%(txt)s" 
 				or supplier_name like "%(txt)s") 
@@ -102,7 +102,7 @@
 		'page_len': page_len})
 		
 def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select name, parent_account, debit_or_credit 
+	return frappe.conn.sql("""select name, parent_account, debit_or_credit 
 		from tabAccount 
 		where tabAccount.docstatus!=2 
 			and (account_type in (%s) or 
@@ -117,11 +117,11 @@
 			filters.get("company"), "%%%s%%" % txt, start, page_len]))
 
 def item_query(doctype, txt, searchfield, start, page_len, filters):
-	from webnotes.utils import nowdate
+	from frappe.utils import nowdate
 	
 	conditions = []
 
-	return webnotes.conn.sql("""select tabItem.name, 
+	return frappe.conn.sql("""select tabItem.name, 
 		if(length(tabItem.item_name) > 40, 
 			concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name, 
 		if(length(tabItem.description) > 40, \
@@ -145,7 +145,7 @@
 def bom(doctype, txt, searchfield, start, page_len, filters):
 	conditions = []	
 
-	return webnotes.conn.sql("""select tabBOM.name, tabBOM.item 
+	return frappe.conn.sql("""select tabBOM.name, tabBOM.item 
 		from tabBOM 
 		where tabBOM.docstatus=1 
 			and tabBOM.is_active=1 
@@ -160,7 +160,7 @@
 	if filters['customer']:
 		cond = '(`tabProject`.customer = "' + filters['customer'] + '" or ifnull(`tabProject`.customer,"")="") and'
 	
-	return webnotes.conn.sql("""select `tabProject`.name from `tabProject` 
+	return frappe.conn.sql("""select `tabProject`.name from `tabProject` 
 		where `tabProject`.status not in ("Completed", "Cancelled") 
 			and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s 
 		order by `tabProject`.name asc 
@@ -168,7 +168,7 @@
 		'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len})
 			
 def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
+	return frappe.conn.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
 		from `tabDelivery Note` 
 		where `tabDelivery Note`.`%(key)s` like %(txt)s and 
 			`tabDelivery Note`.docstatus = 1 %(fcond)s and
@@ -189,7 +189,7 @@
 	from erpnext.controllers.queries import get_match_cond
 
 	if filters.has_key('warehouse'):
-		return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle 
+		return frappe.conn.sql("""select batch_no from `tabStock Ledger Entry` sle 
 				where item_code = '%(item_code)s' 
 					and warehouse = '%(warehouse)s' 
 					and batch_no like '%(txt)s' 
@@ -205,7 +205,7 @@
 					'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 
 					'start': start, 'page_len': page_len})
 	else:
-		return webnotes.conn.sql("""select name from tabBatch 
+		return frappe.conn.sql("""select name from tabBatch 
 				where docstatus != 2 
 					and item = '%(item_code)s' 
 					and (ifnull(expiry_date, '')='' or expiry_date >= '%(posting_date)s')
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 90ab919..5494011 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, flt, comma_or, _round, cstr
+import frappe
+from frappe.utils import cint, flt, comma_or, _round, cstr
 from erpnext.setup.utils import get_company_currency
-from webnotes import msgprint, _
+from frappe import msgprint, _
 
 from erpnext.controllers.stock_controller import StockController
 
@@ -20,7 +20,7 @@
 		check_active_sales_items(self)
 	
 	def get_sender(self, comm):
-		return webnotes.conn.get_value('Sales Email Settings', None, 'email_id')
+		return frappe.conn.get_value('Sales Email Settings', None, 'email_id')
 	
 	def set_missing_values(self, for_validate=False):
 		super(SellingController, self).set_missing_values(for_validate)
@@ -45,7 +45,7 @@
 										
 	def apply_shipping_rule(self):
 		if self.doc.shipping_rule:
-			shipping_rule = webnotes.bean("Shipping Rule", self.doc.shipping_rule)
+			shipping_rule = frappe.bean("Shipping Rule", self.doc.shipping_rule)
 			value = self.doc.net_total
 			
 			# TODO
@@ -68,10 +68,10 @@
 			})
 		
 	def set_total_in_words(self):
-		from webnotes.utils import money_in_words
+		from frappe.utils import money_in_words
 		company_currency = get_company_currency(self.doc.company)
 		
-		disable_rounded_total = cint(webnotes.conn.get_value("Global Defaults", None, 
+		disable_rounded_total = cint(frappe.conn.get_value("Global Defaults", None, 
 			"disable_rounded_total"))
 			
 		if self.meta.get_field("in_words"):
@@ -264,24 +264,24 @@
 				_("must be one of") + ": " + comma_or(valid_types), raise_exception=True)
 				
 	def check_credit(self, grand_total):
-		customer_account = webnotes.conn.get_value("Account", {"company": self.doc.company, 
+		customer_account = frappe.conn.get_value("Account", {"company": self.doc.company, 
 			"master_name": self.doc.customer}, "name")
 		if customer_account:
-			total_outstanding = webnotes.conn.sql("""select 
+			total_outstanding = frappe.conn.sql("""select 
 				sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) 
 				from `tabGL Entry` where account = %s""", customer_account)
 			total_outstanding = total_outstanding[0][0] if total_outstanding else 0
 			
 			outstanding_including_current = flt(total_outstanding) + flt(grand_total)
-			webnotes.bean('Account', customer_account).run_method("check_credit_limit", 
+			frappe.bean('Account', customer_account).run_method("check_credit_limit", 
 				outstanding_including_current)
 				
 	def validate_max_discount(self):
 		for d in self.doclist.get({"parentfield": self.fname}):
-			discount = flt(webnotes.conn.get_value("Item", d.item_code, "max_discount"))
+			discount = flt(frappe.conn.get_value("Item", d.item_code, "max_discount"))
 			
 			if discount and flt(d.discount_percentage) > discount:
-				webnotes.throw(_("You cannot give more than ") + cstr(discount) + "% " + 
+				frappe.throw(_("You cannot give more than ") + cstr(discount) + "% " + 
 					_("discount on Item Code") + ": " + cstr(d.item_code))
 					
 	def get_item_list(self):
@@ -291,9 +291,9 @@
 			reserved_qty_for_main_item = 0
 			
 			if self.doc.doctype == "Sales Order":
-				if (webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes' or 
+				if (frappe.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes' or 
 					self.has_sales_bom(d.item_code)) and not d.warehouse:
-						webnotes.throw(_("Please enter Reserved Warehouse for item ") + 
+						frappe.throw(_("Please enter Reserved Warehouse for item ") + 
 							d.item_code + _(" as it is stock Item or packing item"))
 				reserved_warehouse = d.warehouse
 				if flt(d.qty) > flt(d.delivered_qty):
@@ -316,7 +316,7 @@
 				for p in self.doclist.get({"parentfield": "packing_details"}):
 					if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
 						# the packing details table's qty is already multiplied with parent's qty
-						il.append(webnotes._dict({
+						il.append(frappe._dict({
 							'warehouse': p.warehouse,
 							'reserved_warehouse': reserved_warehouse,
 							'item_code': p.item_code,
@@ -328,7 +328,7 @@
 							'name': d.name
 						}))
 			else:
-				il.append(webnotes._dict({
+				il.append(frappe._dict({
 					'warehouse': d.warehouse,
 					'reserved_warehouse': reserved_warehouse,
 					'item_code': d.item_code,
@@ -342,18 +342,18 @@
 		return il
 		
 	def has_sales_bom(self, item_code):
-		return webnotes.conn.sql("""select name from `tabSales BOM` 
+		return frappe.conn.sql("""select name from `tabSales BOM` 
 			where new_item_code=%s and docstatus != 2""", item_code)
 			
 	def get_already_delivered_qty(self, dn, so, so_detail):
-		qty = webnotes.conn.sql("""select sum(qty) from `tabDelivery Note Item` 
+		qty = frappe.conn.sql("""select sum(qty) from `tabDelivery Note Item` 
 			where prevdoc_detail_docname = %s and docstatus = 1 
 			and against_sales_order = %s 
 			and parent != %s""", (so_detail, so, dn))
 		return qty and flt(qty[0][0]) or 0.0
 
 	def get_so_qty_and_warehouse(self, so_detail):
-		so_item = webnotes.conn.sql("""select qty, warehouse from `tabSales Order Item`
+		so_item = frappe.conn.sql("""select qty, warehouse from `tabSales Order Item`
 			where name = %s and docstatus = 1""", so_detail, as_dict=1)
 		so_qty = so_item and flt(so_item[0]["qty"]) or 0.0
 		so_warehouse = so_item and so_item[0]["warehouse"] or ""
@@ -362,20 +362,20 @@
 	def check_stop_sales_order(self, ref_fieldname):
 		for d in self.doclist.get({"parentfield": self.fname}):
 			if d.fields.get(ref_fieldname):
-				status = webnotes.conn.get_value("Sales Order", d.fields[ref_fieldname], "status")
+				status = frappe.conn.get_value("Sales Order", d.fields[ref_fieldname], "status")
 				if status == "Stopped":
-					webnotes.throw(self.doc.doctype + 
+					frappe.throw(self.doc.doctype + 
 						_(" can not be created/modified against stopped Sales Order ") + 
 						d.fields[ref_fieldname])
 		
 def check_active_sales_items(obj):
 	for d in obj.doclist.get({"parentfield": obj.fname}):
 		if d.item_code:
-			item = webnotes.conn.sql("""select docstatus, is_sales_item, 
+			item = frappe.conn.sql("""select docstatus, is_sales_item, 
 				is_service_item, income_account from tabItem where name = %s""", 
 				d.item_code, as_dict=True)[0]
 			if item.is_sales_item == 'No' and item.is_service_item == 'No':
-				webnotes.throw(_("Item is neither Sales nor Service Item") + ": " + d.item_code)
+				frappe.throw(_("Item is neither Sales nor Service Item") + ": " + d.item_code)
 			if d.income_account and not item.income_account:
-				webnotes.conn.set_value("Item", d.item_code, "income_account", 
+				frappe.conn.set_value("Item", d.item_code, "income_account", 
 					d.income_account)
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 1743887..29cd490 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt, cstr
-from webnotes import msgprint
+import frappe
+from frappe.utils import flt, cstr
+from frappe import msgprint
 
-from webnotes.model.controller import DocListController
+from frappe.model.controller import DocListController
 
 status_map = {
 	"Contact": [
@@ -85,7 +85,7 @@
 					break
 		
 			if update:
-				webnotes.conn.set_value(self.doc.doctype, self.doc.name, "status", self.doc.status)
+				frappe.conn.set_value(self.doc.doctype, self.doc.name, "status", self.doc.status)
 	
 	def on_communication(self):
 		self.communication_set = True
@@ -118,7 +118,7 @@
 					args['name'] = d.fields[args['join_field']]
 
 					# get all qty where qty > target_field
-					item = webnotes.conn.sql("""select item_code, `%(target_ref_field)s`, 
+					item = frappe.conn.sql("""select item_code, `%(target_ref_field)s`, 
 						`%(target_field)s`, parenttype, parent from `tab%(target_dt)s` 
 						where `%(target_ref_field)s` < `%(target_field)s` 
 						and name="%(name)s" and docstatus=1""" % args, as_dict=1)
@@ -204,7 +204,7 @@
 							and (docstatus=1))""" % args
 			
 					if args['detail_id']:
-						webnotes.conn.sql("""update `tab%(target_dt)s` 
+						frappe.conn.sql("""update `tab%(target_dt)s` 
 							set %(target_field)s = (select sum(%(source_field)s) 
 								from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" 
 								and (docstatus=1 %(cond)s)) %(second_source_condition)s
@@ -217,7 +217,7 @@
 					args['name'] = name
 				
 					# update percent complete in the parent table
-					webnotes.conn.sql("""update `tab%(target_parent_dt)s` 
+					frappe.conn.sql("""update `tab%(target_parent_dt)s` 
 						set %(target_parent_field)s = (select sum(if(%(target_ref_field)s > 
 							ifnull(%(target_field)s, 0), %(target_field)s, 
 							%(target_ref_field)s))/sum(%(target_ref_field)s)*100 
@@ -226,7 +226,7 @@
 
 					# update field
 					if args.get('status_field'):
-						webnotes.conn.sql("""update `tab%(target_parent_dt)s` 
+						frappe.conn.sql("""update `tab%(target_parent_dt)s` 
 							set %(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001, 
 								'Not %(keyword)s', if(%(target_parent_field)s>=99.99, 
 								'Fully %(keyword)s', 'Partly %(keyword)s'))
@@ -236,7 +236,7 @@
 	def update_billing_status_for_zero_amount_refdoc(self, ref_dt):
 		ref_fieldname = ref_dt.lower().replace(" ", "_")
 		zero_amount_refdoc = []
-		all_zero_amount_refdoc = webnotes.conn.sql_list("""select name from `tab%s` 
+		all_zero_amount_refdoc = frappe.conn.sql_list("""select name from `tab%s` 
 			where docstatus=1 and net_total = 0""" % ref_dt)
 	
 		for item in self.doclist.get({"parentfield": "entries"}):
@@ -250,24 +250,24 @@
 	
 	def update_biling_status(self, zero_amount_refdoc, ref_dt, ref_fieldname):
 		for ref_dn in zero_amount_refdoc:
-			ref_doc_qty = flt(webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tab%s Item` 
+			ref_doc_qty = flt(frappe.conn.sql("""select sum(ifnull(qty, 0)) from `tab%s Item` 
 				where parent=%s""" % (ref_dt, '%s'), (ref_dn))[0][0])
 			
-			billed_qty = flt(webnotes.conn.sql("""select sum(ifnull(qty, 0)) 
+			billed_qty = flt(frappe.conn.sql("""select sum(ifnull(qty, 0)) 
 				from `tab%s Item` where %s=%s and docstatus=1""" % 
 				(self.doc.doctype, ref_fieldname, '%s'), (ref_dn))[0][0])
 			
 			per_billed = ((ref_doc_qty if billed_qty > ref_doc_qty else billed_qty)\
 				/ ref_doc_qty)*100
-			webnotes.conn.set_value(ref_dt, ref_dn, "per_billed", per_billed)
+			frappe.conn.set_value(ref_dt, ref_dn, "per_billed", per_billed)
 			
-			from webnotes.model.meta import has_field
+			from frappe.model.meta import has_field
 			if has_field(ref_dt, "billing_status"):
 				if per_billed < 0.001: billing_status = "Not Billed"
 				elif per_billed >= 99.99: billing_status = "Fully Billed"
 				else: billing_status = "Partly Billed"
 			
-				webnotes.conn.set_value(ref_dt, ref_dn, "billing_status", billing_status)
+				frappe.conn.set_value(ref_dt, ref_dn, "billing_status", billing_status)
 							
 def get_tolerance_for(item_code, item_tolerance={}, global_tolerance=None):
 	"""
@@ -276,11 +276,11 @@
 	if item_tolerance.get(item_code):
 		return item_tolerance[item_code], item_tolerance, global_tolerance
 	
-	tolerance = flt(webnotes.conn.get_value('Item',item_code,'tolerance') or 0)
+	tolerance = flt(frappe.conn.get_value('Item',item_code,'tolerance') or 0)
 
 	if not tolerance:
 		if global_tolerance == None:
-			global_tolerance = flt(webnotes.conn.get_value('Global Defaults', None, 
+			global_tolerance = flt(frappe.conn.get_value('Global Defaults', None, 
 				'tolerance'))
 		tolerance = global_tolerance
 	
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index eff6491..5b542bd 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, flt, cstr
-from webnotes import msgprint, _
-import webnotes.defaults
+import frappe
+from frappe.utils import cint, flt, cstr
+from frappe import msgprint, _
+import frappe.defaults
 
 from erpnext.controllers.accounts_controller import AccountsController
 from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries
@@ -15,7 +15,7 @@
 		if self.doc.docstatus == 2:
 			delete_gl_entries(voucher_type=self.doc.doctype, voucher_no=self.doc.name)
 			
-		if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
+		if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
 			warehouse_account = self.get_warehouse_account()
 		
 			if self.doc.docstatus==1:
@@ -74,7 +74,7 @@
 			for d in details:
 				self.check_expense_account(d)
 		else:
-			details = [webnotes._dict({
+			details = [frappe._dict({
 				"name":d, 
 				"expense_account": default_expense_account, 
 				"cost_center": default_cost_center
@@ -84,14 +84,14 @@
 		
 	def get_stock_ledger_details(self):
 		stock_ledger = {}
-		for sle in webnotes.conn.sql("""select warehouse, stock_value_difference, voucher_detail_no
+		for sle in frappe.conn.sql("""select warehouse, stock_value_difference, voucher_detail_no
 			from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""",
 			(self.doc.doctype, self.doc.name), as_dict=True):
 				stock_ledger.setdefault(sle.voucher_detail_no, []).append(sle)
 		return stock_ledger
 		
 	def get_warehouse_account(self):
-		warehouse_account = dict(webnotes.conn.sql("""select master_name, name from tabAccount 
+		warehouse_account = dict(frappe.conn.sql("""select master_name, name from tabAccount 
 			where account_type = 'Warehouse' and ifnull(master_name, '') != ''"""))
 		return warehouse_account
 		
@@ -102,7 +102,7 @@
 			warehouse_account = self.get_warehouse_account()
 		for voucher_type, voucher_no in future_stock_vouchers:
 			existing_gle = gle.get((voucher_type, voucher_no), [])
-			voucher_obj = webnotes.get_obj(voucher_type, voucher_no)
+			voucher_obj = frappe.get_obj(voucher_type, voucher_no)
 			expected_gle = voucher_obj.get_gl_entries(warehouse_account)
 			if expected_gle:
 				matched = True
@@ -134,7 +134,7 @@
 		else:
 			condition = ""
 		
-		for d in webnotes.conn.sql("""select distinct sle.voucher_type, sle.voucher_no 
+		for d in frappe.conn.sql("""select distinct sle.voucher_type, sle.voucher_no 
 			from `tabStock Ledger Entry` sle
 			where timestamp(sle.posting_date, sle.posting_time) >= timestamp(%s, %s) %s
 			order by timestamp(sle.posting_date, sle.posting_time) asc, name asc""" % 
@@ -147,7 +147,7 @@
 	def get_voucherwise_gl_entries(self, future_stock_vouchers):
 		gl_entries = {}
 		if future_stock_vouchers:
-			for d in webnotes.conn.sql("""select * from `tabGL Entry` 
+			for d in frappe.conn.sql("""select * from `tabGL Entry` 
 				where posting_date >= %s and voucher_no in (%s)""" % 
 				('%s', ', '.join(['%s']*len(future_stock_vouchers))), 
 				tuple([self.doc.posting_date] + [d[1] for d in future_stock_vouchers]), as_dict=1):
@@ -156,7 +156,7 @@
 		return gl_entries
 		
 	def delete_gl_entries(self, voucher_type, voucher_no):
-		webnotes.conn.sql("""delete from `tabGL Entry` 
+		frappe.conn.sql("""delete from `tabGL Entry` 
 			where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no))
 					
 	def make_adjustment_entry(self, expected_gle, voucher_obj):
@@ -236,7 +236,7 @@
 			item_list, warehouse_list = self.get_distinct_item_warehouse()
 			
 		if item_list and warehouse_list:
-			res = webnotes.conn.sql("""select item_code, voucher_type, voucher_no,
+			res = frappe.conn.sql("""select item_code, voucher_type, voucher_no,
 				voucher_detail_no, posting_date, posting_time, stock_value,
 				warehouse, actual_qty as qty from `tabStock Ledger Entry` 
 				where company = %s and item_code in (%s) and warehouse in (%s)
@@ -264,6 +264,6 @@
 		return list(set(item_list)), list(set(warehouse_list))
 		
 	def make_cancel_gl_entries(self):
-		if webnotes.conn.sql("""select name from `tabGL Entry` where voucher_type=%s 
+		if frappe.conn.sql("""select name from `tabGL Entry` where voucher_type=%s 
 			and voucher_no=%s""", (self.doc.doctype, self.doc.name)):
 				self.make_gl_entries()
\ No newline at end of file
diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py
index 7559b1f..9bc259c 100644
--- a/erpnext/controllers/trends.py
+++ b/erpnext/controllers/trends.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import add_days, add_months, cstr, getdate
-from webnotes import _
+import frappe
+from frappe.utils import add_days, add_months, cstr, getdate
+from frappe import _
 
 def get_columns(filters, trans):
 	validate_filters(filters)
@@ -30,10 +30,10 @@
 def validate_filters(filters):
 	for f in ["Fiscal Year", "Based On", "Period", "Company"]:
 		if not filters.get(f.lower().replace(" ", "_")):
-			webnotes.msgprint(f + _(" is mandatory"), raise_exception=1)
+			frappe.msgprint(f + _(" is mandatory"), raise_exception=1)
 	
 	if filters.get("based_on") == filters.get("group_by"):
-		webnotes.msgprint("'Based On' and 'Group By' can not be same", raise_exception=1)
+		frappe.msgprint("'Based On' and 'Group By' can not be same", raise_exception=1)
 
 def get_data(filters, conditions):
 	data = []
@@ -58,7 +58,7 @@
 			inc = 2
 		else :
 			inc = 1
-		data1 = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
+		data1 = frappe.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
 					where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and 
 					t1.docstatus = 1 %s 
 					group by %s 
@@ -73,7 +73,7 @@
 			data.append(dt)
 
 			#to get distinct value of col specified by group_by in filter
-			row = webnotes.conn.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s
+			row = frappe.conn.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s
 						where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s 
 						and t1.docstatus = 1 and %s = %s 
 					""" % 
@@ -85,7 +85,7 @@
 				des = ['' for q in range(len(conditions["columns"]))]
 				
 				#get data for group_by filter 
-				row1 = webnotes.conn.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s
+				row1 = frappe.conn.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s
 							where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s 
 							and t1.docstatus = 1 and %s = %s and %s = %s 
 						""" % 
@@ -101,7 +101,7 @@
 					
 				data.append(des)
 	else:
-		data = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
+		data = frappe.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
 					where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and 
 					t1.docstatus = 1 %s 
 					group by %s	
@@ -151,12 +151,12 @@
 				""" % {"trans_date": trans_date, "sd": bet_dates[0],"ed": bet_dates[1]}
 	return query_details
 
-@webnotes.whitelist(allow_guest=True)
+@frappe.whitelist(allow_guest=True)
 def get_period_date_ranges(period, fiscal_year=None, year_start_date=None):
 	from dateutil.relativedelta import relativedelta
 
 	if not year_start_date:
-		year_start_date, year_end_date = webnotes.conn.get_value("Fiscal Year", 
+		year_start_date, year_end_date = frappe.conn.get_value("Fiscal Year", 
 			fiscal_year, ["year_start_date", "year_end_date"])
 
 	increment = {
@@ -249,7 +249,7 @@
 			based_on_details["based_on_group_by"] = 't2.project_name'
 			based_on_details["addl_tables"] = ''
 		else:
-			webnotes.msgprint("Project-wise data is not available for Quotation", raise_exception=1)
+			frappe.msgprint("Project-wise data is not available for Quotation", raise_exception=1)
 
 	return based_on_details
 
diff --git a/erpnext/home/__init__.py b/erpnext/home/__init__.py
index f809dde..198bf6d 100644
--- a/erpnext/home/__init__.py
+++ b/erpnext/home/__init__.py
@@ -15,8 +15,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint
+import frappe
+from frappe import msgprint
 
 feed_dict = {
 	# Project
@@ -59,16 +59,16 @@
 def make_feed(feedtype, doctype, name, owner, subject, color):
 	"makes a new Feed record"
 	#msgprint(subject)
-	from webnotes.model.doc import Document
-	from webnotes.utils import get_fullname
+	from frappe.model.doc import Document
+	from frappe.utils import get_fullname
 
 	if feedtype in ('Login', 'Comment', 'Assignment'):
 		# delete old login, comment feed
-		webnotes.conn.sql("""delete from tabFeed where 
+		frappe.conn.sql("""delete from tabFeed where 
 			datediff(curdate(), creation) > 7 and doc_type in ('Comment', 'Login', 'Assignment')""")
 	else:
 		# one feed per item
-		webnotes.conn.sql("""delete from tabFeed
+		frappe.conn.sql("""delete from tabFeed
 			where doc_type=%s and doc_name=%s 
 			and ifnull(feed_type,'') != 'Comment'""", (doctype, name))
 
diff --git a/erpnext/home/doctype/feed/feed.py b/erpnext/home/doctype/feed/feed.py
index dcfb7ba..cdea27d 100644
--- a/erpnext/home/doctype/feed/feed.py
+++ b/erpnext/home/doctype/feed/feed.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
 
 	
 
@@ -15,8 +15,8 @@
     self.doc, self.doclist = d, dl
 	
 def on_doctype_update():
-	if not webnotes.conn.sql("""show index from `tabFeed` 
+	if not frappe.conn.sql("""show index from `tabFeed` 
 		where Key_name="feed_doctype_docname_index" """):
-		webnotes.conn.commit()
-		webnotes.conn.sql("""alter table `tabFeed` 
+		frappe.conn.commit()
+		frappe.conn.sql("""alter table `tabFeed` 
 			add index feed_doctype_docname_index(doc_type, doc_name)""")
\ No newline at end of file
diff --git a/erpnext/home/page/activity/activity.js b/erpnext/home/page/activity/activity.js
index 91b8184..f3f2e04 100644
--- a/erpnext/home/page/activity/activity.js
+++ b/erpnext/home/page/activity/activity.js
@@ -1,15 +1,15 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['activity'].onload = function(wrapper) {
-	wn.ui.make_app_page({
+frappe.pages['activity'].onload = function(wrapper) {
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._("Activity"),
+		title: frappe._("Activity"),
 		single_column: true
 	})
 	wrapper.appframe.add_module_icon("Activity");
 	
-	var list = new wn.ui.Listing({
+	var list = new frappe.ui.Listing({
 		hide_refresh: true,
 		appframe: wrapper.appframe,
 		method: 'erpnext.home.page.activity.activity.get_feed',
@@ -23,9 +23,9 @@
 	wrapper.appframe.set_title_right("Refresh", function() { list.run(); });
 	
 	// Build Report Button
-	if(wn.boot.profile.can_get_report.indexOf("Feed")!=-1) {
-		wrapper.appframe.add_primary_action(wn._('Build Report'), function() {
-			wn.set_route('Report', "Feed");
+	if(frappe.boot.profile.can_get_report.indexOf("Feed")!=-1) {
+		wrapper.appframe.add_primary_action(frappe._('Build Report'), function() {
+			frappe.set_route('Report', "Feed");
 		}, 'icon-th')
 	}
 }
@@ -42,12 +42,12 @@
 			%(link)s %(subject)s <span class="user-info">%(by)s</span></div>', data));
 	},
 	scrub_data: function(data) {
-		data.by = wn.user_info(data.owner).fullname;
-		data.imgsrc = wn.utils.get_file_link(wn.user_info(data.owner).image);
+		data.by = frappe.user_info(data.owner).fullname;
+		data.imgsrc = frappe.utils.get_file_link(frappe.user_info(data.owner).image);
 		
 		// feedtype
 		if(!data.feed_type) {
-			data.feed_type = wn._(data.doc_type);
+			data.feed_type = frappe._(data.doc_type);
 			data.add_class = "label-info";
 			data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
 		}
@@ -63,7 +63,7 @@
 		
 		// link
 		if(data.doc_name && data.feed_type!='Login') {
-			data.link = wn.format(data.doc_name, {"fieldtype":"Link", "options":data.doc_type})
+			data.link = frappe.format(data.doc_name, {"fieldtype":"Link", "options":data.doc_type})
 		} else {
 			data.link = "";
 		}
diff --git a/erpnext/home/page/activity/activity.py b/erpnext/home/page/activity/activity.py
index 2d902e1..1e02968 100644
--- a/erpnext/home/page/activity/activity.py
+++ b/erpnext/home/page/activity/activity.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_feed(arg=None):
 	"""get feed"""	
-	return webnotes.conn.sql("""select
+	return frappe.conn.sql("""select
 		distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner,
 		t1.modified
 		from tabFeed t1, tabDocPerm t2
@@ -16,6 +16,6 @@
 		and t2.permlevel = 0
 		and ifnull(t2.`read`,0) = 1
 		order by t1.modified desc
-		limit %s, %s""" % ("','".join(webnotes.get_roles()), 
-			webnotes.form_dict['limit_start'], webnotes.form_dict['limit_page_length']), 
+		limit %s, %s""" % ("','".join(frappe.get_roles()), 
+			frappe.form_dict['limit_start'], frappe.form_dict['limit_page_length']), 
 			as_dict=1)
\ No newline at end of file
diff --git a/erpnext/home/page/latest_updates/README.md b/erpnext/home/page/latest_updates/README.md
deleted file mode 100644
index d3bf0d4..0000000
--- a/erpnext/home/page/latest_updates/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Update log.
\ No newline at end of file
diff --git a/erpnext/home/page/latest_updates/__init__.py b/erpnext/home/page/latest_updates/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/home/page/latest_updates/__init__.py
+++ /dev/null
diff --git a/erpnext/home/page/latest_updates/latest_updates.js b/erpnext/home/page/latest_updates/latest_updates.js
deleted file mode 100644
index 06c34ef..0000000
--- a/erpnext/home/page/latest_updates/latest_updates.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-wn.pages['latest-updates'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
-		parent: wrapper,
-		title: wn._('Latest Updates'),
-		single_column: true
-	});
-		
-	var parent = $(wrapper).find(".layout-main");
-	parent.html('<div class="progress progress-striped active">\
-		<div class="progress-bar" style="width: 100%;"></div></div>')
-	
-	return wn.call({
-		method: "erpnext.home.page.latest_updates.latest_updates.get",
-		callback: function(r) {
-			parent.empty();
-			$("<p class='help'>"+wn._("Report issues at")+
-				"<a href='https://github.com/webnotes/erpnext/issues'>"+wn._("GitHub Issues")+"</a></p>\
-				<hr><h3>"+wn._("Commit Log")+"</h3>")
-					.appendTo(parent);
-				
-			var $tbody = $('<table class="table table-bordered"><tbody></tbody></table>')
-				.appendTo(parent).find("tbody");
-			$.each(r.message, function(i, log) {
-				if(log.message.indexOf("minor")===-1 
-					&& log.message.indexOf("docs")===-1
-					&& log.message.indexOf("[")!==-1) {
-					log.message = log.message.replace(/(\[[^\]]*\])/g, 
-						function(match, p1, offset, string) { 
-							match = match.toLowerCase();
-							var color_class = "";
-							$.each(["bug", "fix"], function(i, v) {
-								if(!color_class && match.indexOf(v)!==-1)
-									color_class = "label-danger";
-							});
-							return  '<span class="label ' + color_class +'">' + p1.slice(1,-1) + '</span> ' 
-						});
-					log.repo = log.repo==="lib" ? "wnframework" : "erpnext";
-					$(repl('<tr>\
-						<td><b><a href="https://github.com/webnotes/%(repo)s/commit/%(commit)s" \
-							target="_blank">%(message)s</b>\
-						<br><span class="text-muted">By %(author)s on %(date)s</span></td></tr>', log)).appendTo($tbody);
-				}
-				
-			})
-		}
-	})
-};
\ No newline at end of file
diff --git a/erpnext/home/page/latest_updates/latest_updates.py b/erpnext/home/page/latest_updates/latest_updates.py
deleted file mode 100644
index 90e87f1..0000000
--- a/erpnext/home/page/latest_updates/latest_updates.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes, os, subprocess, tempfile, json, datetime
-
-@webnotes.whitelist()
-def get():
-	with open("../app/home/page/latest_updates/latest_updates.json", "r") as lufile:
-		return json.loads(lufile.read())
-
-def make():
-	def add_to_logs(out, repo):
-		out.seek(0)
-		last_commit = None
-		for l in out.readlines():
-			l = l.decode('utf-8')
-			if last_commit is not None:
-				if l.startswith("Date:"):
-					last_commit["date"] = l[8:-1]
-					last_commit["datetime"] = datetime.datetime.strptime(last_commit["date"][:-6], "%a %b %d %H:%M:%S %Y")
-				if l.startswith("Author:"):
-					last_commit["author"] = l[8:-1]
-				if l.startswith("    "):
-					last_commit["message"] = l[4:-1]
-
-			if l.startswith("commit"):
-				last_commit = {
-					"repo": repo,
-					"commit": l.split(" ")[1][:-1]
-				}
-				logs.append(last_commit)
-
-	os.chdir("lib")
-	logs = []
-	out_lib = tempfile.TemporaryFile()
-	subprocess.call("git --no-pager log -n 200 --no-color", shell=True, stdout=out_lib)
-	add_to_logs(out_lib, "lib")
-
-	os.chdir("../app")
-	out_app = tempfile.TemporaryFile()
-	subprocess.call("git --no-pager log -n 200 --no-color", shell=True, stdout=out_app)
-	add_to_logs(out_app, "app")
-	
-	logs.sort(key=lambda a: a["datetime"], reverse=True)
-	for a in logs:
-		del a["datetime"]
-		
-	for i in xrange(len(logs)):
-		if i and logs[i]["message"]==logs[i-1]["message"]:
-			logs[i]["delete"] = True
-			
-		if logs[i]["message"].startswith("Merge branch") or "[" not in logs[i]["message"]:
-			logs[i]["delete"] = True
-	
-	logs = filter(lambda a: a if not a.get("delete") else None, logs)
-	
-	os.chdir("..")
-	with open("app/home/page/latest_updates/latest_updates.json", "w") as lufile:
-		lufile.write(json.dumps(logs, indent=1, sort_keys=True))
-	
-if __name__=="__main__":
-	make()
diff --git a/erpnext/home/page/latest_updates/latest_updates.txt b/erpnext/home/page/latest_updates/latest_updates.txt
deleted file mode 100644
index db22b70..0000000
--- a/erpnext/home/page/latest_updates/latest_updates.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-[
- {
-  "creation": "2012-11-19 12:06:54", 
-  "docstatus": 0, 
-  "modified": "2013-07-11 14:43:20", 
-  "modified_by": "Administrator", 
-  "owner": "Administrator"
- }, 
- {
-  "doctype": "Page", 
-  "icon": "icon-asterisk", 
-  "module": "Home", 
-  "name": "__common__", 
-  "page_name": "latest-updates", 
-  "standard": "Yes", 
-  "title": "Latest Updates"
- }, 
- {
-  "doctype": "Page Role", 
-  "name": "__common__", 
-  "parent": "latest-updates", 
-  "parentfield": "roles", 
-  "parenttype": "Page", 
-  "role": "All"
- }, 
- {
-  "doctype": "Page", 
-  "name": "latest-updates"
- }, 
- {
-  "doctype": "Page Role"
- }
-]
\ No newline at end of file
diff --git a/erpnext/hooks.txt b/erpnext/hooks.txt
index 433fef7..8b0ece2 100644
--- a/erpnext/hooks.txt
+++ b/erpnext/hooks.txt
@@ -29,9 +29,9 @@
 bean_event:*:on_submit = erpnext.home.update_feed
 bean_event:Comment:on_update = erpnext.home.make_comment_feed
 
-bean_event:*:on_update = webnotes.core.doctype.notification_count.notification_count.clear_doctype_notifications
-bean_event:*:on_cancel = webnotes.core.doctype.notification_count.notification_count.clear_doctype_notifications
-bean_event:*:on_trash = webnotes.core.doctype.notification_count.notification_count.clear_doctype_notifications
+bean_event:*:on_update = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
+bean_event:*:on_cancel = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
+bean_event:*:on_trash = frappe.core.doctype.notification_count.notification_count.clear_doctype_notifications
 
 bean_event:Stock Entry:on_submit = erpnext.stock.doctype.material_request.material_request.update_completed_qty
 bean_event:Stock Entry:on_cancel = erpnext.stock.doctype.material_request.material_request.update_completed_qty
diff --git a/erpnext/hr/doctype/appraisal/appraisal.js b/erpnext/hr/doctype/appraisal/appraisal.js
index 29157d0..5bcb96d 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.js
+++ b/erpnext/hr/doctype/appraisal/appraisal.js
@@ -13,7 +13,7 @@
 }
 
 cur_frm.cscript.onload_post_render = function(doc,cdt,cdn){
-	if(doc.__islocal && doc.employee==wn.defaults.get_user_default("employee")) {
+	if(doc.__islocal && doc.employee==frappe.defaults.get_user_default("employee")) {
 		cur_frm.set_value("employee", "");
 		cur_frm.set_value("employee_name", "")
 	}
@@ -24,7 +24,7 @@
 }
 
 cur_frm.cscript.kra_template = function(doc, dt, dn) {
-	wn.model.map_current_doc({
+	frappe.model.map_current_doc({
 		method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
 		source_name: cur_frm.doc.kra_template,
 	});
@@ -45,7 +45,7 @@
 	var d = locals[cdt][cdn];
 	if (d.score){
 		if (flt(d.score) > 5) {
-			msgprint(wn._("Score must be less than or equal to 5"));
+			msgprint(frappe._("Score must be less than or equal to 5"));
 			d.score = 0;
 			refresh_field('score', d.name, 'appraisal_details');
 		}
diff --git a/erpnext/hr/doctype/appraisal/appraisal.py b/erpnext/hr/doctype/appraisal/appraisal.py
index 81c13cb..7c042c5 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.py
+++ b/erpnext/hr/doctype/appraisal/appraisal.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, getdate
-from webnotes.model.bean import getlist
-from webnotes import msgprint
+from frappe.utils import cstr, flt, getdate
+from frappe.model.bean import getlist
+from frappe import msgprint
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -22,7 +22,7 @@
 		self.calculate_total()
 
 	def get_employee_name(self):
-		emp_nm = webnotes.conn.sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
+		emp_nm = frappe.conn.sql("select employee_name from `tabEmployee` where name=%s", self.doc.employee)
 		emp_nm= emp_nm and emp_nm[0][0] or ''
 		self.doc.employee_name = emp_nm
 		return emp_nm
@@ -33,7 +33,7 @@
 			raise Exception
 	
 	def validate_existing_appraisal(self):
-		chk = webnotes.conn.sql("""select name from `tabAppraisal` where employee=%s 
+		chk = frappe.conn.sql("""select name from `tabAppraisal` where employee=%s 
 			and (status='Submitted' or status='Completed') 
 			and ((start_date>=%s and start_date<=%s) 
 			or (end_date>=%s and end_date<=%s))""",(self.doc.employee,self.doc.start_date,self.doc.end_date,self.doc.start_date,self.doc.end_date))
@@ -55,21 +55,21 @@
 			msgprint("Total weightage assigned should be 100%. It is :" + str(total_w) + "%", 
 				raise_exception=1)
 
-		if webnotes.conn.get_value("Employee", self.doc.employee, "user_id") != \
-				webnotes.session.user and total == 0:
+		if frappe.conn.get_value("Employee", self.doc.employee, "user_id") != \
+				frappe.session.user and total == 0:
 			msgprint("Total can't be zero. You must atleast give some points!", raise_exception=1)
 
 		self.doc.total_score = total
 			
 	def on_submit(self):
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 	
 	def on_cancel(self): 
-		webnotes.conn.set(self.doc, 'status', 'Cancelled')
+		frappe.conn.set(self.doc, 'status', 'Cancelled')
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def fetch_appraisal_template(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	doclist = get_mapped_doclist("Appraisal Template", source_name, {
 		"Appraisal Template": {
diff --git a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
+++ b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.py b/erpnext/hr/doctype/appraisal_template/appraisal_template.py
index 39f8545..0f78a4a 100644
--- a/erpnext/hr/doctype/appraisal_template/appraisal_template.py
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
 class DocType:
 	def __init__(self, d, dl):
@@ -15,6 +15,6 @@
 			self.doc.total_points += int(d.per_weightage or 0)
 		
 		if int(self.doc.total_points) != 100:
-			webnotes.msgprint(_("Total (sum of) points distribution for all goals should be 100.") \
+			frappe.msgprint(_("Total (sum of) points distribution for all goals should be 100.") \
 				+ " " + _("Not") + " " + str(self.doc.total_points),
 				raise_exception=True)
\ No newline at end of file
diff --git a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
+++ b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py
index 10d4222..385170f 100644
--- a/erpnext/hr/doctype/attendance/attendance.py
+++ b/erpnext/hr/doctype/attendance/attendance.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import getdate, nowdate
-from webnotes import msgprint, _
+from frappe.utils import getdate, nowdate
+from frappe import msgprint, _
 
 
 class DocType:
@@ -14,7 +14,7 @@
 		self.doclist = doclist
 	
 	def validate_duplicate_record(self):	 
-		res = webnotes.conn.sql("""select name from `tabAttendance` where employee = %s and att_date = %s 
+		res = frappe.conn.sql("""select name from `tabAttendance` where employee = %s and att_date = %s 
 			and name != %s and docstatus = 1""", 
 			(self.doc.employee, self.doc.att_date, self.doc.name))
 		if res:
@@ -23,12 +23,12 @@
 			
 	def check_leave_record(self):
 		if self.doc.status == 'Present':
-			leave = webnotes.conn.sql("""select name from `tabLeave Application` 
+			leave = frappe.conn.sql("""select name from `tabLeave Application` 
 				where employee = %s and %s between from_date and to_date and status = 'Approved' 
 				and docstatus = 1""", (self.doc.employee, self.doc.att_date))
 			
 			if leave:
-				webnotes.msgprint(_("Employee: ") + self.doc.employee + _(" was on leave on ")
+				frappe.msgprint(_("Employee: ") + self.doc.employee + _(" was on leave on ")
 					+ self.doc.att_date + _(". You can not mark his attendance as 'Present'"), 
 					raise_exception=1)
 	
@@ -41,7 +41,7 @@
 			msgprint(_("Attendance can not be marked for future dates"), raise_exception=1)
 
 	def validate_employee(self):
-		emp = webnotes.conn.sql("select name from `tabEmployee` where name = %s and status = 'Active'",
+		emp = frappe.conn.sql("select name from `tabEmployee` where name = %s and status = 'Active'",
 		 	self.doc.employee)
 		if not emp:
 			msgprint(_("Employee: ") + self.doc.employee + 
@@ -58,5 +58,5 @@
 	def on_update(self):
 		# this is done because sometimes user entered wrong employee name 
 		# while uploading employee attendance
-		employee_name = webnotes.conn.get_value("Employee", self.doc.employee, "employee_name")
-		webnotes.conn.set(self.doc, 'employee_name', employee_name)
\ No newline at end of file
+		employee_name = frappe.conn.get_value("Employee", self.doc.employee, "employee_name")
+		frappe.conn.set(self.doc, 'employee_name', employee_name)
\ No newline at end of file
diff --git a/erpnext/hr/doctype/branch/branch.py b/erpnext/hr/doctype/branch/branch.py
index 87b54f2..58ecbe8 100644
--- a/erpnext/hr/doctype/branch/branch.py
+++ b/erpnext/hr/doctype/branch/branch.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/deduction_type/deduction_type.py b/erpnext/hr/doctype/deduction_type/deduction_type.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/deduction_type/deduction_type.py
+++ b/erpnext/hr/doctype/deduction_type/deduction_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/department/department.py b/erpnext/hr/doctype/department/department.py
index b0215d5..5015bed 100644
--- a/erpnext/hr/doctype/department/department.py
+++ b/erpnext/hr/doctype/department/department.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/designation/designation.py b/erpnext/hr/doctype/designation/designation.py
index 87b54f2..58ecbe8 100644
--- a/erpnext/hr/doctype/designation/designation.py
+++ b/erpnext/hr/doctype/designation/designation.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/earning_type/earning_type.py b/erpnext/hr/doctype/earning_type/earning_type.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/earning_type/earning_type.py
+++ b/erpnext/hr/doctype/earning_type/earning_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index 7ee88f7..80150f1 100644
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -1,11 +1,11 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.hr");
-erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
+frappe.provide("erpnext.hr");
+erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
 	setup: function() {
 		this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) {
-			return { query:"webnotes.core.doctype.profile.profile.profile_query"} }
+			return { query:"frappe.core.doctype.profile.profile.profile_query"} }
 		this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) {
 			return { query: "erpnext.controllers.queries.employee_query"} }
 	},
@@ -13,7 +13,7 @@
 	onload: function() {
 		this.setup_leave_approver_select();
 		this.frm.toggle_display(["esic_card_no", "gratuity_lic_id", "pan_number", "pf_number"],
-			wn.control_panel.country==="India");
+			frappe.control_panel.country==="India");
 		if(this.frm.doc.__islocal) this.frm.set_value("employee_name", "");
 	},
 	
@@ -21,7 +21,7 @@
 		var me = this;
 		erpnext.hide_naming_series();
 		if(!this.frm.doc.__islocal) {			
-			cur_frm.add_custom_button(wn._('Make Salary Structure'), function() {
+			cur_frm.add_custom_button(frappe._('Make Salary Structure'), function() {
 				me.make_salary_structure(this); });
 		}
 	},
@@ -31,10 +31,10 @@
 		return this.frm.call({
 			method: "erpnext.hr.utils.get_leave_approver_list",
 			callback: function(r) {
-				var df = wn.meta.get_docfield("Employee Leave Approver", "leave_approver",
+				var df = frappe.meta.get_docfield("Employee Leave Approver", "leave_approver",
 					me.frm.doc.name);
 				df.options = $.map(r.message, function(profile) { 
-					return {value: profile, label: wn.user_info(profile).fullname}; 
+					return {value: profile, label: frappe.user_info(profile).fullname}; 
 				});
 				me.frm.fields_dict.employee_leave_approvers.refresh();
 			}
@@ -61,14 +61,14 @@
 		var me = this;
 		this.validate_salary_structure(btn, function(r) {
 			if(r.message) {
-				msgprint(wn._("Employee") + ' "' + me.frm.doc.name + '": ' 
-					+ wn._("An active Salary Structure already exists. \
+				msgprint(frappe._("Employee") + ' "' + me.frm.doc.name + '": ' 
+					+ frappe._("An active Salary Structure already exists. \
 						If you want to create new one, please ensure that no active \
 						Salary Structure exists for this Employee. \
 						Go to the active Salary Structure and set \"Is Active\" = \"No\""));
 			} else if(!r.exc) {
-				wn.model.map({
-					source: wn.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name),
+				frappe.model.map({
+					source: frappe.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name),
 					target: "Salary Structure"
 				});
 			}
@@ -79,7 +79,7 @@
 		var me = this;
 		return this.frm.call({
 			btn: btn,
-			method: "webnotes.client.get_value",
+			method: "frappe.client.get_value",
 			args: {
 				doctype: "Salary Structure",
 				fieldname: "name",
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index e7a9343..bfbbfbd 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -2,18 +2,18 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import getdate, validate_email_add, cstr, cint
-from webnotes.model.doc import make_autoname
-from webnotes import msgprint, throw, _
-import webnotes.permissions
-from webnotes.defaults import get_restrictions
-from webnotes.model.controller import DocListController
+from frappe.utils import getdate, validate_email_add, cstr, cint
+from frappe.model.doc import make_autoname
+from frappe import msgprint, throw, _
+import frappe.permissions
+from frappe.defaults import get_restrictions
+from frappe.model.controller import DocListController
 
 class DocType(DocListController):
 	def autoname(self):
-		naming_method = webnotes.conn.get_value("HR Settings", None, "emp_created_by")
+		naming_method = frappe.conn.get_value("HR Settings", None, "emp_created_by")
 		if not naming_method:
 			throw(_("Please setup Employee Naming System in Human Resource > HR Settings"))
 		else:
@@ -52,33 +52,33 @@
 		self.add_restriction_if_required("Employee", self.doc.user_id)
 
 	def update_user_default(self):
-		webnotes.conn.set_default("employee_name", self.doc.employee_name, self.doc.user_id)
-		webnotes.conn.set_default("company", self.doc.company, self.doc.user_id)
+		frappe.conn.set_default("employee_name", self.doc.employee_name, self.doc.user_id)
+		frappe.conn.set_default("company", self.doc.company, self.doc.user_id)
 	
 	def restrict_leave_approver(self):
 		"""restrict to this employee for leave approver"""
 		employee_leave_approvers = [d.leave_approver for d in self.doclist.get({"parentfield": "employee_leave_approvers"})]
 		if self.doc.reports_to and self.doc.reports_to not in employee_leave_approvers:
-			employee_leave_approvers.append(webnotes.conn.get_value("Employee", self.doc.reports_to, "user_id"))
+			employee_leave_approvers.append(frappe.conn.get_value("Employee", self.doc.reports_to, "user_id"))
 			
 		for user in employee_leave_approvers:
 			self.add_restriction_if_required("Employee", user)
 			self.add_restriction_if_required("Leave Application", user)
 				
 	def add_restriction_if_required(self, doctype, user):
-		if webnotes.permissions.has_only_non_restrict_role(webnotes.get_doctype(doctype), user) \
+		if frappe.permissions.has_only_non_restrict_role(frappe.get_doctype(doctype), user) \
 			and self.doc.name not in get_restrictions(user).get("Employee", []):
 			
-			webnotes.defaults.add_default("Employee", self.doc.name, user, "Restriction")
+			frappe.defaults.add_default("Employee", self.doc.name, user, "Restriction")
 	
 	def update_profile(self):
 		# add employee role if missing
-		if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
+		if not "Employee" in frappe.conn.sql_list("""select role from tabUserRole
 				where parent=%s""", self.doc.user_id):
-			from webnotes.profile import add_role
+			from frappe.profile import add_role
 			add_role(self.doc.user_id, "Employee")
 			
-		profile_wrapper = webnotes.bean("Profile", self.doc.user_id)
+		profile_wrapper = frappe.bean("Profile", self.doc.user_id)
 		
 		# copy details like Fullname, DOB and Image to Profile
 		if self.doc.employee_name:
@@ -101,13 +101,13 @@
 			if not profile_wrapper.doc.user_image == self.doc.image:
 				profile_wrapper.doc.user_image = self.doc.image
 				try:
-					webnotes.doc({
+					frappe.doc({
 						"doctype": "File Data",
 						"file_name": self.doc.image,
 						"attached_to_doctype": "Profile",
 						"attached_to_name": self.doc.user_id
 					}).insert()
-				except webnotes.DuplicateEntryError, e:
+				except frappe.DuplicateEntryError, e:
 					# already exists
 					pass
 		profile_wrapper.ignore_permissions = True
@@ -143,7 +143,7 @@
 			throw(_("Please enter relieving date."))
 
 	def validate_for_enabled_user_id(self):
-		enabled = webnotes.conn.sql("""select name from `tabProfile` where 
+		enabled = frappe.conn.sql("""select name from `tabProfile` where 
 			name=%s and enabled=1""", self.doc.user_id)
 		if not enabled:
 			throw("{id}: {user_id} {msg}".format(**{
@@ -153,7 +153,7 @@
 			}))
 
 	def validate_duplicate_user_id(self):
-		employee = webnotes.conn.sql_list("""select name from `tabEmployee` where 
+		employee = frappe.conn.sql_list("""select name from `tabEmployee` where 
 			user_id=%s and status='Active' and name!=%s""", (self.doc.user_id, self.doc.name))
 		if employee:
 			throw("{id}: {user_id} {msg}: {employee}".format(**{
@@ -164,7 +164,7 @@
 			}))
 			
 	def validate_employee_leave_approver(self):
-		from webnotes.profile import Profile
+		from frappe.profile import Profile
 		from erpnext.hr.doctype.leave_application.leave_application import InvalidLeaveApproverError
 		
 		for l in self.doclist.get({"parentfield": "employee_leave_approvers"}):
@@ -174,20 +174,20 @@
 
 	def update_dob_event(self):
 		if self.doc.status == "Active" and self.doc.date_of_birth \
-			and not cint(webnotes.conn.get_value("HR Settings", None, "stop_birthday_reminders")):
-			birthday_event = webnotes.conn.sql("""select name from `tabEvent` where repeat_on='Every Year' 
+			and not cint(frappe.conn.get_value("HR Settings", None, "stop_birthday_reminders")):
+			birthday_event = frappe.conn.sql("""select name from `tabEvent` where repeat_on='Every Year' 
 				and ref_type='Employee' and ref_name=%s""", self.doc.name)
 			
 			starts_on = self.doc.date_of_birth + " 00:00:00"
 			ends_on = self.doc.date_of_birth + " 00:15:00"
 
 			if birthday_event:
-				event = webnotes.bean("Event", birthday_event[0][0])
+				event = frappe.bean("Event", birthday_event[0][0])
 				event.doc.starts_on = starts_on
 				event.doc.ends_on = ends_on
 				event.save()
 			else:
-				webnotes.bean({
+				frappe.bean({
 					"doctype": "Event",
 					"subject": _("Birthday") + ": " + self.doc.employee_name,
 					"description": _("Happy Birthday!") + " " + self.doc.employee_name,
@@ -202,10 +202,10 @@
 					"ref_name": self.doc.name
 				}).insert()
 		else:
-			webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and
+			frappe.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and
 				ref_type='Employee' and ref_name=%s""", self.doc.name)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_retirement_date(date_of_birth=None):
 	import datetime
 	ret = {}
diff --git a/erpnext/hr/doctype/employee_education/employee_education.py b/erpnext/hr/doctype/employee_education/employee_education.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/employee_education/employee_education.py
+++ b/erpnext/hr/doctype/employee_education/employee_education.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
+++ b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
+++ b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.py b/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.py
index e5468e5..968a25b 100644
--- a/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.py
+++ b/erpnext/hr/doctype/employee_leave_approver/employee_leave_approver.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/employment_type/employment_type.py b/erpnext/hr/doctype/employment_type/employment_type.py
index b0215d5..5015bed 100644
--- a/erpnext/hr/doctype/employment_type/employment_type.py
+++ b/erpnext/hr/doctype/employment_type/employment_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 716afd3..6ff1d3f 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -1,30 +1,30 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.hr");
+frappe.provide("erpnext.hr");
 
-erpnext.hr.ExpenseClaimController = wn.ui.form.Controller.extend({
+erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({
 	make_bank_voucher: function() {
 		var me = this;
-		return wn.call({
+		return frappe.call({
 			method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
 			args: {
 				"company": cur_frm.doc.company,
 				"voucher_type": "Bank Voucher"
 			},
 			callback: function(r) {
-				var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
+				var jv = frappe.model.make_new_doc_and_get_name('Journal Voucher');
 				jv = locals['Journal Voucher'][jv];
 				jv.voucher_type = 'Bank Voucher';
 				jv.company = cur_frm.doc.company;
 				jv.remark = 'Payment against Expense Claim: ' + cur_frm.doc.name;
 				jv.fiscal_year = cur_frm.doc.fiscal_year;
 
-				var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
+				var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
 				d1.debit = cur_frm.doc.total_sanctioned_amount;
 
 				// credit to bank
-				var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
+				var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
 				d1.credit = cur_frm.doc.total_sanctioned_amount;
 				if(r.message) {
 					d1.account = r.message.account;
@@ -92,27 +92,27 @@
 		if(doc.docstatus==0 && doc.exp_approver==user && doc.approval_status=="Approved")
 			 cur_frm.savesubmit();
 		
-		if(doc.docstatus==1 && wn.model.can_create("Journal Voucher"))
-			 cur_frm.add_custom_button(wn._("Make Bank Voucher"), cur_frm.cscript.make_bank_voucher);
+		if(doc.docstatus==1 && frappe.model.can_create("Journal Voucher"))
+			 cur_frm.add_custom_button(frappe._("Make Bank Voucher"), cur_frm.cscript.make_bank_voucher);
 	}
 }
 
 cur_frm.cscript.set_help = function(doc) {
 	cur_frm.set_intro("");
 	if(doc.__islocal && !in_list(user_roles, "HR User")) {
-		cur_frm.set_intro(wn._("Fill the form and save it"))
+		cur_frm.set_intro(frappe._("Fill the form and save it"))
 	} else {
 		if(doc.docstatus==0 && doc.approval_status=="Draft") {
 			if(user==doc.exp_approver) {
-				cur_frm.set_intro(wn._("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
+				cur_frm.set_intro(frappe._("You are the Expense Approver for this record. Please Update the 'Status' and Save"));
 			} else {
-				cur_frm.set_intro(wn._("Expense Claim is pending approval. Only the Expense Approver can update status."));
+				cur_frm.set_intro(frappe._("Expense Claim is pending approval. Only the Expense Approver can update status."));
 			}
 		} else {
 			if(doc.approval_status=="Approved") {
-				cur_frm.set_intro(wn._("Expense Claim has been approved."));
+				cur_frm.set_intro(frappe._("Expense Claim has been approved."));
 			} else if(doc.approval_status=="Rejected") {
-				cur_frm.set_intro(wn._("Expense Claim has been rejected."));
+				cur_frm.set_intro(frappe._("Expense Claim has been rejected."));
 			}
 		}
 	}
@@ -125,7 +125,7 @@
 cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
 	doc.total_claimed_amount = 0;
 	doc.total_sanctioned_amount = 0;
-	$.each(wn.model.get("Expense Claim Detail", {parent:doc.name}), function(i, d) {
+	$.each(frappe.model.get("Expense Claim Detail", {parent:doc.name}), function(i, d) {
 		doc.total_claimed_amount += d.claim_amount;
 		if(d.sanctioned_amount==null) {
 			d.sanctioned_amount = d.claim_amount;
@@ -152,7 +152,7 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings && wn.boot.notification_settings.expense_claim)) {
-		cur_frm.email_doc(wn.boot.notification_settings.expense_claim_message);
+	if(cint(frappe.boot.notification_settings && frappe.boot.notification_settings.expense_claim)) {
+		cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message);
 	}
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
index 521195f..0fbfde5 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.model.bean import getlist
-from webnotes import msgprint
+from frappe.model.bean import getlist
+from frappe import msgprint
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -18,7 +18,7 @@
 			
 	def on_submit(self):
 		if self.doc.approval_status=="Draft":
-			webnotes.msgprint("""Please set Approval Status to 'Approved' or \
+			frappe.msgprint("""Please set Approval Status to 'Approved' or \
 				'Rejected' before submitting""", raise_exception=1)
 	
 	def validate_fiscal_year(self):
diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
+++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
+++ b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/grade/grade.py b/erpnext/hr/doctype/grade/grade.py
index 87b54f2..58ecbe8 100644
--- a/erpnext/hr/doctype/grade/grade.py
+++ b/erpnext/hr/doctype/grade/grade.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/holiday/holiday.py b/erpnext/hr/doctype/holiday/holiday.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/holiday/holiday.py
+++ b/erpnext/hr/doctype/holiday/holiday.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py
index 9f28e4c6..6d5181d 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import add_days, add_years, cint, getdate
-from webnotes.model import db_exists
-from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.bean import copy_doclist
-from webnotes import msgprint, throw, _
+from frappe.utils import add_days, add_years, cint, getdate
+from frappe.model import db_exists
+from frappe.model.doc import addchild, make_autoname
+from frappe.model.bean import copy_doclist
+from frappe import msgprint, throw, _
 import datetime
 
 class DocType:
@@ -41,11 +41,11 @@
 			throw(_("Please select weekly off day"))
 
 	def get_fy_start_end_dates(self):
-		return webnotes.conn.sql("""select year_start_date, year_end_date
+		return frappe.conn.sql("""select year_start_date, year_end_date
 			from `tabFiscal Year` where name=%s""", (self.doc.fiscal_year,))[0]
 
 	def get_weekly_off_date_list(self, year_start_date, year_end_date):
-		from webnotes.utils import getdate
+		from frappe.utils import getdate
 		year_start_date, year_end_date = getdate(year_start_date), getdate(year_end_date)
 		
 		from dateutil import relativedelta
@@ -66,5 +66,5 @@
 		self.doclist = self.doc.clear_table(self.doclist, 'holiday_list_details')
 
 	def update_default_holiday_list(self):
-		webnotes.conn.sql("""update `tabHoliday List` set is_default = 0 
+		frappe.conn.sql("""update `tabHoliday List` set is_default = 0 
 			where ifnull(is_default, 0) = 1 and fiscal_year = %s""", (self.doc.fiscal_year,))
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.py b/erpnext/hr/doctype/hr_settings/hr_settings.py
index e7e5d3e..1102dd6 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.py
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.py
@@ -4,9 +4,9 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cint
+from frappe.utils import cint
 
 class DocType:
 	def __init__(self, d, dl):
@@ -20,16 +20,16 @@
 			self.doc.get("emp_created_by")=="Naming Series", hide_name_field=True)
 			
 	def update_birthday_reminders(self):
-		original_stop_birthday_reminders = cint(webnotes.conn.get_value("HR Settings", 
+		original_stop_birthday_reminders = cint(frappe.conn.get_value("HR Settings", 
 			None, "stop_birthday_reminders"))
 
 		# reset birthday reminders
 		if cint(self.doc.stop_birthday_reminders) != original_stop_birthday_reminders:
-			webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
+			frappe.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
 		
 			if not self.doc.stop_birthday_reminders:
-				for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and 
+				for employee in frappe.conn.sql_list("""select name from `tabEmployee` where status='Active' and 
 					ifnull(date_of_birth, '')!=''"""):
-					webnotes.get_obj("Employee", employee).update_dob_event()
+					frappe.get_obj("Employee", employee).update_dob_event()
 					
-			webnotes.msgprint(webnotes._("Updated Birthday Reminders"))
\ No newline at end of file
+			frappe.msgprint(frappe._("Updated Birthday Reminders"))
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_applicant/get_job_applications.py b/erpnext/hr/doctype/job_applicant/get_job_applications.py
index d821afa..3b7a1c1 100644
--- a/erpnext/hr/doctype/job_applicant/get_job_applications.py
+++ b/erpnext/hr/doctype/job_applicant/get_job_applications.py
@@ -2,30 +2,30 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, cint
-from webnotes.utils.email_lib.receive import POP3Mailbox
-from webnotes.core.doctype.communication.communication import _make
+import frappe
+from frappe.utils import cstr, cint
+from frappe.utils.email_lib.receive import POP3Mailbox
+from frappe.core.doctype.communication.communication import _make
 
 class JobsMailbox(POP3Mailbox):	
 	def setup(self, args=None):
-		self.settings = args or webnotes.doc("Jobs Email Settings", "Jobs Email Settings")
+		self.settings = args or frappe.doc("Jobs Email Settings", "Jobs Email Settings")
 		
 	def process_message(self, mail):
 		if mail.from_email == self.settings.email_id:
 			return
 			
-		name = webnotes.conn.get_value("Job Applicant", {"email_id": mail.from_email}, 
+		name = frappe.conn.get_value("Job Applicant", {"email_id": mail.from_email}, 
 			"name")
 		if name:
-			applicant = webnotes.bean("Job Applicant", name)
+			applicant = frappe.bean("Job Applicant", name)
 			if applicant.doc.status!="Rejected":
 				applicant.doc.status = "Open"
 			applicant.doc.save()
 		else:
 			name = (mail.from_real_name and (mail.from_real_name + " - ") or "") \
 				+ mail.from_email
-			applicant = webnotes.bean({
+			applicant = frappe.bean({
 				"creation": mail.date,
 				"doctype":"Job Applicant",
 				"applicant_name": name,
@@ -40,5 +40,5 @@
 			doctype="Job Applicant", name=applicant.doc.name, sent_or_received="Received")
 
 def get_job_applications():
-	if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')):
+	if cint(frappe.conn.get_value('Jobs Email Settings', None, 'extract_emails')):
 		JobsMailbox()
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.js b/erpnext/hr/doctype/job_applicant/job_applicant.js
index fbe7714..f0fe443 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.js
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.js
@@ -6,16 +6,16 @@
 cur_frm.cscript = {
 	onload: function(doc, dt, dn) {
 		if(in_list(user_roles,'System Manager')) {
-			cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Jobs Email Settings">'+wn._("Jobs Email Settings")+'</a><br>\
-				<span class="help">'+wn._('Automatically extract Job Applicants from a mail box ')+'e.g. "jobs@example.com"</span></p>';
+			cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Jobs Email Settings">'+frappe._("Jobs Email Settings")+'</a><br>\
+				<span class="help">'+frappe._('Automatically extract Job Applicants from a mail box ')+'e.g. "jobs@example.com"</span></p>';
 		}
 	},
 	refresh: function(doc) {
 		cur_frm.cscript.make_listing(doc);
 	},
 	make_listing: function(doc) {
-		cur_frm.communication_view = new wn.views.CommunicationList({
-			list: wn.model.get("Communication", {"parent": doc.name, "parenttype": "Job Applicant"}),
+		cur_frm.communication_view = new frappe.views.CommunicationList({
+			list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Job Applicant"}),
 			parent: cur_frm.fields_dict['thread_html'].wrapper,
 			doc: doc,
 			recipients: doc.email_id
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.py b/erpnext/hr/doctype/job_applicant/job_applicant.py
index 0262568..f503240 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.py
@@ -4,16 +4,16 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.utilities.transaction_base import TransactionBase
-from webnotes.utils import extract_email_id
+from frappe.utils import extract_email_id
 
 class DocType(TransactionBase):
 	def __init__(self, d, dl):
 		self.doc, self.doclist = d, dl
 	
 	def get_sender(self, comm):
-		return webnotes.conn.get_value('Jobs Email Settings',None,'email_id')	
+		return frappe.conn.get_value('Jobs Email Settings',None,'email_id')	
 	
 	def validate(self):
 		self.set_status()	
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_opening/job_opening.py b/erpnext/hr/doctype/job_opening/job_opening.py
index e5468e5..968a25b 100644
--- a/erpnext/hr/doctype/job_opening/job_opening.py
+++ b/erpnext/hr/doctype/job_opening/job_opening.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
index dede0cf..ccea37b 100755
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, flt
-from webnotes import msgprint
+import frappe
+from frappe.utils import cint, flt
+from frappe import msgprint
 	
 class DocType:
 	def __init__(self, doc, doclist):
@@ -36,7 +36,7 @@
 		
 	def check_existing_leave_allocation(self):
 		"""check whether leave for same type is already allocated or not"""
-		leave_allocation = webnotes.conn.sql("""select name from `tabLeave Allocation`
+		leave_allocation = frappe.conn.sql("""select name from `tabLeave Allocation`
 			where employee=%s and leave_type=%s and fiscal_year=%s and docstatus=1""",
 			(self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
 		if leave_allocation:
@@ -63,14 +63,14 @@
 		return self.get_leaves_allocated(prev_fyear) - self.get_leaves_applied(prev_fyear)
 		
 	def get_leaves_applied(self, fiscal_year):
-		leaves_applied = webnotes.conn.sql("""select SUM(ifnull(total_leave_days, 0))
+		leaves_applied = frappe.conn.sql("""select SUM(ifnull(total_leave_days, 0))
 			from `tabLeave Application` where employee=%s and leave_type=%s
 			and fiscal_year=%s and docstatus=1""", 
 			(self.doc.employee, self.doc.leave_type, fiscal_year))
 		return leaves_applied and flt(leaves_applied[0][0]) or 0
 
 	def get_leaves_allocated(self, fiscal_year):
-		leaves_allocated = webnotes.conn.sql("""select SUM(ifnull(total_leaves_allocated, 0))
+		leaves_allocated = frappe.conn.sql("""select SUM(ifnull(total_leaves_allocated, 0))
 			from `tabLeave Allocation` where employee=%s and leave_type=%s
 			and fiscal_year=%s and docstatus=1 and name!=%s""",
 			(self.doc.employee, self.doc.leave_type, fiscal_year, self.doc.name))
@@ -78,18 +78,18 @@
 	
 	def allow_carry_forward(self):
 		"""check whether carry forward is allowed or not for this leave type"""
-		cf = webnotes.conn.sql("""select is_carry_forward from `tabLeave Type` where name = %s""",
+		cf = frappe.conn.sql("""select is_carry_forward from `tabLeave Type` where name = %s""",
 			self.doc.leave_type)
 		cf = cf and cint(cf[0][0]) or 0
 		if not cf:
-			webnotes.conn.set(self.doc,'carry_forward',0)
+			frappe.conn.set(self.doc,'carry_forward',0)
 			msgprint("Sorry! You cannot carry forward %s" % (self.doc.leave_type),
 				raise_exception=1)
 
 	def get_carry_forwarded_leaves(self):
 		if self.doc.carry_forward:
 			self.allow_carry_forward()
-		prev_fiscal_year = webnotes.conn.sql("""select name from `tabFiscal Year` 
+		prev_fiscal_year = frappe.conn.sql("""select name from `tabFiscal Year` 
 			where year_start_date = (select date_add(year_start_date, interval -1 year) 
 				from `tabFiscal Year` where name=%s) 
 			order by name desc limit 1""", self.doc.fiscal_year)
@@ -105,11 +105,11 @@
 
 	def get_total_allocated_leaves(self):
 		leave_det = self.get_carry_forwarded_leaves()
-		webnotes.conn.set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
-		webnotes.conn.set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
+		frappe.conn.set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves']))
+		frappe.conn.set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated']))
 
 	def check_for_leave_application(self):
-		exists = webnotes.conn.sql("""select name from `tabLeave Application`
+		exists = frappe.conn.sql("""select name from `tabLeave Application`
 			where employee=%s and leave_type=%s and fiscal_year=%s and docstatus=1""",
 			(self.doc.employee, self.doc.leave_type, self.doc.fiscal_year))
 		if exists:
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index cd04384..447f7ff 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -17,7 +17,7 @@
 		callback: function(r) {
 			cur_frm.set_df_property("leave_approver", "options", $.map(r.message, 
 				function(profile) { 
-					return {value: profile, label: wn.user_info(profile).fullname}; 
+					return {value: profile, label: frappe.user_info(profile).fullname}; 
 				}));
 			if(leave_approver) cur_frm.set_value("leave_approver", leave_approver);
 			cur_frm.cscript.get_leave_balance(cur_frm.doc);
@@ -31,14 +31,14 @@
 	}
 	cur_frm.set_intro("");
 	if(doc.__islocal && !in_list(user_roles, "HR User")) {
-		cur_frm.set_intro(wn._("Fill the form and save it"))
+		cur_frm.set_intro(frappe._("Fill the form and save it"))
 	} else {
 		if(doc.docstatus==0 && doc.status=="Open") {
 			if(user==doc.leave_approver) {
-				cur_frm.set_intro(wn._("You are the Leave Approver for this record. Please Update the 'Status' and Save"));
+				cur_frm.set_intro(frappe._("You are the Leave Approver for this record. Please Update the 'Status' and Save"));
 				cur_frm.toggle_enable("status", true);
 			} else {
-				cur_frm.set_intro(wn._("This Leave Application is pending approval. Only the Leave Apporver can update status."))
+				cur_frm.set_intro(frappe._("This Leave Application is pending approval. Only the Leave Apporver can update status."))
 				cur_frm.toggle_enable("status", false);
 				if(!doc.__islocal) {
 						cur_frm.frm_head.appframe.set_title_right("");
@@ -46,12 +46,12 @@
 			}
 		} else {
  			if(doc.status=="Approved") {
-				cur_frm.set_intro(wn._("Leave application has been approved."));
+				cur_frm.set_intro(frappe._("Leave application has been approved."));
 				if(cur_frm.doc.docstatus==0) {
-					cur_frm.set_intro(wn._("Please submit to update Leave Balance."));
+					cur_frm.set_intro(frappe._("Please submit to update Leave Balance."));
 				}
 			} else if(doc.status=="Rejected") {
-				cur_frm.set_intro(wn._("Leave application has been rejected."));
+				cur_frm.set_intro(frappe._("Leave application has been rejected."));
 			}
 		}
 	}	
@@ -85,7 +85,7 @@
 
 cur_frm.cscript.to_date = function(doc, dt, dn) {
 	if(cint(doc.half_day) == 1 && cstr(doc.from_date) && doc.from_date != doc.to_date){
-		msgprint(wn._("To Date should be same as From Date for Half Day leave"));
+		msgprint(frappe._("To Date should be same as From Date for Half Day leave"));
 		set_multiple(dt,dn,{to_date:doc.from_date});		
 	}
 	cur_frm.cscript.calculate_total_days(doc, dt, dn);
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 04b03a7..f04952d 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -2,23 +2,23 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
-from webnotes.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_url_to_form, \
+from frappe.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_url_to_form, \
 	comma_or, get_fullname
-from webnotes import msgprint
+from frappe import msgprint
 
-class LeaveDayBlockedError(webnotes.ValidationError): pass
-class OverlapError(webnotes.ValidationError): pass
-class InvalidLeaveApproverError(webnotes.ValidationError): pass
-class LeaveApproverIdentityError(webnotes.ValidationError): pass
+class LeaveDayBlockedError(frappe.ValidationError): pass
+class OverlapError(frappe.ValidationError): pass
+class InvalidLeaveApproverError(frappe.ValidationError): pass
+class LeaveApproverIdentityError(frappe.ValidationError): pass
 	
-from webnotes.model.controller import DocListController
+from frappe.model.controller import DocListController
 class DocType(DocListController):
 	def setup(self):
-		if webnotes.conn.exists(self.doc.doctype, self.doc.name):
-			self.previous_doc = webnotes.doc(self.doc.doctype, self.doc.name)
+		if frappe.conn.exists(self.doc.doctype, self.doc.name):
+			self.previous_doc = frappe.doc(self.doc.doctype, self.doc.name)
 		else:
 			self.previous_doc = None
 		
@@ -43,7 +43,7 @@
 	
 	def on_submit(self):
 		if self.doc.status != "Approved":
-			webnotes.msgprint("""Only Leave Applications with status 'Approved' can be Submitted.""",
+			frappe.msgprint("""Only Leave Applications with status 'Approved' can be Submitted.""",
 				raise_exception=True)
 
 		# notify leave applier about approval
@@ -60,9 +60,9 @@
 			self.doc.employee, self.doc.company, all_lists=True)
 			
 		if block_dates:
-			webnotes.msgprint(_("Warning: Leave application contains following block dates") + ":")
+			frappe.msgprint(_("Warning: Leave application contains following block dates") + ":")
 			for d in block_dates:
-				webnotes.msgprint(formatdate(d.block_date) + ": " + d.reason)
+				frappe.msgprint(formatdate(d.block_date) + ": " + d.reason)
 
 	def validate_block_days(self):
 		from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
@@ -72,15 +72,15 @@
 			
 		if block_dates:
 			if self.doc.status == "Approved":
-				webnotes.msgprint(_("Cannot approve leave as you are not authorized to approve leaves on Block Dates."))
+				frappe.msgprint(_("Cannot approve leave as you are not authorized to approve leaves on Block Dates."))
 				raise LeaveDayBlockedError
 			
 	def get_holidays(self):
-		tot_hol = webnotes.conn.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1 
+		tot_hol = frappe.conn.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2, `tabEmployee` e1 
 			where e1.name = %s and h1.parent = h2.name and e1.holiday_list = h2.name 
 			and h1.holiday_date between %s and %s""", (self.doc.employee, self.doc.from_date, self.doc.to_date))
 		if not tot_hol:
-			tot_hol = webnotes.conn.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2 
+			tot_hol = frappe.conn.sql("""select count(*) from `tabHoliday` h1, `tabHoliday List` h2 
 				where h1.parent = h2.name and h1.holiday_date between %s and %s
 				and ifnull(h2.is_default,0) = 1 and h2.fiscal_year = %s""",
 				(self.doc.from_date, self.doc.to_date, self.doc.fiscal_year))
@@ -120,13 +120,13 @@
 					#check if this leave type allow the remaining balance to be in negative. If yes then warn the user and continue to save else warn the user and don't save.
 					msgprint("There is not enough leave balance for Leave Type: %s" % \
 						(self.doc.leave_type,), 
-						raise_exception=not(webnotes.conn.get_value("Leave Type", self.doc.leave_type,"allow_negative") or None))
+						raise_exception=not(frappe.conn.get_value("Leave Type", self.doc.leave_type,"allow_negative") or None))
 					
 	def validate_leave_overlap(self):
 		if not self.doc.name:
 			self.doc.name = "New Leave Application"
 			
-		for d in webnotes.conn.sql("""select name, leave_type, posting_date, 
+		for d in frappe.conn.sql("""select name, leave_type, posting_date, 
 			from_date, to_date 
 			from `tabLeave Application` 
 			where 
@@ -141,14 +141,14 @@
 			msgprint("Employee : %s has already applied for %s between %s and %s on %s. Please refer Leave Application : <a href=\"#Form/Leave Application/%s\">%s</a>" % (self.doc.employee, cstr(d['leave_type']), formatdate(d['from_date']), formatdate(d['to_date']), formatdate(d['posting_date']), d['name'], d['name']), raise_exception = OverlapError)
 
 	def validate_max_days(self):
-		max_days = webnotes.conn.sql("select max_days_allowed from `tabLeave Type` where name = '%s'" %(self.doc.leave_type))
+		max_days = frappe.conn.sql("select max_days_allowed from `tabLeave Type` where name = '%s'" %(self.doc.leave_type))
 		max_days = max_days and flt(max_days[0][0]) or 0
 		if max_days and self.doc.total_leave_days > max_days:
 			msgprint("Sorry ! You cannot apply for %s for more than %s days" % (self.doc.leave_type, max_days))
 			raise Exception
 			
 	def validate_leave_approver(self):
-		employee = webnotes.bean("Employee", self.doc.employee)
+		employee = frappe.bean("Employee", self.doc.employee)
 		leave_approvers = [l.leave_approver for l in 
 			employee.doclist.get({"parentfield": "employee_leave_approvers"})]
 			
@@ -157,17 +157,17 @@
 				+ _("Leave Approver can be one of") + ": "
 				+ comma_or(leave_approvers)), raise_exception=InvalidLeaveApproverError)
 		
-		elif self.doc.leave_approver and not webnotes.conn.sql("""select name from `tabUserRole` 
+		elif self.doc.leave_approver and not frappe.conn.sql("""select name from `tabUserRole` 
 			where parent=%s and role='Leave Approver'""", self.doc.leave_approver):
 				msgprint(get_fullname(self.doc.leave_approver) + ": " \
 					+ _("does not have role 'Leave Approver'"), raise_exception=InvalidLeaveApproverError)
 					
-		elif self.doc.docstatus==1 and len(leave_approvers) and self.doc.leave_approver != webnotes.session.user:
+		elif self.doc.docstatus==1 and len(leave_approvers) and self.doc.leave_approver != frappe.session.user:
 			msgprint(_("Only the selected Leave Approver can submit this Leave Application"),
 				raise_exception=LeaveApproverIdentityError)
 			
 	def notify_employee(self, status):
-		employee = webnotes.doc("Employee", self.doc.employee)
+		employee = frappe.doc("Employee", self.doc.employee)
 		if not employee.user_id:
 			return
 			
@@ -187,7 +187,7 @@
 		})
 		
 	def notify_leave_approver(self):
-		employee = webnotes.doc("Employee", self.doc.employee)
+		employee = frappe.doc("Employee", self.doc.employee)
 		
 		def _get_message(url=False):
 			name = self.doc.name
@@ -208,21 +208,21 @@
 		})
 		
 	def notify(self, args):
-		args = webnotes._dict(args)
-		from webnotes.core.page.messages.messages import post
+		args = frappe._dict(args)
+		from frappe.core.page.messages.messages import post
 		post({"txt": args.message, "contact": args.message_to, "subject": args.subject,
 			"notify": cint(self.doc.follow_via_email)})
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_leave_balance(employee, leave_type, fiscal_year):	
-	leave_all = webnotes.conn.sql("""select total_leaves_allocated 
+	leave_all = frappe.conn.sql("""select total_leaves_allocated 
 		from `tabLeave Allocation` where employee = %s and leave_type = %s
 		and fiscal_year = %s and docstatus = 1""", (employee, 
 			leave_type, fiscal_year))
 	
 	leave_all = leave_all and flt(leave_all[0][0]) or 0
 	
-	leave_app = webnotes.conn.sql("""select SUM(total_leave_days) 
+	leave_app = frappe.conn.sql("""select SUM(total_leave_days) 
 		from `tabLeave Application` 
 		where employee = %s and leave_type = %s and fiscal_year = %s
 		and status="Approved" and docstatus = 1""", (employee, leave_type, fiscal_year))
@@ -232,20 +232,20 @@
 	return ret
 
 def is_lwp(leave_type):
-	lwp = webnotes.conn.sql("select is_lwp from `tabLeave Type` where name = %s", leave_type)
+	lwp = frappe.conn.sql("select is_lwp from `tabLeave Type` where name = %s", leave_type)
 	return lwp and cint(lwp[0][0]) or 0
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_events(start, end):
 	events = []
-	employee = webnotes.conn.get_default("employee", webnotes.session.user)
-	company = webnotes.conn.get_default("company", webnotes.session.user)
+	employee = frappe.conn.get_default("employee", frappe.session.user)
+	company = frappe.conn.get_default("company", frappe.session.user)
 	
-	from webnotes.widgets.reportview import build_match_conditions
+	from frappe.widgets.reportview import build_match_conditions
 	match_conditions = build_match_conditions("Leave Application")
 	
 	# show department leaves for employee
-	if "Employee" in webnotes.get_roles():
+	if "Employee" in frappe.get_roles():
 		add_department_leaves(events, start, end, employee, company)
 
 	add_leaves(events, start, end, employee, company, match_conditions)
@@ -256,13 +256,13 @@
 	return events
 	
 def add_department_leaves(events, start, end, employee, company):
-	department = webnotes.conn.get_value("Employee", employee, "department")
+	department = frappe.conn.get_value("Employee", employee, "department")
 	
 	if not department:
 		return
 	
 	# department leaves
-	department_employees = webnotes.conn.sql_list("""select name from tabEmployee where department=%s
+	department_employees = frappe.conn.sql_list("""select name from tabEmployee where department=%s
 		and company=%s""", (department, company))
 	
 	match_conditions = "employee in (\"%s\")" % '", "'.join(department_employees)
@@ -278,7 +278,7 @@
 	if match_conditions:
 		query += " and " + match_conditions
 	
-	for d in webnotes.conn.sql(query, (start, end, start, end), as_dict=True):
+	for d in frappe.conn.sql(query, (start, end, start, end), as_dict=True):
 		e = {
 			"name": d.name,
 			"doctype": "Leave Application",
@@ -309,11 +309,11 @@
 		cnt+=1
 
 def add_holidays(events, start, end, employee, company):
-	applicable_holiday_list = webnotes.conn.get_value("Employee", employee, "holiday_list")
+	applicable_holiday_list = frappe.conn.get_value("Employee", employee, "holiday_list")
 	if not applicable_holiday_list:
 		return
 	
-	for holiday in webnotes.conn.sql("""select name, holiday_date, description
+	for holiday in frappe.conn.sql("""select name, holiday_date, description
 		from `tabHoliday` where parent=%s and holiday_date between %s and %s""", 
 		(applicable_holiday_list, start, end), as_dict=True):
 			events.append({
@@ -323,22 +323,22 @@
 				"name": holiday.name
 			})
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def query_for_permitted_employees(doctype, txt, searchfield, start, page_len, filters):
 	txt = "%" + cstr(txt) + "%"
 	
-	if "Leave Approver" in webnotes.user.get_roles():
+	if "Leave Approver" in frappe.user.get_roles():
 		condition = """and (exists(select ela.name from `tabEmployee Leave Approver` ela
 				where ela.parent=`tabEmployee`.name and ela.leave_approver= "%s") or 
 			not exists(select ela.name from `tabEmployee Leave Approver` ela 
 				where ela.parent=`tabEmployee`.name)
-			or user_id = "%s")""" % (webnotes.session.user, webnotes.session.user)
+			or user_id = "%s")""" % (frappe.session.user, frappe.session.user)
 	else:
-		from webnotes.widgets.reportview import build_match_conditions
+		from frappe.widgets.reportview import build_match_conditions
 		condition = build_match_conditions("Employee")
 		condition = ("and " + condition) if condition else ""
 	
-	return webnotes.conn.sql("""select name, employee_name from `tabEmployee`
+	return frappe.conn.sql("""select name, employee_name from `tabEmployee`
 		where status = 'Active' and docstatus < 2 and
 		(`%s` like %s or employee_name like %s) %s
 		order by
diff --git a/erpnext/hr/doctype/leave_application/leave_application_calendar.js b/erpnext/hr/doctype/leave_application/leave_application_calendar.js
index ba09a39..9f0d187 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_calendar.js
+++ b/erpnext/hr/doctype/leave_application/leave_application_calendar.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.views.calendar["Leave Application"] = {
+frappe.views.calendar["Leave Application"] = {
 	field_map: {
 		"start": "from_date",
 		"end": "to_date",
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 9bb0134..30dc804 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -1,39 +1,39 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
+import frappe
 import unittest
 
 from erpnext.hr.doctype.leave_application.leave_application import LeaveDayBlockedError, OverlapError
 
 class TestLeaveApplication(unittest.TestCase):
 	def tearDown(self):
-		webnotes.set_user("Administrator")
+		frappe.set_user("Administrator")
 		
 		# so that this test doesn't affect other tests
-		webnotes.conn.sql("""delete from `tabEmployee Leave Approver`""")
+		frappe.conn.sql("""delete from `tabEmployee Leave Approver`""")
 		
 	def _clear_roles(self):
-		webnotes.conn.sql("""delete from `tabUserRole` where parent in 
+		frappe.conn.sql("""delete from `tabUserRole` where parent in 
 			("test@example.com", "test1@example.com", "test2@example.com")""")
 			
 	def _clear_applications(self):
-		webnotes.conn.sql("""delete from `tabLeave Application`""")
+		frappe.conn.sql("""delete from `tabLeave Application`""")
 		
 	def _add_employee_leave_approver(self, employee, leave_approver):
-		temp_session_user = webnotes.session.user
-		webnotes.set_user("Administrator")
-		employee = webnotes.bean("Employee", employee)
+		temp_session_user = frappe.session.user
+		frappe.set_user("Administrator")
+		employee = frappe.bean("Employee", employee)
 		employee.doclist.append({
 			"doctype": "Employee Leave Approver",
 			"parentfield": "employee_leave_approvers",
 			"leave_approver": leave_approver
 		})
 		employee.save()
-		webnotes.set_user(temp_session_user)
+		frappe.set_user(temp_session_user)
 	
 	def get_application(self, doclist):
-		application = webnotes.bean(copy=doclist)
+		application = frappe.bean(copy=doclist)
 		application.doc.from_date = "2013-01-01"
 		application.doc.to_date = "2013-01-05"
 		return application
@@ -41,10 +41,10 @@
 	def test_block_list(self):
 		self._clear_roles()
 		
-		from webnotes.profile import add_role
+		from frappe.profile import add_role
 		add_role("test1@example.com", "HR User")
 			
-		webnotes.conn.set_value("Department", "_Test Department", 
+		frappe.conn.set_value("Department", "_Test Department", 
 			"leave_block_list", "_Test Leave Block List")
 		
 		application = self.get_application(test_records[1])
@@ -52,10 +52,10 @@
 		application.doc.status = "Approved"
 		self.assertRaises(LeaveDayBlockedError, application.submit)
 		
-		webnotes.set_user("test1@example.com")
+		frappe.set_user("test1@example.com")
 
 		# clear other applications
-		webnotes.conn.sql("delete from `tabLeave Application`")
+		frappe.conn.sql("delete from `tabLeave Application`")
 		
 		application = self.get_application(test_records[1])
 		self.assertTrue(application.insert())
@@ -64,11 +64,11 @@
 		self._clear_roles()
 		self._clear_applications()
 		
-		from webnotes.profile import add_role
+		from frappe.profile import add_role
 		add_role("test@example.com", "Employee")
 		add_role("test2@example.com", "Leave Approver")
 		
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 		application = self.get_application(test_records[1])
 		application.doc.leave_approver = "test2@example.com"
 		application.insert()
@@ -80,32 +80,32 @@
 	def test_global_block_list(self):
 		self._clear_roles()
 
-		from webnotes.profile import add_role
+		from frappe.profile import add_role
 		add_role("test1@example.com", "Employee")
 		add_role("test@example.com", "Leave Approver")
 				
 		application = self.get_application(test_records[3])
 		application.doc.leave_approver = "test@example.com"
 		
-		webnotes.conn.set_value("Leave Block List", "_Test Leave Block List", 
+		frappe.conn.set_value("Leave Block List", "_Test Leave Block List", 
 			"applies_to_all_departments", 1)
-		webnotes.conn.set_value("Employee", "_T-Employee-0002", "department", 
+		frappe.conn.set_value("Employee", "_T-Employee-0002", "department", 
 			"_Test Department")
 		
-		webnotes.set_user("test1@example.com")
+		frappe.set_user("test1@example.com")
 		application.insert()
 		
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 		application.doc.status = "Approved"
 		self.assertRaises(LeaveDayBlockedError, application.submit)
 		
-		webnotes.conn.set_value("Leave Block List", "_Test Leave Block List", 
+		frappe.conn.set_value("Leave Block List", "_Test Leave Block List", 
 			"applies_to_all_departments", 0)
 		
 	def test_leave_approval(self):
 		self._clear_roles()
 		
-		from webnotes.profile import add_role
+		from frappe.profile import add_role
 		add_role("test@example.com", "Employee")
 		add_role("test1@example.com", "Leave Approver")
 		add_role("test2@example.com", "Leave Approver")
@@ -119,16 +119,16 @@
 		self._clear_applications()
 		
 		# create leave application as Employee
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 		application = self.get_application(test_records[1])
 		application.doc.leave_approver = "test1@example.com"
 		application.insert()
 		
 		# submit leave application by Leave Approver
-		webnotes.set_user("test1@example.com")
+		frappe.set_user("test1@example.com")
 		application.doc.status = "Approved"
 		application.submit()
-		self.assertEqual(webnotes.conn.get_value("Leave Application", application.doc.name,
+		self.assertEqual(frappe.conn.get_value("Leave Application", application.doc.name,
 			"docstatus"), 1)
 		
 	def _test_leave_approval_invalid_leave_approver_insert(self):
@@ -142,12 +142,12 @@
 		
 		# TODO - add test2@example.com leave approver in employee's leave approvers list
 		application = self.get_application(test_records[1])
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 		
 		application.doc.leave_approver = "test1@example.com"
 		self.assertRaises(InvalidLeaveApproverError, application.insert)
 		
-		webnotes.conn.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
+		frappe.conn.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
 			"_T-Employee-0001")
 		
 	def _test_leave_approval_invalid_leave_approver_submit(self):
@@ -156,42 +156,42 @@
 		
 		# create leave application as employee
 		# but submit as invalid leave approver - should raise exception
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 		application = self.get_application(test_records[1])
 		application.doc.leave_approver = "test2@example.com"
 		application.insert()
-		webnotes.set_user("test1@example.com")
+		frappe.set_user("test1@example.com")
 		application.doc.status = "Approved"
 		
 		from erpnext.hr.doctype.leave_application.leave_application import LeaveApproverIdentityError
 		self.assertRaises(LeaveApproverIdentityError, application.submit)
 
-		webnotes.conn.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
+		frappe.conn.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
 			"_T-Employee-0001")
 			
 	def _test_leave_approval_valid_leave_approver_insert(self):
 		self._clear_applications()
 		self._add_employee_leave_approver("_T-Employee-0001", "test2@example.com")
 		
-		original_department = webnotes.conn.get_value("Employee", "_T-Employee-0001", "department")
-		webnotes.conn.set_value("Employee", "_T-Employee-0001", "department", None)
+		original_department = frappe.conn.get_value("Employee", "_T-Employee-0001", "department")
+		frappe.conn.set_value("Employee", "_T-Employee-0001", "department", None)
 		
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 		application = self.get_application(test_records[1])
 		application.doc.leave_approver = "test2@example.com"
 		application.insert()
 
 		# change to valid leave approver and try to submit leave application
-		webnotes.set_user("test2@example.com")
+		frappe.set_user("test2@example.com")
 		application.doc.status = "Approved"
 		application.submit()
-		self.assertEqual(webnotes.conn.get_value("Leave Application", application.doc.name,
+		self.assertEqual(frappe.conn.get_value("Leave Application", application.doc.name,
 			"docstatus"), 1)
 			
-		webnotes.conn.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
+		frappe.conn.sql("""delete from `tabEmployee Leave Approver` where parent=%s""",
 			"_T-Employee-0001")
 		
-		webnotes.conn.set_value("Employee", "_T-Employee-0001", "department", original_department)
+		frappe.conn.set_value("Employee", "_T-Employee-0001", "department", original_department)
 		
 test_dependencies = ["Leave Block List"]		
 
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list.py b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
index 4585e90..ccc8478 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list.py
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
@@ -4,9 +4,9 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.accounts.utils import validate_fiscal_year
-from webnotes import _
+from frappe import _
 
 class DocType:
 	def __init__(self, d, dl):
@@ -20,15 +20,15 @@
 			
 			# date is not repeated
 			if d.block_date in dates:
-				webnotes.msgprint(_("Date is repeated") + ":" + d.block_date, raise_exception=1)
+				frappe.msgprint(_("Date is repeated") + ":" + d.block_date, raise_exception=1)
 			dates.append(d.block_date)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_applicable_block_dates(from_date, to_date, employee=None, 
 	company=None, all_lists=False):
 	block_dates = []
 	for block_list in get_applicable_block_lists(employee, company, all_lists):
-		block_dates.extend(webnotes.conn.sql("""select block_date, reason 
+		block_dates.extend(frappe.conn.sql("""select block_date, reason 
 			from `tabLeave Block List Date` where parent=%s 
 			and block_date between %s and %s""", (block_list, from_date, to_date), 
 			as_dict=1))
@@ -39,12 +39,12 @@
 	block_lists = []
 	
 	if not employee:
-		employee = webnotes.conn.get_value("Employee", {"user_id":webnotes.session.user})
+		employee = frappe.conn.get_value("Employee", {"user_id":frappe.session.user})
 		if not employee:
 			return []
 	
 	if not company:
-		company = webnotes.conn.get_value("Employee", employee, "company")
+		company = frappe.conn.get_value("Employee", employee, "company")
 		
 	def add_block_list(block_list):
 		if block_list:
@@ -52,18 +52,18 @@
 				block_lists.append(block_list)
 
 	# per department
-	department = webnotes.conn.get_value("Employee",employee, "department")
+	department = frappe.conn.get_value("Employee",employee, "department")
 	if department:
-		block_list = webnotes.conn.get_value("Department", department, "leave_block_list")
+		block_list = frappe.conn.get_value("Department", department, "leave_block_list")
 		add_block_list(block_list)
 
 	# global
-	for block_list in webnotes.conn.sql_list("""select name from `tabLeave Block List`
+	for block_list in frappe.conn.sql_list("""select name from `tabLeave Block List`
 		where ifnull(applies_to_all_departments,0)=1 and company=%s""", company):
 		add_block_list(block_list)
 		
 	return list(set(block_lists))
 	
 def is_user_in_allow_list(block_list):
-	return webnotes.session.user in webnotes.conn.sql_list("""select allow_user
+	return frappe.session.user in frappe.conn.sql_list("""select allow_user
 		from `tabLeave Block List Allow` where parent=%s""", block_list)
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py
index d386704..578658e 100644
--- a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py
+++ b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py
@@ -1,31 +1,31 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
+import frappe
 import unittest
 
 from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
 
 class TestLeaveBlockList(unittest.TestCase):
 	def tearDown(self):
-		 webnotes.set_user("Administrator")
+		 frappe.set_user("Administrator")
 		
 	def test_get_applicable_block_dates(self):
-		webnotes.set_user("test@example.com")
-		webnotes.conn.set_value("Department", "_Test Department", "leave_block_list", 
+		frappe.set_user("test@example.com")
+		frappe.conn.set_value("Department", "_Test Department", "leave_block_list", 
 			"_Test Leave Block List")
 		self.assertTrue("2013-01-02" in 
 			[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
 			
 	def test_get_applicable_block_dates_for_allowed_user(self):
-		webnotes.set_user("test1@example.com")
-		webnotes.conn.set_value("Department", "_Test Department 1", "leave_block_list", 
+		frappe.set_user("test1@example.com")
+		frappe.conn.set_value("Department", "_Test Department 1", "leave_block_list", 
 			"_Test Leave Block List")
 		self.assertEquals([], [d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03")])
 	
 	def test_get_applicable_block_dates_all_lists(self):
-		webnotes.set_user("test1@example.com")
-		webnotes.conn.set_value("Department", "_Test Department 1", "leave_block_list", 
+		frappe.set_user("test1@example.com")
+		frappe.conn.set_value("Department", "_Test Department 1", "leave_block_list", 
 			"_Test Leave Block List")
 		self.assertTrue("2013-01-02" in 
 			[d.block_date for d in get_applicable_block_dates("2013-01-01", "2013-01-03", all_lists=True)])
diff --git a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
index e5468e5..968a25b 100644
--- a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
+++ b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
index e5468e5..968a25b 100644
--- a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
+++ b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
index 59bf829..be9096c 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js
@@ -9,11 +9,11 @@
 }
 
 cur_frm.cscript.to_date = function(doc, cdt, cdn) {
-	return $c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
+	return $c('runserverobj', args={'method':'to_date_validation','docs':frappe.model.compress(make_doclist(doc.doctype, doc.name))},
 		function(r, rt) {
 			var doc = locals[cdt][cdn];
 			if (r.message) {
-				msgprint(wn._("To date cannot be before from date"));
+				msgprint(frappe._("To date cannot be before from date"));
 				doc.to_date = '';
 				refresh_field('to_date');
 			}
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py
index e3a0ebe..4845a69 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cint, cstr, flt, nowdate
-from webnotes.model.doc import Document
-from webnotes.model.code import get_obj
-from webnotes import msgprint
+from frappe.utils import cint, cstr, flt, nowdate
+from frappe.model.doc import Document
+from frappe.model.code import get_obj
+from frappe import msgprint
 
 	
 
@@ -33,7 +33,7 @@
     emp_query = "select name from `tabEmployee` "
     if flag == 1:
       emp_query += condition 
-    e = webnotes.conn.sql(emp_query)
+    e = frappe.conn.sql(emp_query)
     return e
 
   # ----------------
@@ -54,7 +54,7 @@
     for d in self.get_employees():
       la = Document('Leave Allocation')
       la.employee = cstr(d[0])
-      la.employee_name = webnotes.conn.get_value('Employee',cstr(d[0]),'employee_name')
+      la.employee_name = frappe.conn.get_value('Employee',cstr(d[0]),'employee_name')
       la.leave_type = self.doc.leave_type
       la.fiscal_year = self.doc.fiscal_year
       la.posting_date = nowdate()
diff --git a/erpnext/hr/doctype/leave_type/leave_type.py b/erpnext/hr/doctype/leave_type/leave_type.py
index b0215d5..5015bed 100644
--- a/erpnext/hr/doctype/leave_type/leave_type.py
+++ b/erpnext/hr/doctype/leave_type/leave_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/salary_manager/__init__.py b/erpnext/hr/doctype/salary_manager/__init__.py
index 3405b48..b699b37 100644
--- a/erpnext/hr/doctype/salary_manager/__init__.py
+++ b/erpnext/hr/doctype/salary_manager/__init__.py
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import unicode_literals
-from webnotes import ValidationError
+from frappe import ValidationError
 
 class SalarySlipExistsError(ValidationError): pass
 
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.js b/erpnext/hr/doctype/salary_manager/salary_manager.js
index ec485ca..312a06d 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.js
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.js
@@ -5,7 +5,7 @@
 	if(!pscript.ss_html)
 		pscript.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
 	pscript.ss_html.innerHTML = 
-		'<div class="panel"><div class="panel-heading">'+wn._("Activity Log:")+'</div>'+msg+'</div>';
+		'<div class="panel"><div class="panel-heading">'+frappe._("Activity Log:")+'</div>'+msg+'</div>';
 }
 
 //Create salary slip
@@ -15,17 +15,17 @@
 		if (r.message)
 			display_activity_log(r.message);
 	}
-	return $c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
+	return $c('runserverobj', args={'method':'create_sal_slip','docs':frappe.model.compress(make_doclist (cdt, cdn))},callback);
 }
 
 cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
-	var check = confirm(wn._("Do you really want to Submit all Salary Slip for month : ") + doc.month+ wn._(" and fiscal year : ")+doc.fiscal_year);
+	var check = confirm(frappe._("Do you really want to Submit all Salary Slip for month : ") + doc.month+ frappe._(" and fiscal year : ")+doc.fiscal_year);
 	if(check){
 		var callback = function(r, rt){
 			if (r.message)
 				display_activity_log(r.message);
 		}
-		return $c('runserverobj', args={'method':'submit_salary_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
+		return $c('runserverobj', args={'method':'submit_salary_slip','docs':frappe.model.compress(make_doclist (cdt, cdn))},callback);
 	}
 }
 
@@ -33,28 +33,28 @@
     if(doc.company && doc.month && doc.fiscal_year){
     	cur_frm.cscript.make_jv(doc, cdt, cdn);
     } else {
-  	  msgprint(wn._("Company, Month and Fiscal Year is mandatory"));
+  	  msgprint(frappe._("Company, Month and Fiscal Year is mandatory"));
     }
 }
 
 cur_frm.cscript.make_jv = function(doc, dt, dn) {
 	var call_back = function(r, rt){
-		var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
+		var jv = frappe.model.make_new_doc_and_get_name('Journal Voucher');
 		jv = locals['Journal Voucher'][jv];
 		jv.voucher_type = 'Bank Voucher';
-		jv.user_remark = wn._('Payment of salary for the month: ') + doc.month + 
-			wn._(' and fiscal year: ') + doc.fiscal_year;
+		jv.user_remark = frappe._('Payment of salary for the month: ') + doc.month + 
+			frappe._(' and fiscal year: ') + doc.fiscal_year;
 		jv.fiscal_year = doc.fiscal_year;
 		jv.company = doc.company;
 		jv.posting_date = dateutil.obj_to_str(new Date());
 
 		// credit to bank
-		var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
+		var d1 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
 		d1.account = r.message['default_bank_account'];
 		d1.credit = r.message['amount']
 
 		// debit to salary account
-		var d2 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
+		var d2 = frappe.model.add_child(jv, 'Journal Voucher Detail', 'entries');
 		d2.debit = r.message['amount']
 
 		loaddoc('Journal Voucher', jv.name);
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.py b/erpnext/hr/doctype/salary_manager/salary_manager.py
index 37a8c5d..0b037bc 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.py
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, flt
-from webnotes.model.code import get_obj
-from webnotes import msgprint
+import frappe
+from frappe.utils import cint, flt
+from frappe.model.code import get_obj
+from frappe import msgprint
 
 class DocType:
 	def __init__(self, doc, doclist):
@@ -21,7 +21,7 @@
 		cond = self.get_filter_condition()
 		cond += self.get_joining_releiving_condition()
 		
-		emp_list = webnotes.conn.sql("""
+		emp_list = frappe.conn.sql("""
 			select t1.name
 			from `tabEmployee` t1, `tabSalary Structure` t2 
 			where t1.docstatus!=2 and t2.docstatus != 2 
@@ -58,7 +58,7 @@
 		
 	
 	def get_month_details(self, year, month):
-		ysd = webnotes.conn.sql("select year_start_date from `tabFiscal Year` where name ='%s'"%year)[0][0]
+		ysd = frappe.conn.sql("select year_start_date from `tabFiscal Year` where name ='%s'"%year)[0][0]
 		if ysd:
 			from dateutil.relativedelta import relativedelta
 			import calendar, datetime
@@ -84,10 +84,10 @@
 		emp_list = self.get_emp_list()
 		ss_list = []
 		for emp in emp_list:
-			if not webnotes.conn.sql("""select name from `tabSalary Slip` 
+			if not frappe.conn.sql("""select name from `tabSalary Slip` 
 					where docstatus!= 2 and employee = %s and month = %s and fiscal_year = %s and company = %s
 					""", (emp[0], self.doc.month, self.doc.fiscal_year, self.doc.company)):
-				ss = webnotes.bean({
+				ss = frappe.bean({
 					"doctype": "Salary Slip",
 					"fiscal_year": self.doc.fiscal_year,
 					"employee": emp[0],
@@ -115,7 +115,7 @@
 			which are not submitted
 		"""
 		cond = self.get_filter_condition()
-		ss_list = webnotes.conn.sql("""
+		ss_list = frappe.conn.sql("""
 			select t1.name from `tabSalary Slip` t1 
 			where t1.docstatus = 0 and month = '%s' and fiscal_year = '%s' %s
 		""" % (self.doc.month, self.doc.fiscal_year, cond))
@@ -131,11 +131,11 @@
 		for ss in ss_list:
 			ss_obj = get_obj("Salary Slip",ss[0],with_children=1)
 			try:
-				webnotes.conn.set(ss_obj.doc, 'email_check', cint(self.doc.send_mail))
+				frappe.conn.set(ss_obj.doc, 'email_check', cint(self.doc.send_mail))
 				if cint(self.doc.send_email) == 1:
 					ss_obj.send_mail_funct()
 					
-				webnotes.conn.set(ss_obj.doc, 'docstatus', 1)
+				frappe.conn.set(ss_obj.doc, 'docstatus', 1)
 			except Exception,e:
 				not_submitted_ss.append(ss[0])
 				msgprint(e)
@@ -177,7 +177,7 @@
 			Get total salary amount from submitted salary slip based on selected criteria
 		"""
 		cond = self.get_filter_condition()
-		tot = webnotes.conn.sql("""
+		tot = frappe.conn.sql("""
 			select sum(rounded_total) from `tabSalary Slip` t1 
 			where t1.docstatus = 1 and month = '%s' and fiscal_year = '%s' %s
 		""" % (self.doc.month, self.doc.fiscal_year, cond))
@@ -190,7 +190,7 @@
 			get default bank account,default salary acount from company
 		"""
 		amt = self.get_total_salary()
-		default_bank_account = webnotes.conn.get_value("Company", self.doc.company, 
+		default_bank_account = frappe.conn.get_value("Company", self.doc.company, 
 			"default_bank_account")
 		if not default_bank_account:
 			msgprint("You can set Default Bank Account in Company master.")
diff --git a/erpnext/hr/doctype/salary_manager/test_salary_manager.py b/erpnext/hr/doctype/salary_manager/test_salary_manager.py
index 2800d53..7a4c6d1 100644
--- a/erpnext/hr/doctype/salary_manager/test_salary_manager.py
+++ b/erpnext/hr/doctype/salary_manager/test_salary_manager.py
@@ -3,32 +3,32 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
 test_records = []
 
-# from webnotes.model.doc import Document
-# from webnotes.model.code import get_obj
-# webnotes.conn.sql = webnotes.conn.sql
+# from frappe.model.doc import Document
+# from frappe.model.code import get_obj
+# frappe.conn.sql = frappe.conn.sql
 # 
 # class TestSalaryManager(unittest.TestCase):
 # 	def setUp(self):
-# 		webnotes.conn.begin()
+# 		frappe.conn.begin()
 # 		for rec in [des1, dep1, branch1, grade1, comp1, emp1, emp2]:
 # 			rec.save(1)
 # 					
 # 		ss1[0].employee = emp1.name
 # 		for s in ss1: s.save(1)
 # 		for s in ss1[1:]:
-# 			webnotes.conn.sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
-# 			webnotes.conn.sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
+# 			frappe.conn.sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
+# 			frappe.conn.sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss1[0].name, s.name))
 # 			
 # 		
 # 		ss2[0].employee = emp2.name
 # 		for s in ss2: s.save(1)		
 # 		for s in ss2[1:]:
-# 			webnotes.conn.sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
-# 			webnotes.conn.sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
+# 			frappe.conn.sql("update `tabSalary Structure Earning` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
+# 			frappe.conn.sql("update `tabSalary Structure Deduction` set parent = '%s' where name = '%s'" % (ss2[0].name, s.name))
 # 			
 # 		sman.save()
 # 		self.sm = get_obj('Salary Manager')	
@@ -36,7 +36,7 @@
 # 		self.sm.create_sal_slip()
 # 		
 # 	def test_creation(self):
-# 		ssid = webnotes.conn.sql("""
+# 		ssid = frappe.conn.sql("""
 # 			select name, department 
 # 			from `tabSalary Slip` 
 # 			where month = '08' and fiscal_year='2011-2012'""")
@@ -46,7 +46,7 @@
 # 		
 # 		
 # 	def test_lwp_calc(self):
-# 		ss = webnotes.conn.sql("""
+# 		ss = frappe.conn.sql("""
 # 			select payment_days
 # 			from `tabSalary Slip` 
 # 			where month = '08' and fiscal_year='2011-2012' and employee = '%s'
@@ -55,7 +55,7 @@
 # 		self.assertTrue(ss[0][0]==27)
 # 		
 # 	def test_net_pay(self):
-# 		ss = webnotes.conn.sql("""
+# 		ss = frappe.conn.sql("""
 # 			select rounded_total 
 # 			from `tabSalary Slip` 
 # 			where month = '08'
@@ -64,7 +64,7 @@
 # 
 # 	def test_submit(self):
 # 		self.sm.submit_salary_slip()
-# 		ss = webnotes.conn.sql("""
+# 		ss = frappe.conn.sql("""
 # 			select docstatus 
 # 			from `tabSalary Slip` 
 # 			where month = '08'
@@ -72,7 +72,7 @@
 # 		self.assertTrue(ss[0][0]==1)
 # 		
 # 	def tearDown(self):
-# 		webnotes.conn.rollback()
+# 		frappe.conn.rollback()
 # 		
 # #--------------------------------------------
 # # test data
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index f799592..76e6800 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import add_days, cint, cstr, flt, getdate, nowdate, _round
-from webnotes.model.doc import make_autoname
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import add_days, cint, cstr, flt, getdate, nowdate, _round
+from frappe.model.doc import make_autoname
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 from erpnext.setup.utils import get_company_currency
 
 	
@@ -30,7 +30,7 @@
 				self.pull_sal_struct(struct)
 
 	def check_sal_struct(self):
-		struct = webnotes.conn.sql("""select name from `tabSalary Structure` 
+		struct = frappe.conn.sql("""select name from `tabSalary Structure` 
 			where employee=%s and is_active = 'Yes'""", self.doc.employee)
 		if not struct:
 			msgprint("Please create Salary Structure for employee '%s'" % self.doc.employee)
@@ -42,7 +42,7 @@
 		self.doclist = get_mapped_doclist(struct, self.doclist)
 		
 	def pull_emp_details(self):
-		emp = webnotes.conn.get_value("Employee", self.doc.employee, 
+		emp = frappe.conn.get_value("Employee", self.doc.employee, 
 			["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1)
 		if emp:
 			self.doc.bank_name = emp.bank_name
@@ -52,14 +52,14 @@
 
 	def get_leave_details(self, lwp=None):
 		if not self.doc.fiscal_year:
-			self.doc.fiscal_year = webnotes.get_default("fiscal_year")
+			self.doc.fiscal_year = frappe.get_default("fiscal_year")
 		if not self.doc.month:
 			self.doc.month = "%02d" % getdate(nowdate()).month
 			
 		m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)
 		holidays = self.get_holidays_for_employee(m)
 		
-		if not cint(webnotes.conn.get_value("HR Settings", "HR Settings",
+		if not cint(frappe.conn.get_value("HR Settings", "HR Settings",
 			"include_holidays_in_total_working_days")):
 				m["month_days"] -= len(holidays)
 				if m["month_days"] < 0:
@@ -76,7 +76,7 @@
 
 	def get_payment_days(self, m):
 		payment_days = m['month_days']
-		emp = webnotes.conn.sql("select date_of_joining, relieving_date from `tabEmployee` \
+		emp = frappe.conn.sql("select date_of_joining, relieving_date from `tabEmployee` \
 			where name = %s", self.doc.employee, as_dict=1)[0]
 			
 		if emp['relieving_date']:
@@ -84,7 +84,7 @@
 				getdate(emp['relieving_date']) < m['month_end_date']:
 					payment_days = getdate(emp['relieving_date']).day
 			elif getdate(emp['relieving_date']) < m['month_start_date']:
-				webnotes.msgprint(_("Relieving Date of employee is ") + cstr(emp['relieving_date']
+				frappe.msgprint(_("Relieving Date of employee is ") + cstr(emp['relieving_date']
 					+ _(". Please set status of the employee as 'Left'")), raise_exception=1)
 				
 			
@@ -98,13 +98,13 @@
 		return payment_days
 		
 	def get_holidays_for_employee(self, m):
-		holidays = webnotes.conn.sql("""select t1.holiday_date 
+		holidays = frappe.conn.sql("""select t1.holiday_date 
 			from `tabHoliday` t1, tabEmployee t2 
 			where t1.parent = t2.holiday_list and t2.name = %s 
 			and t1.holiday_date between %s and %s""", 
 			(self.doc.employee, m['month_start_date'], m['month_end_date']))
 		if not holidays:
-			holidays = webnotes.conn.sql("""select t1.holiday_date 
+			holidays = frappe.conn.sql("""select t1.holiday_date 
 				from `tabHoliday` t1, `tabHoliday List` t2 
 				where t1.parent = t2.name and ifnull(t2.is_default, 0) = 1 
 				and t2.fiscal_year = %s
@@ -118,7 +118,7 @@
 		for d in range(m['month_days']):
 			dt = add_days(cstr(m['month_start_date']), d)
 			if dt not in holidays:
-				leave = webnotes.conn.sql("""
+				leave = frappe.conn.sql("""
 					select t1.name, t1.half_day
 					from `tabLeave Application` t1, `tabLeave Type` t2 
 					where t2.name = t1.leave_type 
@@ -132,7 +132,7 @@
 		return lwp
 
 	def check_existing(self):
-		ret_exist = webnotes.conn.sql("""select name from `tabSalary Slip` 
+		ret_exist = frappe.conn.sql("""select name from `tabSalary Slip` 
 			where month = %s and fiscal_year = %s and docstatus != 2 
 			and employee = %s and name != %s""", 
 			(self.doc.month, self.doc.fiscal_year, self.doc.employee, self.doc.name))
@@ -143,7 +143,7 @@
 
 
 	def validate(self):
-		from webnotes.utils import money_in_words
+		from frappe.utils import money_in_words
 		self.check_existing()
 		
 		if not (len(self.doclist.get({"parentfield": "earning_details"})) or 
@@ -195,13 +195,13 @@
 			
 
 	def send_mail_funct(self):	 
-		from webnotes.utils.email_lib import sendmail
-		receiver = webnotes.conn.get_value("Employee", self.doc.employee, "company_email")
+		from frappe.utils.email_lib import sendmail
+		receiver = frappe.conn.get_value("Employee", self.doc.employee, "company_email")
 		if receiver:
 			subj = 'Salary Slip - ' + cstr(self.doc.month) +'/'+cstr(self.doc.fiscal_year)
-			earn_ret=webnotes.conn.sql("""select e_type, e_modified_amount from `tabSalary Slip Earning` 
+			earn_ret=frappe.conn.sql("""select e_type, e_modified_amount from `tabSalary Slip Earning` 
 				where parent = %s""", self.doc.name)
-			ded_ret=webnotes.conn.sql("""select d_type, d_modified_amount from `tabSalary Slip Deduction` 
+			ded_ret=frappe.conn.sql("""select d_type, d_modified_amount from `tabSalary Slip Deduction` 
 				where parent = %s""", self.doc.name)
 		 
 			earn_table = ''
@@ -229,7 +229,7 @@
 							% (cstr(d[0]), cstr(d[1]))
 				ded_table += '</table>'
 			
-			letter_head = webnotes.conn.get_value("Letter Head", {"is_default": 1, "disabled": 0}, 
+			letter_head = frappe.conn.get_value("Letter Head", {"is_default": 1, "disabled": 0}, 
 				"content")
 			
 			msg = '''<div> %s <br>
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 372a858..a4728cd 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -1,25 +1,25 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
+import frappe
 import unittest
 
 class TestSalarySlip(unittest.TestCase):
 	def setUp(self):
-		webnotes.conn.sql("""delete from `tabLeave Application`""")
-		webnotes.conn.sql("""delete from `tabSalary Slip`""")
+		frappe.conn.sql("""delete from `tabLeave Application`""")
+		frappe.conn.sql("""delete from `tabSalary Slip`""")
 		from erpnext.hr.doctype.leave_application.test_leave_application import test_records as leave_applications
-		la = webnotes.bean(copy=leave_applications[4])
+		la = frappe.bean(copy=leave_applications[4])
 		la.insert()
 		la.doc.status = "Approved"
 		la.submit()
 		
 	def tearDown(self):
-		webnotes.conn.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 0)
+		frappe.conn.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 0)
 		
 	def test_salary_slip_with_holidays_included(self):
-		webnotes.conn.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 1)
-		ss = webnotes.bean(copy=test_records[0])
+		frappe.conn.set_value("HR Settings", "HR Settings", "include_holidays_in_total_working_days", 1)
+		ss = frappe.bean(copy=test_records[0])
 		ss.insert()
 		self.assertEquals(ss.doc.total_days_in_month, 31)
 		self.assertEquals(ss.doc.payment_days, 30)
@@ -31,7 +31,7 @@
 		self.assertEquals(ss.doc.net_pay, 14867.74)
 		
 	def test_salary_slip_with_holidays_excluded(self):
-		ss = webnotes.bean(copy=test_records[0])
+		ss = frappe.bean(copy=test_records[0])
 		ss.insert()
 		self.assertEquals(ss.doc.total_days_in_month, 30)
 		self.assertEquals(ss.doc.payment_days, 29)
diff --git a/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.py b/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.py
+++ b/erpnext/hr/doctype/salary_slip_deduction/salary_slip_deduction.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.py b/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.py
+++ b/erpnext/hr/doctype/salary_slip_earning/salary_slip_earning.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.js b/erpnext/hr/doctype/salary_structure/salary_structure.js
index 24da8a0..3b90ee6 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.js
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.js
@@ -12,14 +12,14 @@
 
 cur_frm.cscript.refresh = function(doc, dt, dn){
   if((!doc.__islocal) && (doc.is_active == 'Yes')){
-    cur_frm.add_custom_button(wn._('Make Salary Slip'), cur_frm.cscript['Make Salary Slip']);  
+    cur_frm.add_custom_button(frappe._('Make Salary Slip'), cur_frm.cscript['Make Salary Slip']);  
   }
 
   cur_frm.toggle_enable('employee', doc.__islocal);
 }
 
 cur_frm.cscript['Make Salary Slip'] = function() {
-	wn.model.open_mapped_doc({
+	frappe.model.open_mapped_doc({
 		method: "erpnext.hr.doctype.salary_structure.salary_structure.make_salary_slip",
 		source_name: cur_frm.doc.name
 	});
diff --git a/erpnext/hr/doctype/salary_structure/salary_structure.py b/erpnext/hr/doctype/salary_structure/salary_structure.py
index 67771e6..6b080fb 100644
--- a/erpnext/hr/doctype/salary_structure/salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/salary_structure.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt
-from webnotes.model.doc import addchild, make_autoname
-from webnotes import msgprint, _
+from frappe.utils import cstr, flt
+from frappe.model.doc import addchild, make_autoname
+from frappe import msgprint, _
 
 
 class DocType:
@@ -19,7 +19,7 @@
 
 	def get_employee_details(self):
 		ret = {}
-		det = webnotes.conn.sql("""select employee_name, branch, designation, department, grade 
+		det = frappe.conn.sql("""select employee_name, branch, designation, department, grade 
 			from `tabEmployee` where name = %s""", self.doc.employee)
 		if det:
 			ret = {
@@ -33,7 +33,7 @@
 		return ret
 
 	def get_ss_values(self,employee):
-		basic_info = webnotes.conn.sql("""select bank_name, bank_ac_no, esic_card_no, pf_number 
+		basic_info = frappe.conn.sql("""select bank_name, bank_ac_no, esic_card_no, pf_number 
 			from `tabEmployee` where name =%s""", employee)
 		ret = {'bank_name': basic_info and basic_info[0][0] or '',
 			'bank_ac_no': basic_info and basic_info[0][1] or '',
@@ -42,7 +42,7 @@
 		return ret
 
 	def make_table(self, doct_name, tab_fname, tab_name):
-		list1 = webnotes.conn.sql("select name from `tab%s` where docstatus != 2" % doct_name)
+		list1 = frappe.conn.sql("select name from `tab%s` where docstatus != 2" % doct_name)
 		for li in list1:
 			child = addchild(self.doc, tab_fname, tab_name, self.doclist)
 			if(tab_fname == 'earning_details'):
@@ -57,7 +57,7 @@
 		self.make_table('Deduction Type','deduction_details', 'Salary Structure Deduction')
 
 	def check_existing(self):
-		ret = webnotes.conn.sql("""select name from `tabSalary Structure` where is_active = 'Yes' 
+		ret = frappe.conn.sql("""select name from `tabSalary Structure` where is_active = 'Yes' 
 			and employee = %s and name!=%s""", (self.doc.employee,self.doc.name))
 		if ret and self.doc.is_active=='Yes':
 			msgprint(_("""Another Salary Structure '%s' is active for employee '%s'. Please make its status 'Inactive' to proceed.""") % 
@@ -71,15 +71,15 @@
 		self.check_existing()
 		self.validate_amount()
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_salary_slip(source_name, target_doclist=None):
 	return [d.fields for d in get_mapped_doclist(source_name, target_doclist)]
 	
 def get_mapped_doclist(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def postprocess(source, target):
-		sal_slip = webnotes.bean(target)
+		sal_slip = frappe.bean(target)
 		sal_slip.run_method("pull_emp_details")
 		sal_slip.run_method("get_leave_details")
 		sal_slip.run_method("calculate_net_pay")
diff --git a/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.py b/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.py
+++ b/erpnext/hr/doctype/salary_structure_deduction/salary_structure_deduction.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.py b/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.py
index cb6190f..26c87f1 100644
--- a/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.py
+++ b/erpnext/hr/doctype/salary_structure_earning/salary_structure_earning.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.js b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
index ee58945..404ba52 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.js
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.js
@@ -2,10 +2,10 @@
 // License: GNU General Public License v3. See license.txt
 
 
-wn.require("assets/erpnext/js/utils.js");
-wn.provide("erpnext.hr");
+frappe.require("assets/erpnext/js/utils.js");
+frappe.provide("erpnext.hr");
 
-erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
+erpnext.hr.AttendanceControlPanel = frappe.ui.form.Controller.extend({
 	onload: function() {
 		this.frm.set_value("att_fr_date", get_today());
 		this.frm.set_value("att_to_date", get_today());
@@ -17,10 +17,10 @@
 	
 	get_template:function() {
 		if(!this.frm.doc.att_fr_date || !this.frm.doc.att_to_date) {
-			msgprint(wn._("Attendance From Date and Attendance To Date is mandatory"));
+			msgprint(frappe._("Attendance From Date and Attendance To Date is mandatory"));
 			return;
 		}
-		window.location.href = repl(wn.request.url + 
+		window.location.href = repl(frappe.request.url + 
 			'?cmd=%(cmd)s&from_date=%(from_date)s&to_date=%(to_date)s', {
 				cmd: "erpnext.hr.doctype.upload_attendance.upload_attendance.get_template",
 				from_date: this.frm.doc.att_fr_date,
@@ -33,7 +33,7 @@
 		var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
 		
 		// upload
-		wn.upload.make({
+		frappe.upload.make({
 			parent: $wrapper,
 			args: {
 				method: 'erpnext.hr.doctype.upload_attendance.upload_attendance.upload'
@@ -56,10 +56,10 @@
 						return v;
 					});
 
-					r.messages = ["<h4 style='color:red'>"+wn._("Import Failed!")+"</h4>"]
+					r.messages = ["<h4 style='color:red'>"+frappe._("Import Failed!")+"</h4>"]
 						.concat(r.messages)
 				} else {
-					r.messages = ["<h4 style='color:green'>"+wn._("Import Successful!")+"</h4>"].
+					r.messages = ["<h4 style='color:green'>"+frappe._("Import Successful!")+"</h4>"].
 						concat(r.message.messages)
 				}
 				
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index 53b88f7..4ac0f14 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -4,26 +4,26 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, add_days, date_diff
-from webnotes import msgprint, _
-from webnotes.utils.datautils import UnicodeWriter
+import frappe
+from frappe.utils import cstr, add_days, date_diff
+from frappe import msgprint, _
+from frappe.utils.datautils import UnicodeWriter
 
 # doclist = None
-doclist = webnotes.local('uploadattendance_doclist')
+doclist = frappe.local('uploadattendance_doclist')
 
 class DocType():
 	def __init__(self, doc, doclist=[]):
 		self.doc = doc
 		self.doclist = doclist
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_template():
-	if not webnotes.has_permission("Attendance", "create"):
-		raise webnotes.PermissionError
+	if not frappe.has_permission("Attendance", "create"):
+		raise frappe.PermissionError
 	
-	args = webnotes.local.form_dict
-	webnotes.local.uploadattendance_doclist = webnotes.model.doctype.get("Attendance")
+	args = frappe.local.form_dict
+	frappe.local.uploadattendance_doclist = frappe.model.doctype.get("Attendance")
 
 	w = UnicodeWriter()
 	w = add_header(w)
@@ -31,9 +31,9 @@
 	w = add_data(w, args)
 
 	# write out response as a type csv
-	webnotes.response['result'] = cstr(w.getvalue())
-	webnotes.response['type'] = 'csv'
-	webnotes.response['doctype'] = "Attendance"
+	frappe.response['result'] = cstr(w.getvalue())
+	frappe.response['type'] = 'csv'
+	frappe.response['doctype'] = "Attendance"
 	
 def getdocfield(fieldname):
 	"""get docfield from doclist of doctype"""
@@ -79,12 +79,12 @@
 	return dates
 	
 def get_active_employees():
-	employees = webnotes.conn.sql("""select name, employee_name, company 
+	employees = frappe.conn.sql("""select name, employee_name, company 
 		from tabEmployee where docstatus < 2 and status = 'Active'""", as_dict=1)
 	return employees
 	
 def get_existing_attendance_records(args):
-	attendance = webnotes.conn.sql("""select name, att_date, employee, status, naming_series 
+	attendance = frappe.conn.sql("""select name, att_date, employee, status, naming_series 
 		from `tabAttendance` where att_date between %s and %s and docstatus < 2""", 
 		(args["from_date"], args["to_date"]), as_dict=1)
 		
@@ -102,13 +102,13 @@
 	return series[0]
 
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def upload():
-	if not webnotes.has_permission("Attendance", "create"):
-		raise webnotes.PermissionError
+	if not frappe.has_permission("Attendance", "create"):
+		raise frappe.PermissionError
 	
-	from webnotes.utils.datautils import read_csv_content_from_uploaded_file
-	from webnotes.modules import scrub
+	from frappe.utils.datautils import read_csv_content_from_uploaded_file
+	from frappe.modules import scrub
 	
 	rows = read_csv_content_from_uploaded_file()
 	if not rows:
@@ -120,16 +120,16 @@
 	ret = []
 	error = False
 	
-	from webnotes.utils.datautils import check_record, import_doc
-	doctype_dl = webnotes.get_doctype("Attendance")
+	from frappe.utils.datautils import check_record, import_doc
+	doctype_dl = frappe.get_doctype("Attendance")
 	
 	for i, row in enumerate(rows[5:]):
 		if not row: continue
 		row_idx = i + 5
-		d = webnotes._dict(zip(columns, row))
+		d = frappe._dict(zip(columns, row))
 		d["doctype"] = "Attendance"
 		if d.name:
-			d["docstatus"] = webnotes.conn.get_value("Attendance", d.name, "docstatus")
+			d["docstatus"] = frappe.conn.get_value("Attendance", d.name, "docstatus")
 			
 		try:
 			check_record(d, doctype_dl=doctype_dl)
@@ -138,10 +138,10 @@
 			error = True
 			ret.append('Error for row (#%d) %s : %s' % (row_idx, 
 				len(row)>1 and row[1] or "", cstr(e)))
-			webnotes.errprint(webnotes.get_traceback())
+			frappe.errprint(frappe.get_traceback())
 
 	if error:
-		webnotes.conn.rollback()		
+		frappe.conn.rollback()		
 	else:
-		webnotes.conn.commit()
+		frappe.conn.commit()
 	return {"messages": ret, "error": error}
diff --git a/erpnext/hr/page/hr_home/hr_home.js b/erpnext/hr/page/hr_home/hr_home.js
index 86514ba..af6a108 100644
--- a/erpnext/hr/page/hr_home/hr_home.js
+++ b/erpnext/hr/page/hr_home/hr_home.js
@@ -1,172 +1,172 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["HR"] = [
+frappe.module_page["HR"] = [
 	{
-		title: wn._("Top"),
+		title: frappe._("Top"),
 		top: true,
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Employee"),
-				description: wn._("Employee records."),
+				label: frappe._("Employee"),
+				description: frappe._("Employee records."),
 				doctype:"Employee"
 			},
 			{
-				label: wn._("Leave Application"),
-				description: wn._("Applications for leave."),
+				label: frappe._("Leave Application"),
+				description: frappe._("Applications for leave."),
 				doctype:"Leave Application"
 			},
 			{
-				label: wn._("Expense Claim"),
-				description: wn._("Claims for company expense."),
+				label: frappe._("Expense Claim"),
+				description: frappe._("Claims for company expense."),
 				doctype:"Expense Claim"
 			},
 			{
-				label: wn._("Salary Slip"),
-				description: wn._("Monthly salary statement."),
+				label: frappe._("Salary Slip"),
+				description: frappe._("Monthly salary statement."),
 				doctype:"Salary Slip"
 			},
 			{
-				label: wn._("Attendance"),
-				description: wn._("Attendance record."),
+				label: frappe._("Attendance"),
+				description: frappe._("Attendance record."),
 				doctype:"Attendance"
 			},
 		]
 	},
 	{
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Job Applicant"),
-				description: wn._("Applicant for a Job."),
+				label: frappe._("Job Applicant"),
+				description: frappe._("Applicant for a Job."),
 				doctype:"Job Applicant"
 			},
 			{
-				label: wn._("Appraisal"),
-				description: wn._("Performance appraisal."),
+				label: frappe._("Appraisal"),
+				description: frappe._("Performance appraisal."),
 				doctype:"Appraisal"
 			},
 		]
 	},
 	{
-		title: wn._("Leave Setup"),
+		title: frappe._("Leave Setup"),
 		icon: "icon-cog",
 		items: [
 			{
 				"route":"Form/Upload Attendance/Upload Attendance",
-				"label":wn._("Upload Attendance"),
-				"description":wn._("Upload attendance from a .csv file"),
+				"label":frappe._("Upload Attendance"),
+				"description":frappe._("Upload attendance from a .csv file"),
 				doctype: "Upload Attendance"
 			},
 			{
 				"route":"Form/Leave Control Panel/Leave Control Panel",
-				"label": wn._("Leave Allocation Tool"),
-				"description": wn._("Allocate leaves for the year."),
+				"label": frappe._("Leave Allocation Tool"),
+				"description": frappe._("Allocate leaves for the year."),
 				doctype: "Leave Control Panel"
 			},
 			{
-				"label":wn._("Leave Allocation"),
-				"description":wn._("Leave allocations."),
+				"label":frappe._("Leave Allocation"),
+				"description":frappe._("Leave allocations."),
 				doctype: "Leave Allocation"
 			},
 			{
-				"label":wn._("Leave Type"),
-				"description":wn._("Type of leaves like casual, sick etc."),
+				"label":frappe._("Leave Type"),
+				"description":frappe._("Type of leaves like casual, sick etc."),
 				doctype: "Leave Type"
 			},
 			{
-				"label":wn._("Holiday List"),
-				"description":wn._("List of holidays."),
+				"label":frappe._("Holiday List"),
+				"description":frappe._("List of holidays."),
 				doctype: "Holiday List"
 			},
 			{
-				"label":wn._("Leave Block List"),
-				"description":wn._("Block leave applications by department."),
+				"label":frappe._("Leave Block List"),
+				"description":frappe._("Block leave applications by department."),
 				doctype: "Leave Block List"
 			},
 		]
 	},
 	{
-		title: wn._("Payroll Setup"),
+		title: frappe._("Payroll Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				"label": wn._("Salary Structure"),
-				"description": wn._("Monthly salary template."),
+				"label": frappe._("Salary Structure"),
+				"description": frappe._("Monthly salary template."),
 				doctype: "Salary Structure"
 			},
 			{
 				"route":"Form/Salary Manager/Salary Manager",
-				"label":wn._("Process Payroll"),
-				"description":wn._("Generate Salary Slips"),
+				"label":frappe._("Process Payroll"),
+				"description":frappe._("Generate Salary Slips"),
 				doctype: "Salary Manager"
 			},
 			{
-				"label": wn._("Earning Type"),
-				"description": wn._("Salary components."),
+				"label": frappe._("Earning Type"),
+				"description": frappe._("Salary components."),
 				doctype: "Earning Type"
 			},
 			{
-				"label": wn._("Deduction Type"),
-				"description": wn._("Tax and other salary deductions."),
+				"label": frappe._("Deduction Type"),
+				"description": frappe._("Tax and other salary deductions."),
 				doctype: "Deduction Type"
 			},
 		]
 	},
 	{
-		title: wn._("Employee Setup"),
+		title: frappe._("Employee Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				label: wn._("Job Opening"),
-				description: wn._("Opening for a Job."),
+				label: frappe._("Job Opening"),
+				description: frappe._("Opening for a Job."),
 				doctype:"Job Opening"
 			},
 			{
-				"label": wn._("Employment Type"),
-				"description": wn._("Type of employment master."),
+				"label": frappe._("Employment Type"),
+				"description": frappe._("Type of employment master."),
 				doctype: "Employment Type"
 			},	
 			{
-				"label": wn._("Designation"),
-				"description": wn._("Employee Designation."),
+				"label": frappe._("Designation"),
+				"description": frappe._("Employee Designation."),
 				doctype: "Designation"
 			},	
 			{
-				"label": wn._("Appraisal Template"),
-				"description": wn._("Template for employee performance appraisals."),
+				"label": frappe._("Appraisal Template"),
+				"description": frappe._("Template for employee performance appraisals."),
 				doctype: "Appraisal Template"
 			},
 			{
-				"label": wn._("Expense Claim Type"),
-				"description": wn._("Types of Expense Claim."),
+				"label": frappe._("Expense Claim Type"),
+				"description": frappe._("Types of Expense Claim."),
 				doctype: "Expense Claim Type"
 			},
 			{
-				"label": wn._("Branch"),
-				"description": wn._("Company branches."),
+				"label": frappe._("Branch"),
+				"description": frappe._("Company branches."),
 				doctype: "Branch"
 			},
 			{
-				"label": wn._("Department"),
-				"description": wn._("Company departments."),
+				"label": frappe._("Department"),
+				"description": frappe._("Company departments."),
 				doctype: "Department"
 			},
 			{
-				"label": wn._("Grade"),
-				"description": wn._("Employee grades"),
+				"label": frappe._("Grade"),
+				"description": frappe._("Employee grades"),
 				doctype: "Grade"
 			},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				"label": wn._("HR Settings"),
+				"label": frappe._("HR Settings"),
 				"route": "Form/HR Settings",
 				"doctype":"HR Settings",
 				"description": "Settings for HR Module"
@@ -174,32 +174,32 @@
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Employee Leave Balance"),
+				"label":frappe._("Employee Leave Balance"),
 				route: "query-report/Employee Leave Balance",
 				doctype: "Leave Application"
 			},
 			{
-				"label":wn._("Employee Birthday"),
+				"label":frappe._("Employee Birthday"),
 				route: "query-report/Employee Birthday",
 				doctype: "Employee"
 			},
 			{
-				"label":wn._("Employee Information"),
+				"label":frappe._("Employee Information"),
 				route: "Report/Employee/Employee Information",
 				doctype: "Employee"
 			},
 			{
-				"label":wn._("Monthly Salary Register"),
+				"label":frappe._("Monthly Salary Register"),
 				route: "query-report/Monthly Salary Register",
 				doctype: "Salary Slip"
 			},
 			{
-				"label":wn._("Monthly Attendance Sheet"),
+				"label":frappe._("Monthly Attendance Sheet"),
 				route: "query-report/Monthly Attendance Sheet",
 				doctype: "Attendance"
 			},
@@ -208,5 +208,5 @@
 ];
 
 pscript['onload_hr-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "HR");
+	frappe.views.moduleview.make(wrapper, "HR");
 }
\ No newline at end of file
diff --git a/erpnext/hr/report/employee_birthday/employee_birthday.js b/erpnext/hr/report/employee_birthday/employee_birthday.js
index b534047..9af3f39 100644
--- a/erpnext/hr/report/employee_birthday/employee_birthday.js
+++ b/erpnext/hr/report/employee_birthday/employee_birthday.js
@@ -1,22 +1,22 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Employee Birthday"] = {
+frappe.query_reports["Employee Birthday"] = {
 	"filters": [
 		{
 			"fieldname":"month",
-			"label": wn._("Month"),
+			"label": frappe._("Month"),
 			"fieldtype": "Select",
 			"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
 			"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", 
-				"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
+				"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company")
+			"default": frappe.defaults.get_user_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/hr/report/employee_birthday/employee_birthday.py b/erpnext/hr/report/employee_birthday/employee_birthday.py
index 8c5211e..444ecfc 100644
--- a/erpnext/hr/report/employee_birthday/employee_birthday.py
+++ b/erpnext/hr/report/employee_birthday/employee_birthday.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -22,7 +22,7 @@
 	
 def get_employees(filters):
 	conditions = get_conditions(filters)
-	return webnotes.conn.sql("""select name, date_of_birth, branch, department, designation, 
+	return frappe.conn.sql("""select name, date_of_birth, branch, department, designation, 
 	gender, company from tabEmployee where status = 'Active' %s""" % conditions, as_list=1)
 	
 def get_conditions(filters):
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js
index de8f378..ff0bdf4 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js
@@ -1,21 +1,21 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Employee Leave Balance"] = {
+frappe.query_reports["Employee Leave Balance"] = {
 	"filters": [
 		{
 			"fieldname":"fiscal_year",
-			"label": wn._("Fiscal Year"),
+			"label": frappe._("Fiscal Year"),
 			"fieldtype": "Link",
 			"options": "Fiscal Year",
-			"default": wn.defaults.get_user_default("fiscal_year")
+			"default": frappe.defaults.get_user_default("fiscal_year")
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company")
+			"default": frappe.defaults.get_user_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index 6720576..3b6243c 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.widgets.reportview import execute as runreport
+import frappe
+from frappe.widgets.reportview import execute as runreport
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -12,19 +12,19 @@
 		[["Employee", "company", "=", filters.get("company")]] or None
 	employees = runreport(doctype="Employee", fields=["name", "employee_name", "department"],
 		filters=employee_filters)
-	leave_types = webnotes.conn.sql_list("select name from `tabLeave Type`")
+	leave_types = frappe.conn.sql_list("select name from `tabLeave Type`")
 	
 	if filters.get("fiscal_year"):
 		fiscal_years = [filters["fiscal_year"]]
 	else:
-		fiscal_years = webnotes.conn.sql_list("select name from `tabFiscal Year` order by name desc")
+		fiscal_years = frappe.conn.sql_list("select name from `tabFiscal Year` order by name desc")
 		
 	employee_in = '", "'.join([e.name for e in employees])
 	
-	allocations = webnotes.conn.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
+	allocations = frappe.conn.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
 	 	from `tabLeave Allocation` 
 		where docstatus=1 and employee in ("%s")""" % employee_in, as_dict=True)
-	applications = webnotes.conn.sql("""select employee, fiscal_year, leave_type, SUM(total_leave_days) as leaves
+	applications = frappe.conn.sql("""select employee, fiscal_year, leave_type, SUM(total_leave_days) as leaves
 			from `tabLeave Application` 
 			where status="Approved" and docstatus = 1 and employee in ("%s")
 			group by employee, fiscal_year, leave_type""" % employee_in, as_dict=True)
@@ -41,11 +41,11 @@
 	data = {}
 	for d in allocations:
 		data.setdefault((d.fiscal_year, d.employee, 
-			d.leave_type), webnotes._dict()).allocation = d.total_leaves_allocated
+			d.leave_type), frappe._dict()).allocation = d.total_leaves_allocated
 
 	for d in applications:
 		data.setdefault((d.fiscal_year, d.employee, 
-			d.leave_type), webnotes._dict()).leaves = d.leaves
+			d.leave_type), frappe._dict()).leaves = d.leaves
 	
 	result = []
 	for fiscal_year in fiscal_years:
@@ -53,7 +53,7 @@
 			row = [fiscal_year, employee.name, employee.employee_name, employee.department]
 			result.append(row)
 			for leave_type in leave_types:
-				tmp = data.get((fiscal_year, employee.name, leave_type), webnotes._dict())
+				tmp = data.get((fiscal_year, employee.name, leave_type), frappe._dict())
 				row.append(tmp.allocation or 0)
 				row.append(tmp.leaves or 0)
 				row.append((tmp.allocation or 0) - (tmp.leaves or 0))
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
index 44289b7..0b33d8e 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
@@ -1,35 +1,35 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Monthly Attendance Sheet"] = {
+frappe.query_reports["Monthly Attendance Sheet"] = {
 	"filters": [
 		{
 			"fieldname":"month",
-			"label": wn._("Month"),
+			"label": frappe._("Month"),
 			"fieldtype": "Select",
 			"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
 			"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", 
-				"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
+				"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
 		},
 		{
 			"fieldname":"fiscal_year",
-			"label": wn._("Fiscal Year"),
+			"label": frappe._("Fiscal Year"),
 			"fieldtype": "Link",
 			"options": "Fiscal Year",
 			"default": sys_defaults.fiscal_year,
 		},
 		{
 			"fieldname":"employee",
-			"label": wn._("Employee"),
+			"label": frappe._("Employee"),
 			"fieldtype": "Link",
 			"options": "Employee"
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index a25ca36..4b651bb 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, cint
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import cstr, cint
+from frappe import msgprint, _
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -54,13 +54,13 @@
 	return columns
 	
 def get_attendance_list(conditions, filters):
-	attendance_list = webnotes.conn.sql("""select employee, day(att_date) as day_of_month, 
+	attendance_list = frappe.conn.sql("""select employee, day(att_date) as day_of_month, 
 		status from tabAttendance where docstatus = 1 %s order by employee, att_date""" % 
 		conditions, filters, as_dict=1)
 		
 	att_map = {}
 	for d in attendance_list:
-		att_map.setdefault(d.employee, webnotes._dict()).setdefault(d.day_of_month, "")
+		att_map.setdefault(d.employee, frappe._dict()).setdefault(d.day_of_month, "")
 		att_map[d.employee][d.day_of_month] = d.status
 
 	return att_map
@@ -84,7 +84,7 @@
 	return conditions, filters
 	
 def get_employee_details():
-	employee = webnotes.conn.sql("""select name, employee_name, designation, department, 
+	employee = frappe.conn.sql("""select name, employee_name, designation, department, 
 		branch, company from tabEmployee where docstatus < 2 and status = 'Active'""", as_dict=1)
 	
 	emp_map = {}
diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.js b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.js
index 32b4ef3..d1561c7 100644
--- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.js
+++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.js
@@ -1,35 +1,35 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Monthly Salary Register"] = {
+frappe.query_reports["Monthly Salary Register"] = {
 	"filters": [
 		{
 			"fieldname":"month",
-			"label": wn._("Month"),
+			"label": frappe._("Month"),
 			"fieldtype": "Select",
 			"options": "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
 			"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", 
-				"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
+				"Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()],
 		},
 		{
 			"fieldname":"fiscal_year",
-			"label": wn._("Fiscal Year"),
+			"label": frappe._("Fiscal Year"),
 			"fieldtype": "Link",
 			"options": "Fiscal Year",
 			"default": sys_defaults.fiscal_year,
 		},
 		{
 			"fieldname":"employee",
-			"label": wn._("Employee"),
+			"label": frappe._("Employee"),
 			"fieldtype": "Link",
 			"options": "Employee"
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
index 42c62e4..ff4d700 100644
--- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
+++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt, cstr
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import flt, cstr
+from frappe import msgprint, _
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -42,11 +42,11 @@
 		"Payment Days:Float:120"
 	]
 	
-	earning_types = webnotes.conn.sql_list("""select distinct e_type from `tabSalary Slip Earning`
+	earning_types = frappe.conn.sql_list("""select distinct e_type from `tabSalary Slip Earning`
 		where ifnull(e_modified_amount, 0) != 0 and parent in (%s)""" % 
 		(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
 		
-	ded_types = webnotes.conn.sql_list("""select distinct d_type from `tabSalary Slip Deduction`
+	ded_types = frappe.conn.sql_list("""select distinct d_type from `tabSalary Slip Deduction`
 		where ifnull(d_modified_amount, 0) != 0 and parent in (%s)""" % 
 		(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
 		
@@ -59,7 +59,7 @@
 	
 def get_salary_slips(filters):
 	conditions, filters = get_conditions(filters)
-	salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
+	salary_slips = frappe.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
 		order by employee, month""" % conditions, filters, as_dict=1)
 	
 	if not salary_slips:
@@ -83,25 +83,25 @@
 	return conditions, filters
 	
 def get_ss_earning_map(salary_slips):
-	ss_earnings = webnotes.conn.sql("""select parent, e_type, e_modified_amount 
+	ss_earnings = frappe.conn.sql("""select parent, e_type, e_modified_amount 
 		from `tabSalary Slip Earning` where parent in (%s)""" %
 		(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1)
 	
 	ss_earning_map = {}
 	for d in ss_earnings:
-		ss_earning_map.setdefault(d.parent, webnotes._dict()).setdefault(d.e_type, [])
+		ss_earning_map.setdefault(d.parent, frappe._dict()).setdefault(d.e_type, [])
 		ss_earning_map[d.parent][d.e_type] = flt(d.e_modified_amount)
 	
 	return ss_earning_map
 
 def get_ss_ded_map(salary_slips):
-	ss_deductions = webnotes.conn.sql("""select parent, d_type, d_modified_amount 
+	ss_deductions = frappe.conn.sql("""select parent, d_type, d_modified_amount 
 		from `tabSalary Slip Deduction` where parent in (%s)""" %
 		(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1)
 	
 	ss_ded_map = {}
 	for d in ss_deductions:
-		ss_ded_map.setdefault(d.parent, webnotes._dict()).setdefault(d.d_type, [])
+		ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault(d.d_type, [])
 		ss_ded_map[d.parent][d.d_type] = flt(d.d_modified_amount)
 	
 	return ss_ded_map
\ No newline at end of file
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index f36a066..99000ea 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -2,24 +2,24 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_leave_approver_list():
-	roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
+	roles = [r[0] for r in frappe.conn.sql("""select distinct parent from `tabUserRole`
 		where role='Leave Approver'""")]
 	if not roles:
-		webnotes.msgprint(_("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user."))
+		frappe.msgprint(_("No Leave Approvers. Please assign 'Leave Approver' Role to atleast one user."))
 		
 	return roles
 
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_expense_approver_list():
-	roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
+	roles = [r[0] for r in frappe.conn.sql("""select distinct parent from `tabUserRole`
 		where role='Expense Approver'""")]
 	if not roles:
-		webnotes.msgprint("No Expense Approvers. Please assign 'Expense Approver' \
+		frappe.msgprint("No Expense Approvers. Please assign 'Expense Approver' \
 			Role to atleast one user.")
 	return roles
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index c0dcdfc..363ab75 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -6,7 +6,7 @@
 	cur_frm.toggle_enable("item", doc.__islocal);
 	
 	if (!doc.__islocal && doc.docstatus<2) {
-		cur_frm.add_custom_button(wn._("Update Cost"), cur_frm.cscript.update_cost);
+		cur_frm.add_custom_button(frappe._("Update Cost"), cur_frm.cscript.update_cost);
 	}
 	
 	cur_frm.cscript.with_operations(doc);
@@ -14,7 +14,7 @@
 }
 
 cur_frm.cscript.update_cost = function() {
-	return wn.call({
+	return frappe.call({
 		doc: cur_frm.doc,
 		method: "update_cost",
 		callback: function(r) {
@@ -42,7 +42,7 @@
 		if (op && !inList(operations, op)) operations.push(op);
 	}
 		
-	wn.meta.get_docfield("BOM Item", "operation_no", 
+	frappe.meta.get_docfield("BOM Item", "operation_no", 
 		cur_frm.docname).options = operations.join("\n");
 	
 	$.each(getchildren("BOM Item", doc.name, "bom_materials"), function(i, v) {
@@ -61,7 +61,7 @@
 
 cur_frm.cscript.workstation = function(doc,dt,dn) {
 	var d = locals[dt][dn];
-	wn.model.with_doc("Workstation", d.workstation, function(i, r) {
+	frappe.model.with_doc("Workstation", d.workstation, function(i, r) {
 		d.hour_rate = r.docs[0].hour_rate;
 		refresh_field("hour_rate", dn, "bom_operations");
 		calculate_op_cost(doc);
@@ -93,7 +93,7 @@
 var get_bom_material_detail= function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if (d.item_code) {
-		return wn.call({
+		return frappe.call({
 			doc: cur_frm.doc,
 			method: "get_bom_material_detail",
 			args: {
@@ -123,7 +123,7 @@
 cur_frm.cscript.rate = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if (d.bom_no) {
-		msgprint(wn._("You can not change rate if BOM mentioned agianst any item"));
+		msgprint(frappe._("You can not change rate if BOM mentioned agianst any item"));
 		get_bom_material_detail(doc, cdt, cdn);
 	} else {
 		calculate_rm_cost(doc);
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 47eacf2..d151136 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, cstr, flt, now, nowdate
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import cint, cstr, flt, now, nowdate
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
 
 
@@ -17,7 +17,7 @@
 		self.doclist = doclist
 
 	def autoname(self):
-		last_name = webnotes.conn.sql("""select max(name) from `tabBOM` 
+		last_name = frappe.conn.sql("""select max(name) from `tabBOM` 
 			where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
 		if last_name:
 			idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
@@ -47,8 +47,8 @@
 		self.manage_default_bom()
 
 	def on_cancel(self):
-		webnotes.conn.set(self.doc, "is_active", 0)
-		webnotes.conn.set(self.doc, "is_default", 0)
+		frappe.conn.set(self.doc, "is_active", 0)
+		frappe.conn.set(self.doc, "is_default", 0)
 
 		# check if used in any other bom
 		self.validate_bom_links()
@@ -59,7 +59,7 @@
 		self.manage_default_bom()
 
 	def get_item_det(self, item_code):
-		item = webnotes.conn.sql("""select name, is_asset_item, is_purchase_item, 
+		item = frappe.conn.sql("""select name, is_asset_item, is_purchase_item, 
 			docstatus, description, is_sub_contracted_item, stock_uom, default_bom, 
 			last_purchase_rate, standard_rate, is_manufactured_item 
 			from `tabItem` where name=%s""", item_code, as_dict = 1)
@@ -86,7 +86,7 @@
 	def get_bom_material_detail(self, args=None):
 		""" Get raw material details like uom, desc and rate"""
 		if not args:
-			args = webnotes.form_dict.get('args')
+			args = frappe.form_dict.get('args')
 		
 		if isinstance(args, basestring):
 			import json
@@ -119,8 +119,8 @@
 				rate = arg['last_purchase_rate']
 			elif self.doc.rm_cost_as_per == "Price List":
 				if not self.doc.buying_price_list:
-					webnotes.throw(_("Please select Price List"))
-				rate = webnotes.conn.get_value("Item Price", {"price_list": self.doc.buying_price_list, 
+					frappe.throw(_("Please select Price List"))
+				rate = frappe.conn.get_value("Item Price", {"price_list": self.doc.buying_price_list, 
 					"item_code": arg["item_code"]}, "price_list_rate") or 0
 			elif self.doc.rm_cost_as_per == 'Standard Rate':
 				rate = arg['standard_rate']
@@ -136,14 +136,14 @@
 			})["rate"]
 		
 		if self.doc.docstatus == 0:
-			webnotes.bean(self.doclist).save()
+			frappe.bean(self.doclist).save()
 		elif self.doc.docstatus == 1:
 			self.calculate_cost()
 			self.update_exploded_items()
-			webnotes.bean(self.doclist).update_after_submit()
+			frappe.bean(self.doclist).update_after_submit()
 
 	def get_bom_unitcost(self, bom_no):
-		bom = webnotes.conn.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
+		bom = frappe.conn.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
 			where is_active = 1 and name = %s""", bom_no, as_dict=1)
 		return bom and bom[0]['unit_cost'] or 0
 
@@ -155,7 +155,7 @@
 		from erpnext.stock.utils import get_incoming_rate
 		dt = self.doc.costing_date or nowdate()
 		time = self.doc.costing_date == nowdate() and now().split()[1] or '23:59'
-		warehouse = webnotes.conn.sql("select warehouse from `tabBin` where item_code = %s", args['item_code'])
+		warehouse = frappe.conn.sql("select warehouse from `tabBin` where item_code = %s", args['item_code'])
 		rate = []
 		for wh in warehouse:
 			r = get_incoming_rate({
@@ -175,15 +175,15 @@
 			update default bom in item master
 		"""
 		if self.doc.is_default and self.doc.is_active:
-			from webnotes.model.utils import set_default
+			from frappe.model.utils import set_default
 			set_default(self.doc, "item")
-			webnotes.conn.set_value("Item", self.doc.item, "default_bom", self.doc.name)
+			frappe.conn.set_value("Item", self.doc.item, "default_bom", self.doc.name)
 		
 		else:
 			if not self.doc.is_active:
-				webnotes.conn.set(self.doc, "is_default", 0)
+				frappe.conn.set(self.doc, "is_default", 0)
 			
-			webnotes.conn.sql("update `tabItem` set default_bom = null where name = %s and default_bom = %s", 
+			frappe.conn.sql("update `tabItem` set default_bom = null where name = %s and default_bom = %s", 
 				 (self.doc.item, self.doc.name))
 
 	def clear_operations(self):
@@ -203,7 +203,7 @@
 			msgprint("""As Item: %s is not a manufactured / sub-contracted item, \
 				you can not make BOM for it""" % self.doc.item, raise_exception = 1)
 		else:
-			ret = webnotes.conn.get_value("Item", self.doc.item, ["description", "stock_uom"])
+			ret = frappe.conn.get_value("Item", self.doc.item, ["description", "stock_uom"])
 			self.doc.description = ret[0]
 			self.doc.uom = ret[1]
 
@@ -249,7 +249,7 @@
 
 	def validate_bom_no(self, item, bom_no, idx):
 		"""Validate BOM No of sub-contracted items"""
-		bom = webnotes.conn.sql("""select name from `tabBOM` where name = %s and item = %s 
+		bom = frappe.conn.sql("""select name from `tabBOM` where name = %s and item = %s 
 			and is_active=1 and docstatus=1""", 
 			(bom_no, item), as_dict =1)
 		if not bom:
@@ -271,7 +271,7 @@
 		for d in check_list:
 			bom_list, count = [self.doc.name], 0
 			while (len(bom_list) > count ):
-				boms = webnotes.conn.sql(" select %s from `tabBOM Item` where %s = '%s' " % 
+				boms = frappe.conn.sql(" select %s from `tabBOM Item` where %s = '%s' " % 
 					(d[0], d[1], cstr(bom_list[count])))
 				count = count + 1
 				for b in boms:
@@ -291,7 +291,7 @@
 			
 	def traverse_tree(self, bom_list=[]):
 		def _get_children(bom_no):
-			return [cstr(d[0]) for d in webnotes.conn.sql("""select bom_no from `tabBOM Item` 
+			return [cstr(d[0]) for d in frappe.conn.sql("""select bom_no from `tabBOM Item` 
 				where parent = %s and ifnull(bom_no, '') != ''""", bom_no)]
 				
 		count = 0
@@ -317,7 +317,7 @@
 		total_op_cost = 0
 		for d in getlist(self.doclist, 'bom_operations'):
 			if d.workstation and not d.hour_rate:
-				d.hour_rate = webnotes.conn.get_value("Workstation", d.workstation, "hour_rate")
+				d.hour_rate = frappe.conn.get_value("Workstation", d.workstation, "hour_rate")
 			if d.hour_rate and d.time_in_mins:
 				d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0
 			total_op_cost += flt(d.operating_cost)
@@ -347,7 +347,7 @@
 			if d.bom_no:
 				self.get_child_exploded_items(d.bom_no, d.qty)
 			else:
-				self.add_to_cur_exploded_items(webnotes._dict({
+				self.add_to_cur_exploded_items(frappe._dict({
 					'item_code'				: d.item_code, 
 					'description'			: d.description, 
 					'stock_uom'				: d.stock_uom, 
@@ -364,12 +364,12 @@
 	def get_child_exploded_items(self, bom_no, qty):
 		""" Add all items from Flat BOM of child BOM"""
 		
-		child_fb_items = webnotes.conn.sql("""select item_code, description, stock_uom, qty, rate, 
+		child_fb_items = frappe.conn.sql("""select item_code, description, stock_uom, qty, rate, 
 			qty_consumed_per_unit from `tabBOM Explosion Item` 
 			where parent = %s and docstatus = 1""", bom_no, as_dict = 1)
 			
 		for d in child_fb_items:
-			self.add_to_cur_exploded_items(webnotes._dict({
+			self.add_to_cur_exploded_items(frappe._dict({
 				'item_code'				: d['item_code'], 
 				'description'			: d['description'], 
 				'stock_uom'				: d['stock_uom'], 
@@ -390,12 +390,12 @@
 			ch.save(1)
 
 	def get_parent_bom_list(self, bom_no):
-		p_bom = webnotes.conn.sql("select parent from `tabBOM Item` where bom_no = '%s'" % bom_no)
+		p_bom = frappe.conn.sql("select parent from `tabBOM Item` where bom_no = '%s'" % bom_no)
 		return p_bom and [i[0] for i in p_bom] or []
 
 	def validate_bom_links(self):
 		if not self.doc.is_active:
-			act_pbom = webnotes.conn.sql("""select distinct bom_item.parent from `tabBOM Item` bom_item
+			act_pbom = frappe.conn.sql("""select distinct bom_item.parent from `tabBOM Item` bom_item
 				where bom_item.bom_no = %s and bom_item.docstatus = 1
 				and exists (select * from `tabBOM` where name = bom_item.parent
 					and docstatus = 1 and is_active = 1)""", self.doc.name)
@@ -427,7 +427,7 @@
 				group by item_code, stock_uom"""
 	
 	if fetch_exploded:
-		items = webnotes.conn.sql(query % {
+		items = frappe.conn.sql(query % {
 			"qty": qty,
 			"table": "BOM Explosion Item",
 			"bom": bom,
@@ -435,7 +435,7 @@
 					and ifnull(item.is_sub_contracted_item, 'No') = 'No' """
 		}, as_dict=True)
 	else:
-		items = webnotes.conn.sql(query % {
+		items = frappe.conn.sql(query % {
 			"qty": qty,
 			"table": "BOM Item",
 			"bom": bom,
@@ -451,7 +451,7 @@
 		
 	return item_dict
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_bom_items(bom, qty=1, fetch_exploded=1):
 	items = get_bom_items_as_dict(bom, qty, fetch_exploded).values()
 	items.sort(lambda a, b: a.item_code > b.item_code and 1 or -1)
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py
index 5f9186a..9bd9a07 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.py
+++ b/erpnext/manufacturing/doctype/bom/test_bom.py
@@ -4,7 +4,7 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
 test_records = [
 	[
diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
+++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.py b/erpnext/manufacturing/doctype/bom_item/bom_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.py
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.py b/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
index cb6190f..26c87f1 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py
index b3d1ae4..39e4623 100644
--- a/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py
+++ b/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, flt
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import cstr, flt
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 	
 class DocType:
 	def __init__( self, doc, doclist=[]):
@@ -21,21 +21,21 @@
 			bom_obj = get_obj("BOM", bom, with_children=1)
 			updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
 			
-		webnotes.msgprint(_("BOM replaced"))
+		frappe.msgprint(_("BOM replaced"))
 
 	def validate_bom(self):
 		if cstr(self.doc.current_bom) == cstr(self.doc.new_bom):
 			msgprint("Current BOM and New BOM can not be same", raise_exception=1)
 	
 	def update_new_bom(self):
-		current_bom_unitcost = webnotes.conn.sql("""select total_cost/quantity 
+		current_bom_unitcost = frappe.conn.sql("""select total_cost/quantity 
 			from `tabBOM` where name = %s""", self.doc.current_bom)
 		current_bom_unitcost = current_bom_unitcost and flt(current_bom_unitcost[0][0]) or 0
-		webnotes.conn.sql("""update `tabBOM Item` set bom_no=%s, 
+		frappe.conn.sql("""update `tabBOM Item` set bom_no=%s, 
 			rate=%s, amount=qty*%s where bom_no = %s and docstatus < 2""", 
 			(self.doc.new_bom, current_bom_unitcost, current_bom_unitcost, self.doc.current_bom))
 				
 	def get_parent_boms(self):
-		return [d[0] for d in webnotes.conn.sql("""select distinct parent 
+		return [d[0] for d in frappe.conn.sql("""select distinct parent 
 			from `tabBOM Item` where ifnull(bom_no, '') = %s and docstatus < 2""",
 			self.doc.new_bom)]
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index 480f1a6..86580d6 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -17,13 +17,13 @@
 		cfn_set_fields(doc, dt, dn);
 
 		if (doc.docstatus === 0 && !doc.__islocal) {
-			this.frm.set_intro(wn._("Submit this Production Order for further processing."));
+			this.frm.set_intro(frappe._("Submit this Production Order for further processing."));
 		} else if (doc.docstatus === 1) {
 			var percent = flt(doc.produced_qty) / flt(doc.qty) * 100;
-			this.frm.dashboard.add_progress(cint(percent) + "% " + wn._("Complete"), percent);
+			this.frm.dashboard.add_progress(cint(percent) + "% " + frappe._("Complete"), percent);
 
 			if(doc.status === "Stopped") {
-				this.frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop");
+				this.frm.dashboard.set_headline_alert(frappe._("Stopped"), "alert-danger", "icon-stop");
 			}
 		}
 	},
@@ -38,15 +38,15 @@
 	make_se: function(purpose) {
 		var me = this;
 
-		wn.call({
+		frappe.call({
 			method:"erpnext.manufacturing.doctype.production_order.production_order.make_stock_entry",
 			args: {
 				"production_order_id": me.frm.doc.name,
 				"purpose": purpose
 			},
 			callback: function(r) {
-				var doclist = wn.model.sync(r.message);
-				wn.set_route("Form", doclist[0].doctype, doclist[0].name);
+				var doclist = frappe.model.sync(r.message);
+				frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
 			}
 		});
 	}
@@ -55,20 +55,20 @@
 var cfn_set_fields = function(doc, dt, dn) {
 	if (doc.docstatus == 1) {
 		if (doc.status != 'Stopped' && doc.status != 'Completed')
-		cur_frm.add_custom_button(wn._('Stop!'), cur_frm.cscript['Stop Production Order'], "icon-exclamation");
+		cur_frm.add_custom_button(frappe._('Stop!'), cur_frm.cscript['Stop Production Order'], "icon-exclamation");
 		else if (doc.status == 'Stopped')
-			cur_frm.add_custom_button(wn._('Unstop'), cur_frm.cscript['Unstop Production Order'], "icon-check");
+			cur_frm.add_custom_button(frappe._('Unstop'), cur_frm.cscript['Unstop Production Order'], "icon-check");
 
 		if (doc.status == 'Submitted' || doc.status == 'Material Transferred' || doc.status == 'In Process'){
-			cur_frm.add_custom_button(wn._('Transfer Raw Materials'), cur_frm.cscript['Transfer Raw Materials']);
-			cur_frm.add_custom_button(wn._('Update Finished Goods'), cur_frm.cscript['Update Finished Goods']);
+			cur_frm.add_custom_button(frappe._('Transfer Raw Materials'), cur_frm.cscript['Transfer Raw Materials']);
+			cur_frm.add_custom_button(frappe._('Update Finished Goods'), cur_frm.cscript['Update Finished Goods']);
 		} 
 	}
 }
 
 cur_frm.cscript['Stop Production Order'] = function() {
 	var doc = cur_frm.doc;
-	var check = confirm(wn._("Do you really want to stop production order: " + doc.name));
+	var check = confirm(frappe._("Do you really want to stop production order: " + doc.name));
 	if (check) {
 		return $c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Stopped', function(r, rt) {cur_frm.refresh();});
 	}
@@ -76,7 +76,7 @@
 
 cur_frm.cscript['Unstop Production Order'] = function() {
 	var doc = cur_frm.doc;
-	var check = confirm(wn._("Do really want to unstop production order: " + doc.name));
+	var check = confirm(frappe._("Do really want to unstop production order: " + doc.name));
 	if (check)
 		return $c_obj(make_doclist(doc.doctype, doc.name), 'stop_unstop', 'Unstopped', function(r, rt) {cur_frm.refresh();});
 }
@@ -111,5 +111,5 @@
 			query: "erpnext.controllers.queries.bom",
 			filters: {item: cstr(doc.production_item)}
 		}
-	} else msgprint(wn._("Please enter Production Item first"));
+	} else msgprint(frappe._("Please enter Production Item first"));
 });
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 8a47a8e..75289a0 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, nowdate
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import cstr, flt, nowdate
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
-class OverProductionError(webnotes.ValidationError): pass
+class OverProductionError(frappe.ValidationError): pass
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -32,21 +32,21 @@
 		
 	def validate_bom_no(self):
 		if self.doc.bom_no:
-			bom = webnotes.conn.sql("""select name from `tabBOM` where name=%s and docstatus=1 
+			bom = frappe.conn.sql("""select name from `tabBOM` where name=%s and docstatus=1 
 				and is_active=1 and item=%s"""
 				, (self.doc.bom_no, self.doc.production_item), as_dict =1)
 			if not bom:
-				webnotes.throw("""Incorrect BOM: %s entered. 
+				frappe.throw("""Incorrect BOM: %s entered. 
 					May be BOM not exists or inactive or not submitted 
 					or for some other item.""" % cstr(self.doc.bom_no))
 					
 	def validate_sales_order(self):
 		if self.doc.sales_order:
-			so = webnotes.conn.sql("""select name, delivery_date from `tabSales Order` 
+			so = frappe.conn.sql("""select name, delivery_date from `tabSales Order` 
 				where name=%s and docstatus = 1""", self.doc.sales_order, as_dict=1)[0]
 
 			if not so.name:
-				webnotes.throw("Sales Order: %s is not valid" % self.doc.sales_order)
+				frappe.throw("Sales Order: %s is not valid" % self.doc.sales_order)
 
 			if not self.doc.expected_delivery_date:
 				self.doc.expected_delivery_date = so.delivery_date
@@ -61,25 +61,25 @@
 	
 	def validate_production_order_against_so(self):
 		# already ordered qty
-		ordered_qty_against_so = webnotes.conn.sql("""select sum(qty) from `tabProduction Order`
+		ordered_qty_against_so = frappe.conn.sql("""select sum(qty) from `tabProduction Order`
 			where production_item = %s and sales_order = %s and docstatus < 2 and name != %s""", 
 			(self.doc.production_item, self.doc.sales_order, self.doc.name))[0][0]
 
 		total_qty = flt(ordered_qty_against_so) + flt(self.doc.qty)
 		
 		# get qty from Sales Order Item table
-		so_item_qty = webnotes.conn.sql("""select sum(qty) from `tabSales Order Item` 
+		so_item_qty = frappe.conn.sql("""select sum(qty) from `tabSales Order Item` 
 			where parent = %s and item_code = %s""", 
 			(self.doc.sales_order, self.doc.production_item))[0][0]
 		# get qty from Packing Item table
-		dnpi_qty = webnotes.conn.sql("""select sum(qty) from `tabPacked Item` 
+		dnpi_qty = frappe.conn.sql("""select sum(qty) from `tabPacked Item` 
 			where parent = %s and parenttype = 'Sales Order' and item_code = %s""", 
 			(self.doc.sales_order, self.doc.production_item))[0][0]
 		# total qty in SO
 		so_qty = flt(so_item_qty) + flt(dnpi_qty)
 				
 		if total_qty > so_qty:
-			webnotes.throw(_("Total production order qty for item") + ": " + 
+			frappe.throw(_("Total production order qty for item") + ": " + 
 				cstr(self.doc.production_item) + _(" against sales order") + ": " + 
 				cstr(self.doc.sales_order) + _(" will be ") + cstr(total_qty) + ", " + 
 				_("which is greater than sales order qty ") + "(" + cstr(so_qty) + ")" + 
@@ -95,32 +95,32 @@
 
 	def update_status(self, status):
 		if status == 'Stopped':
-			webnotes.conn.set(self.doc, 'status', cstr(status))
+			frappe.conn.set(self.doc, 'status', cstr(status))
 		else:
 			if flt(self.doc.qty) == flt(self.doc.produced_qty):
-				webnotes.conn.set(self.doc, 'status', 'Completed')
+				frappe.conn.set(self.doc, 'status', 'Completed')
 			if flt(self.doc.qty) > flt(self.doc.produced_qty):
-				webnotes.conn.set(self.doc, 'status', 'In Process')
+				frappe.conn.set(self.doc, 'status', 'In Process')
 			if flt(self.doc.produced_qty) == 0:
-				webnotes.conn.set(self.doc, 'status', 'Submitted')
+				frappe.conn.set(self.doc, 'status', 'Submitted')
 
 
 	def on_submit(self):
 		if not self.doc.wip_warehouse:
-			webnotes.throw(_("WIP Warehouse required before Submit"))
-		webnotes.conn.set(self.doc,'status', 'Submitted')
+			frappe.throw(_("WIP Warehouse required before Submit"))
+		frappe.conn.set(self.doc,'status', 'Submitted')
 		self.update_planned_qty(self.doc.qty)
 		
 
 	def on_cancel(self):
 		# Check whether any stock entry exists against this Production Order
-		stock_entry = webnotes.conn.sql("""select name from `tabStock Entry` 
+		stock_entry = frappe.conn.sql("""select name from `tabStock Entry` 
 			where production_order = %s and docstatus = 1""", self.doc.name)
 		if stock_entry:
-			webnotes.throw("""Submitted Stock Entry %s exists against this production order. 
+			frappe.throw("""Submitted Stock Entry %s exists against this production order. 
 				Hence can not be cancelled.""" % stock_entry[0][0])
 
-		webnotes.conn.set(self.doc,'status', 'Cancelled')
+		frappe.conn.set(self.doc,'status', 'Cancelled')
 		self.update_planned_qty(-self.doc.qty)
 
 	def update_planned_qty(self, qty):
@@ -134,9 +134,9 @@
 		from erpnext.stock.utils import update_bin
 		update_bin(args)
 
-@webnotes.whitelist()	
+@frappe.whitelist()	
 def get_item_details(item):
-	res = webnotes.conn.sql("""select stock_uom, description
+	res = frappe.conn.sql("""select stock_uom, description
 		from `tabItem` where (ifnull(end_of_life, "")="" or end_of_life > now())
 		and name=%s""", item, as_dict=1)
 	
@@ -144,18 +144,18 @@
 		return {}
 		
 	res = res[0]
-	bom = webnotes.conn.sql("""select name from `tabBOM` where item=%s 
+	bom = frappe.conn.sql("""select name from `tabBOM` where item=%s 
 		and ifnull(is_default, 0)=1""", item)
 	if bom:
 		res.bom_no = bom[0][0]
 		
 	return res
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_stock_entry(production_order_id, purpose):
-	production_order = webnotes.bean("Production Order", production_order_id)
+	production_order = frappe.bean("Production Order", production_order_id)
 		
-	stock_entry = webnotes.new_bean("Stock Entry")
+	stock_entry = frappe.new_bean("Stock Entry")
 	stock_entry.doc.purpose = purpose
 	stock_entry.doc.production_order = production_order_id
 	stock_entry.doc.company = production_order.doc.company
diff --git a/erpnext/manufacturing/doctype/production_order/test_production_order.py b/erpnext/manufacturing/doctype/production_order/test_production_order.py
index e2ff921..0733959 100644
--- a/erpnext/manufacturing/doctype/production_order/test_production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/test_production_order.py
@@ -4,8 +4,8 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-from webnotes.utils import cstr, getdate
+import frappe
+from frappe.utils import cstr, getdate
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 from erpnext.manufacturing.doctype.production_order.production_order import make_stock_entry
 
@@ -13,26 +13,26 @@
 class TestProductionOrder(unittest.TestCase):
 	def test_planned_qty(self):
 		set_perpetual_inventory(0)
-		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
-		webnotes.conn.sql("""delete from `tabBin`""")
-		webnotes.conn.sql("""delete from `tabGL Entry`""")
+		frappe.conn.sql("delete from `tabStock Ledger Entry`")
+		frappe.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("""delete from `tabGL Entry`""")
 		
-		pro_bean = webnotes.bean(copy = test_records[0])
+		pro_bean = frappe.bean(copy = test_records[0])
 		pro_bean.insert()
 		pro_bean.submit()
 		
 		from erpnext.stock.doctype.stock_entry.test_stock_entry import test_records as se_test_records
-		mr1 = webnotes.bean(copy = se_test_records[0])
+		mr1 = frappe.bean(copy = se_test_records[0])
 		mr1.insert()
 		mr1.submit()
 		
-		mr2 = webnotes.bean(copy = se_test_records[0])
+		mr2 = frappe.bean(copy = se_test_records[0])
 		mr2.doclist[1].item_code = "_Test Item Home Desktop 100"
 		mr2.insert()
 		mr2.submit()
 		
 		stock_entry = make_stock_entry(pro_bean.doc.name, "Manufacture/Repack")
-		stock_entry = webnotes.bean(stock_entry)
+		stock_entry = frappe.bean(stock_entry)
 		stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013"
 		stock_entry.doc.fg_completed_qty = 4
 		stock_entry.doc.posting_date = "2013-05-12"
@@ -40,9 +40,9 @@
 		stock_entry.run_method("get_items")
 		stock_entry.submit()
 		
-		self.assertEqual(webnotes.conn.get_value("Production Order", pro_bean.doc.name, 
+		self.assertEqual(frappe.conn.get_value("Production Order", pro_bean.doc.name, 
 			"produced_qty"), 4)
-		self.assertEqual(webnotes.conn.get_value("Bin", {"item_code": "_Test FG Item", 
+		self.assertEqual(frappe.conn.get_value("Bin", {"item_code": "_Test FG Item", 
 			"warehouse": "_Test Warehouse 1 - _TC"}, "planned_qty"), 6)
 			
 		return pro_bean.doc.name
@@ -52,7 +52,7 @@
 		pro_order = self.test_planned_qty()
 		
 		stock_entry = make_stock_entry(pro_order, "Manufacture/Repack")
-		stock_entry = webnotes.bean(stock_entry)
+		stock_entry = frappe.bean(stock_entry)
 		stock_entry.doc.posting_date = "2013-05-12"
 		stock_entry.doc.fiscal_year = "_Test Fiscal Year 2013"
 		stock_entry.doc.fg_completed_qty = 15
diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
+++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
index cb6190f..26c87f1 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
index f52fb8d..0e9231e 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 cur_frm.cscript.onload = function(doc, cdt, cdn) {
-	cur_frm.set_value("company", wn.defaults.get_default("company"))
+	cur_frm.set_value("company", frappe.defaults.get_default("company"))
 	cur_frm.set_value("use_multi_level_bom", 1)
 }
 
@@ -44,7 +44,7 @@
 			query: "erpnext.controllers.queries.bom",
 			filters:{'item': cstr(d.item_code)}
 		}
-	} else msgprint(wn._("Please enter Item first"));
+	} else msgprint(frappe._("Please enter Item first"));
 }
 
 cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 371b02c..5cef523 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, flt, cint, nowdate, add_days
-from webnotes.model.doc import addchild, Document
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import cstr, flt, cint, nowdate, add_days
+from frappe.model.doc import addchild, Document
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -17,7 +17,7 @@
 
 	def get_so_details(self, so):
 		"""Pull other details from so"""
-		so = webnotes.conn.sql("""select transaction_date, customer, grand_total 
+		so = frappe.conn.sql("""select transaction_date, customer, grand_total 
 			from `tabSales Order` where name = %s""", so, as_dict = 1)
 		ret = {
 			'sales_order_date': so and so[0]['transaction_date'] or '',
@@ -29,7 +29,7 @@
 	def get_item_details(self, item_code):
 		""" Pull other item details from item master"""
 
-		item = webnotes.conn.sql("""select description, stock_uom, default_bom 
+		item = frappe.conn.sql("""select description, stock_uom, default_bom 
 			from `tabItem` where name = %s""", item_code, as_dict =1)
 		ret = {
 			'description'	: item and item[0]['description'],
@@ -46,7 +46,7 @@
 		
 	def validate_company(self):
 		if not self.doc.company:
-			webnotes.throw(_("Please enter Company"))
+			frappe.throw(_("Please enter Company"))
 
 	def get_open_sales_orders(self):
 		""" Pull sales orders  which are pending to deliver based on criteria selected"""
@@ -61,7 +61,7 @@
 		if self.doc.fg_item:
 			item_filter += ' and item.name = "' + self.doc.fg_item + '"'
 		
-		open_so = webnotes.conn.sql("""
+		open_so = frappe.conn.sql("""
 			select distinct so.name, so.transaction_date, so.customer, so.grand_total
 			from `tabSales Order` so, `tabSales Order Item` so_item
 			where so_item.parent = so.name
@@ -108,7 +108,7 @@
 			msgprint(_("Please enter sales order in the above table"))
 			return []
 			
-		items = webnotes.conn.sql("""select distinct parent, item_code, warehouse,
+		items = frappe.conn.sql("""select distinct parent, item_code, warehouse,
 			(qty - ifnull(delivered_qty, 0)) as pending_qty
 			from `tabSales Order Item` so_item
 			where parent in (%s) and docstatus = 1 and ifnull(qty, 0) > ifnull(delivered_qty, 0)
@@ -117,7 +117,7 @@
 					or ifnull(item.is_sub_contracted_item, 'No') = 'Yes'))""" % \
 			(", ".join(["%s"] * len(so_list))), tuple(so_list), as_dict=1)
 		
-		packed_items = webnotes.conn.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as reserved_warhouse,
+		packed_items = frappe.conn.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as reserved_warhouse,
 			(((so_item.qty - ifnull(so_item.delivered_qty, 0)) * pi.qty) / so_item.qty) 
 				as pending_qty
 			from `tabSales Order Item` so_item, `tabPacked Item` pi
@@ -136,7 +136,7 @@
 		self.clear_item_table()
 
 		for p in items:
-			item_details = webnotes.conn.sql("""select description, stock_uom, default_bom 
+			item_details = frappe.conn.sql("""select description, stock_uom, default_bom 
 				from tabItem where name=%s""", p['item_code'])
 			pi = addchild(self.doc, 'pp_details', 'Production Plan Item', self.doclist)
 			pi.sales_order				= p['parent']
@@ -154,19 +154,19 @@
 		for d in getlist(self.doclist, 'pp_details'):
 			self.validate_bom_no(d)
 			if not flt(d.planned_qty):
-				webnotes.throw("Please Enter Planned Qty for item: %s at row no: %s" % 
+				frappe.throw("Please Enter Planned Qty for item: %s at row no: %s" % 
 					(d.item_code, d.idx))
 				
 	def validate_bom_no(self, d):
 		if not d.bom_no:
-			webnotes.throw("Please enter bom no for item: %s at row no: %s" % 
+			frappe.throw("Please enter bom no for item: %s at row no: %s" % 
 				(d.item_code, d.idx))
 		else:
-			bom = webnotes.conn.sql("""select name from `tabBOM` where name = %s and item = %s 
+			bom = frappe.conn.sql("""select name from `tabBOM` where name = %s and item = %s 
 				and docstatus = 1 and is_active = 1""", 
 				(d.bom_no, d.item_code), as_dict = 1)
 			if not bom:
-				webnotes.throw("""Incorrect BOM No: %s entered for item: %s at row no: %s
+				frappe.throw("""Incorrect BOM No: %s entered for item: %s at row no: %s
 					May be BOM is inactive or for other item or does not exists in the system""" % 
 					(d.bom_no, d.item_doce, d.idx))
 
@@ -216,17 +216,17 @@
 
 		pro_list = []
 		for key in items:
-			pro = webnotes.new_bean("Production Order")
+			pro = frappe.new_bean("Production Order")
 			pro.doc.fields.update(items[key])
 			
-			webnotes.flags.mute_messages = True
+			frappe.flags.mute_messages = True
 			try:
 				pro.insert()
 				pro_list.append(pro.doc.name)
 			except OverProductionError, e:
 				pass
 				
-			webnotes.flags.mute_messages = False
+			frappe.flags.mute_messages = False
 			
 		return pro_list
 
@@ -249,7 +249,7 @@
 			bom_wise_item_details = {}
 			if self.doc.use_multi_level_bom:
 				# get all raw materials with sub assembly childs					
-				for d in webnotes.conn.sql("""select fb.item_code, 
+				for d in frappe.conn.sql("""select fb.item_code, 
 					ifnull(sum(fb.qty_consumed_per_unit), 0) as qty, 
 					fb.description, fb.stock_uom, it.min_order_qty 
 					from `tabBOM Explosion Item` fb,`tabItem` it 
@@ -261,7 +261,7 @@
 			else:
 				# Get all raw materials considering SA items as raw materials, 
 				# so no childs of SA items
-				for d in webnotes.conn.sql("""select bom_item.item_code, 
+				for d in frappe.conn.sql("""select bom_item.item_code, 
 					ifnull(sum(bom_item.qty_consumed_per_unit), 0) as qty, 
 					bom_item.description, bom_item.stock_uom, item.min_order_qty 
 					from `tabBOM Item` bom_item, tabItem item 
@@ -288,7 +288,7 @@
 			total_qty = sum([flt(d[0]) for d in self.item_dict[item]])
 			for item_details in self.item_dict[item]:
 				item_list.append([item, item_details[1], item_details[2], item_details[0]])
-				item_qty = webnotes.conn.sql("""select warehouse, indented_qty, ordered_qty, actual_qty 
+				item_qty = frappe.conn.sql("""select warehouse, indented_qty, ordered_qty, actual_qty 
 					from `tabBin` where item_code = %s""", item, as_dict=1)
 				i_qty, o_qty, a_qty = 0, 0, 0
 				for w in item_qty:
@@ -307,7 +307,7 @@
 		"""
 		self.validate_data()
 		if not self.doc.purchase_request_for_warehouse:
-			webnotes.throw(_("Please enter Warehouse for which Material Request will be raised"))
+			frappe.throw(_("Please enter Warehouse for which Material Request will be raised"))
 			
 		bom_dict = self.get_distinct_items_and_boms()[0]		
 		self.get_raw_materials(bom_dict)
@@ -317,7 +317,7 @@
 
 	def get_requested_items(self):
 		item_projected_qty = self.get_projected_qty()
-		items_to_be_requested = webnotes._dict()
+		items_to_be_requested = frappe._dict()
 
 		for item, so_item_qty in self.item_dict.items():
 			requested_qty = 0
@@ -353,7 +353,7 @@
 			
 	def get_projected_qty(self):
 		items = self.item_dict.keys()
-		item_projected_qty = webnotes.conn.sql("""select item_code, sum(projected_qty) 
+		item_projected_qty = frappe.conn.sql("""select item_code, sum(projected_qty) 
 			from `tabBin` where item_code in (%s) group by item_code""" % 
 			(", ".join(["%s"]*len(items)),), tuple(items))
 
@@ -368,7 +368,7 @@
 		purchase_request_list = []
 		if items_to_be_requested:
 			for item in items_to_be_requested:
-				item_wrapper = webnotes.bean("Item", item)
+				item_wrapper = frappe.bean("Item", item)
 				pr_doclist = [{
 					"doctype": "Material Request",
 					"__islocal": 1,
@@ -377,7 +377,7 @@
 					"status": "Draft",
 					"company": self.doc.company,
 					"fiscal_year": fiscal_year,
-					"requested_by": webnotes.session.user,
+					"requested_by": frappe.session.user,
 					"material_request_type": "Purchase"
 				}]
 				for sales_order, requested_qty in items_to_be_requested[item].items():
@@ -397,7 +397,7 @@
 						"sales_order_no": sales_order if sales_order!="No Sales Order" else None
 					})
 
-				pr_wrapper = webnotes.bean(pr_doclist)
+				pr_wrapper = frappe.bean(pr_doclist)
 				pr_wrapper.ignore_permissions = 1
 				pr_wrapper.submit()
 				purchase_request_list.append(pr_wrapper.doc.name)
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index fce16a5..db4cd98 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
+from frappe.utils import flt
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
 
 	
 
@@ -17,11 +17,11 @@
     self.doclist = doclist
 
   def update_bom_operation(self):
-      bom_list = webnotes.conn.sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name)
+      bom_list = frappe.conn.sql(" select DISTINCT parent from `tabBOM Operation` where workstation = '%s'" % self.doc.name)
       for bom_no in bom_list:
-        webnotes.conn.sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no[0], self.doc.name))
+        frappe.conn.sql("update `tabBOM Operation` set hour_rate = '%s' where parent = '%s' and workstation = '%s'"%( self.doc.hour_rate, bom_no[0], self.doc.name))
   
   def on_update(self):
-    webnotes.conn.set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
-    webnotes.conn.set(self.doc, 'hour_rate', flt(self.doc.hour_rate_labour) + flt(self.doc.overhead))
+    frappe.conn.set(self.doc, 'overhead', flt(self.doc.hour_rate_electricity) + flt(self.doc.hour_rate_consumable) + flt(self.doc.hour_rate_rent))
+    frappe.conn.set(self.doc, 'hour_rate', flt(self.doc.hour_rate_labour) + flt(self.doc.overhead))
     self.update_bom_operation()
\ No newline at end of file
diff --git a/erpnext/manufacturing/page/manufacturing_home/manufacturing_home.js b/erpnext/manufacturing/page/manufacturing_home/manufacturing_home.js
index 847f8e8..ab7bfe6 100644
--- a/erpnext/manufacturing/page/manufacturing_home/manufacturing_home.js
+++ b/erpnext/manufacturing/page/manufacturing_home/manufacturing_home.js
@@ -1,86 +1,86 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Manufacturing"] = [
+frappe.module_page["Manufacturing"] = [
 	{
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		top: true,
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Bill of Materials"),
-				description: wn._("Bill of Materials (BOM)"),
+				label: frappe._("Bill of Materials"),
+				description: frappe._("Bill of Materials (BOM)"),
 				doctype:"BOM"
 			},
 			{
-				label: wn._("Production Order"),
-				description: wn._("Orders released for production."),
+				label: frappe._("Production Order"),
+				description: frappe._("Orders released for production."),
 				doctype:"Production Order"
 			},
 		]
 	},
 	{
-		title: wn._("Production Planning (MRP)"),
+		title: frappe._("Production Planning (MRP)"),
 		icon: "icon-wrench",
 		items: [
 			{
 				"route":"Form/Production Planning Tool/Production Planning Tool",
-				"label":wn._("Production Planning Tool"),
-				"description":wn._("Generate Material Requests (MRP) and Production Orders."),
+				"label":frappe._("Production Planning Tool"),
+				"description":frappe._("Generate Material Requests (MRP) and Production Orders."),
 				doctype: "Production Planning Tool"
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Item"),
-				description: wn._("All Products or Services."),
+				label: frappe._("Item"),
+				description: frappe._("All Products or Services."),
 				doctype:"Item"
 			},
 			{
-				label: wn._("Workstation"),
-				description: wn._("Where manufacturing operations are carried out."),
+				label: frappe._("Workstation"),
+				description: frappe._("Where manufacturing operations are carried out."),
 				doctype:"Workstation"
 			},
 		]
 	},
 	{
-		title: wn._("Utility"),
+		title: frappe._("Utility"),
 		icon: "icon-wrench",
 		items: [
 			{
 				"route":"Form/BOM Replace Tool/BOM Replace Tool",
-				"label":wn._("BOM Replace Tool"),
-				"description":wn._("Replace Item / BOM in all BOMs"),
+				"label":frappe._("BOM Replace Tool"),
+				"description":frappe._("Replace Item / BOM in all BOMs"),
 				doctype: "BOM Replace Tool"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Open Production Orders"),
+				"label":frappe._("Open Production Orders"),
 				route: "query-report/Open Production Orders",
 				doctype:"Production Order"
 			},
 			{
-				"label":wn._("Production Orders in Progress"),
+				"label":frappe._("Production Orders in Progress"),
 				route: "query-report/Production Orders in Progress",
 				doctype:"Production Order"
 			},
 			{
-				"label":wn._("Issued Items Against Production Order"),
+				"label":frappe._("Issued Items Against Production Order"),
 				route: "query-report/Issued Items Against Production Order",
 				doctype:"Production Order"
 			},
 			{
-				"label":wn._("Completed Production Orders"),
+				"label":frappe._("Completed Production Orders"),
 				route: "query-report/Completed Production Orders",
 				doctype:"Production Order"
 			},
@@ -89,5 +89,5 @@
 ]
 
 pscript['onload_manufacturing-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Manufacturing");
+	frappe.views.moduleview.make(wrapper, "Manufacturing");
 }
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 5d29096..1b6553b 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -3,21 +3,21 @@
 erpnext.patches.4_0.move_warehouse_user_to_restrictions
 erpnext.patches.4_0.new_permissions
 erpnext.patches.4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
-execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29
-execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
-execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
-execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
+execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29
+execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
+execute:frappe.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
+execute:frappe.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
 erpnext.patches.4_0.reload_sales_print_format
-execute:webnotes.reload_doc('accounts', 'doctype', 'purchase_invoice') # 2014-01-29
-execute:webnotes.reload_doc('buying', 'doctype', 'purchase_order') # 2014-01-29
-execute:webnotes.reload_doc('buying', 'doctype', 'supplier_quotation') # 2014-01-29
-execute:webnotes.reload_doc('stock', 'doctype', 'purchase_receipt') # 2014-01-29
+execute:frappe.reload_doc('accounts', 'doctype', 'purchase_invoice') # 2014-01-29
+execute:frappe.reload_doc('buying', 'doctype', 'purchase_order') # 2014-01-29
+execute:frappe.reload_doc('buying', 'doctype', 'supplier_quotation') # 2014-01-29
+execute:frappe.reload_doc('stock', 'doctype', 'purchase_receipt') # 2014-01-29
 erpnext.patches.4_0.reload_purchase_print_format
-execute:webnotes.reload_doc('accounts', 'doctype', 'pos_setting') # 2014-01-29
-execute:webnotes.reload_doc('selling', 'doctype', 'customer') # 2014-01-29
-execute:webnotes.reload_doc('buying', 'doctype', 'supplier') # 2014-01-29
+execute:frappe.reload_doc('accounts', 'doctype', 'pos_setting') # 2014-01-29
+execute:frappe.reload_doc('selling', 'doctype', 'customer') # 2014-01-29
+execute:frappe.reload_doc('buying', 'doctype', 'supplier') # 2014-01-29
 erpnext.patches.4_0.map_charge_to_taxes_and_charges
-execute:webnotes.reload_doc('support', 'doctype', 'newsletter') # 2014-01-31
-execute:webnotes.reload_doc('hr', 'doctype', 'employee') # 2014-02-03
-execute:webnotes.conn.sql("update tabPage set module='Core' where name='Setup'")
+execute:frappe.reload_doc('support', 'doctype', 'newsletter') # 2014-01-31
+execute:frappe.reload_doc('hr', 'doctype', 'employee') # 2014-02-03
+execute:frappe.conn.sql("update tabPage set module='Core' where name='Setup'")
 erpnext.patches.4_0.fields_to_be_renamed
diff --git a/erpnext/patches/1311/__init__.py b/erpnext/patches/1311/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/1311/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/1311/p01_cleanup.py b/erpnext/patches/1311/p01_cleanup.py
deleted file mode 100644
index 23f6576..0000000
--- a/erpnext/patches/1311/p01_cleanup.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "material_request")
-	webnotes.reload_doc("buying", "doctype", "purchase_order")
-	webnotes.reload_doc("selling", "doctype", "lead")
-
-	from webnotes.core.doctype.custom_field.custom_field import create_custom_field_if_values_exist
-	
-	create_custom_field_if_values_exist("Material Request", 
-		{"fieldtype":"Text", "fieldname":"remark", "label":"Remarks","insert_after":"Fiscal Year"})
-	create_custom_field_if_values_exist("Purchase Order", 
-		{"fieldtype":"Text", "fieldname":"instructions", "label":"Instructions","insert_after":"% Billed"})		
-	create_custom_field_if_values_exist("Purchase Order", 
-		{"fieldtype":"Text", "fieldname":"remarks", "label":"Remarks","insert_after":"% Billed"})
-	create_custom_field_if_values_exist("Purchase Order", 
-		{"fieldtype":"Text", "fieldname":"payment_terms", "label":"Payment Terms","insert_after":"Print Heading"})		
-	create_custom_field_if_values_exist("Lead", 
-		{"fieldtype":"Text", "fieldname":"remark", "label":"Remark","insert_after":"Territory"})
-		
\ No newline at end of file
diff --git a/erpnext/patches/1311/p01_make_gl_entries_for_si.py b/erpnext/patches/1311/p01_make_gl_entries_for_si.py
deleted file mode 100644
index acd52cd..0000000
--- a/erpnext/patches/1311/p01_make_gl_entries_for_si.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	si_no_gle = webnotes.conn.sql("""select si.name from `tabSales Invoice` si 
-		where docstatus=1 and not exists(select name from `tabGL Entry` 
-			where voucher_type='Sales Invoice' and voucher_no=si.name) 
-		and modified >= '2013-08-01'""")
-
-	for si in si_no_gle:
-		webnotes.get_obj("Sales Invoice", si[0]).make_gl_entries()
\ No newline at end of file
diff --git a/erpnext/patches/1311/p02_index_singles.py b/erpnext/patches/1311/p02_index_singles.py
deleted file mode 100644
index ea67ad6..0000000
--- a/erpnext/patches/1311/p02_index_singles.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-
-def execute():
-	import webnotes
-	if not webnotes.conn.sql("""show index from `tabSingles` 
-		where Key_name="singles_doctype_field_index" """):
-		webnotes.conn.commit()
-		webnotes.conn.sql("""alter table `tabSingles` 
-			add index singles_doctype_field_index(`doctype`, `field`)""")
\ No newline at end of file
diff --git a/erpnext/patches/1311/p03_update_reqd_report_fields.py b/erpnext/patches/1311/p03_update_reqd_report_fields.py
deleted file mode 100644
index a2207cc..0000000
--- a/erpnext/patches/1311/p03_update_reqd_report_fields.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-def execute():
-    import webnotes
-    
-    # report_name
-    webnotes.conn.sql("""update `tabReport` set report_name=name where ifnull(report_name, '')=''""")
-    
-    # report_type
-    webnotes.conn.sql("""update `tabReport` set report_type='Report Builder' 
-        where ifnull(report_type, '')='' and ifnull(json, '')!=''""")
-    
-    # is_standard
-    webnotes.conn.sql("""update `tabReport` set is_standard='No' where ifnull(is_standard, '')=''""")
\ No newline at end of file
diff --git a/erpnext/patches/1311/p04_update_comments.py b/erpnext/patches/1311/p04_update_comments.py
deleted file mode 100644
index b076475..0000000
--- a/erpnext/patches/1311/p04_update_comments.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.auto_commit_on_many_writes = True
-	for name in webnotes.conn.sql_list("""select name from tabComment"""):
-		webnotes.get_obj("Comment", name).update_comment_in_doc()
-	webnotes.conn.auto_commit_on_many_writes = False
-	
diff --git a/erpnext/patches/1311/p04_update_year_end_date_of_fiscal_year.py b/erpnext/patches/1311/p04_update_year_end_date_of_fiscal_year.py
deleted file mode 100644
index 0b0399a..0000000
--- a/erpnext/patches/1311/p04_update_year_end_date_of_fiscal_year.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("accounts", "doctype", "fiscal_year")
-
-	webnotes.conn.sql("""update `tabFiscal Year` set year_end_date = 
-		subdate(adddate(year_start_date, interval 1 year), interval 1 day)""")
\ No newline at end of file
diff --git a/erpnext/patches/1311/p05_website_brand_html.py b/erpnext/patches/1311/p05_website_brand_html.py
deleted file mode 100644
index 04d2f83..0000000
--- a/erpnext/patches/1311/p05_website_brand_html.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	bean = webnotes.bean("Website Settings")
-	for company in webnotes.conn.sql_list("select name from `tabCompany`"):
-		if bean.doc.banner_html == ("""<h3 style='margin-bottom: 20px;'>""" + company + "</h3>"):
-			bean.doc.banner_html = None
-			if not bean.doc.brand_html:
-				bean.doc.brand_html = company
-
-			bean.save()
-			break
\ No newline at end of file
diff --git a/erpnext/patches/1311/p06_fix_report_columns.py b/erpnext/patches/1311/p06_fix_report_columns.py
deleted file mode 100644
index 4132f17..0000000
--- a/erpnext/patches/1311/p06_fix_report_columns.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-import json
-
-def execute():
-	doctypes_child_tables_map = {}
-
-	# Get all saved report columns
-	columns = webnotes.conn.sql("""select defvalue, defkey from `tabDefaultValue` where 
-		defkey like '_list_settings:%'""")
-
-	# Make map of doctype and child tables
-	for value, key in columns:
-		doctype = key.split(':')[-1]
-		child_tables = webnotes.conn.sql_list("""select options from `tabDocField` 
-			where parent=%s and fieldtype='Table'""", doctype)
-		doctypes_child_tables_map.setdefault(doctype, child_tables + [doctype])
-
-	# If defvalue contains child doctypes then only append the column
-	for value, key in columns:
-		new_columns = []
-		column_doctype = key.split(':')[-1]
-		for field, field_doctype in json.loads(value):
-			if field_doctype in doctypes_child_tables_map.get(column_doctype):
-				new_columns.append([field, field_doctype])
-
-		if new_columns:
-			webnotes.conn.sql("""update `tabDefaultValue` set defvalue=%s 
-				where defkey=%s""" % ('%s', '%s'), (json.dumps(new_columns), key))
-		else:
-			webnotes.conn.sql("""delete from `tabDefaultValue` where defkey=%s""", key)
\ No newline at end of file
diff --git a/erpnext/patches/1311/p07_scheduler_errors_digest.py b/erpnext/patches/1311/p07_scheduler_errors_digest.py
deleted file mode 100644
index 4527f18..0000000
--- a/erpnext/patches/1311/p07_scheduler_errors_digest.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("setup", "doctype", "email_digest")
-	
-	from webnotes.profile import get_system_managers
-	system_managers = get_system_managers(only_name=True)
-	if not system_managers: 
-		return
-	
-	# no default company
-	company = webnotes.conn.sql_list("select name from `tabCompany`")
-	if company:
-		company = company[0]
-	if not company:
-		return
-	
-	# scheduler errors digest
-	edigest = webnotes.new_bean("Email Digest")
-	edigest.doc.fields.update({
-		"name": "Scheduler Errors",
-		"company": company,
-		"frequency": "Daily",
-		"enabled": 1,
-		"recipient_list": "\n".join(system_managers),
-		"scheduler_errors": 1
-	})
-	edigest.insert()
diff --git a/erpnext/patches/1311/p08_email_digest_recipients.py b/erpnext/patches/1311/p08_email_digest_recipients.py
deleted file mode 100644
index fad5408..0000000
--- a/erpnext/patches/1311/p08_email_digest_recipients.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	from webnotes.utils import extract_email_id
-	for name, recipients in webnotes.conn.sql("""select name, recipient_list from `tabEmail Digest`"""):
-		recipients = "\n".join([extract_email_id(r) for r in recipients.split("\n")])
-		webnotes.conn.set_value("Email Digest", name, "recipient_list", recipients)
\ No newline at end of file
diff --git a/erpnext/patches/1312/__init__.py b/erpnext/patches/1312/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/1312/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/1312/p01_delete_old_stock_reports.py b/erpnext/patches/1312/p01_delete_old_stock_reports.py
deleted file mode 100644
index e8d620b..0000000
--- a/erpnext/patches/1312/p01_delete_old_stock_reports.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes, os, shutil
-	from webnotes.utils import get_base_path
-	
-	webnotes.delete_doc('Page', 'stock-ledger')
-	webnotes.delete_doc('Page', 'stock-ageing')
-	webnotes.delete_doc('Page', 'stock-level')
-	webnotes.delete_doc('Page', 'general-ledger')
-	
-	for d in [["stock", "stock_ledger"], ["stock", "stock_ageing"],
-		 	["stock", "stock_level"], ["accounts", "general_ledger"]]:
-		path = os.path.join(get_base_path(), "app", d[0], "page", d[1])
-		if os.path.exists(path):
-			shutil.rmtree(path)
\ No newline at end of file
diff --git a/erpnext/patches/1312/p02_update_item_details_in_item_price.py b/erpnext/patches/1312/p02_update_item_details_in_item_price.py
deleted file mode 100644
index c19988c..0000000
--- a/erpnext/patches/1312/p02_update_item_details_in_item_price.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update `tabItem Price` ip INNER JOIN `tabItem` i 
-		ON (ip.item_code = i.name) 
-		set ip.item_name = i.item_name, ip.item_description = i.description""")
\ No newline at end of file
diff --git a/erpnext/patches/1401/__init__.py b/erpnext/patches/1401/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/1401/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/1401/enable_all_price_list.py b/erpnext/patches/1401/enable_all_price_list.py
deleted file mode 100644
index 9cf141f..0000000
--- a/erpnext/patches/1401/enable_all_price_list.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2014, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "price_list")
-	webnotes.conn.sql("""update `tabPrice List` set enabled=1""")
\ No newline at end of file
diff --git a/erpnext/patches/1401/fix_planned_qty.py b/erpnext/patches/1401/fix_planned_qty.py
deleted file mode 100644
index 979d949..0000000
--- a/erpnext/patches/1401/fix_planned_qty.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.conn.auto_commit_on_many_writes = 1
-	from utilities.repost_stock import repost_stock
-	for d in webnotes.conn.sql("""select distinct production_item, fg_warehouse 
-		from `tabProduction Order` where docstatus>0""", as_dict=1):
-			repost_stock(d.production_item, d.fg_warehouse)
-			
-	webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/patches/1401/fix_serial_no_status_and_warehouse.py b/erpnext/patches/1401/fix_serial_no_status_and_warehouse.py
deleted file mode 100644
index 9e5579c..0000000
--- a/erpnext/patches/1401/fix_serial_no_status_and_warehouse.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-
-def execute():	
-	serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where docstatus=0 
-		and status in ('Available', 'Sales Returned') and ifnull(warehouse, '') = ''""")
-	for sr in serial_nos:
-		try:
-			last_sle = webnotes.bean("Serial No", sr[0]).make_controller().get_last_sle()
-			if last_sle.actual_qty > 0:
-				webnotes.conn.set_value("Serial No", sr[0], "warehouse", last_sle.warehouse)
-				
-			webnotes.conn.commit()
-		except:
-			pass
\ No newline at end of file
diff --git a/erpnext/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py b/erpnext/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py
deleted file mode 100644
index b764a7f..0000000
--- a/erpnext/patches/1401/p01_make_buying_selling_as_check_box_in_price_list.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (c) 2014, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "price_list")
-	webnotes.reload_doc("stock", "doctype", "item_price")
-
-	if "buying_or_selling" in webnotes.conn.get_table_columns("Price List"):
-		webnotes.conn.sql("""update `tabPrice List` set 
-			selling = 
-				case 
-					when buying_or_selling='Selling' 
-					then 1 
-				end, 
-			buying = 
-				case 
-					when buying_or_selling='Buying' 
-					then 1 
-				end
-			""")
-		webnotes.conn.sql("""update `tabItem Price` ip, `tabPrice List` pl 
-			set ip.buying=pl.buying, ip.selling=pl.selling
-			where ip.price_list=pl.name""")
-
-	webnotes.conn.sql("""update `tabItem Price` set selling=1 where ifnull(selling, 0)=0 and 
-		ifnull(buying, 0)=0""")
\ No newline at end of file
diff --git a/erpnext/patches/1401/p01_move_related_property_setters_to_custom_field.py b/erpnext/patches/1401/p01_move_related_property_setters_to_custom_field.py
deleted file mode 100644
index cf9221b..0000000
--- a/erpnext/patches/1401/p01_move_related_property_setters_to_custom_field.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "custom_field")
-	
-	cf_doclist = webnotes.get_doctype("Custom Field")
-
-	delete_list = []
-	for d in webnotes.conn.sql("""select cf.name as cf_name, ps.property, 
-			ps.value, ps.name as ps_name
-		from `tabProperty Setter` ps, `tabCustom Field` cf
-		where ps.doctype_or_field = 'DocField' and ps.property != 'previous_field'
-		and ps.doc_type=cf.dt and ps.field_name=cf.fieldname""", as_dict=1):
-			if cf_doclist.get_field(d.property):
-				webnotes.conn.sql("""update `tabCustom Field` 
-					set `%s`=%s where name=%s""" % (d.property, '%s', '%s'), (d.value, d.cf_name))
-				
-				delete_list.append(d.ps_name)
-	
-	if delete_list:
-		webnotes.conn.sql("""delete from `tabProperty Setter` where name in (%s)""" % 
-			', '.join(['%s']*len(delete_list)), tuple(delete_list))
\ No newline at end of file
diff --git a/erpnext/patches/1401/update_billing_status_for_zero_value_order.py b/erpnext/patches/1401/update_billing_status_for_zero_value_order.py
deleted file mode 100644
index afeed55..0000000
--- a/erpnext/patches/1401/update_billing_status_for_zero_value_order.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-from webnotes.utils import flt
-
-def execute():
-	for order_type in ["Sales", "Purchase"]:
-		for d in webnotes.conn.sql("""select par.name, sum(ifnull(child.qty, 0)) as total_qty 
-			from `tab%s Order` par, `tab%s Order Item` child  
-			where par.name = child.parent and par.docstatus = 1 
-			and ifnull(par.net_total, 0) = 0 group by par.name""" % 
-			(order_type, order_type), as_dict=1):
-				
-				billed_qty = flt(webnotes.conn.sql("""select sum(ifnull(qty, 0)) 
-					from `tab%s Invoice Item` where %s=%s and docstatus=1""" % 
-					(order_type, "sales_order" if order_type=="Sales" else "purchase_order", '%s'), 
-					(d.name))[0][0])
-				
-				per_billed = ((d.total_qty if billed_qty > d.total_qty else billed_qty)\
-					/ d.total_qty)*100
-				webnotes.conn.set_value(order_type+ " Order", d.name, "per_billed", per_billed)
-				
-				if order_type == "Sales":
-					if per_billed < 0.001: billing_status = "Not Billed"
-					elif per_billed >= 99.99: billing_status = "Fully Billed"
-					else: billing_status = "Partly Billed"
-	
-					webnotes.conn.set_value("Sales Order", d.name, "billing_status", billing_status)
\ No newline at end of file
diff --git a/erpnext/patches/4_0/fields_to_be_renamed.py b/erpnext/patches/4_0/fields_to_be_renamed.py
index e973cdd..105aa15 100644
--- a/erpnext/patches/4_0/fields_to_be_renamed.py
+++ b/erpnext/patches/4_0/fields_to_be_renamed.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.model import rename_field
+import frappe
+from frappe.model import rename_field
 
 
 def execute():
@@ -109,22 +109,22 @@
 			
 def reload_docs(docs):
 	for dn in docs:
-		webnotes.reload_doc(get_module(dn),	"doctype", dn.lower().replace(" ", "_"))
+		frappe.reload_doc(get_module(dn),	"doctype", dn.lower().replace(" ", "_"))
 	
 	# reload all standard print formats
-	for pf in webnotes.conn.sql("""select name, module from `tabPrint Format` 
+	for pf in frappe.conn.sql("""select name, module from `tabPrint Format` 
 			where ifnull(standard, 'No') = 'Yes'""", as_dict=1):
 		try:
-			webnotes.reload_doc(pf.module, "Print Format", pf.name)
+			frappe.reload_doc(pf.module, "Print Format", pf.name)
 		except Exception, e:
 			print e
 			pass
 		
 	# reload all standard reports
-	for r in webnotes.conn.sql("""select name, ref_doctype from `tabReport` 
+	for r in frappe.conn.sql("""select name, ref_doctype from `tabReport` 
 		where ifnull(is_standard, 'No') = 'Yes'
 		and report_type in ('Report Builder', 'Query Report')""", as_dict=1):
-			webnotes.reload_doc(get_module(r.ref_doctype), "Report", r.name)
+			frappe.reload_doc(get_module(r.ref_doctype), "Report", r.name)
 			
 def get_module(dn):
-	return webnotes.conn.get_value("DocType", dn, "module").lower().replace(" ", "_")
\ No newline at end of file
+	return frappe.conn.get_value("DocType", dn, "module").lower().replace(" ", "_")
\ No newline at end of file
diff --git a/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py b/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py
index 6656cee..1f3c2bb 100644
--- a/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py
+++ b/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py
@@ -2,15 +2,15 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute():
 	# udpate sales cycle
 	for d in ['Sales Invoice', 'Sales Order', 'Quotation', 'Delivery Note']:
-		webnotes.conn.sql("""update `tab%s` set taxes_and_charges=charge""" % d)
+		frappe.conn.sql("""update `tab%s` set taxes_and_charges=charge""" % d)
 
 	# udpate purchase cycle
 	for d in ['Purchase Invoice', 'Purchase Order', 'Supplier Quotation', 'Purchase Receipt']:
-		webnotes.conn.sql("""update `tab%s` set taxes_and_charges=purchase_other_charges""" % d)
+		frappe.conn.sql("""update `tab%s` set taxes_and_charges=purchase_other_charges""" % d)
 	
-	webnotes.conn.sql("""update `tabPurchase Taxes and Charges` set parentfield='other_charges'""")
\ No newline at end of file
+	frappe.conn.sql("""update `tabPurchase Taxes and Charges` set parentfield='other_charges'""")
\ No newline at end of file
diff --git a/erpnext/patches/4_0/move_warehouse_user_to_restrictions.py b/erpnext/patches/4_0/move_warehouse_user_to_restrictions.py
index 8622239..6125cdd 100644
--- a/erpnext/patches/4_0/move_warehouse_user_to_restrictions.py
+++ b/erpnext/patches/4_0/move_warehouse_user_to_restrictions.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute():
-	from webnotes.core.page.user_properties import user_properties
-	for warehouse, profile in webnotes.conn.sql("""select parent, user from `tabWarehouse User`"""):
+	from frappe.core.page.user_properties import user_properties
+	for warehouse, profile in frappe.conn.sql("""select parent, user from `tabWarehouse User`"""):
 		user_properties.add(profile, "Warehouse", warehouse)
 	
-	webnotes.delete_doc("DocType", "Warehouse User")
-	webnotes.reload_doc("stock", "doctype", "warehouse")
\ No newline at end of file
+	frappe.delete_doc("DocType", "Warehouse User")
+	frappe.reload_doc("stock", "doctype", "warehouse")
\ No newline at end of file
diff --git a/erpnext/patches/4_0/new_permissions.py b/erpnext/patches/4_0/new_permissions.py
index 9dffdd4..14f9f15 100644
--- a/erpnext/patches/4_0/new_permissions.py
+++ b/erpnext/patches/4_0/new_permissions.py
@@ -2,23 +2,23 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute():
 	# reset Page perms
-	from webnotes.core.page.permission_manager.permission_manager import reset
+	from frappe.core.page.permission_manager.permission_manager import reset
 	reset("Page")
 	reset("Report")
 	
 	# patch to move print, email into DocPerm
-	for doctype, hide_print, hide_email in webnotes.conn.sql("""select name, ifnull(allow_print, 0), ifnull(allow_email, 0)
+	for doctype, hide_print, hide_email in frappe.conn.sql("""select name, ifnull(allow_print, 0), ifnull(allow_email, 0)
 		from `tabDocType` where ifnull(issingle, 0)=0 and ifnull(istable, 0)=0 and
 		(ifnull(allow_print, 0)=0 or ifnull(allow_email, 0)=0)"""):
 		
 		if not hide_print:
-			webnotes.conn.sql("""update `tabDocPerm` set `print`=1
+			frappe.conn.sql("""update `tabDocPerm` set `print`=1
 				where permlevel=0 and `read`=1 and parent=%s""", doctype)
 		
 		if not hide_email:
-			webnotes.conn.sql("""update `tabDocPerm` set `email`=1
+			frappe.conn.sql("""update `tabDocPerm` set `email`=1
 				where permlevel=0 and `read`=1 and parent=%s""", doctype)
diff --git a/erpnext/patches/4_0/reload_purchase_print_format.py b/erpnext/patches/4_0/reload_purchase_print_format.py
index 83f95c0..d8f0433 100644
--- a/erpnext/patches/4_0/reload_purchase_print_format.py
+++ b/erpnext/patches/4_0/reload_purchase_print_format.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute():
-	webnotes.reload_doc('buying', 'Print Format', 'Purchase Order Classic')
-	webnotes.reload_doc('buying', 'Print Format', 'Purchase Order Modern')
-	webnotes.reload_doc('buying', 'Print Format', 'Purchase Order Spartan')
\ No newline at end of file
+	frappe.reload_doc('buying', 'Print Format', 'Purchase Order Classic')
+	frappe.reload_doc('buying', 'Print Format', 'Purchase Order Modern')
+	frappe.reload_doc('buying', 'Print Format', 'Purchase Order Spartan')
\ No newline at end of file
diff --git a/erpnext/patches/4_0/reload_sales_print_format.py b/erpnext/patches/4_0/reload_sales_print_format.py
index f4cf446..a06e3cd 100644
--- a/erpnext/patches/4_0/reload_sales_print_format.py
+++ b/erpnext/patches/4_0/reload_sales_print_format.py
@@ -2,19 +2,19 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute():
-	webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice')
-	webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
-	webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
-	webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
-	webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic')
-	webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern')
-	webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan')
-	webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic')
-	webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern')
-	webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan')
-	webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic')
-	webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern')
-	webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan')
\ No newline at end of file
+	frappe.reload_doc('accounts', 'Print Format', 'POS Invoice')
+	frappe.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
+	frappe.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
+	frappe.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')
+	frappe.reload_doc('selling', 'Print Format', 'Quotation Classic')
+	frappe.reload_doc('selling', 'Print Format', 'Quotation Modern')
+	frappe.reload_doc('selling', 'Print Format', 'Quotation Spartan')
+	frappe.reload_doc('selling', 'Print Format', 'Sales Order Classic')
+	frappe.reload_doc('selling', 'Print Format', 'Sales Order Modern')
+	frappe.reload_doc('selling', 'Print Format', 'Sales Order Spartan')
+	frappe.reload_doc('stock', 'Print Format', 'Delivery Note Classic')
+	frappe.reload_doc('stock', 'Print Format', 'Delivery Note Modern')
+	frappe.reload_doc('stock', 'Print Format', 'Delivery Note Spartan')
\ No newline at end of file
diff --git a/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py b/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py
index 2a488f4..cd5d954 100644
--- a/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py
+++ b/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute():
-	webnotes.reload_doc("support", "doctype", "maintenance_schedule_detail")
-	webnotes.reload_doc("support", "doctype", "maintenance_schedule_item")
+	frappe.reload_doc("support", "doctype", "maintenance_schedule_detail")
+	frappe.reload_doc("support", "doctype", "maintenance_schedule_item")
 	
-	webnotes.conn.sql("""update `tabMaintenance Schedule Detail` set sales_person=incharge_name""")
-	webnotes.conn.sql("""update `tabMaintenance Schedule Item` set sales_person=incharge_name""")
\ No newline at end of file
+	frappe.conn.sql("""update `tabMaintenance Schedule Detail` set sales_person=incharge_name""")
+	frappe.conn.sql("""update `tabMaintenance Schedule Item` set sales_person=incharge_name""")
\ No newline at end of file
diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/4_0/update_user_properties.py
index 54aed64..cb71bf1 100644
--- a/erpnext/patches/4_0/update_user_properties.py
+++ b/erpnext/patches/4_0/update_user_properties.py
@@ -2,50 +2,50 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.permissions
-import webnotes.model.doctype
-import webnotes.defaults
+import frappe
+import frappe.permissions
+import frappe.model.doctype
+import frappe.defaults
 
 def execute():
-	webnotes.reload_doc("core", "doctype", "docperm")
+	frappe.reload_doc("core", "doctype", "docperm")
 	update_user_properties()
 	update_user_match()
 	add_employee_restrictions_to_leave_approver()
 	update_permissions()
 	remove_duplicate_restrictions()
-	webnotes.defaults.clear_cache()
-	webnotes.clear_cache()
+	frappe.defaults.clear_cache()
+	frappe.clear_cache()
 
 def update_user_properties():
-	webnotes.reload_doc("core", "doctype", "docfield")
+	frappe.reload_doc("core", "doctype", "docfield")
 	
-	for d in webnotes.conn.sql("""select parent, defkey, defvalue from tabDefaultValue
+	for d in frappe.conn.sql("""select parent, defkey, defvalue from tabDefaultValue
 		where parent not in ('__global', 'Control Panel')""", as_dict=True):
-		df = webnotes.conn.sql("""select options from tabDocField
+		df = frappe.conn.sql("""select options from tabDocField
 			where fieldname=%s and fieldtype='Link'""", d.defkey, as_dict=True)
 		
 		if df:
-			webnotes.conn.sql("""update tabDefaultValue
+			frappe.conn.sql("""update tabDefaultValue
 				set defkey=%s, parenttype='Restriction'
 				where defkey=%s and
 				parent not in ('__global', 'Control Panel')""", (df[0].options, d.defkey))
 
 def update_user_match():
-	import webnotes.defaults
+	import frappe.defaults
 	doctype_matches = {}
-	for doctype, match in webnotes.conn.sql("""select parent, `match` from `tabDocPerm`
+	for doctype, match in frappe.conn.sql("""select parent, `match` from `tabDocPerm`
 		where `match` like %s and ifnull(`match`, '')!="leave_approver:user" """, "%:user"):
 		doctype_matches.setdefault(doctype, []).append(match)
 	
 	for doctype, user_matches in doctype_matches.items():
-		meta = webnotes.get_doctype(doctype)
+		meta = frappe.get_doctype(doctype)
 		
 		# for each user with roles of this doctype, check if match condition applies
-		for profile in webnotes.conn.sql_list("""select name from `tabProfile`
+		for profile in frappe.conn.sql_list("""select name from `tabProfile`
 			where enabled=1 and user_type='System User'"""):
 			
-			user_roles = webnotes.get_roles(profile)
+			user_roles = frappe.get_roles(profile)
 			
 			perms = meta.get({"doctype": "DocPerm", "permlevel": 0, 
 				"role": ["in", [["All"] + user_roles]], "read": 1})
@@ -68,39 +68,39 @@
 			# if match condition applies, restrict that user
 			# add that doc's restriction to that user
 			for match in user_matches:
-				for name in webnotes.conn.sql_list("""select name from `tab{doctype}`
+				for name in frappe.conn.sql_list("""select name from `tab{doctype}`
 					where `{field}`=%s""".format(doctype=doctype, field=match.split(":")[0]), profile):
 					
-					webnotes.defaults.add_default(doctype, name, profile, "Restriction")
+					frappe.defaults.add_default(doctype, name, profile, "Restriction")
 					
 def add_employee_restrictions_to_leave_approver():
-	from webnotes.core.page.user_properties import user_properties
+	from frappe.core.page.user_properties import user_properties
 	
 	# add restrict rights to HR User and HR Manager
-	webnotes.conn.sql("""update `tabDocPerm` set `restrict`=1 where parent in ('Employee', 'Leave Application')
+	frappe.conn.sql("""update `tabDocPerm` set `restrict`=1 where parent in ('Employee', 'Leave Application')
 		and role in ('HR User', 'HR Manager') and permlevel=0 and `read`=1""")
-	webnotes.model.doctype.clear_cache()
+	frappe.model.doctype.clear_cache()
 	
 	# add Employee restrictions (in on_update method)
-	for employee in webnotes.conn.sql_list("""select name from `tabEmployee`
+	for employee in frappe.conn.sql_list("""select name from `tabEmployee`
 		where exists(select leave_approver from `tabEmployee Leave Approver`
 			where `tabEmployee Leave Approver`.parent=`tabEmployee`.name)
 		or ifnull(`reports_to`, '')!=''"""):
 		
-		webnotes.bean("Employee", employee).save()
+		frappe.bean("Employee", employee).save()
 
 def update_permissions():
 	# clear match conditions other than owner
-	webnotes.conn.sql("""update tabDocPerm set `match`=''
+	frappe.conn.sql("""update tabDocPerm set `match`=''
 		where ifnull(`match`,'') not in ('', 'owner')""")
 
 def remove_duplicate_restrictions():
 	# remove duplicate restrictions (if they exist)
-	for d in webnotes.conn.sql("""select parent, defkey, defvalue,
+	for d in frappe.conn.sql("""select parent, defkey, defvalue,
 		count(*) as cnt from tabDefaultValue
 		where parent not in ('__global', 'Control Panel')
 		group by parent, defkey, defvalue""", as_dict=1):
 		if d.cnt > 1:
 			# order by parenttype so that restriction does not get removed!
-			webnotes.conn.sql("""delete from tabDefaultValue where parent=%s, defkey=%s,
+			frappe.conn.sql("""delete from tabDefaultValue where parent=%s, defkey=%s,
 				defvalue=%s order by parenttype limit %s""", (d.parent, d.defkey, d.defvalue, d.cnt-1))
diff --git a/erpnext/patches/april_2013/__init__.py b/erpnext/patches/april_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/april_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/april_2013/p01_update_serial_no_valuation_rate.py b/erpnext/patches/april_2013/p01_update_serial_no_valuation_rate.py
deleted file mode 100644
index c6f0612..0000000
--- a/erpnext/patches/april_2013/p01_update_serial_no_valuation_rate.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-from webnotes.utils import cstr
-from erpnext.stock.stock_ledger import update_entries_after
-
-def execute():
-	webnotes.conn.auto_commit_on_many_writes = 1
-	
-	pr_items = webnotes.conn.sql("""select item_code, warehouse, serial_no, valuation_rate, name 
-		from `tabPurchase Receipt Item` where ifnull(serial_no, '') != '' and docstatus = 1""", 
-		as_dict=True)
-		
-	item_warehouse = []
-		
-	for item in pr_items:
-		serial_nos = cstr(item.serial_no).strip().split("\n")
-		serial_nos = map(lambda x: x.strip(), serial_nos)
-
-		if cstr(item.serial_no) != "\n".join(serial_nos):
-			webnotes.conn.sql("""update `tabPurchase Receipt Item` set serial_no = %s 
-				where name = %s""", ("\n".join(serial_nos), item.name))
-			
-			if [item.item_code, item.warehouse] not in item_warehouse:
-				item_warehouse.append([item.item_code, item.warehouse])
-		
-			webnotes.conn.sql("""update `tabSerial No` set purchase_rate = %s 
-				where name in (%s)""" % ('%s', ', '.join(['%s']*len(serial_nos))), 
-				tuple([item.valuation_rate] + serial_nos))
-
-	for d in item_warehouse:
-		try:
-			update_entries_after({"item_code": d[0], "warehouse": d[1] })
-		except:
-			continue
-			
-	webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p02_add_country_and_currency.py b/erpnext/patches/april_2013/p02_add_country_and_currency.py
deleted file mode 100644
index 8a48837..0000000
--- a/erpnext/patches/april_2013/p02_add_country_and_currency.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	if not webnotes.conn.exists("Country", "Aruba"):
-		webnotes.bean({
-			"doctype": "Country",
-			"country_name": "Aruba",
-			"time_zones": "America/Aruba",
-			"date_format": "mm-dd-yyyy"
-		}).insert()
-		
-	if not webnotes.conn.exists("Currency", "AWG"):
-		webnotes.bean({
-			"doctype": "Currency",
-			"currency_name": "AWG",
-			"fraction": "Cent",
-			"fraction_units": 100,
-			"symbol": "Afl",
-			"number_format": "#,###.##"
-		}).insert()
-	
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p03_fixes_for_lead_in_quotation.py b/erpnext/patches/april_2013/p03_fixes_for_lead_in_quotation.py
deleted file mode 100644
index 5c6aa0a..0000000
--- a/erpnext/patches/april_2013/p03_fixes_for_lead_in_quotation.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabQuotation` set customer_name = organization 
-		where quotation_to = 'Lead' and ifnull(lead, '') != '' 
-		and ifnull(organization, '') != ''""")
-	
-	webnotes.conn.sql("""update `tabQuotation` set customer_name = lead_name 
-		where quotation_to = 'Lead' and ifnull(lead, '') != '' 
-		and ifnull(organization, '') = '' and ifnull(lead_name, '') != ''""")
-		
-	webnotes.conn.sql("""update `tabQuotation` set contact_display = lead_name 
-		where quotation_to = 'Lead' and ifnull(lead, '') != '' and ifnull(lead_name, '') != ''""")
-		
-	webnotes.conn.sql("""update `tabOpportunity` set contact_display = lead_name 
-		where enquiry_from = 'Lead' and ifnull(lead, '') != '' and ifnull(lead_name, '') != ''""")
-		
-	webnotes.conn.sql("""update `tabOpportunity` opp, `tabLead` lead 
-		set opp.customer_name = lead.company_name where opp.lead = lead.name""")
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p04_reverse_modules_list.py b/erpnext/patches/april_2013/p04_reverse_modules_list.py
deleted file mode 100644
index 33333d1..0000000
--- a/erpnext/patches/april_2013/p04_reverse_modules_list.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, json
-import webnotes.utils
-
-def execute():
-	modules = webnotes.get_config().modules
-	
-	ml = json.loads(webnotes.conn.get_global("modules_list") or "[]")
-	
-	if ml:
-		webnotes.conn.set_global("hidden_modules", 
-			json.dumps(list(set(modules.keys()).difference(set(ml)))))
-	
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p04_update_role_in_pages.py b/erpnext/patches/april_2013/p04_update_role_in_pages.py
deleted file mode 100644
index 7e4374c..0000000
--- a/erpnext/patches/april_2013/p04_update_role_in_pages.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-import webnotes.model
-def execute():
-	for p in ["activity", "todo", "questions", "question-view"]:
-		pbean = webnotes.bean("Page", p)
-		if len(pbean.doclist) == 1:
-			pbean.doclist.append({
-				"doctype": "Page Role",
-				"role": "All",
-				"parentfield": "roles"
-			})
-			pbean.save()
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p05_fixes_in_reverse_modules.py b/erpnext/patches/april_2013/p05_fixes_in_reverse_modules.py
deleted file mode 100644
index b300a4d..0000000
--- a/erpnext/patches/april_2013/p05_fixes_in_reverse_modules.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, json
-import webnotes.utils
-
-def execute():
-	modules = webnotes.get_config().modules
-	
-	ml = json.loads(webnotes.conn.get_global("hidden_modules") or "[]")
-	
-	if len(ml) == len(modules.keys()):
-		webnotes.conn.set_global("hidden_modules", json.dumps([]))
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p05_update_file_data.py b/erpnext/patches/april_2013/p05_update_file_data.py
deleted file mode 100644
index 1403dff..0000000
--- a/erpnext/patches/april_2013/p05_update_file_data.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, webnotes.utils, os
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "file_data")
-	webnotes.reset_perms("File Data")
-	
-	singles = get_single_doctypes()
-	
-	for doctype in webnotes.conn.sql_list("""select parent from tabDocField where 
-		fieldname='file_list'"""):
-		# the other scenario is handled in p07_update_file_data_2
-		if doctype in singles:
-			update_file_list(doctype, singles)
-		
-		# export_to_files([["DocType", doctype]])
-		
-def get_single_doctypes():
-	return webnotes.conn.sql_list("""select name from tabDocType
-			where ifnull(issingle,0)=1""")
-		
-def update_file_list(doctype, singles):
-	if doctype in singles:
-		doc = webnotes.doc(doctype, doctype)
-		if doc.file_list:
-			update_for_doc(doctype, doc)
-			webnotes.conn.set_value(doctype, None, "file_list", None)
-	else:
-		try:
-			for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where 
-				ifnull(file_list, '')!=''""" % doctype, as_dict=True):
-				update_for_doc(doctype, doc)
-			webnotes.conn.commit()
-			webnotes.conn.sql("""alter table `tab%s` drop column `file_list`""" % doctype)
-		except Exception, e:
-			print webnotes.get_traceback()
-			if (e.args and e.args[0]!=1054) or not e.args:
-				raise
-
-def update_for_doc(doctype, doc):
-	for filedata in doc.file_list.split("\n"):
-		if not filedata:
-			continue
-			
-		filedata = filedata.split(",")
-		if len(filedata)==2:
-			filename, fileid = filedata[0], filedata[1] 
-		else:
-			continue
-		
-		exists = True
-		if not (filename.startswith("http://") or filename.startswith("https://")):
-			if not os.path.exists(webnotes.utils.get_site_path(webnotes.conf.files_path, filename)):
-				exists = False
-
-		if exists:
-			if webnotes.conn.exists("File Data", fileid):
-				try:
-					fd = webnotes.bean("File Data", fileid)
-					if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name):
-						fd.doc.attached_to_doctype = doctype
-						fd.doc.attached_to_name = doc.name
-						fd.save()
-					else:
-						fd = webnotes.bean("File Data", copy=fd.doclist)
-						fd.doc.attached_to_doctype = doctype
-						fd.doc.attached_to_name = doc.name
-						fd.doc.name = None
-						fd.insert()
-				except webnotes.DuplicateEntryError:
-					pass
-		else:
-			webnotes.conn.sql("""delete from `tabFile Data` where name=%s""",
-				fileid)
diff --git a/erpnext/patches/april_2013/p06_default_cost_center.py b/erpnext/patches/april_2013/p06_default_cost_center.py
deleted file mode 100644
index 9d45e1e..0000000
--- a/erpnext/patches/april_2013/p06_default_cost_center.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-    webnotes.reload_doc("Stock", "DocType", "Delivery Note Item")
-    for dt in ("Journal Voucher Detail", "Sales Taxes and Charges", 
-		"Purchase Taxes and Charges", "Delivery Note Item", 
-		"Purchase Invoice Item", "Sales Invoice Item"):
-			webnotes.conn.sql_ddl("""alter table `tab%s` alter `cost_center` drop default""" \
-				% (dt,))
-			webnotes.reload_doc(webnotes.conn.get_value("DocType", dt, "module"), "DocType", dt)
diff --git a/erpnext/patches/april_2013/p06_update_file_size.py b/erpnext/patches/april_2013/p06_update_file_size.py
deleted file mode 100644
index 4305489..0000000
--- a/erpnext/patches/april_2013/p06_update_file_size.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, os, webnotes.utils
-
-def execute():
-	files_path = webnotes.utils.get_site_path(webnotes.conf.files_path)
-	webnotes.conn.auto_commit_on_many_writes = 1
-
-	for f in webnotes.conn.sql("""select name, file_name from 
-		`tabFile Data`""", as_dict=True):
-		if f.file_name:
-			filepath = os.path.join(files_path, f.file_name)
-			if os.path.exists(filepath):
-				webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
-				
-	webnotes.conn.auto_commit_on_many_writes = 0
diff --git a/erpnext/patches/april_2013/p07_rename_cost_center_other_charges.py b/erpnext/patches/april_2013/p07_rename_cost_center_other_charges.py
deleted file mode 100644
index 3c91ee3..0000000
--- a/erpnext/patches/april_2013/p07_rename_cost_center_other_charges.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("Accounts", "DocType", "Sales Taxes and Charges")
-	webnotes.conn.sql("""update `tabSales Taxes and Charges`
-		set cost_center = cost_center_other_charges""")
-	webnotes.conn.sql_ddl("""alter table `tabSales Taxes and Charges`
-		drop column cost_center_other_charges""")
-	
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/p07_update_file_data_2.py b/erpnext/patches/april_2013/p07_update_file_data_2.py
deleted file mode 100644
index b75161b..0000000
--- a/erpnext/patches/april_2013/p07_update_file_data_2.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes
-	
-	webnotes.conn.auto_commit_on_many_writes = 1
-	
-	singles = get_single_doctypes()
-	for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns`
-		where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name):
-			doctype = doctype[3:]
-			
-			if not webnotes.conn.exists("DocType", doctype): continue
-			
-			update_file_list(doctype, singles)
-			
-			webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
-				and parent=%s""", doctype)
-	
-	webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/patches/april_2013/rebuild_sales_browser.py b/erpnext/patches/april_2013/rebuild_sales_browser.py
deleted file mode 100644
index 6de6101..0000000
--- a/erpnext/patches/april_2013/rebuild_sales_browser.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	from patches.january_2013 import rebuild_tree
-	rebuild_tree.execute()
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/__init__.py b/erpnext/patches/august_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/august_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/august_2013/fix_fiscal_year.py b/erpnext/patches/august_2013/fix_fiscal_year.py
deleted file mode 100644
index 67988c4..0000000
--- a/erpnext/patches/august_2013/fix_fiscal_year.py
+++ /dev/null
@@ -1,49 +0,0 @@
-import webnotes
-
-def execute():
-	create_fiscal_years()
-	
-	doctypes = webnotes.conn.sql_list("""select parent from tabDocField
-		where (fieldtype="Link" and options='Fiscal Year')
-		or (fieldtype="Select" and options='link:Fiscal Year')""")
-		
-	for dt in doctypes:
-		date_fields = webnotes.conn.sql_list("""select fieldname from tabDocField
-			where parent=%s and fieldtype='Date'""", dt)
-		
-		date_field = get_date_field(date_fields, dt)
-
-		if not date_field:
-			print dt, date_field
-		else:
-			webnotes.conn.sql("""update `tab%s` set fiscal_year = 
-				if(%s<='2013-06-30', '2012-2013', '2013-2014')""" % (dt, date_field))
-			
-def create_fiscal_years():
-	fiscal_years = {
-		"2012-2013": ["2012-07-01", "2013-06-30"],
-		"2013-2014": ["2013-07-01", "2014-06-30"]
-	}
-	
-	for d in fiscal_years:
-		webnotes.bean({
-			"doctype": "Fiscal Year",
-			"year": d,
-			"year_start_date": fiscal_years[d][0],
-			"is_fiscal_year_closed": "No"
-		}).insert()
-	
-		
-def get_date_field(date_fields, dt):
-	date_field = None
-	if date_fields:
-		if "posting_date" in date_fields:
-			date_field = "posting_date"
-		elif "transaction_date" in date_fields:
-			date_field = 'transaction_date'
-		else:
-			date_field = date_fields[0]
-			# print dt, date_fields
-			
-	return date_field
-		
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/p01_auto_accounting_for_stock_patch.py b/erpnext/patches/august_2013/p01_auto_accounting_for_stock_patch.py
deleted file mode 100644
index c6a22dd..0000000
--- a/erpnext/patches/august_2013/p01_auto_accounting_for_stock_patch.py
+++ /dev/null
@@ -1,6 +0,0 @@
-import webnotes
-from webnotes.utils import cint
-
-def execute():	
-	import patches.march_2013.p08_create_aii_accounts
-	patches.march_2013.p08_create_aii_accounts.execute()
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/p01_hr_settings.py b/erpnext/patches/august_2013/p01_hr_settings.py
deleted file mode 100644
index 2c5b615..0000000
--- a/erpnext/patches/august_2013/p01_hr_settings.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("hr", "doctype", "hr_settings")
-	webnotes.reload_doc("setup", "doctype", "global_defaults")
-	
-	hr = webnotes.bean("HR Settings", "HR Settings")
-	hr.doc.emp_created_by = webnotes.conn.get_value("Global Defaults", "Global Defaults", "emp_created_by")
-	
-	if webnotes.conn.sql("""select name from `tabSalary Slip` where docstatus=1 limit 1"""):
-		hr.doc.include_holidays_in_total_working_days = 1
-	
-	hr.save()
-	
-	webnotes.conn.sql("""delete from `tabSingles` where doctype = 'Global Defaults' 
-		and field = 'emp_created_by'""")
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/p02_rename_price_list.py b/erpnext/patches/august_2013/p02_rename_price_list.py
deleted file mode 100644
index dd25254..0000000
--- a/erpnext/patches/august_2013/p02_rename_price_list.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list")
-	webnotes.reload_doc("stock", "doctype", "item_price")
-	
-	for t in [
-			("Supplier Quotation", "price_list_name", "buying_price_list"),
-			("Purchase Order", "price_list_name", "buying_price_list"),
-			("Purchase Invoice", "price_list_name", "buying_price_list"),
-			("Purchase Receipt", "price_list_name", "buying_price_list"),
-			("Quotation", "price_list_name", "selling_price_list"),
-			("Sales Order", "price_list_name", "selling_price_list"),
-			("Delivery Note", "price_list_name", "selling_price_list"),
-			("Sales Invoice", "price_list_name", "selling_price_list"),
-			("POS Setting", "price_list_name", "selling_price_list"),
-			("Shopping Cart Price List", "price_list", "selling_price_list"),
-			("Item Price", "price_list_name", "price_list"),
-			("BOM", "price_list", "buying_price_list"),
-		]:
-		table_columns = webnotes.conn.get_table_columns(t[0])
-		if t[2] in table_columns and t[1] in table_columns:
-			# already reloaded, so copy into new column and drop old column
-			webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" % (t[0], t[2], t[1]))
-			webnotes.conn.sql_ddl("""alter table `tab%s` drop column `%s`""" % (t[0], t[1]))
-		elif t[1] in table_columns:
-			webnotes.conn.sql_ddl("alter table `tab%s` change `%s` `%s` varchar(180)" % t)
-
-		webnotes.reload_doc(webnotes.conn.get_value("DocType", t[0], "module"), "DocType", t[0])
-		
-	webnotes.conn.sql("""update tabSingles set field='selling_price_list'
-		where field='price_list_name' and doctype='Selling Settings'""")
-	
-	webnotes.reload_doc("Selling", "DocType", "Selling Settings")
-	webnotes.bean("Selling Settings").save()
-	
-	
diff --git a/erpnext/patches/august_2013/p03_pos_setting_replace_customer_account.py b/erpnext/patches/august_2013/p03_pos_setting_replace_customer_account.py
deleted file mode 100644
index f401b3d..0000000
--- a/erpnext/patches/august_2013/p03_pos_setting_replace_customer_account.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("accounts", "doctype", "pos_setting")
-	if "customer_account" in webnotes.conn.get_table_columns("POS Setting"):
-		customer_account = webnotes.conn.sql("""select customer_account, name from `tabPOS Setting` 
-			where ifnull(customer_account, '')!=''""")
-
-		for cust_acc, pos_name in customer_account:
-			customer = webnotes.conn.sql("""select master_name, account_name from `tabAccount` 
-				where name=%s""", (cust_acc), as_dict=1)
-
-			if not customer[0].master_name:
-				customer_name = webnotes.conn.get_value('Customer', customer[0].account_name, 'name')
-			else:
-				customer_name = customer[0].master_name
-
-			webnotes.conn.set_value('POS Setting', pos_name, 'customer', customer_name)
-		
-		webnotes.conn.sql_ddl("""alter table `tabPOS Setting` drop column `customer_account`""")
diff --git a/erpnext/patches/august_2013/p05_employee_birthdays.py b/erpnext/patches/august_2013/p05_employee_birthdays.py
deleted file mode 100644
index d090d31..0000000
--- a/erpnext/patches/august_2013/p05_employee_birthdays.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "event")
-	webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
-	for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and 
-		ifnull(date_of_birth, '')!=''"""):
-			obj = webnotes.get_obj("Employee", employee)
-			obj.update_dob_event()
-		
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/p05_update_serial_no_status.py b/erpnext/patches/august_2013/p05_update_serial_no_status.py
deleted file mode 100644
index 49ab411..0000000
--- a/erpnext/patches/august_2013/p05_update_serial_no_status.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update `tabSerial No` set status = 'Not Available' where status='Not In Store'""")
-	webnotes.conn.sql("""update `tabSerial No` set status = 'Available' where status='In Store'""")
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/p06_deprecate_is_cancelled.py b/erpnext/patches/august_2013/p06_deprecate_is_cancelled.py
deleted file mode 100644
index ad196bd..0000000
--- a/erpnext/patches/august_2013/p06_deprecate_is_cancelled.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import webnotes
-def execute():
-	webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
-	webnotes.reload_doc("stock", "doctype", "serial_no")
-	webnotes.reload_doc("stock", "report", "stock_ledger")
-	
-	webnotes.conn.sql("""delete from `tabStock Ledger Entry` 
-		where ifnull(is_cancelled, 'No') = 'Yes'""")
-		
-	webnotes.reload_doc("accounts", "doctype", "gl_entry")
-	webnotes.conn.sql("""delete from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'Yes'""")
\ No newline at end of file
diff --git a/erpnext/patches/august_2013/p06_fix_sle_against_stock_entry.py b/erpnext/patches/august_2013/p06_fix_sle_against_stock_entry.py
deleted file mode 100644
index 2e6c383..0000000
--- a/erpnext/patches/august_2013/p06_fix_sle_against_stock_entry.py
+++ /dev/null
@@ -1,113 +0,0 @@
-import webnotes
-
-def execute():
-	cancelled = []
-	uncancelled = []
-
-	stock_entries = webnotes.conn.sql("""select * from `tabStock Entry` 
-		where docstatus >= 1 and date(modified) >= "2013-08-16" 
-		and ifnull(production_order, '') != '' and ifnull(bom_no, '') != '' 
-		order by modified desc, name desc""", as_dict=True)
-
-	for entry in stock_entries:
-		if not webnotes.conn.sql("""select name from `tabStock Entry Detail` 
-			where parent=%s""", entry.name):
-				res = webnotes.conn.sql("""select * from `tabStock Ledger Entry`
-					where voucher_type='Stock Entry' and voucher_no=%s
-					and is_cancelled='No'""", entry.name, as_dict=True)
-				if res:
-					make_stock_entry_detail(entry, res, cancelled, uncancelled)
-				
-	if cancelled or uncancelled:
-		send_email(cancelled, uncancelled)
-			
-def make_stock_entry_detail(entry, res, cancelled, uncancelled):
-	fg_item = webnotes.conn.get_value("Production Order", entry.production_order,
-		"production_item")
-	voucher_detail_entries_map = {}
-	for sle in res:
-		voucher_detail_entries_map.setdefault(sle.voucher_detail_no, []).append(sle)
-	
-	for i, voucher_detail_no in enumerate(sorted(voucher_detail_entries_map.keys())):
-		sl_entries = voucher_detail_entries_map[voucher_detail_no]
-		# create stock entry details back from stock ledger entries
-		stock_entry_detail = webnotes.doc({
-			"doctype": "Stock Entry Detail",
-			"parentfield": "mtn_details",
-			"parenttype": "Stock Entry",
-			"parent": entry.name,
-			"__islocal": 1,
-			"idx": i+1,
-			"docstatus": 1,
-			"owner": entry.owner,
-			"name": voucher_detail_no,
-			"transfer_qty": abs(sl_entries[0].actual_qty),
-			"qty": abs(sl_entries[0].actual_qty),
-			"stock_uom": sl_entries[0].stock_uom,
-			"uom": sl_entries[0].stock_uom,
-			"conversion_factor": 1,
-			"item_code": sl_entries[0].item_code,
-			"description": webnotes.conn.get_value("Item", sl_entries[0].item_code,
-				"description"),
-			"incoming_rate": sl_entries[0].incoming_rate,
-			"batch_no": sl_entries[0].batch_no,
-			"serial_no": sl_entries[0].serial_no
-		})
-		
-		if sl_entries[0].item_code == fg_item:
-			stock_entry_detail.bom_no = entry.bom_no
-		
-		for sle in sl_entries:
-			if sle.actual_qty < 0:
-				stock_entry_detail.s_warehouse = sle.warehouse
-			else:
-				stock_entry_detail.t_warehouse = sle.warehouse
-				
-		stock_entry_detail.save()
-		
-	if entry.docstatus == 2:
-		webnotes.conn.set_value("Stock Entry", entry.name, "docstatus", 1)
-		
-		# call for cancelled ones
-		se = webnotes.bean("Stock Entry", entry.name)
-		controller = se.make_controller()
-		controller.update_production_order(1)
-		
-		res = webnotes.conn.sql("""select name from `tabStock Entry`
-			where amended_from=%s""", entry.name)
-		if res:
-			cancelled.append(res[0][0])
-			if res[0][0] in uncancelled:
-				uncancelled.remove(res[0][0])
-				
-			webnotes.bean("Stock Entry", res[0][0]).cancel()
-
-		uncancelled.append(se.doc.name)
-		
-def send_email(cancelled, uncancelled):
-	from webnotes.utils.email_lib import sendmail_to_system_managers
-	uncancelled = "we have undone the cancellation of the following Stock Entries through a patch:\n" + \
-		"\n".join(uncancelled) if uncancelled else ""
-	cancelled = "and cancelled the following Stock Entries:\n" + "\n".join(cancelled) \
-		if cancelled else ""
-
-	subject = "[ERPNext] [Important] Cancellation undone for some Stock Entries"
-	content = """Dear System Manager, 
-
-An error got introduced into the code that cleared the item table in a Stock Entry associated to a Production Order.
-
-To undo its effect, 
-%s
-
-%s
-
-You will have to edit them again.
-
-Sorry for the inconvenience this has caused.
-
-Regards,
-Team ERPNext.""" % (uncancelled, cancelled)
-
-	# print subject, content
-
-	sendmail_to_system_managers(subject, content)
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/__init__.py b/erpnext/patches/december_2012/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/december_2012/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/december_2012/address_title.py b/erpnext/patches/december_2012/address_title.py
deleted file mode 100644
index 849f619..0000000
--- a/erpnext/patches/december_2012/address_title.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("utilities", "doctype", "address")
-
-	webnotes.conn.sql("""update tabAddress set address_title = customer_name where ifnull(customer_name,'')!=''""")
-	webnotes.conn.sql("""update tabAddress set address_title = supplier_name where ifnull(supplier_name,'')!=''""")
-	webnotes.conn.sql("""update tabAddress set address_title = sales_partner where ifnull(sales_partner,'')!=''""")
-	
-	# move code to new doctype
-	webnotes.conn.set_value("Website Script", None, "javascript", 
-		webnotes.conn.get_value("Website Settings", None, "startup_code"))
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/delete_form16_print_format.py b/erpnext/patches/december_2012/delete_form16_print_format.py
deleted file mode 100644
index bc65b6e..0000000
--- a/erpnext/patches/december_2012/delete_form16_print_format.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.delete_doc("Print Format", "Form 16A Print Format")
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/deleted_contact_address_patch.py b/erpnext/patches/december_2012/deleted_contact_address_patch.py
deleted file mode 100644
index a9f2ff7..0000000
--- a/erpnext/patches/december_2012/deleted_contact_address_patch.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	"""finds references of deleted addresses and contacts and deletes these references"""
-	import webnotes.model
-
-	for dt in ["Address", "Contact"]:
-		link_fields = webnotes.model.get_link_fields(dt)
-		for parent, lf in link_fields:
-			webnotes.conn.sql("""update `tab%s` ref set `%s`=null
-				where ifnull(`%s`, '')!='' and not exists (
-					select * from `tab%s` where name=ref.`%s`)""" % \
-				(parent, lf, lf, dt, lf))
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/deprecate_tds.py b/erpnext/patches/december_2012/deprecate_tds.py
deleted file mode 100644
index a5db729..0000000
--- a/erpnext/patches/december_2012/deprecate_tds.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from webnotes.model.code import get_obj
-	from webnotes.model.doc import addchild
-	
-	# delete doctypes and tables
-	for dt in ["TDS Payment", "TDS Return Acknowledgement", "Form 16A", 
-			"TDS Rate Chart", "TDS Category", "TDS Control", "TDS Detail", 
-			"TDS Payment Detail", "TDS Rate Detail", "TDS Category Account",
-			"Form 16A Ack Detail", "Form 16A Tax Detail"]:
-		webnotes.delete_doc("DocType", dt)
-		
-		webnotes.conn.commit()
-		webnotes.conn.sql("drop table if exists `tab%s`" % dt)
-		webnotes.conn.begin()
-			
-	# Add tds entry in tax table for purchase invoice
-	pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice` 
-		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
-	for pi in pi_list:
-		piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
-		ch = addchild(piobj.doc, 'taxes_and_charges', 'Purchase Taxes and Charges')
-		ch.charge_type = "Actual"
-		ch.account_head = piobj.doc.tax_code
-		ch.description = piobj.doc.tax_code
-		ch.rate = -1*piobj.doc.ded_amount
-		ch.tax_amount = -1*piobj.doc.ded_amount
-		ch.category = "Total"
-		ch.save(1)		
-	
-	# Add tds entry in entries table for journal voucher
-	jv_list = webnotes.conn.sql("""select name from `tabJournal Voucher` 
-		where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
-	for jv in jv_list:
-		jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
-		ch = addchild(jvobj.doc, 'entries', 'Journal Voucher Detail')
-		ch.account = jvobj.doc.tax_code
-		ch.credit = jvobj.doc.ded_amount
-		ch.save(1)
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/expense_leave_reload.py b/erpnext/patches/december_2012/expense_leave_reload.py
deleted file mode 100644
index 9e2b8df..0000000
--- a/erpnext/patches/december_2012/expense_leave_reload.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	# new roles
-	roles = [r[0] for r in webnotes.conn.sql("""select name from tabRole""")]
-	if not "Leave Approver" in roles:
-		webnotes.bean([{"doctype":"Role", "role_name":"Leave Approver", 
-			"__islocal":1, "module":"HR"}]).save()
-	if not "Expense Approver" in roles:
-		webnotes.bean([{"doctype":"Role", "role_name":"Expense Approver", 
-			"__islocal":1, "module":"HR"}]).save()
-
-	# reload
-	webnotes.clear_perms("Leave Application")
-	webnotes.reload_doc("hr", "doctype", "leave_application")
-
-	webnotes.clear_perms("Expense Claim")
-	webnotes.reload_doc("hr", "doctype", "expense_claim")
-	
-	# remove extra space in Approved Expense Vouchers
-	webnotes.conn.sql("""update `tabExpense Claim` set approval_status='Approved'
-		where approval_status='Approved '""")
-
-	webnotes.conn.commit()
-	for t in ['__CacheItem', '__SessionCache', 'tabSupport Ticket Response']:
-		webnotes.conn.sql("drop table if exists `%s`" % t)
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/file_list_rename.py b/erpnext/patches/december_2012/file_list_rename.py
deleted file mode 100644
index d8a845c..0000000
--- a/erpnext/patches/december_2012/file_list_rename.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	for dt in webnotes.conn.sql("""select distinct parent from tabDocField 
-		where fieldname='file_list'"""):
-		try:
-			webnotes.conn.sql("""update `tab%s` set file_list = 
-				replace(file_list, "-", "")""" % dt[0])
-		except Exception, e:
-			if e.args[0]!=1146: raise
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/fix_default_print_format.py b/erpnext/patches/december_2012/fix_default_print_format.py
deleted file mode 100644
index f6c4738..0000000
--- a/erpnext/patches/december_2012/fix_default_print_format.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabDocType` set default_print_format=null
-		where default_print_format='Standard'""")
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/move_recent_to_memcache.py b/erpnext/patches/december_2012/move_recent_to_memcache.py
deleted file mode 100644
index fe39116..0000000
--- a/erpnext/patches/december_2012/move_recent_to_memcache.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-import webnotes, json
-
-def execute():
-	for p in webnotes.conn.sql("""select name, recent_documents from 
-		tabProfile where ifnull(recent_documents,'')!=''"""):
-		if not '~~~' in p[1] and p[1][0]=='[':
-			webnotes.cache().set_value("recent:" + p[0], json.loads(p[1]))
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/production_cleanup.py b/erpnext/patches/december_2012/production_cleanup.py
deleted file mode 100644
index b8133a9..0000000
--- a/erpnext/patches/december_2012/production_cleanup.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	delete_doctypes()
-	rename_module()
-	cleanup_bom()
-	rebuild_exploded_bom()
-	
-def delete_doctypes():
-	webnotes.delete_doc("DocType", "Production Control")
-	webnotes.delete_doc("DocType", "BOM Control")
-	
-	
-def rename_module():
-	webnotes.reload_doc("core", "doctype", "role")
-	webnotes.reload_doc("core", "doctype", "page")
-	webnotes.reload_doc("core", "doctype", "module_def")
-
-	if webnotes.conn.exists("Role", "Production User"):
-		webnotes.rename_doc("Role", "Production User", "Manufacturing User")
-	if webnotes.conn.exists("Role", "Production Manager"):
-		webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager")
-
-	if webnotes.conn.exists("Page", "manufacturing-home"):
-		webnotes.delete_doc("Page", "production-home")
-	else:
-		webnotes.rename_doc("Page", "production-home", "manufacturing-home")
-
-	if webnotes.conn.exists("Module Def", "Production"):
-		webnotes.rename_doc("Module Def", "Production", "Manufacturing")
-	
-	modules_list = webnotes.conn.get_global('modules_list')
-	if modules_list:
-		webnotes.conn.set_global("modules_list", modules_list.replace("Production", 
-			"Manufacturing"))
-		
-	# set end of life to null if "0000-00-00"
-	webnotes.conn.sql("""update `tabItem` set end_of_life=null where end_of_life='0000-00-00'""")
-	
-def rebuild_exploded_bom():
-	from webnotes.model.code import get_obj
-	for bom in webnotes.conn.sql("""select name from `tabBOM` where docstatus < 2"""):
-		get_obj("BOM", bom[0], with_children=1).on_update()
-
-def cleanup_bom():
-	webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 1 where ifnull(is_active, 'No') = 'Yes'""")
-	webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 0 where ifnull(is_active, 'No') = 'No'""")
-	webnotes.reload_doc("manufacturing", "doctype", "bom")
-	webnotes.conn.sql("""update `tabBOM` set with_operations = 1""")
-	
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/production_order_naming_series.py b/erpnext/patches/december_2012/production_order_naming_series.py
deleted file mode 100644
index cd06222..0000000
--- a/erpnext/patches/december_2012/production_order_naming_series.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	from webnotes.utils import cstr
-	from webnotes.model.code import get_obj
-	
-	fy_list = webnotes.conn.sql("""select name from `tabFiscal Year` 
-		where docstatus < 2 order by year_start_date desc""")
-	series_list = []
-	for fy in fy_list:
-		series_list.append("PRO/" + cstr(fy[0][2:5]) + cstr(fy[0][7:9]) + "/")
-	
-	naming_series_obj = get_obj("Naming Series")
-	naming_series_obj.doc.user_must_always_select = 1
-	naming_series_obj.set_series_for("Production Order", series_list)
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/rebuild_item_group_tree.py b/erpnext/patches/december_2012/rebuild_item_group_tree.py
deleted file mode 100644
index 1345dba..0000000
--- a/erpnext/patches/december_2012/rebuild_item_group_tree.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	from webnotes.utils.nestedset import rebuild_tree
-	rebuild_tree("Item Group", "parent_item_group")
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/remove_quotation_next_contact.py b/erpnext/patches/december_2012/remove_quotation_next_contact.py
deleted file mode 100644
index 06d96ea..0000000
--- a/erpnext/patches/december_2012/remove_quotation_next_contact.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	from webnotes.widgets.form.assign_to import add
-	for t in webnotes.conn.sql("""select * from tabQuotation 
-		where ifnull(contact_by, '')!=''""", as_dict=1):
-		add({
-			'doctype': "Quotation",
-			'name': t['name'],
-			'assign_to': t['contact_by'],
-			'assigned_by': t['owner'],
-			'description': "Contact regarding quotation.",
-			'date': t['creation'],
-			"no_notification": True
-		})
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/replace_createlocal.py b/erpnext/patches/december_2012/replace_createlocal.py
deleted file mode 100644
index 559af01..0000000
--- a/erpnext/patches/december_2012/replace_createlocal.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.sql("""update `tabCustom Script` 
-		set script = replace(script, 'createLocal', 'wn.model.make_new_doc_and_get_name') 
-		where script_type='Client'""")
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/repost_ordered_qty.py b/erpnext/patches/december_2012/repost_ordered_qty.py
deleted file mode 100644
index 5b24fdf..0000000
--- a/erpnext/patches/december_2012/repost_ordered_qty.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from erpnext.utilities.repost_stock import get_ordered_qty, update_bin
-			
-	for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
-		update_bin(d[0], d[1], {
-			"ordered_qty": get_ordered_qty(d[0], d[1])
-		})
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/repost_projected_qty.py b/erpnext/patches/december_2012/repost_projected_qty.py
deleted file mode 100644
index 3adf1c0..0000000
--- a/erpnext/patches/december_2012/repost_projected_qty.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.sql("""update `tabBin` 
-		set projected_qty = ifnull(actual_qty, 0) + ifnull(indented_qty, 0) + 
-			ifnull(ordered_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty, 0)""")
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/stock_entry_cleanup.py b/erpnext/patches/december_2012/stock_entry_cleanup.py
deleted file mode 100644
index ab25c55..0000000
--- a/erpnext/patches/december_2012/stock_entry_cleanup.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	# removed following fields
-	webnotes.reload_doc("stock", "doctype", "stock_entry")
-	custom_fields()
-	deprecate_process()
-	webnotes.delete_doc("doctype", "sandbox")
-	
-def custom_fields():
-	fields = [
-		{
-			"label": "Is Excisable Goods",
-			"fieldname": "is_excisable_goods",
-			"fieldtype": "Select",
-			"options": "\nYes\nNo",
-			"insert_after": "Company"
-		},
-		{
-			"label": "Excisable Goods",
-			"fieldname": "excisable_goods",
-			"fieldtype": "Select",
-			"options": "\nReturnable\nNon-Returnable)",
-			"insert_after": "Amended From"
-		},
-		{
-			"label": "Under Rule",
-			"fieldname": "under_rule",
-			"fieldtype": "Select",
-			"options": "\nOrdinary\n57 AC (5) a\n57 F (2) Non-Exc.",
-			"insert_after": "Remarks"
-		},
-		{
-			"label": "Transporter",
-			"fieldname": "transporter",
-			"fieldtype": "Data",
-			"options": "",
-			"insert_after": "Project Name"
-		},
-		{
-			"label": "Transfer Date",
-			"fieldname": "transfer_date",
-			"fieldtype": "Date",
-			"options": "",
-			"insert_after": "Select Print Heading"
-		},
-	]
-	
-	for fld in fields:
-		if webnotes.conn.sql("""select name from `tabStock Entry` 
-				where ifnull(%s, '') != '' and docstatus<2""", (fld['fieldname'])):
-			create_custom_field(fld)
-			
-def create_custom_field(fld):
-	fld.update({
-		"doctype": "Custom Field",
-		"dt": "Stock Entry",
-		"print_hide": 1,
-		"permlevel": 0
-	})
-	
-	from webnotes.model.doclist import DocList
-	webnotes.insert(DocList([fld]))
-	
-def deprecate_process():
-	webnotes.conn.sql("""update `tabStock Entry` 
-		set `purpose`="Material Transfer"
-		where process="Material Transfer" and purpose="Production Order" """)
-	
-	webnotes.conn.sql("""update `tabStock Entry` 
-		set `purpose`="Manufacture/Repack"
-		where (process="Backflush" and purpose="Production Order") or purpose="Other" """)
-		
-	webnotes.conn.sql("""update `tabStock Entry` 
-		set `purpose`="Subcontract"
-		where process="Subcontracting" """)
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/update_print_width.py b/erpnext/patches/december_2012/update_print_width.py
deleted file mode 100644
index ee2b46a..0000000
--- a/erpnext/patches/december_2012/update_print_width.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "docfield")
-	webnotes.conn.sql("""update tabDocField set print_width = width""")
\ No newline at end of file
diff --git a/erpnext/patches/december_2012/website_cache_refactor.py b/erpnext/patches/december_2012/website_cache_refactor.py
deleted file mode 100644
index cab2af3..0000000
--- a/erpnext/patches/december_2012/website_cache_refactor.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-import webnotes
-
-def execute():
-	# set page published = 1
-	webnotes.reload_doc("website", "doctype", "web_page")
-	webnotes.conn.sql("""update `tabWeb Page` set published=1;""")
-
-	# convert all page & blog markdowns to html
-	from markdown2 import markdown
-
-	for page in webnotes.conn.sql("""select name, main_section from `tabWeb Page`"""):
-		m = markdown(page[1] or "").encode("utf8")
-		webnotes.conn.set_value("Web Page", page[0], "main_section", m)
-
-	for page in webnotes.conn.sql("""select name, content from `tabBlog`"""):
-		m = markdown(page[1] or "").encode("utf8")
-		webnotes.conn.set_value("Blog", page[0], "content", m)
-
-	# delete website cache
-	webnotes.delete_doc("DocType", "Web Cache")
-	webnotes.conn.commit()
-	webnotes.conn.sql("""drop table if exists `tabWeb Cache`""")
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/__init__.py b/erpnext/patches/february_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/february_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/february_2013/account_negative_balance.py b/erpnext/patches/february_2013/account_negative_balance.py
deleted file mode 100644
index cbb9032..0000000
--- a/erpnext/patches/february_2013/account_negative_balance.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.reload_doc("accounts", "doctype", "account")
-	webnotes.conn.sql("update `tabAccount` set allow_negative_balance = 1")
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/fix_outstanding.py b/erpnext/patches/february_2013/fix_outstanding.py
deleted file mode 100644
index 24ebc4e..0000000
--- a/erpnext/patches/february_2013/fix_outstanding.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from webnotes.utils import flt
-	records = webnotes.conn.sql("""
-		select against_voucher_type, against_voucher, 
-			sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) as outstanding from `tabGL Entry`
-		where ifnull(is_cancelled, 'No') = 'No' 
-		and against_voucher_type in ("Sales Invoice", "Purchase Invoice")
-		and ifnull(against_voucher, '') != ''
-		group by against_voucher_type, against_voucher""", as_dict=1)
-	for r in records:
-		outstanding = webnotes.conn.sql("""select name, outstanding_amount from `tab%s` 
-			where name = %s and docstatus = 1""" % 
-			(r["against_voucher_type"], '%s'), (r["against_voucher"]))
-			
-		if outstanding and abs(flt(r["outstanding"])) != flt(outstanding[0][1]):
-			if ((r["against_voucher_type"]=='Sales Invoice' and flt(r["outstanding"]) >= 0) \
-				or (r["against_voucher_type"]=="Purchase Invoice" and flt(["outstanding"]) <= 0)):
-				webnotes.conn.set_value(r["against_voucher_type"], r["against_voucher"], 
-					"outstanding_amount", abs(flt(r["outstanding"])))		
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/gle_floating_point_issue_revisited.py b/erpnext/patches/february_2013/gle_floating_point_issue_revisited.py
deleted file mode 100644
index 078b06a..0000000
--- a/erpnext/patches/february_2013/gle_floating_point_issue_revisited.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from webnotes.utils import flt
-	
-	records = webnotes.conn.sql("""select name, grand_total, debit_to from `tabSales Invoice` 
-		where docstatus = 1""", as_dict=1)
-	
-	for r in records:
-		gle = webnotes.conn.sql("""select name, debit from `tabGL Entry` 
-			where account = %s and voucher_type = 'Sales Invoice' and voucher_no = %s
-			and ifnull(is_cancelled, 'No') = 'No' limit 1""", (r.debit_to, r.name), as_dict=1)
-		if gle:
-			diff = flt((flt(r.grand_total) - flt(gle[0]['debit'])), 2)
-		
-			if abs(diff) == 0.01:
-				# print r.name, r.grand_total, gle[0]['debit'], diff
-				webnotes.conn.sql("""update `tabGL Entry` set debit = debit + %s 
-					where name = %s""", (diff, gle[0]['name']))
-				
-				webnotes.conn.sql("""update `tabGL Entry` set credit = credit - %s
-					where voucher_type = 'Sales Invoice' and voucher_no = %s 
-					and credit > 0 limit 1""", (diff, r.name))
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/p01_event.py b/erpnext/patches/february_2013/p01_event.py
deleted file mode 100644
index 73f08ac..0000000
--- a/erpnext/patches/february_2013/p01_event.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "event")
-
-	webnotes.conn.sql("""update tabEvent set subject=description""")
-		
-	webnotes.conn.sql("""update tabEvent set description = concat(description, "\n", notes)
-		where ifnull(notes,"") != "" """)
-		
-	webnotes.conn.sql("""update tabEvent set starts_on = timestamp(event_date, event_hour)""")
-	
-	webnotes.conn.sql("""update tabEvent set ends_on = timestampadd(hour, 1, starts_on)""")	
-	
diff --git a/erpnext/patches/february_2013/p02_email_digest.py b/erpnext/patches/february_2013/p02_email_digest.py
deleted file mode 100644
index f1ebc33..0000000
--- a/erpnext/patches/february_2013/p02_email_digest.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.reload_doc("setup", "doctype", "email_digest")
-	webnotes.conn.sql('update `tabEmail Digest` set calendar_events=1, todo_list=1 where enabled=1')
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/p03_material_request.py b/erpnext/patches/february_2013/p03_material_request.py
deleted file mode 100644
index 255de10..0000000
--- a/erpnext/patches/february_2013/p03_material_request.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, os, sys
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "doctype")
-	
-	tables = webnotes.conn.sql_list("show tables")
-	if not "tabMaterial Request Item" in tables:
-		webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True)
-	if not "tabMaterial Request" in tables:
-		webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
-
-	webnotes.reload_doc("stock", "doctype", "material_request")
-	webnotes.reload_doc("stock", "doctype", "material_request_item")
-	
-	webnotes.conn.sql("""update `tabMaterial Request` set material_request_type='Purchase'""")
-	
-	os.system("rm -rf app/buying/doctype/purchase_request")
-	os.system("rm -rf app/buying/doctype/purchase_request_item")
-	
-	os.system("rm -rf app/hr/doctype/holiday_block_list")
-	os.system("rm -rf app/hr/doctype/holiday_block_list_allow")
-	os.system("rm -rf app/hr/doctype/holiday_block_list_date")
-	
-	for dt in ("Purchase Request", "Purchase Request Item"):
-		if webnotes.conn.exists("DocType", dt):
-			webnotes.delete_doc("DocType", dt)
-		
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/p04_remove_old_doctypes.py b/erpnext/patches/february_2013/p04_remove_old_doctypes.py
deleted file mode 100644
index d584044..0000000
--- a/erpnext/patches/february_2013/p04_remove_old_doctypes.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, os
-
-def execute():
-	webnotes.delete_doc("DocType", "Product")
-	webnotes.delete_doc("DocType", "Test")
-	webnotes.delete_doc("Module Def", "Test")
-	
-	os.system("rm -rf app/test")
-	os.system("rm -rf app/website/doctype/product")
-	
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/p05_leave_application.py b/erpnext/patches/february_2013/p05_leave_application.py
deleted file mode 100644
index 809df96..0000000
--- a/erpnext/patches/february_2013/p05_leave_application.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("hr", "doctype", "leave_application")
-	
-	if not webnotes.get_doctype("Leave Application").get({"doctype": "DocField", 
-			"parent": "Leave Application", "permlevel": 2}):
-		webnotes.conn.sql("""update `tabDocPerm` set permlevel=1 
-			where parent="Leave Application" and permlevel=2""")
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/p08_todo_query_report.py b/erpnext/patches/february_2013/p08_todo_query_report.py
deleted file mode 100644
index bfb04ce..0000000
--- a/erpnext/patches/february_2013/p08_todo_query_report.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.clear_perms("Report")
-	webnotes.clear_perms("ToDo")
-	webnotes.reload_doc("core", "doctype", "report")
-	webnotes.reload_doc("core", "doctype", "todo")
-	webnotes.reload_doc("core", "report", "todo")
diff --git a/erpnext/patches/february_2013/p09_remove_cancelled_warehouses.py b/erpnext/patches/february_2013/p09_remove_cancelled_warehouses.py
deleted file mode 100644
index 62660b9..0000000
--- a/erpnext/patches/february_2013/p09_remove_cancelled_warehouses.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	for w in webnotes.conn.sql("""select name from `tabWarehouse` where docstatus=2"""):
-		try:
-			webnotes.delete_doc("Warehouse", w[0])
-		except webnotes.ValidationError:
-			pass
-		
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/p09_timesheets.py b/erpnext/patches/february_2013/p09_timesheets.py
deleted file mode 100644
index 639cf1e..0000000
--- a/erpnext/patches/february_2013/p09_timesheets.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	# convert timesheet details to time logs
-	webnotes.reload_doc("projects", "doctype", "time_log")
-	
-	# copy custom fields
-	custom_map = {"Timesheet":[], "Timesheet Detail":[]}
-	for custom_field in webnotes.conn.sql("""select * from `tabCustom Field` where 
-		dt in ('Timesheet', 'Timesheet Detail')""", as_dict=True):
-		custom_map[custom_field.dt].append(custom_field.fieldname)
-		custom_field.doctype = "Custom Field"
-		custom_field.dt = "Time Log"
-		custom_field.insert_after = None
-		try:
-			cf = webnotes.bean(custom_field).insert()
-		except Exception, e:
-			# duplicate custom field
-			pass
-	
-	for name in webnotes.conn.sql_list("""select name from tabTimesheet"""):
-		ts = webnotes.bean("Timesheet", name)
-		
-		for tsd in ts.doclist.get({"doctype":"Timesheet Detail"}):
-			if not webnotes.conn.exists("Project", tsd.project_name):
-				tsd.project_name = None
-			if not webnotes.conn.exists("Task", tsd.task_id):
-				tsd.task_id = None
-				
-			tl = webnotes.bean({
-				"doctype": "Time Log",
-				"status": "Draft",
-				"from_time": ts.doc.timesheet_date + " " + tsd.act_start_time,
-				"to_time": ts.doc.timesheet_date + " " + tsd.act_end_time,
-				"activity_type": tsd.activity_type,
-				"task": tsd.task_id,
-				"project": tsd.project_name,
-				"note": ts.doc.notes,
-				"file_list": ts.doc.file_list,
-				"_user_tags": ts.doc._user_tags,
-				"owner": ts.doc.owner,
-				"creation": ts.doc.creation,
-				"modified_by": ts.doc.modified_by
-			})
-			
-			for key in custom_map["Timesheet"]:
-				tl.doc.fields[key] = ts.doc.fields.get(key)
-
-			for key in custom_map["Timesheet Detail"]:
-				tl.doc.fields[key] = tsd.fields.get(key)
-			
-			tl.make_controller()
-			tl.controller.set_status()
-			tl.controller.calculate_total_hours()
-			tl.doc.insert()
diff --git a/erpnext/patches/february_2013/payment_reconciliation_reset_values.py b/erpnext/patches/february_2013/payment_reconciliation_reset_values.py
deleted file mode 100644
index e45953b..0000000
--- a/erpnext/patches/february_2013/payment_reconciliation_reset_values.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.sql("""update `tabSingles` set value = '' 
-		where doctype  = 'Payment to Invoice Matching Tool' 
-		and field in ('account', 'voucher_no', 'total_amount', 'pending_amt_to_reconcile', 
-		'from_date', 'to_date', 'amt_greater_than', 'amt_less_than')""")
-	
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/reload_bom_replace_tool_permission.py b/erpnext/patches/february_2013/reload_bom_replace_tool_permission.py
deleted file mode 100644
index 70a0d6f..0000000
--- a/erpnext/patches/february_2013/reload_bom_replace_tool_permission.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.sql("""delete from `tabDocPerm` where parent = 'BOM Replace Tool'""")
-	webnotes.reload_doc("manufacturing", "doctype", "bom_replace_tool")
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/remove_account_utils_folder.py b/erpnext/patches/february_2013/remove_account_utils_folder.py
deleted file mode 100644
index c7dfeb3..0000000
--- a/erpnext/patches/february_2013/remove_account_utils_folder.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	from webnotes.utils import get_base_path
-	import shutil
-	import os
-	
-	utils_path = os.path.join(get_base_path(), "app", "accounts", "utils")
-	if os.path.exists(utils_path):
-		shutil.rmtree(utils_path)
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/remove_gl_mapper.py b/erpnext/patches/february_2013/remove_gl_mapper.py
deleted file mode 100644
index 1b50a4b..0000000
--- a/erpnext/patches/february_2013/remove_gl_mapper.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	try:
-		for mapper in webnotes.conn.sql("""select name from `tabGL Mapper`"""):
-			webnotes.delete_doc("GL Mapper", mapper[0])
-	except Exception, e:
-		pass
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/repost_reserved_qty.py b/erpnext/patches/february_2013/repost_reserved_qty.py
deleted file mode 100644
index fbc6f1a..0000000
--- a/erpnext/patches/february_2013/repost_reserved_qty.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.auto_commit_on_many_writes = 1
-	from erpnext.utilities.repost_stock import get_reserved_qty, update_bin
-	
-	for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
-		update_bin(d[0], d[1], {
-			"reserved_qty": get_reserved_qty(d[0], d[1])
-		})
-	webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/patches/february_2013/update_company_in_leave_application.py b/erpnext/patches/february_2013/update_company_in_leave_application.py
deleted file mode 100644
index dfdb82f..0000000
--- a/erpnext/patches/february_2013/update_company_in_leave_application.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.reload_doc("hr", "doctype", "leave_application")
-	
-	webnotes.conn.sql("""update `tabLeave Application`, `tabEmployee` set
-		`tabLeave Application`.company = `tabEmployee`.company where
-		`tabLeave Application`.employee = `tabEmployee`.name""")
-		
-	company = webnotes.conn.get_default("company")
-	if company:
-		webnotes.conn.sql("""update `tabLeave Application`
-			set company = %s where ifnull(company,'')=''""", company)
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/__init__.py b/erpnext/patches/january_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/january_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/january_2013/change_patch_structure.py b/erpnext/patches/january_2013/change_patch_structure.py
deleted file mode 100644
index 57b685d..0000000
--- a/erpnext/patches/january_2013/change_patch_structure.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "patch_log")
-	if webnotes.conn.table_exists("__PatchLog"):
-		for d in webnotes.conn.sql("""select patch from __PatchLog"""):
-			webnotes.doc({
-				"doctype": "Patch Log",
-				"patch": d[0]
-			}).insert()
-	
-		webnotes.conn.commit()
-		webnotes.conn.sql("drop table __PatchLog")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/enable_currencies.py b/erpnext/patches/january_2013/enable_currencies.py
deleted file mode 100644
index f8fcac7..0000000
--- a/erpnext/patches/january_2013/enable_currencies.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	# get all currencies
-	webnotes.reload_doc("setup", "doctype", "currency")
-	clist = [webnotes.conn.get_default("currency")]
-	for f in webnotes.conn.sql("""select parent, fieldname from tabDocField 
-		where options in ('Currency', 'link:Currency')""", as_dict=1):
-		if not webnotes.conn.get_value("DocType", f.parent, "issingle"):
-			clist += [c[0] for c in webnotes.conn.sql("""select distinct `%s`
-				from `tab%s`""" % (f.fieldname, f.parent))]
-
-	clist = list(set(clist))
-	for c in clist:
-		if c:
-			webnotes.conn.sql("""update tabCurrency set `enabled`=1 where name=%s""", c)
diff --git a/erpnext/patches/january_2013/file_list_rename_returns.py b/erpnext/patches/january_2013/file_list_rename_returns.py
deleted file mode 100644
index 1295724..0000000
--- a/erpnext/patches/january_2013/file_list_rename_returns.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-from webnotes.utils import get_base_path
-import os
-
-def execute():
-	# find out when was the file list patch run
-	res = webnotes.conn.sql("""select applied_on from `__PatchLog`
-		where patch='patches.december_2012.file_list_rename' order by applied_on desc limit 1""")
-	if res:
-		patch_date = res[0][0].date()
-		files_path = os.path.join(get_base_path(), "public", "files")
-		
-		change_map = {}
-		
-		file_data_list = webnotes.conn.sql("""select name, file_name from `tabFile Data`
-			where date(modified) <= %s and ifnull(file_url, '')='' and name like "%%-%%" """,
-			patch_date)
-			
-		# print patch_date
-		# print file_data_list
-		# print files_path
-		
-		for fid, file_name in file_data_list:			
-			if os.path.exists(os.path.join(files_path, fid)):
-				new_fid, new_file_name = fid.replace("-", ""), file_name.replace("-", "")
-				
-				try:
-					webnotes.conn.sql("""update `tabFile Data`
-						set name=%s, file_name=%s where name=%s""", (new_fid, new_file_name, fid))
-			
-					os.rename(os.path.join(files_path, fid), os.path.join(files_path, new_fid))
-			
-					change_map[",".join((file_name, fid))] = ",".join((new_file_name, new_fid))
-				except Exception, e:
-					# if duplicate entry, then dont update
-					if e[0]!=1062:
-						raise
-		
-		
-		changed_keys = change_map.keys()
-			
-		for dt in webnotes.conn.sql("""select distinct parent from tabDocField 
-			where fieldname='file_list'"""):
-			try:
-				data = webnotes.conn.sql("""select name, file_list from `tab%s`
-					where ifnull(file_list, '')!=''""" % dt[0])
-				for name, file_list in data:
-					new_file_list = []
-					file_list = file_list.split("\n")
-					for f in file_list:
-						if f in changed_keys:
-							new_file_list.append(change_map[f])
-						else:
-							new_file_list.append(f)
-					if new_file_list != file_list:
-						webnotes.conn.sql("""update `tab%s` set file_list=%s
-							where name=%s""" % (dt[0], "%s", "%s"), 
-							("\n".join(new_file_list), name))
-				
-			except Exception, e:
-				if e[0]!=1146:
-					raise
-	
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/give_report_permission_on_read.py b/erpnext/patches/january_2013/give_report_permission_on_read.py
deleted file mode 100644
index f493e32..0000000
--- a/erpnext/patches/january_2013/give_report_permission_on_read.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.sql("""update tabDocPerm set `report`=`read`
-		where ifnull(permlevel,0)=0""")
diff --git a/erpnext/patches/january_2013/holiday_list_patch.py b/erpnext/patches/january_2013/holiday_list_patch.py
deleted file mode 100644
index 5258329..0000000
--- a/erpnext/patches/january_2013/holiday_list_patch.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	for name in webnotes.conn.sql("""select name from `tabHoliday List`"""):
-		holiday_list_wrapper = webnotes.bean("Holiday List", name[0])
-		
-		desc_count = _count([d.description for d in 
-			holiday_list_wrapper.doclist.get({"doctype": "Holiday"})])
-			
-		holiday_list_obj = webnotes.get_obj(doc=holiday_list_wrapper.doc,
-			doclist=holiday_list_wrapper.doclist)
-			
-		save = False
-		
-		for desc in desc_count.keys():
-			if desc in ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
-					"Friday", "Saturday"] and desc_count[desc] > 50:
-				holiday_list_obj.doclist = holiday_list_obj.doclist.get(
-					{"description": ["!=", desc]})
-				
-				webnotes.conn.sql("""delete from `tabHoliday`
-					where parent=%s and parenttype='Holiday List' 
-					and `description`=%s""", (holiday_list_obj.doc.name, desc))
-				holiday_list_obj.doc.weekly_off = desc
-				holiday_list_obj.get_weekly_off_dates()
-				save = True
-		
-		if save:
-			holiday_list_wrapper.set_doclist(holiday_list_obj.doclist)
-			holiday_list_wrapper.save()
-				
-def _count(lst):
-	out = {}	
-	for l in lst:
-		out[l] = out.setdefault(l, 0) + 1
-		
-	return out
-		
-		
-		
-		
-		
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/rebuild_tree.py b/erpnext/patches/january_2013/rebuild_tree.py
deleted file mode 100644
index 48e5d87..0000000
--- a/erpnext/patches/january_2013/rebuild_tree.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	from webnotes.utils.nestedset import rebuild_tree
-
-	rebuild_tree("Item Group", "parent_item_group")
-	rebuild_tree("Customer Group", "parent_customer_group")
-	rebuild_tree("Territory", "parent_territory")
-	rebuild_tree("Sales Person", "parent_sales_person")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/reload_print_format.py b/erpnext/patches/january_2013/reload_print_format.py
deleted file mode 100644
index 381602d..0000000
--- a/erpnext/patches/january_2013/reload_print_format.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	from webnotes.modules.import_file import import_files
-	import_files([["selling", "Print Format", "Quotation Classic"], 
-		["selling", "Print Format", "Quotation Modern"], 
-		["selling", "Print Format", "Quotation Spartan"], 
-		["selling", "Print Format", "Sales Order Classic"], 
-		["selling", "Print Format", "Sales Order Modern"], 
-		["selling", "Print Format", "Sales Order Spartan"]])
-		
-	import_files([["stock", "Print Format", "Delivery Note Classic"], 
-		["stock", "Print Format", "Delivery Note Modern"], 
-		["stock", "Print Format", "Delivery Note Spartan"]])
-		
-	import_files([["accounts", "Print Format", "Sales Invoice Classic"], 
-		["accounts", "Print Format", "Sales Invoice Modern"], 
-		["accounts", "Print Format", "Sales Invoice Spartan"]])
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/remove_bad_permissions.py b/erpnext/patches/january_2013/remove_bad_permissions.py
deleted file mode 100644
index 98d780b..0000000
--- a/erpnext/patches/january_2013/remove_bad_permissions.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update tabDocPerm set permlevel=0 where permlevel is null""")
-	webnotes.conn.sql("""update tabDocPerm set `create`=0, `submit`=0, `cancel`=0,
-		`amend`=0, `match`='' where permlevel>0""")
-	webnotes.delete_doc("Permission Control")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/remove_landed_cost_master.py b/erpnext/patches/january_2013/remove_landed_cost_master.py
deleted file mode 100644
index be023d8..0000000
--- a/erpnext/patches/january_2013/remove_landed_cost_master.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.delete_doc("DocType", "Landed Cost Master")
-	webnotes.delete_doc("DocType", "Landed Cost Master Detail")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/remove_tds_entry_from_gl_mapper.py b/erpnext/patches/january_2013/remove_tds_entry_from_gl_mapper.py
deleted file mode 100644
index 4e395fb..0000000
--- a/erpnext/patches/january_2013/remove_tds_entry_from_gl_mapper.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	return
-	from webnotes.modules.import_file import import_file
-	import_file("accounts", "GL Mapper", "Journal Voucher")
-	import_file("accounts", "GL Mapper", "Purchase Invoice")
-	import_file("accounts", "GL Mapper", "Purchase Invoice with write off")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/remove_unwanted_permission.py b/erpnext/patches/january_2013/remove_unwanted_permission.py
deleted file mode 100644
index 4ff0424..0000000
--- a/erpnext/patches/january_2013/remove_unwanted_permission.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	for dt in webnotes.conn.sql("""select name, issingle from tabDocType"""):
-		if dt[1]:
-			webnotes.conn.sql("""update tabDocPerm set report = 0 where parent = %s""", dt[0])
-		
-		
-		doctype = webnotes.bean("DocType", dt[0])
-		for pl in [1, 2, 3]:
-			if not doctype.doclist.get({"doctype": "DocField", "permlevel": pl}):
-				if doctype.doclist.get({"doctype":"DocPerm", "permlevel":pl}):
-					webnotes.conn.sql("""delete from `tabDocPerm` 
-						where parent = %s and permlevel = %s""", (dt[0], pl))
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/report_permission.py b/erpnext/patches/january_2013/report_permission.py
deleted file mode 100644
index 15c1269..0000000
--- a/erpnext/patches/january_2013/report_permission.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.reload_doc("core", "doctype", "docperm")
-	webnotes.conn.sql("""update tabDocPerm set `report`=`read`""")
-
-	# no report for singles
-	webnotes.conn.sql("""update tabDocPerm, tabDocType set tabDocPerm.`report`=0
-		where tabDocPerm.`parent` = tabDocType.name
-		and ifnull(tabDocType.issingle,0) = 1""")
-
-	# no submit for not submittables
-	webnotes.conn.sql("""update tabDocPerm, tabDocType set tabDocPerm.`submit`=0
-		where tabDocPerm.`parent` = tabDocType.name
-		and ifnull(tabDocType.is_submittable,0) = 0""")		
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/stock_reconciliation_patch.py b/erpnext/patches/january_2013/stock_reconciliation_patch.py
deleted file mode 100644
index fc37aa6..0000000
--- a/erpnext/patches/january_2013/stock_reconciliation_patch.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
-	webnotes.reload_doc("stock", "doctype", "stock_reconciliation")
-	
-	rename_fields()
-	move_remarks_to_comments()
-	store_stock_reco_json()
-	
-def rename_fields():
-	args = [["Stock Ledger Entry", "bin_aqat", "qty_after_transaction"], 
-		["Stock Ledger Entry", "fcfs_stack", "stock_queue"],
-		["Stock Reconciliation", "reconciliation_date", "posting_date"],
-		["Stock Reconciliation", "reconciliation_time", "posting_time"]]
-	for doctype, old_fieldname, new_fieldname in args:
-		webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" % 
-			(doctype, new_fieldname, old_fieldname))
-			
-def move_remarks_to_comments():
-	from webnotes.utils import get_fullname
-	result = webnotes.conn.sql("""select name, remark, modified_by from `tabStock Reconciliation`
-		where ifnull(remark, '')!=''""")
-	fullname_map = {}
-	for reco, remark, modified_by in result:
-		webnotes.bean([{
-			"doctype": "Comment",
-			"comment": remark,
-			"comment_by": modified_by,
-			"comment_by_fullname": fullname_map.setdefault(modified_by, get_fullname(modified_by)),
-			"comment_doctype": "Stock Reconciliation",
-			"comment_docname": reco
-		}]).insert()
-			
-def store_stock_reco_json():
-	import os
-	import json
-	from webnotes.utils.datautils import read_csv_content
-	from webnotes.utils import get_base_path
-	files_path = os.path.join(get_base_path(), "public", "files")
-	
-	list_of_files = os.listdir(files_path)
-	replaced_list_of_files = [f.replace("-", "") for f in list_of_files]
-	
-	for reco, file_list in webnotes.conn.sql("""select name, file_list 
-			from `tabStock Reconciliation`"""):
-		if file_list:
-			file_list = file_list.split("\n")
-			stock_reco_file = file_list[0].split(",")[1]
-			stock_reco_file_path = os.path.join(files_path, stock_reco_file)
-			if not os.path.exists(stock_reco_file_path):
-				if stock_reco_file in replaced_list_of_files:
-					stock_reco_file_path = os.path.join(files_path,
-						list_of_files[replaced_list_of_files.index(stock_reco_file)])
-				else:
-					stock_reco_file_path = ""
-			
-			if stock_reco_file_path:
-				with open(stock_reco_file_path, "r") as open_reco_file:
-					content = open_reco_file.read()
-					try:
-						content = read_csv_content(content)
-						reconciliation_json = json.dumps(content, separators=(',', ': '))
-						webnotes.conn.sql("""update `tabStock Reconciliation`
-							set reconciliation_json=%s where name=%s""", 
-							(reconciliation_json, reco))
-					except Exception:
-						# if not a valid CSV file, do nothing
-						pass
-	
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/tabsessions_to_myisam.py b/erpnext/patches/january_2013/tabsessions_to_myisam.py
deleted file mode 100644
index 71d8495..0000000
--- a/erpnext/patches/january_2013/tabsessions_to_myisam.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.commit()
-	webnotes.conn.sql("""alter table tabSessions engine=MyISAM""")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/update_closed_on.py b/erpnext/patches/january_2013/update_closed_on.py
deleted file mode 100644
index c929b3a..0000000
--- a/erpnext/patches/january_2013/update_closed_on.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "docfield")
-	webnotes.reload_doc("support", "doctype", "support_ticket")
-	
-	# customer issue resolved_by should be Profile
-	if webnotes.conn.sql("""select count(*) from `tabCustomer Issue` 
-		where ifnull(resolved_by,"")!="" """)[0][0]:
-		webnotes.make_property_setter({
-			"doctype":"Customer Issue", 
-			"fieldname": "resolved_by", 
-			"property": "options",
-			"value": "Sales Person"
-		})
-		
-	def get_communication_time(support_ticket, sort_order = 'asc'):
-		tmp = webnotes.conn.sql("""select creation from tabCommunication where
-			support_ticket=%s order by creation %s limit 1""" % ("%s", sort_order), 
-			support_ticket)
-		return tmp and tmp[0][0] or None
-		
-	# update in support ticket
-	webnotes.conn.auto_commit_on_many_writes = True
-	for st in webnotes.conn.sql("""select name, modified, status from 
-		`tabSupport Ticket`""", as_dict=1):
-		
-		webnotes.conn.sql("""update `tabSupport Ticket` set first_responded_on=%s where 
-			name=%s""", (get_communication_time(st.name) or st.modified, st.name))
-		if st.status=="Closed":
-			webnotes.conn.sql("""update `tabSupport Ticket` set resolution_date=%s where 
-				name=%s""", (get_communication_time(st.name, 'desc') or st.modified, st.name))
diff --git a/erpnext/patches/january_2013/update_country_info.py b/erpnext/patches/january_2013/update_country_info.py
deleted file mode 100644
index 6e26869..0000000
--- a/erpnext/patches/january_2013/update_country_info.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-import webnotes
-
-def execute():
-	from webnotes.country_info import get_all
-	data = get_all()
-
-	webnotes.reload_doc("setup", "doctype", "country")
-	webnotes.reload_doc("setup", "doctype", "currency")	
-	
-	for c in webnotes.conn.sql("""select name from tabCountry"""):
-		if c[0] in data:
-			info = webnotes._dict(data[c[0]])
-			doc = webnotes.doc("Country", c[0])
-			doc.date_format = info.date_format or "dd-mm-yyyy"
-			doc.time_zones = "\n".join(info.timezones or [])
-			doc.save()
-			
-			if webnotes.conn.exists("Currency", info.currency):
-				doc = webnotes.doc("Currency", info.currency)
-				doc.fields.update({
-					"fraction": info.currency_fraction,
-					"symbol": info.currency_symbol,
-					"fraction_units": info.currency_fraction_units
-				})
-				doc.save()
diff --git a/erpnext/patches/january_2013/update_fraction_for_usd.py b/erpnext/patches/january_2013/update_fraction_for_usd.py
deleted file mode 100644
index 62b3047..0000000
--- a/erpnext/patches/january_2013/update_fraction_for_usd.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.conn.sql("""update `tabCurrency` set fraction = 'Cent' where fraction = 'Cent[D]'""")
\ No newline at end of file
diff --git a/erpnext/patches/january_2013/update_number_format.py b/erpnext/patches/january_2013/update_number_format.py
deleted file mode 100644
index b4a6f96..0000000
--- a/erpnext/patches/january_2013/update_number_format.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-import webnotes
-
-def execute():
-	from webnotes.country_info import get_all
-	data = get_all()
-
-	webnotes.reload_doc("setup", "doctype", "currency")	
-	
-	for c in data:
-		info = webnotes._dict(data[c])
-		if webnotes.conn.exists("Currency", info.currency):
-			doc = webnotes.doc("Currency", info.currency)
-			doc.fields.update({
-				"number_format": info.number_format,
-			})
-			doc.save()
diff --git a/erpnext/patches/july_2013/__init__.py b/erpnext/patches/july_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/july_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/july_2013/p01_remove_doctype_mappers.py b/erpnext/patches/july_2013/p01_remove_doctype_mappers.py
deleted file mode 100644
index 1f9db3f..0000000
--- a/erpnext/patches/july_2013/p01_remove_doctype_mappers.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.sql("""drop table if exists `tabDocType Mapper`""")
-	webnotes.conn.sql("""drop table if exists `tabTable Mapper Detail`""")
-	webnotes.conn.sql("""drop table if exists `tabField Mapper Detail`""")
-	webnotes.delete_doc("DocType", "DocType Mapper")
-	webnotes.delete_doc("DocType", "Table Mapper Detail")
-	webnotes.delete_doc("DocType", "Field Mapper Detail")	
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p01_same_sales_rate_patch.py b/erpnext/patches/july_2013/p01_same_sales_rate_patch.py
deleted file mode 100644
index ff3120a..0000000
--- a/erpnext/patches/july_2013/p01_same_sales_rate_patch.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.reload_doc("setup", "doctype", "global_defaults")
-	
-	gd = webnotes.bean('Global Defaults')
-	gd.doc.maintain_same_sales_rate = 1
-	gd.save()
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p02_copy_shipping_address.py b/erpnext/patches/july_2013/p02_copy_shipping_address.py
deleted file mode 100644
index 91bf150..0000000
--- a/erpnext/patches/july_2013/p02_copy_shipping_address.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.reload_doc("stock", "doctype", "delivery_note")
-	webnotes.conn.sql("""update `tabDelivery Note` set shipping_address_name = customer_address, 
-		shipping_address = address_display""")
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p03_cost_center_company.py b/erpnext/patches/july_2013/p03_cost_center_company.py
deleted file mode 100644
index f5e47c5..0000000
--- a/erpnext/patches/july_2013/p03_cost_center_company.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("accounts", "doctype", "cost_center")
-	webnotes.conn.sql("""update `tabCost Center` set company=company_name""")
-	webnotes.conn.sql_ddl("""alter table `tabCost Center` drop column company_name""")
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p04_merge_duplicate_leads.py b/erpnext/patches/july_2013/p04_merge_duplicate_leads.py
deleted file mode 100644
index 3c34d77..0000000
--- a/erpnext/patches/july_2013/p04_merge_duplicate_leads.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-from webnotes.utils import extract_email_id
-
-def execute():
-	email_lead = {}
-	for name, email in webnotes.conn.sql("""select name, email_id from `tabLead`
-		where ifnull(email_id, '')!='' order by creation asc"""):
-		email = extract_email_id(email)
-		if email:
-			if email not in email_lead:
-				email_lead[email] = name
-			else:
-				webnotes.rename_doc("Lead", name, email_lead[email], force=True, merge=True)
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p05_custom_doctypes_in_list_view.py b/erpnext/patches/july_2013/p05_custom_doctypes_in_list_view.py
deleted file mode 100644
index 6587700..0000000
--- a/erpnext/patches/july_2013/p05_custom_doctypes_in_list_view.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-from webnotes.model import no_value_fields
-
-def execute():
-	for dt in webnotes.conn.sql_list("""select name from `tabDocType` where custom=1"""):
-		dtbean = webnotes.bean("DocType", dt)
-		
-		if any((df.in_list_view for df in dtbean.doclist.get({"doctype": "DocField", "parent": dt}))):
-			continue
-		
-		i = 0
-		for df in dtbean.doclist.get({"doctype": "DocField", "parent": dt}):
-			if i > 5:
-				break
-			
-			if df.fieldtype not in no_value_fields:
-				df.in_list_view = 1
-				i += 1
-				
-		if i > 0:
-			dtbean.save()
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p06_same_sales_rate.py b/erpnext/patches/july_2013/p06_same_sales_rate.py
deleted file mode 100644
index 7030cae..0000000
--- a/erpnext/patches/july_2013/p06_same_sales_rate.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	webnotes.reload_doc("selling", "doctype", "selling_settings")
-	ss = webnotes.bean("Selling Settings")
-	
-	same_rate = webnotes.conn.get_value("Global Defaults", "maintain_same_sales_rate")
-
-	if same_rate or same_rate == 0:
-		ss.doc.maintain_same_sales_rate = same_rate
-	else:
-		ss.doc.maintain_same_sales_rate = 1
-
-	ss.save()
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py b/erpnext/patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py
deleted file mode 100644
index 95004c0..0000000
--- a/erpnext/patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-def execute():
-	import webnotes
-	webnotes.reload_doc('stock', 'doctype', 'packed_item')
-	for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
-		webnotes.get_obj("Sales Invoice", si[0], 
-			with_children=1).update_qty(change_modified=False)
-		webnotes.conn.commit()
diff --git a/erpnext/patches/july_2013/p08_custom_print_format_net_total_export.py b/erpnext/patches/july_2013/p08_custom_print_format_net_total_export.py
deleted file mode 100644
index 646bd2f..0000000
--- a/erpnext/patches/july_2013/p08_custom_print_format_net_total_export.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-import re
-
-def execute():
-	for name, html in webnotes.conn.sql("""select name, html from `tabPrint Format` where standard='No'
-		and ifnull(html, '')!=''"""):
-			changed = False
-			for match in re.findall("(doc.net_total.*doc.conversion_rate)", html):
-				if match.replace(" ", "") == "doc.net_total/doc.conversion_rate":
-					html = html.replace(match, "doc.net_total_export")
-					changed = True
-		
-			if changed:
-				webnotes.conn.set_value("Print Format", name, "html", html)
-			
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p09_remove_website_pyc.py b/erpnext/patches/july_2013/p09_remove_website_pyc.py
deleted file mode 100644
index 20befc0..0000000
--- a/erpnext/patches/july_2013/p09_remove_website_pyc.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-import os
-
-def execute():
-	from webnotes.utils import get_base_path
-	website_py = os.path.join(get_base_path(), "app", "startup", "website.py")
-	website_pyc = os.path.join(get_base_path(), "app", "startup", "website.pyc")
-	if not os.path.exists(website_py) and os.path.exists(website_pyc):
-		os.remove(website_pyc)
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p10_change_partner_user_to_website_user.py b/erpnext/patches/july_2013/p10_change_partner_user_to_website_user.py
deleted file mode 100644
index b9230ca..0000000
--- a/erpnext/patches/july_2013/p10_change_partner_user_to_website_user.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update `tabProfile` set user_type="Website User" where user_type="Partner" """)
-	webnotes.conn.sql("""update `tabProfile` set user_type="System User" where ifnull(user_type, "")="" """)
-	
-	webnotes.conn.sql("""update `tabProfile` set user_type='System User'
-		where user_type='Website User' and exists (select name from `tabUserRole`
-			where parent=`tabProfile`.name)""")
\ No newline at end of file
diff --git a/erpnext/patches/july_2013/p11_update_price_list_currency.py b/erpnext/patches/july_2013/p11_update_price_list_currency.py
deleted file mode 100644
index ac259df..0000000
--- a/erpnext/patches/july_2013/p11_update_price_list_currency.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	for price_list_name in webnotes.conn.sql_list("""select name from `tabPrice List` 
-		where ifnull(currency, '')=''"""):
-			res = webnotes.conn.sql("""select distinct ref_currency from `tabItem Price`
-				where price_list_name=%s""", price_list_name)
-			if res and len(res)==1 and res[0][0]:
-				webnotes.conn.set_value("Price List", price_list_name, "currency", res[0][0])
diff --git a/erpnext/patches/july_2013/restore_tree_roots.py b/erpnext/patches/july_2013/restore_tree_roots.py
deleted file mode 100644
index 91b328c..0000000
--- a/erpnext/patches/july_2013/restore_tree_roots.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	from erpnext.startup.install import import_defaults
-	import_defaults()
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/__init__.py b/erpnext/patches/june_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/june_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/june_2013/p01_update_bom_exploded_items.py b/erpnext/patches/june_2013/p01_update_bom_exploded_items.py
deleted file mode 100644
index d4027a1..0000000
--- a/erpnext/patches/june_2013/p01_update_bom_exploded_items.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	updated_bom = []
-	for bom in webnotes.conn.sql("select name from tabBOM where docstatus < 2"):
-		if bom[0] not in updated_bom:
-			try:
-				bom_obj = webnotes.get_obj("BOM", bom[0], with_children=1)
-				updated_bom += bom_obj.update_cost_and_exploded_items(bom[0])
-				webnotes.conn.commit()
-			except:
-				pass
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p02_update_project_completed.py b/erpnext/patches/june_2013/p02_update_project_completed.py
deleted file mode 100644
index a868b20..0000000
--- a/erpnext/patches/june_2013/p02_update_project_completed.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("projects", "doctype", "project")
-	for p in webnotes.conn.sql_list("""select name from tabProject"""):
-		webnotes.bean("Project", p).make_controller().update_percent_complete()
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p03_buying_selling_for_price_list.py b/erpnext/patches/june_2013/p03_buying_selling_for_price_list.py
deleted file mode 100644
index 15da085..0000000
--- a/erpnext/patches/june_2013/p03_buying_selling_for_price_list.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "price_list")
-	webnotes.reload_doc("stock", "doctype", "item_price")
-
-	webnotes.conn.sql("""update `tabPrice List` pl, `tabItem Price` ip 
-		set pl.selling=ip.selling, pl.buying=ip.buying 
-		where pl.name=ip.price_list_name""")
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p04_fix_event_for_lead_oppty_project.py b/erpnext/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
deleted file mode 100644
index f80209f..0000000
--- a/erpnext/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	from erpnext.utilities.transaction_base import delete_events
-	
-	# delete orphaned Event User
-	webnotes.conn.sql("""delete from `tabEvent User`
-		where not exists(select name from `tabEvent` where `tabEvent`.name = `tabEvent User`.parent)""")
-		
-	for dt in ["Lead", "Opportunity", "Project"]:
-		for ref_name in webnotes.conn.sql_list("""select ref_name 
-			from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt):
-				if webnotes.conn.exists(dt, ref_name):
-					if dt in ["Lead", "Opportunity"]:
-						webnotes.get_obj(dt, ref_name).add_calendar_event(force=True)
-					else:
-						webnotes.get_obj(dt, ref_name).add_calendar_event()
-				else:
-					# remove events where ref doc doesn't exist
-					delete_events(dt, ref_name)
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p05_remove_search_criteria_reports.py b/erpnext/patches/june_2013/p05_remove_search_criteria_reports.py
deleted file mode 100644
index 291f6bc..0000000
--- a/erpnext/patches/june_2013/p05_remove_search_criteria_reports.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	try:
-		webnotes.conn.sql("""delete from `tabSearch Criteria` where ifnull(standard, 'No') = 'Yes'""")
-	except Exception, e:
-		pass
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p05_remove_unused_doctypes.py b/erpnext/patches/june_2013/p05_remove_unused_doctypes.py
deleted file mode 100644
index d3905c3..0000000
--- a/erpnext/patches/june_2013/p05_remove_unused_doctypes.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	doctypes = [
-	"Announcement",
-	"Authorization Rules",
-	"Blog Subscriber",
-	"Books",
-	"Call Log",
-	"Call Log Details",
-	"Campaign Expense",
-	"Communication Log",
-	"Compaint Note",
-	"Company Control",
-	"Competitor",
-	"Complaint Detail",
-	"Desktop Item",
-	"DocType Label",
-	"Employee Training",
-	"Featured Item",
-	"GL Control",
-	"GL Mapper",
-	"GL Mapper Detail",
-	"Holiday Block List",
-	"Holiday Block List Allow",
-	"Holiday Block List Date",
-	"Home Control",
-	"Home Settings",
-	"Item Parameter",
-	"Item Parameter Value",
-	"Lead Email CC Detail",
-	"Manage Account",
-	"Market Segment",
-	"Multi Ledger Report Detail",
-	"Naming Series Options",
-	"Navigation Control",
-	"Online Contact",
-	"Order Reconciliation",
-	"Order Reconciliation Detail",
-	"Other Income Detail",
-	"Partner Target Detail",
-	"Permission Control",
-	"Permission Rules",
-	"Print Style",
-	"Product Catalogue Control",
-	"Product Group",
-	"Product Settings",
-	"Products Settings",
-	"Profile Control",
-	"Project Activity",
-	"Project Activity Update",
-	"Project Control",
-	"Project Cost Breakup",
-	"Related Page",
-	"RV Detail",
-	"Sales Browser Control",
-	"Sandbox",
-	"Search Criteria",
-	"Series Detail",
-	"Shipping Address",
-	"SMS Receiver",
-	"State",
-	"TC Detail",
-	"Territory Target Detail",
-	"Timesheet",
-	"Timesheet Detail",
-	"Top Bar Settings",
-	"Training Session",
-	"Training Session Details",
-	"Transfer Ownership",
-	"Trash Control",
-	"Trend Analyzer Control",
-	"Update Delivery Date",
-	"User Setting-Profile",
-	"User Setting-Role Permission",
-	"User Setting-Role User",
-	"User Settings",
-	"Valuation Control",
-	"Website Product Category",
-	"Workflow Action Detail",
-	"Workflow Engine",
-	"Workflow Rule",
-	"Workflow Rule Detail"
-	]
-	
-	for d in doctypes:
-		webnotes.delete_doc("DocType", d)
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p06_drop_unused_tables.py b/erpnext/patches/june_2013/p06_drop_unused_tables.py
deleted file mode 100644
index ecb40ea..0000000
--- a/erpnext/patches/june_2013/p06_drop_unused_tables.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	tables = [
-	"About Us Team",
-	"Account Balance",
-	"Announcement",
-	"Answer",
-	"Blog Subscriber",
-	"Books",
-	"Call Log",
-	"Call Log Details",
-	"Campaign Expense",
-	"Communication Log",
-	"Compaint Note",
-	"Competitor",
-	"Complaint Detail",
-	"Desktop Item",
-	"DocType Label",
-	"Employee Training",
-	"Featured Item",
-	"GL Mapper",
-	"GL Mapper Detail",
-	"Holiday Block List",
-	"Holiday Block List Allow",
-	"Holiday Block List Date",
-	"Item Parameter",
-	"Item Parameter Value",
-	"Landed Cost Master",
-	"Landed Cost Master Detail",
-	"Lead Email CC Detail",
-	"Lease Agreement",
-	"Lease Installment",
-	"Market Segment",
-	"Multi Ledger Report Detail",
-	"Naming Series Options",
-	"Online Contact",
-	"Order Reconciliation Detail",
-	"Other Income Detail",
-	"Partner Target Detail",
-	"Period",
-	"Print Style",
-	"Product",
-	"Product Group",
-	"Project Activity",
-	"Project Activity Update",
-	"Project Cost Breakup",
-	"Question",
-	"RV Detail",
-	"Related Page",
-	"SMS Receiver",
-	"Sales and Purchase Return Item",
-	"Sandbox",
-	"Series Detail",
-	"Service Order Detail",
-	"Service Quotation Detail",
-	"Shipping Address",
-	"State",
-	"TC Detail",
-	"Territory Target Detail",
-	"Timesheet",
-	"Timesheet Detail",
-	"Training Session",
-	"Training Session Details",
-	"User Setting-Profile",
-	"User Setting-Role Permission",
-	"User Setting-Role User",
-	"Website Product Category",
-	"Workflow Action Detail",
-	"Workflow Rule",
-	"Workflow Rule Detail",
-	]
-	
-	webnotes.conn.sql("commit")
-	all_tables = webnotes.conn.sql_list("show tables")
-	for t in tables:
-		if ("tab" + t) in all_tables:
-			webnotes.conn.sql("drop table `tab%s`" % t)
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p07_taxes_price_list_for_territory.py b/erpnext/patches/june_2013/p07_taxes_price_list_for_territory.py
deleted file mode 100644
index f5d7009..0000000
--- a/erpnext/patches/june_2013/p07_taxes_price_list_for_territory.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("setup", "doctype", "applicable_territory")
-	webnotes.reload_doc("stock", "doctype", "price_list")
-	webnotes.reload_doc("accounts", "doctype", "sales_taxes_and_charges_master")
-	webnotes.reload_doc("accounts", "doctype", "shipping_rule")
-	
-	from webnotes.utils.nestedset import get_root_of
-	root_territory = get_root_of("Territory")
-	
-	for parenttype in ["Sales Taxes and Charges Master", "Price List", "Shipping Rule"]:
-		for name in webnotes.conn.sql_list("""select name from `tab%s` main
-			where not exists (select parent from `tabApplicable Territory` territory
-				where territory.parenttype=%s and territory.parent=main.name)""" % \
-				(parenttype, "%s"), (parenttype,)):
-			
-			doc = webnotes.doc({
-				"doctype": "Applicable Territory",
-				"__islocal": 1,
-				"parenttype": parenttype,
-				"parentfield": "valid_for_territories",
-				"parent": name,
-				"territory": root_territory
-			})
-			doc.save()
diff --git a/erpnext/patches/june_2013/p09_update_global_defaults.py b/erpnext/patches/june_2013/p09_update_global_defaults.py
deleted file mode 100644
index 09bc8eb..0000000
--- a/erpnext/patches/june_2013/p09_update_global_defaults.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	from_global_defaults = {
-		"credit_controller": "Accounts Settings",
-		"acc_frozen_upto": "Accounts Settings",
-		"bde_auth_role": "Accounts Settings",
-		"auto_indent": "Stock Settings",
-		"reorder_email_notify": "Stock Settings",
-		"tolerance": "Stock Settings",
-		"stock_frozen_upto": "Stock Settings",
-		"stock_auth_role": "Stock Settings",
-		"so_required": "Selling Settings",
-		"dn_required": "Selling Settings",
-		"po_required": "Selling Settings",
-		"pr_required": "Selling Settings"
-	}
-	
-	from_defaults = {
-		"item_group": "Stock Settings",
-		"item_naming_by": "Stock Settings",
-		"stock_uom": "Stock Settings",
-		"valuation_method": "Stock Settings",
-		"allow_negative_stock": "Stock Settings",
-		"cust_master_name": "Selling Settings",
-		"customer_group": "Selling Settings",
-		"territory": "Selling Settings",
-		"price_list_name": "Selling Settings",
-		"supplier_type": "Buying Settings",
-		"supp_master_name": "Buying Settings",
-		"maintain_same_rate": "Buying Settings"
-	}
-
-	for key in from_global_defaults:
-		webnotes.conn.set_value(from_global_defaults[key], None, key, 
-			webnotes.conn.get_value("Global Defaults", None, key))
-			
-	for key in from_defaults:
-		webnotes.conn.set_value(from_defaults[key], None, key, 
-			webnotes.conn.get_default(key))
-		
\ No newline at end of file
diff --git a/erpnext/patches/june_2013/p10_lead_address.py b/erpnext/patches/june_2013/p10_lead_address.py
deleted file mode 100644
index 0be3390..0000000
--- a/erpnext/patches/june_2013/p10_lead_address.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("utilities", "doctype", "address")
-	
-	webnotes.conn.auto_commit_on_many_writes = True
-	
-	for lead in webnotes.conn.sql("""select name as lead, lead_name, address_line1, address_line2, city, country,
-		state, pincode, status, company_name from `tabLead` where not exists 
-		(select name from `tabAddress` where `tabAddress`.lead=`tabLead`.name) and 
-			(ifnull(address_line1, '')!='' or ifnull(city, '')!='' or ifnull(country, '')!='' or ifnull(pincode, '')!='')""", as_dict=True):
-			if set_in_customer(lead):
-				continue
-
-			create_address_for(lead)
-			
-	webnotes.conn.auto_commit_on_many_writes = False
-			
-def set_in_customer(lead):
-	customer = webnotes.conn.get_value("Customer", {"lead_name": lead.lead})
-	if customer:
-		customer_address = webnotes.conn.sql("""select name from `tabAddress`
-			where customer=%s and (address_line1=%s or address_line2=%s or pincode=%s)""", 
-			(customer, lead.address_line1, lead.address_line2, lead.pincode))
-		if customer_address:
-			webnotes.conn.sql("""update `tabAddress` set lead=%s, lead_name=%s
-				where name=%s""", (lead.lead, lead.company_name or lead.lead_name, customer_address[0][0]))
-			return True
-			
-	return False
-			
-def create_address_for(lead):
-	address_title = lead.company_name or lead.lead_name or lead.lead
-	
-	for c in ['%', "'", '"', '#', '*', '?', '`']:
-		address_title = address_title.replace(c, "")
-	
-	if webnotes.conn.get_value("Address", address_title.strip() + "-" + "Billing"):
-		address_title += " " + lead.lead 
-	
-	lead.update({
-		"doctype": "Address", 
-		"address_type": "Billing", 
-		"address_title": address_title
-	})
-	
-	del lead["company_name"]
-	del lead["status"]
-	
-	lead_bean = webnotes.bean(lead)
-	lead_bean.ignore_mandatory = True
-	lead_bean.insert()
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/__init__.py b/erpnext/patches/march_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/march_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/march_2013/p01_c_form.py b/erpnext/patches/march_2013/p01_c_form.py
deleted file mode 100644
index 9621257..0000000
--- a/erpnext/patches/march_2013/p01_c_form.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	for cform in webnotes.conn.sql("""select name from `tabC-Form` where docstatus=2"""):
-		webnotes.conn.sql("""update `tabSales Invoice` set c_form_no=null
-			where c_form_no=%s""", cform[0])
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p02_get_global_default.py b/erpnext/patches/march_2013/p02_get_global_default.py
deleted file mode 100644
index cd96ece..0000000
--- a/erpnext/patches/march_2013/p02_get_global_default.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-import webnotes.defaults
-
-def execute():
-	# sesison expiry missing
-	if not webnotes.defaults.get_global_default("session_expiry"):
-		gd = webnotes.bean("Global Defaults", "Global Defaults")
-		gd.doc.session_expiry = webnotes.conn.get_value('Control Panel', None, 'session_expiry') \
-			or '06:00'
-		gd.save()
-		
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p03_rename_blog_to_blog_post.py b/erpnext/patches/march_2013/p03_rename_blog_to_blog_post.py
deleted file mode 100644
index 85ae6ad..0000000
--- a/erpnext/patches/march_2013/p03_rename_blog_to_blog_post.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc('website', 'doctype', 'blogger')
-	webnotes.rename_doc("DocType", "Blog", "Blog Post", force=True)
-	webnotes.reload_doc('website', 'doctype', 'blog_post')
-	webnotes.conn.sql('''update tabBlogger set posts=(select count(*) 
-		from `tabBlog Post` where ifnull(blogger,"")=tabBlogger.name)''')
-	webnotes.conn.sql("""update `tabBlog Post` set published_on=date(creation)""")
diff --git a/erpnext/patches/march_2013/p04_pos_update_stock_check.py b/erpnext/patches/march_2013/p04_pos_update_stock_check.py
deleted file mode 100644
index 9faac0b..0000000
--- a/erpnext/patches/march_2013/p04_pos_update_stock_check.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	from webnotes.utils import cint
-	webnotes.reload_doc("setup", "doctype", "global_defaults")
-	
-	doctype_list = webnotes.get_doctype("Sales Invoice")
-	update_stock_df = doctype_list.get_field("update_stock")
-	
-	global_defaults = webnotes.bean("Global Defaults", "Global Defaults")
-	global_defaults.doc.update_stock = cint(update_stock_df.default)
-	global_defaults.save()
-
-	webnotes.conn.sql("""delete from `tabProperty Setter`
-		where doc_type='Sales Invoice' and doctype_or_field='DocField'
-		and field_name='update_stock' and property='default'""")
-		
-	webnotes.reload_doc("accounts", "doctype", "sales_invoice")
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p05_payment_reconciliation.py b/erpnext/patches/march_2013/p05_payment_reconciliation.py
deleted file mode 100644
index c8639e6..0000000
--- a/erpnext/patches/march_2013/p05_payment_reconciliation.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	# delete wrong gle entries created due to a bug in make_gl_entries of Account Controller
-	# when using payment reconciliation
-	res = webnotes.conn.sql_list("""select distinct gl1.voucher_no
-		from `tabGL Entry` gl1, `tabGL Entry` gl2
-		where
-		date(gl1.modified) >= "2013-03-11"
-		and date(gl1.modified) = date(gl2.modified)
-		and gl1.voucher_no = gl2.voucher_no
-		and gl1.voucher_type = "Journal Voucher"
-		and gl1.voucher_type = gl2.voucher_type
-		and gl1.posting_date = gl2.posting_date
-		and gl1.account = gl2.account
-		and ifnull(gl1.is_cancelled, 'No') = 'No' and ifnull(gl2.is_cancelled, 'No') = 'No' 
-		and ifnull(gl1.against_voucher, '') = ifnull(gl2.against_voucher, '')
-		and ifnull(gl1.against_voucher_type, '') = ifnull(gl2.against_voucher_type, '')
-		and gl1.remarks = gl2.remarks
-		and ifnull(gl1.debit, 0) = ifnull(gl2.credit, 0)
-		and ifnull(gl1.credit, 0) = ifnull(gl2.debit, 0)
-		and gl1.name > gl2.name""")
-	
-	for r in res:
-		webnotes.conn.sql("""update `tabGL Entry` set `is_cancelled`='Yes'
-			where voucher_type='Journal Voucher' and voucher_no=%s""", r)
-		jv = webnotes.bean("Journal Voucher", r)
-		jv.run_method("make_gl_entries")
-	
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p06_remove_sales_purchase_return_tool.py b/erpnext/patches/march_2013/p06_remove_sales_purchase_return_tool.py
deleted file mode 100644
index ab40c89..0000000
--- a/erpnext/patches/march_2013/p06_remove_sales_purchase_return_tool.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	if webnotes.conn.exists("DocType", "Sales and Purchase Return Item"):
-		webnotes.delete_doc("DocType", "Sales and Purchase Return Item")
-	if webnotes.conn.exists("DocType", "Sales and Purchase Return Tool"):
-		webnotes.delete_doc("DocType", "Sales and Purchase Return Tool")
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p07_update_project_in_stock_ledger.py b/erpnext/patches/march_2013/p07_update_project_in_stock_ledger.py
deleted file mode 100644
index 3e95d4fe..0000000
--- a/erpnext/patches/march_2013/p07_update_project_in_stock_ledger.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
-	
-	# from stock entry
-	webnotes.conn.sql("""update 
-		`tabStock Ledger Entry` sle, 
-		`tabStock Entry` st
-	set sle.project = st.project_name
-	where
-	 	sle.voucher_type = "Stock Entry"
-		and sle.voucher_no = st.name""")
-			
-	# from purchase
-	webnotes.conn.sql("""update 
-		`tabStock Ledger Entry` sle, 
-		`tabPurchase Receipt Item` pri
-	set sle.project = pri.project_name
-	where
-	 	sle.voucher_type = "Purchase Receipt"
-		and sle.voucher_detail_no = pri.name""")
-
-	# from delivery note
-	webnotes.conn.sql("""update 
-		`tabStock Ledger Entry` sle, 
-		`tabDelivery Note` dn
-	set sle.project = dn.project_name
-	where
-	 	sle.voucher_type = "Delivery Note"
-		and sle.voucher_no = dn.name""")
-		
-	# from pos invoice
-	webnotes.conn.sql("""update 
-		`tabStock Ledger Entry` sle, 
-		`tabSales Invoice` si
-	set sle.project = si.project_name
-	where
-	 	sle.voucher_type = "Sales Invoice"
-		and sle.voucher_no = si.name""")
-	
-	
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p07_update_valuation_rate.py b/erpnext/patches/march_2013/p07_update_valuation_rate.py
deleted file mode 100644
index 0928061..0000000
--- a/erpnext/patches/march_2013/p07_update_valuation_rate.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("accounts", "doctype", "purchase_invoice_item")
-	webnotes.conn.auto_commit_on_many_writes = True
-	for purchase_invoice in webnotes.conn.sql_list("""select distinct parent 
-		from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(valuation_rate, 0)=0"""):
-		pi = webnotes.get_obj("Purchase Invoice", purchase_invoice)
-		try:
-			pi.calculate_taxes_and_totals()
-		except:
-			pass
-		pi.update_raw_material_cost()
-		pi.update_valuation_rate("entries")
-		for item in pi.doclist.get({"parentfield": "entries"}):
-			webnotes.conn.sql("""update `tabPurchase Invoice Item` set valuation_rate = %s 
-				where name = %s""", (item.valuation_rate, item.name))
-
-	webnotes.conn.auto_commit_on_many_writes = False
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p08_create_aii_accounts.py b/erpnext/patches/march_2013/p08_create_aii_accounts.py
deleted file mode 100644
index 78c245f..0000000
--- a/erpnext/patches/march_2013/p08_create_aii_accounts.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.reload_doc("stock", "doctype", "warehouse")	
-	webnotes.reload_doc("setup", "doctype", "company")
-	webnotes.reload_doc("accounts", "doctype", "cost_center")
-	create_chart_of_accounts_if_not_exists()
-	add_group_accounts()
-	add_ledger_accounts()
-	set_default_accounts()
-	
-def set_default_accounts():
-	for company in webnotes.conn.sql_list("select name from `tabCompany`"):
-		webnotes.get_obj("Company", company).set_default_accounts()
-	
-def _check(parent_account, company):
-	def _get_root(is_pl_account, debit_or_credit):
-		res = webnotes.conn.sql("""select name from `tabAccount`
-			where company=%s and is_pl_account = %s and debit_or_credit = %s
-			and ifnull(parent_account, "") ="" """, (company, is_pl_account, debit_or_credit))
-		return res and res[0][0] or None
-		
-	if not webnotes.conn.exists("Account", parent_account):
-		if parent_account.startswith("Current Assets"):
-			parent_account = _get_root("No", "Debit")
-		elif parent_account.startswith("Direct Expenses"):
-			parent_account = _get_root("Yes", "Debit")
-		elif parent_account.startswith("Current Liabilities"):
-			parent_account = _get_root("No", "Credit")
-
-	return parent_account
-	
-	
-def add_group_accounts():
-	accounts_to_add = [
-		["Stock Assets", "Current Assets", "Group", ""],
-		["Stock Expenses", "Direct Expenses", "Group", "Expense Account"],
-		["Stock Liabilities", "Current Liabilities", "Group", ""],
-	]
-		
-	add_accounts(accounts_to_add, _check)
-	
-	
-def add_ledger_accounts():
-	accounts_to_add = [
-		["Cost of Goods Sold", "Stock Expenses", "Ledger", "Expense Account"],
-		["Stock Adjustment", "Stock Expenses", "Ledger", "Expense Account"],
-		["Expenses Included In Valuation", "Stock Expenses", "Ledger", "Expense Account"],
-		["Stock Received But Not Billed", "Stock Liabilities", "Ledger", ""],
-	]
-	add_accounts(accounts_to_add)
-	
-	
-def add_accounts(accounts_to_add, check_fn=None):	
-	for company, abbr in webnotes.conn.sql("""select name, abbr from `tabCompany`"""):
-		count = webnotes.conn.sql("""select count(name) from `tabAccount`
-			where company=%s and ifnull(parent_account, '')=''""", company)[0][0]
-		
-		if count > 4:
-			webnotes.errprint("Company" + company + 
-				"has more than 4 root accounts. cannot apply patch to this company.")
-			continue
-		
-		for account_name, parent_account_name, group_or_ledger, account_type in accounts_to_add:
-			if not webnotes.conn.sql("""select name from `tabAccount` where account_name = %s 
-					and company = %s""", (account_name, company)):
-				parent_account = "%s - %s" % (parent_account_name, abbr)
-				if check_fn:
-					parent_account = check_fn(parent_account, company)
-				account = webnotes.bean({
-					"doctype": "Account",
-					"account_name": account_name,
-					"parent_account": parent_account,
-					"group_or_ledger": group_or_ledger,
-					"account_type": account_type,
-					"company": company
-				})
-				account.insert()
-
-				
-def create_chart_of_accounts_if_not_exists():
-	for company in webnotes.conn.sql("select name from `tabCompany`"):
-		if not webnotes.conn.sql("select * from `tabAccount` where company = %s", company[0]):
-			webnotes.conn.sql("""update `tabCompany` set receivables_group = '', 
-				payables_group = '', default_bank_account = '', default_cash_account = '',
-				default_expense_account = '', default_income_account = '', cost_center = '', 
-				stock_received_but_not_billed = '', stock_adjustment_account = '', 
-				expenses_included_in_valuation = '' where name = %s""", company[0])
-				
-			webnotes.conn.sql("""update `tabCompany` set domain = 'Services' 
-				where name = %s and ifnull(domain, '') = ''""", company[0])
-				
-			webnotes.bean("Company", company[0]).save()
-				
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p10_set_fiscal_year_for_stock.py b/erpnext/patches/march_2013/p10_set_fiscal_year_for_stock.py
deleted file mode 100644
index 97510c7..0000000
--- a/erpnext/patches/march_2013/p10_set_fiscal_year_for_stock.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "stock_entry")
-	webnotes.reload_doc("stock", "doctype", "stock_reconciliation")
-	
-	for doctype in ["Stock Entry", "Stock Reconciliation"]:
-		for name, posting_date in webnotes.conn.sql("""select name, posting_date from `tab%s`
-				where ifnull(fiscal_year,'')='' and docstatus=1""" % doctype):
-			try:
-				fiscal_year = get_fiscal_year(posting_date, 0)[0]
-				webnotes.conn.sql("""update `tab%s` set fiscal_year=%s where name=%s""" % \
-					(doctype, "%s", "%s"), (fiscal_year, name))
-			except FiscalYearError:
-				pass
-			
-	
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p10_update_against_expense_account.py b/erpnext/patches/march_2013/p10_update_against_expense_account.py
deleted file mode 100644
index 4814953..0000000
--- a/erpnext/patches/march_2013/p10_update_against_expense_account.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from webnotes import get_obj
-	pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice` 
-		where docstatus = 1 and ifnull(against_expense_account, '') = ''""")
-		
-	for pi in pi_list:
-		pi_obj = get_obj("Purchase Invoice", pi[0], with_children=1)
-		pi_obj.set_against_expense_account()
-		webnotes.conn.sql("""update `tabPurchase Invoice` set against_expense_account = %s 
-			where name = %s""", (pi_obj.doc.against_expense_account, pi[0]))
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p11_update_attach_files.py b/erpnext/patches/march_2013/p11_update_attach_files.py
deleted file mode 100644
index f7b0a53..0000000
--- a/erpnext/patches/march_2013/p11_update_attach_files.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	for f in webnotes.conn.sql("""select parent, fieldname 
-		from tabDocField where options="attach_files:" """, as_dict=1):
-		if webnotes.conn.get_value("DocType", f.parent, "issingle"):
-			fname = webnotes.conn.get_value(f.parent, None, f.fieldname)
-			if fname:
-				if not (fname.startswith("http") or fname.startswith("files")):
-					webnotes.conn.set_value(f.parent, None, f.fieldname, "files/" + fname)
-		else:
-			webnotes.conn.sql("""update `tab%(parent)s`
-				set %(fieldname)s = 
-					if(substr(%(fieldname)s,1,4)='http' or substr(%(fieldname)s,1,5)='files',
-					 	%(fieldname)s, 
-						concat('files/', %(fieldname)s))""" % f)
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/p12_set_item_tax_rate_in_json.py b/erpnext/patches/march_2013/p12_set_item_tax_rate_in_json.py
deleted file mode 100644
index 85ddafc..0000000
--- a/erpnext/patches/march_2013/p12_set_item_tax_rate_in_json.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-import json
-
-def execute():
-	"""replace item_tax_rate stored as string with a json string"""
-	webnotes.conn.auto_commit_on_many_writes = 1
-	for dt in ["Quotation Item", "Sales Order Item", "Sales Invoice Item", 
-			"Delivery Note Item", "Supplier Quotation Item", "Purchase Order Item",
-			"Purchase Invoice Item", "Purchase Receipt Item"]:
-		for d in webnotes.conn.sql("""select name, item_tax_rate from `tab%s`
-				where ifnull(item_tax_rate, '')!=''""" % (dt,), as_dict=1):
-			try:
-				json.loads(d["item_tax_rate"])
-			except ValueError, e:
-				webnotes.conn.sql("""update `tab%s` set item_tax_rate=%s
-					where name=%s""" % (dt, "%s", "%s"),
-					(json.dumps(eval(d["item_tax_rate"])), d["name"]))
-		
-	webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/patches/march_2013/update_po_prevdoc_doctype.py b/erpnext/patches/march_2013/update_po_prevdoc_doctype.py
deleted file mode 100644
index ab7c932..0000000
--- a/erpnext/patches/march_2013/update_po_prevdoc_doctype.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabPurchase Order Item` set prevdoc_doctype = 'Material Request' 
-		where prevdoc_doctype = 'Purchase Request'""")
-	webnotes.conn.sql("""update `tabSupplier Quotation Item` 
-		set prevdoc_doctype = 'Material Request' where prevdoc_doctype = 'Purchase Request'""")
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/__init__.py b/erpnext/patches/may_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/may_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/may_2013/p01_selling_net_total_export.py b/erpnext/patches/may_2013/p01_selling_net_total_export.py
deleted file mode 100644
index 0a3cf5b..0000000
--- a/erpnext/patches/may_2013/p01_selling_net_total_export.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint
-
-def execute():
-	for module, doctype in (("Accounts", "Sales Invoice"), ("Selling", "Sales Order"), ("Selling", "Quotation"), 
-		("Stock", "Delivery Note")):
-			webnotes.reload_doc(module, "DocType", doctype)
-			webnotes.conn.sql("""update `tab%s` 
-				set net_total_export = round(net_total / if(conversion_rate=0, 1, ifnull(conversion_rate, 1)), 2),
-				other_charges_total_export = round(grand_total_export - net_total_export, 2)""" %
-				(doctype,))
-	
-	for module, doctype in (("Accounts", "Sales Invoice Item"), ("Selling", "Sales Order Item"), ("Selling", "Quotation Item"), 
-		("Stock", "Delivery Note Item")):
-			webnotes.reload_doc(module, "DocType", doctype)
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p02_update_valuation_rate.py b/erpnext/patches/may_2013/p02_update_valuation_rate.py
deleted file mode 100644
index 1419ebf..0000000
--- a/erpnext/patches/may_2013/p02_update_valuation_rate.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	from erpnext.stock.stock_ledger import update_entries_after
-	item_warehouse = []
-	# update valuation_rate in transaction
-	doctypes = {"Purchase Receipt": "purchase_receipt_details", "Purchase Invoice": "entries"}
-	
-	for dt in doctypes:
-		for d in webnotes.conn.sql("""select name from `tab%s` 
-				where modified >= '2013-05-09' and docstatus=1""" % dt):
-			rec = webnotes.get_obj(dt, d[0])
-			rec.update_valuation_rate(doctypes[dt])
-			
-			for item in rec.doclist.get({"parentfield": doctypes[dt]}):
-				webnotes.conn.sql("""update `tab%s Item` set valuation_rate = %s 
-					where name = %s"""% (dt, '%s', '%s'), tuple([item.valuation_rate, item.name]))
-					
-				if dt == "Purchase Receipt":
-					webnotes.conn.sql("""update `tabStock Ledger Entry` set incoming_rate = %s 
-						where voucher_detail_no = %s""", (item.valuation_rate, item.name))
-					if [item.item_code, item.warehouse] not in item_warehouse:
-						item_warehouse.append([item.item_code, item.warehouse])
-			
-	for d in item_warehouse:
-		try:
-			update_entries_after({"item_code": d[0], "warehouse": d[1], 
-				"posting_date": "2013-01-01", "posting_time": "00:05:00"})
-			webnotes.conn.commit()
-		except:
-			pass
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p03_update_support_ticket.py b/erpnext/patches/may_2013/p03_update_support_ticket.py
deleted file mode 100644
index 954bcf8..0000000
--- a/erpnext/patches/may_2013/p03_update_support_ticket.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	webnotes.reload_doc("support", "doctype", "support_ticket")
-	webnotes.reload_doc("core", "doctype", "communication")
-	for d in webnotes.conn.sql("""select name, raised_by from `tabSupport Ticket` 
-			where docstatus < 2""", as_dict=True):
-		tic = webnotes.get_obj("Support Ticket", d.name)
-		tic.set_lead_contact(d.raised_by)
-		webnotes.conn.sql("""update `tabSupport Ticket` set lead = %s, contact = %s, company = %s 
-			where name = %s""", (tic.doc.lead, tic.doc.contact, tic.doc.company, d.name
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p04_reorder_level.py b/erpnext/patches/may_2013/p04_reorder_level.py
deleted file mode 100644
index 351e799..0000000
--- a/erpnext/patches/may_2013/p04_reorder_level.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	webnotes.reload_doc("Setup", "DocType", "Global Defaults")
-	
-	if webnotes.conn.exists({"doctype": "Item", "email_notify": 1}):
-		webnotes.conn.set_value("Global Defaults", None, "reorder_email_notify", 1)
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p05_update_cancelled_gl_entries.py b/erpnext/patches/may_2013/p05_update_cancelled_gl_entries.py
deleted file mode 100644
index bea2832..0000000
--- a/erpnext/patches/may_2013/p05_update_cancelled_gl_entries.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint
-
-def execute():
-	aii_enabled = cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
-	
-	if aii_enabled:
-		webnotes.conn.sql("""update `tabGL Entry` gle set is_cancelled = 'Yes' 
-			where voucher_type = 'Delivery Note'
-			and exists(select name from `tabDelivery Note` 
-				where name = gle.voucher_no and docstatus = 2)""")
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p06_make_notes.py b/erpnext/patches/may_2013/p06_make_notes.py
deleted file mode 100644
index 149547f..0000000
--- a/erpnext/patches/may_2013/p06_make_notes.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, markdown2
-
-def execute():
-	webnotes.reload_doc("utilities", "doctype", "note")
-	webnotes.reload_doc("utilities", "doctype", "note_user")
-	
-	for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
-		if question.question:
-			try:
-				name = question.question[:180]
-				if webnotes.conn.exists("Note", name):
-					webnotes.delete_doc("Note", name)
-
-				similar_questions = webnotes.conn.sql_list("""select name from `tabQuestion`
-					where question like %s""", "%s%%" % name)
-				answers = [markdown2.markdown(c) for c in webnotes.conn.sql_list("""
-						select answer from tabAnswer where question in (%s)""" % \
-						", ".join(["%s"]*len(similar_questions)), similar_questions)]
-
-				webnotes.bean({
-					"doctype":"Note",
-					"title": name,
-					"content": "<hr>".join(answers),
-					"owner": question.owner,
-					"creation": question.creation,
-					"public": 1
-				}).insert()
-			
-			except NameError:
-				pass
-			except Exception, e:
-				if e.args[0] != 1062:
-					raise
-
-	webnotes.delete_doc("DocType", "Question")
-	webnotes.delete_doc("DocType", "Answer")
-	
-	# update comment delete
-	webnotes.conn.sql("""update tabDocPerm \
-		set cancel=1 where parent='Comment' and role='System Manager'""")
diff --git a/erpnext/patches/may_2013/p06_update_billed_amt_po_pr.py b/erpnext/patches/may_2013/p06_update_billed_amt_po_pr.py
deleted file mode 100644
index 9acbe91..0000000
--- a/erpnext/patches/may_2013/p06_update_billed_amt_po_pr.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	import webnotes
-	webnotes.reload_doc("buying", "doctype", "purchase_order_item")
-	webnotes.reload_doc("stock", "doctype", "purchase_receipt_item")
-	
-	for pi in webnotes.conn.sql("""select name from `tabPurchase Invoice` where docstatus = 1"""):
-		webnotes.get_obj("Purchase Invoice", pi[0], 
-			with_children=1).update_qty(change_modified=False)
-		webnotes.conn.commit()
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p07_move_update_stock_to_pos.py b/erpnext/patches/may_2013/p07_move_update_stock_to_pos.py
deleted file mode 100644
index 13c5f77..0000000
--- a/erpnext/patches/may_2013/p07_move_update_stock_to_pos.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes, webnotes.defaults
-from webnotes.utils import cint
-
-def execute():
-	webnotes.reload_doc("accounts", "doctype", "pos_setting")
-	
-	webnotes.conn.sql("""update `tabPOS Setting` set update_stock=%s""", 
-		cint(webnotes.defaults.get_global_default("update_stock")))
-	
-	webnotes.conn.sql("""delete from `tabSingles`
-		where doctype='Global Defaults' and field='update_stock'""")
-
-	webnotes.conn.sql("""delete from `tabDefaultValue` 
-		where parent='Control Panel' and defkey="update_stock" """)
-
-	webnotes.defaults.clear_cache("Control Panel")
-
-	webnotes.reload_doc("setup", "doctype", "global_defaults")
-	
-	# previously, update_stock was valid only when is_pos was checked
-	# henceforth it is valid, and hence the patch
-	webnotes.conn.sql("""update `tabSales Invoice` set update_stock=0 
-		where ifnull(is_pos, 0)=0""")
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/p08_change_item_wise_tax.py b/erpnext/patches/may_2013/p08_change_item_wise_tax.py
deleted file mode 100644
index a5aa6bf..0000000
--- a/erpnext/patches/may_2013/p08_change_item_wise_tax.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-import json
-from webnotes.utils import flt
-
-def execute():
-	webnotes.conn.auto_commit_on_many_writes = 1
-	
-	for doctype in ["Purchase Taxes and Charges", "Sales Taxes and Charges"]:
-		for tax_name, item_wise_tax_detail in \
-			webnotes.conn.sql("""select name, item_wise_tax_detail from `tab%s`""" % doctype):
-				if not item_wise_tax_detail or not isinstance(item_wise_tax_detail, basestring):
-					continue
-				
-				try:
-					json.loads(item_wise_tax_detail)
-				except ValueError:
-					out = {}
-					for t in item_wise_tax_detail.split("\n"):
-						if " : " in t:
-							split_index = t.rfind(" : ")
-							account_head, amount = t[:split_index], t[split_index+3:]
-							out[account_head.strip()] = flt(amount.strip())
-							
-					if out:
-						webnotes.conn.sql("""update `tab%s` set item_wise_tax_detail=%s
-							where name=%s""" % (doctype, "%s", "%s"), (json.dumps(out), tax_name))
-
-	webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/patches/may_2013/repost_stock_for_no_posting_time.py b/erpnext/patches/may_2013/repost_stock_for_no_posting_time.py
deleted file mode 100644
index b36ccf3..0000000
--- a/erpnext/patches/may_2013/repost_stock_for_no_posting_time.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	import webnotes
-	from erpnext.stock.stock_ledger import update_entries_after
-	
-	res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry` 
-		where posting_time = '00:00'""")
-	
-	i=0
-	for d in res:
-	    try:
-	        update_entries_after({ "item_code": d[0], "warehouse": d[1]	})
-	    except:
-	        pass
-	    i += 1
-	    if i%20 == 0:
-	        webnotes.conn.sql("commit")
-	        webnotes.conn.sql("start transaction")
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/__init__.py b/erpnext/patches/november_2012/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/november_2012/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/november_2012/add_employee_field_in_employee.py b/erpnext/patches/november_2012/add_employee_field_in_employee.py
deleted file mode 100644
index d834eb9..0000000
--- a/erpnext/patches/november_2012/add_employee_field_in_employee.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.clear_perms("Employee")
-	webnotes.reload_doc("hr", "doctype", "employee")
-	webnotes.conn.sql("""update tabEmployee set employee=name""")
diff --git a/erpnext/patches/november_2012/add_theme_to_profile.py b/erpnext/patches/november_2012/add_theme_to_profile.py
deleted file mode 100644
index 7b912b2..0000000
--- a/erpnext/patches/november_2012/add_theme_to_profile.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.clear_perms("Profile")
-	webnotes.reload_doc("core", "doctype", "profile")
-	webnotes.conn.sql("""delete from `tabDefaultValue` where defkey='theme'""")
-	webnotes.delete_doc("Page", "profile-settings")
-	return
-
-	for name in webnotes.conn.sql("""select name from tabProfile"""):
-		theme = webnotes.conn.get_default("theme", name[0])
-		if theme:
-			webnotes.conn.set_value("Profile", name[0], "theme", theme)
-			
diff --git a/erpnext/patches/november_2012/cancelled_bom_patch.py b/erpnext/patches/november_2012/cancelled_bom_patch.py
deleted file mode 100644
index 75d867c..0000000
--- a/erpnext/patches/november_2012/cancelled_bom_patch.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	cancelled_boms = webnotes.conn.sql("""select name from `tabBOM`
-		where docstatus = 2""")
-	
-	for bom in cancelled_boms:
-		webnotes.conn.sql("""update `tabBOM` set is_default=0, is_active=0
-			where name=%s""", (bom[0],))
-		
-		webnotes.conn.sql("""update `tabItem` set default_bom=null
-			where default_bom=%s""", (bom[0],))
-		
-		
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/communication_sender_and_recipient.py b/erpnext/patches/november_2012/communication_sender_and_recipient.py
deleted file mode 100644
index e05a24b..0000000
--- a/erpnext/patches/november_2012/communication_sender_and_recipient.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "communication")
-	webnotes.conn.sql("""update tabCommunication set sender=email_address 
-		where ifnull(support_ticket,'') != ''""")
-	webnotes.conn.sql("""update tabCommunication set recipients=email_address where
-		ifnull(sender,'')=''""")
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/custom_field_insert_after.py b/erpnext/patches/november_2012/custom_field_insert_after.py
deleted file mode 100644
index e261573..0000000
--- a/erpnext/patches/november_2012/custom_field_insert_after.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	import re
-	regex = re.compile("\s-\s[\d\.]*")
-	
-	for name, insert_after in webnotes.conn.sql("""select name, insert_after
-			from `tabCustom Field`"""):
-		if insert_after:
-			new_insert_after = regex.sub("", insert_after)
-			webnotes.conn.set_value("Custom Field", name, "insert_after", new_insert_after)
-		
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/customer_issue_allocated_to_assigned.py b/erpnext/patches/november_2012/customer_issue_allocated_to_assigned.py
deleted file mode 100644
index e1e8cfe..0000000
--- a/erpnext/patches/november_2012/customer_issue_allocated_to_assigned.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	from webnotes.widgets.form.assign_to import add
-	# clear old customer issue todos
-	webnotes.conn.sql("""delete from tabToDo where reference_type='Customer Issue'""")
-	webnotes.conn.sql("""delete from tabComment where comment like '%Form/Customer Issue%'""")
-	for t in webnotes.conn.sql("""select * from `tabCustomer Issue` 
-		where ifnull(allocated_to, '')!='' and ifnull(status, "")="Open" """, as_dict=1):
-		add({
-			'doctype': "Customer Issue",
-			'name': t['name'],
-			'assign_to': t['allocated_to'],
-			'assigned_by': t['owner'],
-			'description': t['complaint'],
-			'date': t['creation'],
-			'no_notification': True
-		})
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/disable_cancelled_profiles.py b/erpnext/patches/november_2012/disable_cancelled_profiles.py
deleted file mode 100644
index 68e8867..0000000
--- a/erpnext/patches/november_2012/disable_cancelled_profiles.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	"""
-		in old system, deleted profiles were set as docstatus=2
-		in new system, its either disabled or deleted.
-	"""
-	webnotes.conn.sql("""update `tabProfile` set docstatus=0, enabled=0
-		where docstatus=2""")
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/gle_floating_point_issue.py b/erpnext/patches/november_2012/gle_floating_point_issue.py
deleted file mode 100644
index e9fdcf1..0000000
--- a/erpnext/patches/november_2012/gle_floating_point_issue.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	
-	webnotes.conn.sql("""update `tabGL Entry` 
-		set debit = round(debit, 2), credit = round(credit, 2)""")
-
-	gle = webnotes.conn.sql("""select voucher_type, voucher_no, 
-		sum(ifnull(debit,0)) - sum(ifnull(credit, 0)) as diff 
-	    from `tabGL Entry`
-		group by voucher_type, voucher_no
-		having sum(ifnull(debit, 0)) != sum(ifnull(credit, 0))""", as_dict=1)
-
-	for d in gle:
-		webnotes.conn.sql("""update `tabGL Entry` set debit = debit - %s 
-			where voucher_type = %s and voucher_no = %s and debit > 0 limit 1""", 
-			(d['diff'], d['voucher_type'], d['voucher_no']))
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/leave_application_cleanup.py b/erpnext/patches/november_2012/leave_application_cleanup.py
deleted file mode 100644
index 2a566e7..0000000
--- a/erpnext/patches/november_2012/leave_application_cleanup.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "doctype")
-	webnotes.clear_perms("Leave Application")
-	webnotes.reload_doc("hr", "doctype", "leave_application")
-	webnotes.conn.sql("""update `tabLeave Application` set status='Approved'
-		where docstatus=1""")
-	webnotes.conn.sql("""update `tabLeave Application` set status='Open'
-		where docstatus=0""")		
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/production_order_patch.py b/erpnext/patches/november_2012/production_order_patch.py
deleted file mode 100644
index a25c2c8..0000000
--- a/erpnext/patches/november_2012/production_order_patch.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	
-	webnotes.reload_doc("manufacturing", "doctype", "production_order")
-	webnotes.reload_doc("stock", "doctype", "stock_entry")
-	
-	webnotes.conn.sql("""update `tabStock Entry` 
-		set use_multi_level_bom = if(consider_sa_items_as_raw_materials='Yes', 0, 1)""")
-	
-	webnotes.conn.sql("""update `tabProduction Order` 
-		set use_multi_level_bom = if(consider_sa_items='Yes', 0, 1)
-		where use_multi_level_bom is null""")
diff --git a/erpnext/patches/november_2012/report_permissions.py b/erpnext/patches/november_2012/report_permissions.py
deleted file mode 100644
index 64b3498..0000000
--- a/erpnext/patches/november_2012/report_permissions.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update tabDocPerm set `write`=1 where
-		parent='Report'
-		and role in ('Administrator', 'Report Manager', 'System Manager')""")
\ No newline at end of file
diff --git a/erpnext/patches/november_2012/reset_appraisal_permissions.py b/erpnext/patches/november_2012/reset_appraisal_permissions.py
deleted file mode 100644
index 3bb2c01..0000000
--- a/erpnext/patches/november_2012/reset_appraisal_permissions.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.reset_perms("Appraisal")
diff --git a/erpnext/patches/november_2012/support_ticket_response_to_communication.py b/erpnext/patches/november_2012/support_ticket_response_to_communication.py
deleted file mode 100644
index a4dec94..0000000
--- a/erpnext/patches/november_2012/support_ticket_response_to_communication.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-import email.utils
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "communication")
-	webnotes.conn.commit()
-	for d in webnotes.conn.sql("""select owner, creation, modified, modified_by, parent, 
-		from_email, mail from `tabSupport Ticket Response`""", as_dict=1):
-		c = webnotes.doc("Communication")
-		c.creation = d.creation
-		c.owner = d.owner
-		c.modified = d.modified
-		c.modified_by = d.modified_by
-		c.naming_series = "COMM-"
-		c.subject = "response to Support Ticket: " + d.parent
-		c.content = d.mail
-		c.email_address = d.from_email
-		c.support_ticket = d.parent
-		email_addr = email.utils.parseaddr(c.email_address)[1]
-		c.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr}, "name") or None
-		c.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr}, "name") or None
-		c.communication_medium = "Email"
-		webnotes.conn.begin()
-		c.save(1, keep_timestamps=True)
-		webnotes.conn.commit()
-		
-	webnotes.delete_doc("DocType", "Support Ticket Response")
diff --git a/erpnext/patches/november_2012/update_delivered_billed_percentage_for_pos.py b/erpnext/patches/november_2012/update_delivered_billed_percentage_for_pos.py
deleted file mode 100644
index 4f64255..0000000
--- a/erpnext/patches/november_2012/update_delivered_billed_percentage_for_pos.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	
-	si = webnotes.conn.sql("""select distinct si.name 
-		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
-		where si_item.parent = si.name
-		and si.docstatus = 1
-		and ifnull(si.is_pos, 0) = 1
-		and ifnull(si_item.sales_order, '') != ''
-	""")
-	for d in si:
-		webnotes.bean("Sales Invoice", d[0]).run_method("update_qty")
\ No newline at end of file
diff --git a/erpnext/patches/october_2012/__init__.py b/erpnext/patches/october_2012/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/october_2012/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/october_2012/company_fiscal_year_docstatus_patch.py b/erpnext/patches/october_2012/company_fiscal_year_docstatus_patch.py
deleted file mode 100644
index 3e3177e..0000000
--- a/erpnext/patches/october_2012/company_fiscal_year_docstatus_patch.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabCompany` set docstatus = 0
-		where docstatus is null""")
-		
-	webnotes.conn.sql("""update `tabFiscal Year` set docstatus = 0
-		where docstatus is null""")
\ No newline at end of file
diff --git a/erpnext/patches/october_2012/custom_script_delete_permission.py b/erpnext/patches/october_2012/custom_script_delete_permission.py
deleted file mode 100644
index bc5d46a..0000000
--- a/erpnext/patches/october_2012/custom_script_delete_permission.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-def execute():
-	webnotes.reload_doc("core", "doctype", "docperm")
-	webnotes.reset_perms("Custom Script")
diff --git a/erpnext/patches/october_2012/fix_cancelled_gl_entries.py b/erpnext/patches/october_2012/fix_cancelled_gl_entries.py
deleted file mode 100644
index ee6058e..0000000
--- a/erpnext/patches/october_2012/fix_cancelled_gl_entries.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	entries = webnotes.conn.sql("""select voucher_type, voucher_no 
-		from `tabGL Entry` group by voucher_type, voucher_no""", as_dict=1)
-	for entry in entries:
-		try:
-			docstatus = webnotes.conn.sql("""select docstatus from `tab%s` where name = %s
-				and docstatus=2""" % (entry['voucher_type'], "%s"), entry['voucher_no'])
-			is_cancelled = docstatus and 'Yes' or None
-			if is_cancelled:
-				print entry['voucher_type'], entry['voucher_no']
-				webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'Yes'
-					where voucher_type = %s and voucher_no = %s""", 
-					(entry['voucher_type'], entry['voucher_no']))
-		except Exception, e:
-			pass
\ No newline at end of file
diff --git a/erpnext/patches/october_2012/fix_wrong_vouchers.py b/erpnext/patches/october_2012/fix_wrong_vouchers.py
deleted file mode 100644
index 48e996c..0000000
--- a/erpnext/patches/october_2012/fix_wrong_vouchers.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from webnotes.utils import flt
-	from webnotes.model.code import get_obj
-	from webnotes.utils import money_in_words
-	
-	vouchers = webnotes.conn.sql("""
-		select 
-			parent, parenttype, modified, docstatus, 
-			sum(if(category in ('Valuation and Total', 'Total') and add_deduct_tax='Add',
- 				tax_amount, 0)) as tax_added, 
-			sum(if(category in ('Valuation and Total', 'Total') and add_deduct_tax='Deduct', 
- 				tax_amount, 0)) as tax_ded			
-		from 
-			`tabPurchase Taxes and Charges`
-		where 
-			modified >= '2012-07-12'
-			and parenttype != 'Purchase Taxes and Charges Master'
-			and parent not like 'old_p%'
-			and docstatus != 2
-		group by parenttype, parent
-		order by modified
-	""", as_dict=1)
-
-	for d in vouchers:
-		current_total_tax = webnotes.conn.sql("""select total_tax from `tab%s` where name = %s""" %
-			(d['parenttype'], '%s'), d['parent'])
-		correct_total_tax = flt(d['tax_added']) - flt(d['tax_ded'])
-		
-		if flt(current_total_tax[0][0]) != correct_total_tax:			
-			if d['parenttype'] == 'Purchase Invoice':
-				webnotes.conn.sql("""
-					update `tab%s` 
-					set 
-						total_tax = %s, 
-						other_charges_added = %s, 
-						other_charges_added_import = other_charges_added / conversion_rate, 
-						other_charges_deducted = %s, 
-						other_charges_deducted_import = other_charges_deducted / conversion_rate, 
-						grand_total = net_total + other_charges_added - other_charges_deducted,
-						grand_total_import = grand_total / conversion_rate,
-						total_amount_to_pay = grand_total - total_tds_on_voucher,
-						outstanding_amount = total_amount_to_pay - total_advance
-					where 
-						name = %s
-				""" % (d['parenttype'], '%s', '%s', '%s', '%s'), 
-					(correct_total_tax, d['tax_added'], d['tax_ded'], d['parent']))				
-				
-			else:
-				webnotes.conn.sql("""
-					update `tab%s` 
-					set 
-						total_tax = %s, 
-						other_charges_added = %s, 
-						other_charges_added_import = other_charges_added / conversion_rate, 
-						other_charges_deducted = %s, 
-						other_charges_deducted_import = other_charges_deducted / conversion_rate,
-						grand_total = net_total + total_tax, 
-						grand_total_import = grand_total / conversion_rate,
-						rounded_total = round(grand_total)
-					where 
-						name = %s
-				""" % (d['parenttype'], '%s', '%s', '%s', '%s'), 
-					(correct_total_tax, d['tax_added'], d['tax_ded'], d['parent']))
-			
-			# set in words
-			obj = get_obj(d['parenttype'], d['parent'], with_children=1)
-			
-			base_currency = webnotes.conn.get_value('Company', obj.doc.company, 'default_currency')\
-				or get_defaults('default_currency')
-				
-			webnotes.conn.set_value(d['parenttype'], d['parent'], \
-				'in_words', money_in_words(obj.doc.grand_total, base_currency))
-			webnotes.conn.set_value(d['parenttype'], d['parent'], \
-				'in_words_import', money_in_words(obj.doc.grand_total_import, obj.doc.currency))
-			
-			# fix gl entries
-			if d['parenttype'] == 'Purchase Invoice' and d['docstatus'] == 1:
-				webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'Yes' 
-					where voucher_type = %s and voucher_no = %s""", 
-					(d['parenttype'], d['parent']))
-				
-				obj.make_gl_entries()
\ No newline at end of file
diff --git a/erpnext/patches/october_2012/update_account_property.py b/erpnext/patches/october_2012/update_account_property.py
deleted file mode 100644
index 0af1bcb..0000000
--- a/erpnext/patches/october_2012/update_account_property.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from webnotes.utils.nestedset import rebuild_tree
-	rebuild_tree('Account', 'parent_account')
-
-	roots = webnotes.conn.sql("""
-		select lft, rgt, debit_or_credit, is_pl_account, company from `tabAccount`
-		where ifnull(parent_account, '') = ''
-	""", as_dict=1)
-
-	for acc in roots:
-		webnotes.conn.sql("""update tabAccount set debit_or_credit = %(debit_or_credit)s, 
-			is_pl_account = %(is_pl_account)s, company = %(company)s
-			where lft > %(lft)s and rgt < %(rgt)s""", acc)
\ No newline at end of file
diff --git a/erpnext/patches/october_2012/update_permission.py b/erpnext/patches/october_2012/update_permission.py
deleted file mode 100644
index dc5e0f5..0000000
--- a/erpnext/patches/october_2012/update_permission.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	import webnotes
-	webnotes.conn.sql("""
-		delete from `tabDocPerm`
-		where 
-			role in ('Sales User', 'Sales Manager', 'Sales Master Manager', 
-				'Purchase User', 'Purchase Manager', 'Purchase Master Manager')
-			and parent = 'Sales and Purchase Return Tool'
-	""")
-	
-	webnotes.conn.sql("""delete from `tabDocPerm` where ifnull(role, '') = ''""")
-	
-	if not webnotes.conn.sql("""select name from `tabDocPerm` where parent = 'Leave Application'
-			and role = 'Employee' and permlevel = 1"""):
-		from webnotes.model.code import get_obj
-		from webnotes.model.doc import addchild
-		leave_app = get_obj('DocType', 'Leave Application', with_children=1)
-		ch = addchild(leave_app.doc, 'permissions', 'DocPerm')
-		ch.role = 'Employee'
-		ch.permlevel = 1
-		ch.read = 1
-		ch.save()
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/__init__.py b/erpnext/patches/october_2013/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/patches/october_2013/__init__.py
+++ /dev/null
diff --git a/erpnext/patches/october_2013/fix_is_cancelled_in_sle.py b/erpnext/patches/october_2013/fix_is_cancelled_in_sle.py
deleted file mode 100644
index cb5bcb9..0000000
--- a/erpnext/patches/october_2013/fix_is_cancelled_in_sle.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update `tabStock Ledger Entry` set is_cancelled = 'No' 
-		where ifnull(is_cancelled, '') = ''""")
-		
-	webnotes.conn.sql("""update tabBin b set b.stock_uom = 
-		(select i.stock_uom from tabItem i where i.name = b.item_code) 
-		where b.creation>='2013-09-01'""")
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p01_fix_serial_no_status.py b/erpnext/patches/october_2013/p01_fix_serial_no_status.py
deleted file mode 100644
index 4f00b27..0000000
--- a/erpnext/patches/october_2013/p01_fix_serial_no_status.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():	
-	serial_nos = webnotes.conn.sql("""select name from `tabSerial No` where status!='Not in Use' 
-		and docstatus=0""")
-	for sr in serial_nos:
-		try:
-			sr_bean = webnotes.bean("Serial No", sr[0])
-			sr_bean.make_controller().via_stock_ledger = True
-			sr_bean.save()
-			webnotes.conn.commit()
-		except:
-			pass
-			
-	webnotes.conn.sql("""update `tabSerial No` set warehouse='' where status in 
-		('Delivered', 'Purchase Returned')""")
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p01_update_delivery_note_prevdocs.py b/erpnext/patches/october_2013/p01_update_delivery_note_prevdocs.py
deleted file mode 100644
index 3fb06b0..0000000
--- a/erpnext/patches/october_2013/p01_update_delivery_note_prevdocs.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "delivery_note_item")
-	webnotes.conn.sql("""update `tabDelivery Note Item` set against_sales_order=prevdoc_docname
-		where prevdoc_doctype='Sales Order' """)
-		
-	webnotes.conn.sql("""update `tabDelivery Note Item` set against_sales_invoice=prevdoc_docname
-		where prevdoc_doctype='Sales Invoice' """)
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p02_set_communication_status.py b/erpnext/patches/october_2013/p02_set_communication_status.py
deleted file mode 100644
index e8820ff..0000000
--- a/erpnext/patches/october_2013/p02_set_communication_status.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "communication")
-	
-	webnotes.conn.sql("""update tabCommunication 
-		set sent_or_received= if(ifnull(recipients, '')='', "Received", "Sent")""")
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py b/erpnext/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py
deleted file mode 100644
index b92f7d0..0000000
--- a/erpnext/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "item_price")
-
-	webnotes.conn.sql("""update `tabItem Price` ip, `tabItem` i 
-		set ip.item_name=i.item_name, ip.item_description=i.description 
-		where ip.item_code=i.name""")
-
-	webnotes.conn.sql("""update `tabItem Price` ip, `tabPrice List` pl 
-		set ip.price_list=pl.name, ip.currency=pl.currency where ip.parent=pl.name""")
-
-	webnotes.conn.sql("""update `tabItem Price` 
-		set parent=null, parenttype=null, parentfield=null, idx=null""")
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p03_crm_update_status.py b/erpnext/patches/october_2013/p03_crm_update_status.py
deleted file mode 100644
index bfc5437..0000000
--- a/erpnext/patches/october_2013/p03_crm_update_status.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-# reason field
-
-def execute():
-	change_map = {
-		"Lead": [
-			["Lead Lost", "Lead"],
-			["Not interested", "Do Not Contact"],
-			["Opportunity Made", "Opportunity"],
-			["Contacted", "Replied"],
-			["Attempted to Contact", "Replied"],
-			["Contact in Future", "Interested"],
-		],
-		"Opportunity": [
-			["Quotation Sent", "Quotation"],
-			["Order Confirmed", "Quotation"],
-			["Opportunity Lost", "Lost"],
-		],
-		"Quotation": [
-			["Order Confirmed", "Ordered"],
-			["Order Lost", "Lost"]
-		],
-		"Support Ticket": [
-			["Waiting for Customer", "Replied"],
-			["To Reply", "Open"],
-		]
-	}
-	
-	for dt, opts in change_map.items():
-		for status in opts:
-			webnotes.conn.sql("""update `tab%s` set status=%s where status=%s""" % \
-				(dt, "%s", "%s"), (status[1], status[0]))
-				
-	for dt in ["Lead", "Opportunity"]:
-		for name in webnotes.conn.sql_list("""select name from `tab%s`""" % dt):
-			bean = webnotes.bean(dt, name)
-			before_status = bean.doc.status
-			bean.get_controller().set_status()
-			
-			if bean.doc.status != before_status:
-				webnotes.conn.sql("""update `tab%s` set status=%s where name=%s""" % (dt, "%s", "%s"),
-					(bean.doc.status, name))
diff --git a/erpnext/patches/october_2013/p03_remove_sales_and_purchase_return_tool.py b/erpnext/patches/october_2013/p03_remove_sales_and_purchase_return_tool.py
deleted file mode 100644
index a70c73d..0000000
--- a/erpnext/patches/october_2013/p03_remove_sales_and_purchase_return_tool.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-
-def execute():
-	from patches.march_2013 import p06_remove_sales_purchase_return_tool
-	p06_remove_sales_purchase_return_tool.execute()
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p04_update_report_permission.py b/erpnext/patches/october_2013/p04_update_report_permission.py
deleted file mode 100644
index 459e57d..0000000
--- a/erpnext/patches/october_2013/p04_update_report_permission.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-import webnotes
-
-def execute():
-	webnotes.conn.sql("""update tabDocPerm set `create`=1 where
-		parent='Report'
-		and role in ('Administrator', 'Report Manager', 'System Manager')""")
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p04_wsgi_migration.py b/erpnext/patches/october_2013/p04_wsgi_migration.py
deleted file mode 100644
index 9031c70..0000000
--- a/erpnext/patches/october_2013/p04_wsgi_migration.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-import webnotes.utils
-import os
-
-def execute():
-	base_path = webnotes.utils.get_base_path()
-	
-	# Remove symlinks from public folder:
-	# 	- server.py
-	# 	- web.py
-	# 	- unsupported.html
-	# 	- blank.html
-	# 	- rss.xml
-	# 	- sitemap.xml
-	for file in ("server.py", "web.py", "unsupported.html", "blank.html", "rss.xml", "sitemap.xml"):
-		file_path = os.path.join(base_path, "public", file)
-		if os.path.exists(file_path):
-			os.remove(file_path)
-			
-	# Remove wn-web files
-	# 	- js/wn-web.js
-	# 	- css/wn-web.css
-	for file_path in (("js", "wn-web.js"), ("css", "wn-web.css")):
-		file_path = os.path.join(base_path, "public", *file_path)
-		if os.path.exists(file_path):
-			os.remove(file_path)
-			
-	# Remove update app page
-	webnotes.delete_doc("Page", "update-manager")
diff --git a/erpnext/patches/october_2013/p05_delete_gl_entries_for_cancelled_vouchers.py b/erpnext/patches/october_2013/p05_delete_gl_entries_for_cancelled_vouchers.py
deleted file mode 100644
index b418f1f..0000000
--- a/erpnext/patches/october_2013/p05_delete_gl_entries_for_cancelled_vouchers.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	entries = webnotes.conn.sql("""select voucher_type, voucher_no 
-		from `tabGL Entry` group by voucher_type, voucher_no""", as_dict=1)
-	for entry in entries:
-		try:
-			cancelled_voucher = webnotes.conn.sql("""select name from `tab%s` where name = %s
-				and docstatus=2""" % (entry['voucher_type'], "%s"), entry['voucher_no'])
-			if cancelled_voucher:
-				webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type = %s and 
-					voucher_no = %s""", (entry['voucher_type'], entry['voucher_no']))
-		except:
-			pass
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p05_server_custom_script_to_file.py b/erpnext/patches/october_2013/p05_server_custom_script_to_file.py
deleted file mode 100644
index 5cffed6..0000000
--- a/erpnext/patches/october_2013/p05_server_custom_script_to_file.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	"""
-		Assuming that some kind of indentation exists:
-		- Find indentation of server custom script
-		- replace indentation with tabs
-		- Add line:
-			class CustomDocType(DocType):
-		- Add tab indented code after this line
-		- Write to file
-		- Delete custom script record
-	"""
-	import os
-	from webnotes.utils import get_site_base_path
-	from webnotes.core.doctype.custom_script.custom_script import make_custom_server_script_file
-	for name, dt, script in webnotes.conn.sql("""select name, dt, script from `tabCustom Script`
-		where script_type='Server'"""):
-			if script and script.strip():
-				try:
-					script = indent_using_tabs(script)
-					make_custom_server_script_file(dt, script)
-				except IOError, e:
-					if "already exists" not in repr(e):
-						raise
-			
-def indent_using_tabs(script):
-	for line in script.split("\n"):
-		try:
-			indentation_used = line[:line.index("def ")]
-			script = script.replace(indentation_used, "\t")
-			break
-		except ValueError:
-			pass
-	
-	return script
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p06_rename_packing_list_doctype.py b/erpnext/patches/october_2013/p06_rename_packing_list_doctype.py
deleted file mode 100644
index b4af592..0000000
--- a/erpnext/patches/october_2013/p06_rename_packing_list_doctype.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes, os
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "doctype")
-	
-	tables = webnotes.conn.sql_list("show tables")
-	
-	if "tabPacked Item" not in tables:
-		webnotes.rename_doc("DocType", "Delivery Note Packing Item", "Packed Item", force=True)
-	
-	webnotes.reload_doc("stock", "doctype", "packed_item")
-	
-	if os.path.exists("app/stock/doctype/delivery_note_packing_item"):
-		os.system("rm -rf app/stock/doctype/delivery_note_packing_item")
-	
-	if webnotes.conn.exists("DocType", "Delivery Note Packing Item"):
-			webnotes.delete_doc("DocType", "Delivery Note Packing Item")
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p06_update_control_panel_and_global_defaults.py b/erpnext/patches/october_2013/p06_update_control_panel_and_global_defaults.py
deleted file mode 100644
index cee5a6d..0000000
--- a/erpnext/patches/october_2013/p06_update_control_panel_and_global_defaults.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("setup", "doctype", "global_defaults")
-
-	country = webnotes.conn.sql("""select value from `tabSingles` where 
-		field='country' and doctype='Control Panel'""")
-	time_zone = webnotes.conn.sql("""select value from `tabSingles` where 
-		field='timezone' and doctype='Control Panel'""")
-
-	try:
-		gb_bean = webnotes.bean("Global Defaults")
-		gb_bean.doc.country = country and country[0][0] or None
-		gb_bean.doc.time_zone = time_zone and time_zone[0][0] or None
-		gb_bean.save()
-	except:
-		pass
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/p07_rename_for_territory.py b/erpnext/patches/october_2013/p07_rename_for_territory.py
deleted file mode 100644
index 7b10b71..0000000
--- a/erpnext/patches/october_2013/p07_rename_for_territory.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes, os
-
-def execute():
-	from webnotes.utils import get_base_path
-	import shutil
-	webnotes.reload_doc("core", "doctype", "doctype")
-
-	tables = webnotes.conn.sql_list("show tables")
-	
-	if "tabApplicable Territory" not in tables:
-		webnotes.rename_doc("DocType", "For Territory", "Applicable Territory", force=True)
-	
-	webnotes.reload_doc("setup", "doctype", "applicable_territory")
-	
-	path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory")
-	if os.path.exists(path):
-		shutil.rmtree(path)
-	
-	if webnotes.conn.exists("DocType", "For Territory"):
-		webnotes.delete_doc("DocType", "For Territory")
diff --git a/erpnext/patches/october_2013/p08_cleanup_after_item_price_module_change.py b/erpnext/patches/october_2013/p08_cleanup_after_item_price_module_change.py
deleted file mode 100644
index 783f1e4..0000000
--- a/erpnext/patches/october_2013/p08_cleanup_after_item_price_module_change.py
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes, os
-
-def execute():
-	import shutil
-	from webnotes.utils import get_base_path
-	
-	for dt in ("item_price", "price_list"):
-		path = os.path.join(get_base_path(), "app", "setup", "doctype", dt)
-		if os.path.exists(path):
-			shutil.rmtree(path)
diff --git a/erpnext/patches/october_2013/p09_update_naming_series_settings.py b/erpnext/patches/october_2013/p09_update_naming_series_settings.py
deleted file mode 100644
index 7771b73..0000000
--- a/erpnext/patches/october_2013/p09_update_naming_series_settings.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	selling_price_list =  webnotes.conn.get_value("Selling Settings", None, "selling_price_list")
-	if selling_price_list and not webnotes.conn.exists("Price List", selling_price_list):
-		webnotes.conn.set_value("Selling Settings", None, "selling_price_list", None)
-		
-	buying_price_list =  webnotes.conn.get_value("Buying Settings", None, "buying_price_list")
-	if buying_price_list and not webnotes.conn.exists("Price List", buying_price_list):
-		webnotes.conn.set_value("Buying Settings", None, "buying_price_list", None)
-	
-	# reset property setters for series
-	for name in ("Stock Settings", "Selling Settings", "Buying Settings", "HR Settings"):
-		webnotes.reload_doc(name.split()[0], 'DocType', name)
-		webnotes.bean(name, name).save()
diff --git a/erpnext/patches/october_2013/p10_plugins_refactor.py b/erpnext/patches/october_2013/p10_plugins_refactor.py
deleted file mode 100644
index 851c8af..0000000
--- a/erpnext/patches/october_2013/p10_plugins_refactor.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes, os, shutil
-
-def execute():
-	# changed cache key for plugin code files
-	return
-	
-	for doctype in webnotes.conn.sql_list("""select name from `tabDocType`"""):
-		webnotes.cache().delete_value("_server_script:"+doctype)
-	
-	# move custom script reports to plugins folder
-	for name in webnotes.conn.sql_list("""select name from `tabReport`
-		where report_type="Script Report" and is_standard="No" """):
-			bean = webnotes.bean("Report", name)
-			bean.save()
-			
-			module = webnotes.conn.get_value("DocType", bean.doc.ref_doctype, "module")
-			path = webnotes.modules.get_doc_path(module, "Report", name)
-			for extn in ["py", "js"]:
-				file_path = os.path.join(path, name + "." + extn)
-				plugins_file_path = webnotes.plugins.get_path(module, "Report", name, extn=extn)
-				if not os.path.exists(plugins_file_path) and os.path.exists(file_path):
-					shutil.copyfile(file_path, plugins_file_path)
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/perpetual_inventory_stock_transfer_utility.py b/erpnext/patches/october_2013/perpetual_inventory_stock_transfer_utility.py
deleted file mode 100644
index 889f5e2..0000000
--- a/erpnext/patches/october_2013/perpetual_inventory_stock_transfer_utility.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import nowdate, nowtime, cstr
-from erpnext.accounts.utils import get_fiscal_year
-
-def execute():
-	item_map = {}
-	for item in webnotes.conn.sql("""select * from tabItem""", as_dict=1):
-		item_map.setdefault(item.name, item)
-	
-	warehouse_map = get_warehosue_map()
-	naming_series = "STE/13/"
-	
-	for company in webnotes.conn.sql("select name from tabCompany"):
-		stock_entry = [{
-			"doctype": "Stock Entry",
-			"naming_series": naming_series,
-			"posting_date": nowdate(),
-			"posting_time": nowtime(),
-			"purpose": "Material Transfer",
-			"company": company[0],
-			"remarks": "Material Transfer to activate perpetual inventory",
-			"fiscal_year": get_fiscal_year(nowdate())[0]
-		}]
-		expense_account = "Cost of Goods Sold - NISL"
-		cost_center = "Default CC Ledger - NISL"
-		
-		for bin in webnotes.conn.sql("""select * from tabBin bin where ifnull(item_code, '')!='' 
-				and ifnull(warehouse, '') in (%s) and ifnull(actual_qty, 0) != 0
-				and (select company from tabWarehouse where name=bin.warehouse)=%s""" %
-				(', '.join(['%s']*len(warehouse_map)), '%s'), 
-				(warehouse_map.keys() + [company[0]]), as_dict=1):
-			item_details = item_map[bin.item_code]
-			new_warehouse = warehouse_map[bin.warehouse].get("fixed_asset_warehouse") \
-				if cstr(item_details.is_asset_item) == "Yes" \
-				else warehouse_map[bin.warehouse].get("current_asset_warehouse")
-				
-			if item_details.has_serial_no == "Yes":
-				serial_no = "\n".join([d[0] for d in webnotes.conn.sql("""select name 
-					from `tabSerial No` where item_code = %s and warehouse = %s 
-					and status in ('Available', 'Sales Returned')""", 
-					(bin.item_code, bin.warehouse))])
-			else:
-				serial_no = None
-			
-			stock_entry.append({
-				"doctype": "Stock Entry Detail",
-				"parentfield": "mtn_details",
-				"s_warehouse": bin.warehouse,
-				"t_warehouse": new_warehouse,
-				"item_code": bin.item_code,
-				"description": item_details.description,
-				"qty": bin.actual_qty,
-				"transfer_qty": bin.actual_qty,
-				"uom": item_details.stock_uom,
-				"stock_uom": item_details.stock_uom,
-				"conversion_factor": 1,
-				"expense_account": expense_account,
-				"cost_center": cost_center,
-				"serial_no": serial_no
-			})
-		
-		webnotes.bean(stock_entry).insert()
-		
-def get_warehosue_map():
-	return {
-		"MAHAPE": {
-			"current_asset_warehouse": "Mahape-New - NISL",
-			"fixed_asset_warehouse": ""
-		},
-		"DROP SHIPMENT": {
-			"current_asset_warehouse": "Drop Shipment-New - NISL",
-			"fixed_asset_warehouse": ""
-		},
-		"TRANSIT": {
-			"current_asset_warehouse": "Transit-New - NISL",
-			"fixed_asset_warehouse": ""
-		},
-		"ASSET - MAHAPE": {
-			"current_asset_warehouse": "",
-			"fixed_asset_warehouse": "Assets-New - NISL"
-		}
-	}
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/repost_ordered_qty.py b/erpnext/patches/october_2013/repost_ordered_qty.py
deleted file mode 100644
index 8295e29..0000000
--- a/erpnext/patches/october_2013/repost_ordered_qty.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	from patches.december_2012 import repost_ordered_qty
-	repost_ordered_qty.execute()
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/repost_planned_qty.py b/erpnext/patches/october_2013/repost_planned_qty.py
deleted file mode 100644
index 1e9da30..0000000
--- a/erpnext/patches/october_2013/repost_planned_qty.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-def execute():
-	import webnotes
-	from erpnext.utilities.repost_stock import get_planned_qty, update_bin
-	
-	for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
-		update_bin(d[0], d[1], {
-			"planned_qty": get_planned_qty(d[0], d[1])
-		})
\ No newline at end of file
diff --git a/erpnext/patches/october_2013/set_stock_value_diff_in_sle.py b/erpnext/patches/october_2013/set_stock_value_diff_in_sle.py
deleted file mode 100644
index 1f29ddc..0000000
--- a/erpnext/patches/october_2013/set_stock_value_diff_in_sle.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint
-
-def execute():
-	from patches.september_2012 import repost_stock
-	repost_stock.execute()
\ No newline at end of file
diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py
deleted file mode 100644
index 5c83ce1..0000000
--- a/erpnext/patches/patch_list.py
+++ /dev/null
@@ -1,276 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-patch_list = [
-	"execute:webnotes.reload_doc('core', 'doctype', 'doctype', force=True) #2013-10-15",
-	"execute:webnotes.reload_doc('core', 'doctype', 'docfield', force=True) #2013-10-15",
-	"execute:webnotes.reload_doc('core', 'doctype', 'docperm') #2013-07-16",
-	"execute:webnotes.reload_doc('core', 'doctype', 'page') #2013-07-16",
-	"execute:webnotes.reload_doc('core', 'doctype', 'report') #2013-07-16",
-	"patches.september_2012.stock_report_permissions_for_accounts", 
-	"patches.september_2012.communication_delete_permission", 
-	"patches.september_2012.all_permissions_patch", 
-	"patches.september_2012.customer_permission_patch", 
-	"patches.september_2012.add_stock_ledger_entry_index", 
-	"patches.september_2012.plot_patch", 
-	"patches.september_2012.event_permission", 
-	"patches.september_2012.repost_stock", 
-	"patches.september_2012.rebuild_trees", 
-	"patches.september_2012.deprecate_account_balance", 
-	"patches.september_2012.profile_delete_permission", 
-	"patches.october_2012.update_permission", 
-	"patches.october_2012.fix_wrong_vouchers", 
-	"patches.october_2012.company_fiscal_year_docstatus_patch", 
-	"patches.october_2012.update_account_property", 
-	"patches.october_2012.fix_cancelled_gl_entries", 
-	"patches.october_2012.custom_script_delete_permission", 
-	"patches.november_2012.custom_field_insert_after", 
-	"patches.november_2012.report_permissions", 
-	"patches.november_2012.customer_issue_allocated_to_assigned", 
-	"patches.november_2012.reset_appraisal_permissions", 
-	"patches.november_2012.disable_cancelled_profiles", 
-	"patches.november_2012.support_ticket_response_to_communication", 
-	"patches.november_2012.cancelled_bom_patch", 
-	"patches.november_2012.communication_sender_and_recipient", 
-	"patches.november_2012.update_delivered_billed_percentage_for_pos", 
-	"patches.november_2012.add_theme_to_profile", 
-	"patches.november_2012.add_employee_field_in_employee", 
-	"patches.november_2012.leave_application_cleanup", 
-	"patches.november_2012.production_order_patch", 
-	"patches.november_2012.gle_floating_point_issue", 
-	"patches.december_2012.deprecate_tds", 
-	"patches.december_2012.expense_leave_reload", 
-	"patches.december_2012.repost_ordered_qty", 
-	"patches.december_2012.repost_projected_qty", 
-	"patches.december_2012.website_cache_refactor", 
-	"patches.december_2012.production_cleanup", 
-	"patches.december_2012.fix_default_print_format", 
-	"patches.december_2012.file_list_rename", 
-	"patches.december_2012.replace_createlocal", 
-	"patches.december_2012.remove_quotation_next_contact", 
-	"patches.december_2012.stock_entry_cleanup", 
-	"patches.december_2012.production_order_naming_series", 
-	"patches.december_2012.rebuild_item_group_tree", 
-	"patches.december_2012.address_title", 
-	"patches.december_2012.delete_form16_print_format", 
-	"patches.december_2012.update_print_width", 
-	"patches.january_2013.remove_bad_permissions", 
-	"patches.january_2013.holiday_list_patch", 
-	"patches.january_2013.stock_reconciliation_patch", 
-	"patches.january_2013.report_permission", 
-	"patches.january_2013.give_report_permission_on_read", 
-	"patches.january_2013.update_closed_on",
-	"patches.january_2013.change_patch_structure",
-	"patches.january_2013.update_country_info",
-	"patches.january_2013.remove_tds_entry_from_gl_mapper",
-	"patches.january_2013.update_number_format",
-	"execute:webnotes.reload_doc('core', 'doctype', 'print_format') #2013-01",
-	"execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')",
-	"patches.january_2013.update_fraction_for_usd",
-	"patches.january_2013.enable_currencies",
-	"patches.january_2013.remove_unwanted_permission",
-	"patches.january_2013.remove_landed_cost_master",
-	"patches.january_2013.reload_print_format",
-	"patches.january_2013.rebuild_tree",
-	"execute:webnotes.reload_doc('core','doctype','docfield') #2013-01-28",
-	"patches.january_2013.tabsessions_to_myisam",
-	"patches.february_2013.remove_gl_mapper",
-	"patches.february_2013.reload_bom_replace_tool_permission",
-	"patches.february_2013.payment_reconciliation_reset_values",
-	"patches.february_2013.account_negative_balance",
-	"patches.february_2013.remove_account_utils_folder",
-	"patches.february_2013.update_company_in_leave_application",
-	"execute:webnotes.conn.sql_ddl('alter table tabSeries change `name` `name` varchar(100)')",
-	"execute:webnotes.conn.sql('update tabUserRole set parentfield=\"user_roles\" where parentfield=\"userroles\"')",
-	"patches.february_2013.p01_event",
-	"execute:webnotes.delete_doc('Page', 'Calendar')",
-	"patches.february_2013.p02_email_digest",
-	"patches.february_2013.p03_material_request",
-	"patches.february_2013.p04_remove_old_doctypes",
-	"execute:webnotes.delete_doc('DocType', 'Plot Control')",
-	"patches.february_2013.p05_leave_application",
-	"patches.february_2013.gle_floating_point_issue_revisited",
-	"patches.february_2013.fix_outstanding",
-	"execute:webnotes.delete_doc('DocType', 'Service Order')",
-	"execute:webnotes.delete_doc('DocType', 'Service Quotation')",
-	"execute:webnotes.delete_doc('DocType', 'Service Order Detail')",
-	"execute:webnotes.delete_doc('DocType', 'Service Quotation Detail')",
-	"execute:webnotes.delete_doc('Page', 'Query Report')",
-	"patches.february_2013.repost_reserved_qty",
-	"execute:webnotes.reload_doc('core', 'doctype', 'report') # 2013-02-25",
-	"execute:webnotes.conn.sql(\"update `tabReport` set report_type=if(ifnull(query, '')='', 'Report Builder', 'Query Report') where is_standard='No'\")",
-	"execute:webnotes.conn.sql(\"update `tabReport` set report_name=name where ifnull(report_name,'')='' and is_standard='No'\")",
-	"patches.february_2013.p08_todo_query_report",
-	"execute:(not webnotes.conn.exists('Role', 'Projects Manager')) and webnotes.doc({'doctype':'Role', 'role_name':'Projects Manager'}).insert()",
-	"patches.february_2013.p09_remove_cancelled_warehouses",
-	"patches.march_2013.update_po_prevdoc_doctype",
-	"patches.february_2013.p09_timesheets",
-	"execute:(not webnotes.conn.exists('UOM', 'Hour')) and webnotes.doc({'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'}).insert()",
-	"patches.march_2013.p01_c_form",
-	"execute:webnotes.conn.sql('update tabDocPerm set `submit`=1, `cancel`=1, `amend`=1 where parent=\"Time Log\"')",
-	"execute:webnotes.delete_doc('DocType', 'Attendance Control Panel')",
-	"patches.march_2013.p02_get_global_default",
-	"patches.march_2013.p03_rename_blog_to_blog_post",
-	"patches.march_2013.p04_pos_update_stock_check",
-	"patches.march_2013.p05_payment_reconciliation",
-	"patches.march_2013.p06_remove_sales_purchase_return_tool",
-	"execute:webnotes.bean('Global Defaults').save()",
-	"patches.march_2013.p07_update_project_in_stock_ledger",
-	"execute:webnotes.reload_doc('stock', 'doctype', 'item') #2013-03-25",
-	"execute:webnotes.reload_doc('setup', 'doctype', 'item_group') #2013-03-25",
-	"execute:webnotes.reload_doc('website', 'doctype', 'blog_post') #2013-03-25",
-	"execute:webnotes.reload_doc('website', 'doctype', 'web_page') #2013-03-25",
-	"execute:webnotes.reload_doc('setup', 'doctype', 'sales_partner') #2013-06-25",
-	"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
-	"patches.march_2013.p10_set_fiscal_year_for_stock",
-	"patches.march_2013.p10_update_against_expense_account",
-	"patches.march_2013.p11_update_attach_files",
-	"patches.march_2013.p12_set_item_tax_rate_in_json",
-	"patches.march_2013.p07_update_valuation_rate",
-	"patches.march_2013.p08_create_aii_accounts",
-	"patches.april_2013.p01_update_serial_no_valuation_rate",
-	"patches.april_2013.p02_add_country_and_currency",
-	"patches.april_2013.p03_fixes_for_lead_in_quotation",
-	"patches.april_2013.p04_reverse_modules_list",
-	"patches.april_2013.p04_update_role_in_pages",
-	"patches.april_2013.p05_update_file_data",
-	"patches.april_2013.p06_update_file_size",
-	"patches.april_2013.p05_fixes_in_reverse_modules",
-	"patches.april_2013.p07_rename_cost_center_other_charges",
-	"patches.april_2013.p06_default_cost_center",
-	"execute:webnotes.reset_perms('File Data')",
-	"patches.april_2013.p07_update_file_data_2",
-	"patches.april_2013.rebuild_sales_browser",
-	"patches.may_2013.p01_selling_net_total_export",
-	"patches.may_2013.repost_stock_for_no_posting_time",
-	"patches.may_2013.p02_update_valuation_rate",
-	"patches.may_2013.p03_update_support_ticket",
-	"patches.may_2013.p04_reorder_level",
-	"patches.may_2013.p05_update_cancelled_gl_entries",
-	"patches.may_2013.p06_make_notes",
-	"patches.may_2013.p06_update_billed_amt_po_pr",
-	"patches.may_2013.p07_move_update_stock_to_pos",
-	"patches.may_2013.p08_change_item_wise_tax",
-	"patches.june_2013.p01_update_bom_exploded_items",
-	"patches.june_2013.p02_update_project_completed",
-	"execute:webnotes.delete_doc('DocType', 'System Console')",
-	"patches.june_2013.p03_buying_selling_for_price_list",
-	"patches.june_2013.p04_fix_event_for_lead_oppty_project",
-	"patches.june_2013.p05_remove_search_criteria_reports",
-	"execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')",
-	"patches.june_2013.p05_remove_unused_doctypes",
-	"patches.june_2013.p06_drop_unused_tables",
-	"patches.june_2013.p09_update_global_defaults",
-	"patches.june_2013.p10_lead_address",
-	"patches.july_2013.p01_remove_doctype_mappers",
-	"execute:webnotes.delete_doc('Report', 'Delivered Items To Be Billed')",
-	"execute:webnotes.delete_doc('Report', 'Received Items To Be Billed')",
-	"patches.july_2013.p02_copy_shipping_address",
-	"patches.july_2013.p03_cost_center_company",
-	"patches.july_2013.p04_merge_duplicate_leads",
-	"patches.july_2013.p05_custom_doctypes_in_list_view",
-	"patches.july_2013.p06_same_sales_rate",
-	"patches.july_2013.p07_repost_billed_amt_in_sales_cycle",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2013-12-26",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2013-12-26",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2013-12-26",
-	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2013-12-26",
-	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2013-12-26",
-	"execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2013-12-26",
-	"patches.july_2013.p08_custom_print_format_net_total_export",
-	"patches.july_2013.p09_remove_website_pyc",
-	"patches.july_2013.p10_change_partner_user_to_website_user",
-	"patches.july_2013.p11_update_price_list_currency",
-	"execute:webnotes.bean('Selling Settings').save() #2013-07-29",
-	"execute:webnotes.reload_doc('accounts', 'doctype', 'accounts_settings') # 2013-09-24",
-	"patches.august_2013.p01_auto_accounting_for_stock_patch",
-	"patches.august_2013.p01_hr_settings",
-	"patches.august_2013.p02_rename_price_list",
-	"patches.august_2013.p03_pos_setting_replace_customer_account",
-	"patches.august_2013.p05_update_serial_no_status",
-	"patches.august_2013.p05_employee_birthdays",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16",
-	"execute:webnotes.delete_doc('DocType', 'Stock Ledger')",
-	"patches.august_2013.p06_deprecate_is_cancelled",
-	"patches.august_2013.p06_fix_sle_against_stock_entry",
-	"patches.september_2013.p01_add_user_defaults_from_pos_setting",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02",
-	"patches.september_2013.p01_fix_buying_amount_gl_entries",
-	"patches.september_2013.p01_update_communication",
-	"execute:webnotes.reload_doc('setup', 'doctype', 'features_setup') # 2013-09-05",
-	"patches.september_2013.p02_fix_serial_no_status",
-	"patches.september_2013.p03_modify_item_price_include_in_price_list",
-	"patches.august_2013.p06_deprecate_is_cancelled",
-	"execute:webnotes.delete_doc('DocType', 'Budget Control')",
-	"patches.september_2013.p03_update_stock_uom_in_sle",
-	"patches.september_2013.p03_move_website_to_framework",
-	"execute:webnotes.conn.set_value('Accounts Settings', None, 'frozen_accounts_modifier', 'Accounts Manager') # 2013-09-24",
-	"patches.september_2013.p04_unsubmit_serial_nos",
-	"patches.september_2013.p05_fix_customer_in_pos",
-	"patches.october_2013.fix_is_cancelled_in_sle",
-	"patches.october_2013.p01_update_delivery_note_prevdocs",
-	"patches.october_2013.p02_set_communication_status",
-	"patches.october_2013.p03_crm_update_status",
-	"execute:webnotes.delete_doc('DocType', 'Setup Control')",
-	"patches.october_2013.p04_wsgi_migration",
-	"patches.october_2013.p05_server_custom_script_to_file",
-	"patches.october_2013.repost_ordered_qty",
-	"patches.october_2013.repost_planned_qty",
-	"patches.october_2013.p06_rename_packing_list_doctype",
-	"execute:webnotes.delete_doc('DocType', 'Sales Common')",
-	"patches.october_2013.p09_update_naming_series_settings",
-	"patches.october_2013.p02_update_price_list_and_item_details_in_item_price",
-	"execute:webnotes.delete_doc('Report', 'Item-wise Price List')",
-	"patches.october_2013.p03_remove_sales_and_purchase_return_tool",
-	"patches.october_2013.p04_update_report_permission",
-	"patches.october_2013.p05_delete_gl_entries_for_cancelled_vouchers",
-	"patches.october_2013.p06_update_control_panel_and_global_defaults",
-	"patches.october_2013.p07_rename_for_territory",
-	"patches.june_2013.p07_taxes_price_list_for_territory",
-	"patches.october_2013.p08_cleanup_after_item_price_module_change",
-	"patches.october_2013.p10_plugins_refactor",
-	"patches.1311.p01_cleanup",
-	"execute:webnotes.reload_doc('website', 'doctype', 'table_of_contents') #2013-11-13",
-	"execute:webnotes.reload_doc('website', 'doctype', 'web_page') #2013-11-13",
-	"execute:webnotes.reload_doc('home', 'doctype', 'feed') #2013-11-15",
-	"execute:webnotes.reload_doc('core', 'doctype', 'defaultvalue') #2013-11-15",
-	"execute:webnotes.reload_doc('core', 'doctype', 'comment') #2013-11-15",
-	"patches.1311.p02_index_singles",
-	"patches.1311.p01_make_gl_entries_for_si",
-	"patches.1311.p03_update_reqd_report_fields",
-	"execute:webnotes.reload_doc('website', 'doctype', 'website_sitemap_config') #2013-11-20",
-	"execute:webnotes.reload_doc('website', 'doctype', 'website_sitemap') #2013-11-20",
-	"execute:webnotes.bean('Style Settings').save() #2013-11-20",
-	"execute:webnotes.get_module('website.doctype.website_sitemap_config.website_sitemap_config').rebuild_website_sitemap_config()",
-	"patches.1311.p04_update_year_end_date_of_fiscal_year",
-	"patches.1311.p04_update_comments",
-	"patches.1311.p05_website_brand_html",
-	"patches.1311.p06_fix_report_columns",
-	"execute:webnotes.delete_doc('DocType', 'Documentation Tool')",
-	"execute:webnotes.delete_doc('Report', 'Stock Ledger') #2013-11-29",
-	"execute:webnotes.delete_doc('Report', 'Payment Collection With Ageing')",
-	"execute:webnotes.delete_doc('Report', 'Payment Made With Ageing')",
-	"patches.1311.p07_scheduler_errors_digest",
-	"patches.1311.p08_email_digest_recipients",
-	"execute:webnotes.delete_doc('DocType', 'Warehouse Type')",
-	"patches.1312.p01_delete_old_stock_reports",
-	"patches.1312.p02_update_item_details_in_item_price",
-	"patches.1401.p01_move_related_property_setters_to_custom_field",
-	"patches.1401.p01_make_buying_selling_as_check_box_in_price_list",
-	"patches.1401.update_billing_status_for_zero_value_order",
-	"execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-12-26",
-	"execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2013-12-26",
-	"execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2013-12-26",
-	"execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2013-12-26",
-	"patches.1401.enable_all_price_list",
-	"patches.1401.fix_serial_no_status_and_warehouse",
-	"patches.1401.fix_planned_qty",
-]
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/__init__.py b/erpnext/patches/september_2012/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/patches/september_2012/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/patches/september_2012/add_stock_ledger_entry_index.py b/erpnext/patches/september_2012/add_stock_ledger_entry_index.py
deleted file mode 100644
index 69e9d54..0000000
--- a/erpnext/patches/september_2012/add_stock_ledger_entry_index.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.conn.commit()
-	try:
-		webnotes.conn.sql("""alter table `tabStock Ledger Entry` add index posting_sort_index(posting_date, posting_time, name)""")
-		webnotes.conn.commit()
-	except Exception, e:
-		if e.args[0]!=1061: raise
-	webnotes.conn.begin()
-	
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/all_permissions_patch.py b/erpnext/patches/september_2012/all_permissions_patch.py
deleted file mode 100644
index d0caa01..0000000
--- a/erpnext/patches/september_2012/all_permissions_patch.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	web_cache_perms()
-	stock_perms()
-	project_perms()
-	account_perms()
-	
-def web_cache_perms():
-	webnotes.conn.sql("""update `tabDocPerm`
-		set role='Guest' where parent='Web Cache' and role='All' and permlevel=0""")
-		
-def project_perms():
-	webnotes.conn.sql("""delete from `tabDocPerm`
-		where parent in ('Task', 'Project Activity') and role='All'""")
-
-def stock_perms():
-	webnotes.conn.sql("""delete from `tabDocPerm`
-		where parent in ('Landed Cost Wizard', 
-		'Sales and Purchase Return Tool') and role='All' and permlevel=0""")
-		
-def account_perms():
-	# since it is a child doctype, it does not need permissions
-	webnotes.conn.sql("""delete from tabDocPerm where parent='TDS Detail'""")
diff --git a/erpnext/patches/september_2012/communication_delete_permission.py b/erpnext/patches/september_2012/communication_delete_permission.py
deleted file mode 100644
index 06451e9..0000000
--- a/erpnext/patches/september_2012/communication_delete_permission.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	import webnotes
-	from webnotes.model.doc import addchild
-	from webnotes.model.code import get_obj
-	
-	existing = webnotes.conn.sql("""select role, name from `tabDocPerm`
-		where permlevel=0 and parent='Communication'""")
-
-	for role in ("Support Manager", "System Manager"):
-		if role not in map(lambda x: x[0], existing):
-			doctype_obj = get_obj("DocType", "Communication", with_children=1)
-			ch = addchild(doctype_obj.doc, "permissions", "DocPerm")
-			ch.permlevel = 0
-			ch.role = role
-			ch.read = 1
-			ch.write = 1
-			ch.create = 1
-			ch.cancel = 1
-			ch.save()
-		else:
-			webnotes.conn.set_value("DocPerm", dict(existing).get(role), "cancel", 1)
diff --git a/erpnext/patches/september_2012/customer_permission_patch.py b/erpnext/patches/september_2012/customer_permission_patch.py
deleted file mode 100644
index a249aec..0000000
--- a/erpnext/patches/september_2012/customer_permission_patch.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	from webnotes.model.doc import Document
-	perms = []
-	# create permissions for permlevel 2 assigned to "Credit Days" and "Credit Limit"
-	# 2 Accounts Manager r,w
-	# 2 System Manager r,w
-	perms.append([2, "Accounts Manager", 1, 1, 0, 0])
-	perms.append([2, "System Manager", 1, 1, 0, 0])
-	perms.append([2, "All", 1, 0, 0, 0])
-
-	# read, write, create, cancel perm for Accounts Manager for permlevel 0
-	perms.append([0, "Accounts Manager", 1, 1, 1, 1])
-
-	# permlevel 1 read permission for 'All'
-	# 1 All r
-	perms.append([1, "All", 1, 0, 0, 0])
-
-	for p in perms:
-		d = Document("DocPerm", fielddata={
-			"parent": "Customer",
-			"parentfield": "permissions",
-			"permlevel": p[0],
-			"role": p[1],
-			"read": p[2],
-			"write": p[3],
-			"create": p[4],
-			"cancel": p[5]
-		}).save(1)
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/deprecate_account_balance.py b/erpnext/patches/september_2012/deprecate_account_balance.py
deleted file mode 100644
index d39f82c..0000000
--- a/erpnext/patches/september_2012/deprecate_account_balance.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	# remove doctypes
-	for dt in ["Period", "Account Balance", "Multi Ledger Report", 
-			"Multi Ledger Report Detail", "Period Control", "Reposting Tool", 
-			"Lease Agreement", "Lease Installment"]:
-		webnotes.delete_doc("DocType", dt)
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/event_permission.py b/erpnext/patches/september_2012/event_permission.py
deleted file mode 100644
index 5dd7c89..0000000
--- a/erpnext/patches/september_2012/event_permission.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.model.code import get_obj
-from webnotes.model.doc import addchild
-
-def execute():
-	existing = webnotes.conn.sql("""select name from `tabDocPerm`
-		where permlevel=0 and parent='Event' and role='System Manager'
-		and cancel=1""")
-	if not existing:
-		ev_obj = get_obj("DocType", "Event", with_children=1)
-		ch = addchild(ev_obj.doc, "permissions", "DocPerm")
-		ch.permlevel = 0
-		ch.role = 'System Manager'
-		ch.read = ch.write = ch.create = ch.cancel = 1
-		ch.save()
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/plot_patch.py b/erpnext/patches/september_2012/plot_patch.py
deleted file mode 100644
index a3e10e0..0000000
--- a/erpnext/patches/september_2012/plot_patch.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	set_master_name_in_accounts()
-	set_customer_in_sales_invoices()
-	reset_lft_rgt()
-	add_analytics_role()
-
-def set_master_name_in_accounts():
-	accounts = webnotes.conn.sql("""select name, account_name, master_type from tabAccount
-		where ifnull(master_name, '')=''""", as_dict=1)
-	for acc in accounts:
-		if acc["master_type"] in ["Customer", "Supplier"]:
-			master = webnotes.conn.sql("""select name from `tab%s`
-				where name=%s """ % (acc["master_type"], "%s"), acc["account_name"])
-			if master:
-				webnotes.conn.sql("""update `tabAccount`
-					set master_name=%s where name=%s""", (master[0][0], acc["name"]))
-	
-def set_customer_in_sales_invoices():
-	webnotes.conn.sql("""update `tabSales Invoice` si
-		set si.customer=(select a.master_name from `tabAccount` a where a.name=si.debit_to)
-		where ifnull(si.customer, '')=''""")
-		
-def reset_lft_rgt():
-	from webnotes.utils.nestedset import rebuild_tree
-	dt = [
-		["Item Group", "parent_item_group"], 
-		["Customer Group", "parent_customer_group"],
-		["Territory", "parent_territory"],
-		["Account", "parent_account"], 
-		["Cost Center", "parent_cost_center"],
-		["Sales Person", "parent_sales_person"]
-	]
-	for d in dt:
-		rebuild_tree(d[0], d[1])
-		webnotes.conn.commit()
-		webnotes.conn.begin()
-	
-def add_analytics_role():
-	from webnotes.model.doc import Document
-	Document("Role", fielddata={
-		"name": "Analytics",
-		"role_name": "Analytics",
-		"module": "Setup",
-	}).save(1);
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/profile_delete_permission.py b/erpnext/patches/september_2012/profile_delete_permission.py
deleted file mode 100644
index 09ff708..0000000
--- a/erpnext/patches/september_2012/profile_delete_permission.py
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabDocPerm` set cancel=1
-		where parent='Profile' and role in ('System Manager', 'Administrator') and permlevel=0""")
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/rebuild_trees.py b/erpnext/patches/september_2012/rebuild_trees.py
deleted file mode 100644
index 2d988fd..0000000
--- a/erpnext/patches/september_2012/rebuild_trees.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	from webnotes.utils.nestedset import rebuild_tree
-
-	rebuild_tree("Item Group", "parent_item_group")
-	rebuild_tree("Customer Group", "parent_customer_group")
-	rebuild_tree("Territory", "parent_territory")
-	rebuild_tree("Account", "parent_account")
-	rebuild_tree("Cost Center", "parent_cost_center")
-	rebuild_tree("Sales Person", "parent_sales_person")
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/repost_stock.py b/erpnext/patches/september_2012/repost_stock.py
deleted file mode 100644
index 11c8747..0000000
--- a/erpnext/patches/september_2012/repost_stock.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	import webnotes
-	from erpnext.stock.stock_ledger import update_entries_after
-	res = webnotes.conn.sql("select distinct item_code, warehouse from `tabStock Ledger Entry`")
-	i=0
-	for d in res:
-	    try:
-			update_entries_after({ "item_code": d[0], "warehouse": d[1]})
-	    except:
-	        pass
-	    i += 1
-	    if i%100 == 0:
-	        webnotes.conn.sql("commit")
-	        webnotes.conn.sql("start transaction")
\ No newline at end of file
diff --git a/erpnext/patches/september_2012/stock_report_permissions_for_accounts.py b/erpnext/patches/september_2012/stock_report_permissions_for_accounts.py
deleted file mode 100644
index 6be5151..0000000
--- a/erpnext/patches/september_2012/stock_report_permissions_for_accounts.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-def execute():
-	import webnotes
-	from webnotes.model.doc import addchild
-	from webnotes.model.code import get_obj
-	
-	for parent in ("Stock Ledger Entry", "Bin"):
-		existing = webnotes.conn.sql("""select role from `tabDocPerm`
-			where permlevel=0 and parent=%s""", (parent,))
-	
-		if "Accounts Manager" not in map(lambda x: x[0], existing):
-			doctype_obj = get_obj("DocType", parent, with_children=1)
-			ch = addchild(doctype_obj.doc, "permissions", "DocPerm")
-			ch.permlevel = 0
-			ch.role = "Accounts Manager"
-			ch.read = 1
-			ch.save()
-		
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/__init__.py b/erpnext/patches/september_2013/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/patches/september_2013/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/patches/september_2013/p01_add_user_defaults_from_pos_setting.py b/erpnext/patches/september_2013/p01_add_user_defaults_from_pos_setting.py
deleted file mode 100644
index cb5111a..0000000
--- a/erpnext/patches/september_2013/p01_add_user_defaults_from_pos_setting.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	pos_view_users = webnotes.conn.sql_list("""select user from `tabPOS Setting`""")
-	for user in pos_view_users:
-		if user:
-			webnotes.defaults.set_user_default("is_pos", 1, user)
-		else:
-			webnotes.defaults.set_global_default("is_pos", 1)
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p01_fix_buying_amount_gl_entries.py b/erpnext/patches/september_2013/p01_fix_buying_amount_gl_entries.py
deleted file mode 100644
index 40b0e2d..0000000
--- a/erpnext/patches/september_2013/p01_fix_buying_amount_gl_entries.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-import webnotes.defaults
-from webnotes.utils import cint
-
-def execute():
-	if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")):
-		return
-	
-	# fix delivery note
-	for dn in webnotes.conn.sql_list("""select name from `tabDelivery Note` where docstatus=1
-		and posting_date >= "2013-08-06" order by posting_date"""):
-			recreate_gl_entries("Delivery Note", dn, "delivery_note_details")
-	
-	# fix sales invoice
-	for si in webnotes.conn.sql_list("""select name from `tabSales Invoice` where docstatus=1
-		and update_stock=1 and posting_date >= "2013-08-06" order by posting_date"""):
-			recreate_gl_entries("Sales Invoice", si, "entries")
-	
-def recreate_gl_entries(doctype, name, parentfield):
-	# calculate buying amount and make gl entries
-	bean = webnotes.bean(doctype, name)
-	bean.run_method("set_buying_amount")
-	
-	company_values = webnotes.conn.get_value("Company", bean.doc.company, ["default_expense_account",
-		"stock_adjustment_account", "cost_center", "stock_adjustment_cost_center"])
-	
-	# update missing expense account and cost center
-	for item in bean.doclist.get({"parentfield": parentfield}):
-		if item.buying_amount and not validate_item_values(item, bean.doc.company):
-			res = webnotes.conn.sql("""select expense_account, cost_center
-				from `tab%s` child where docstatus=1 and item_code=%s and
-					ifnull(expense_account, '')!='' and ifnull(cost_center, '')!='' and
-					(select company from `tabAccount` ac where ac.name=child.expense_account)=%s and
-					(select company from `tabCost Center` cc where cc.name=child.cost_center)=%s
-					order by creation desc limit 1""" % (item.doctype, "%s", "%s", "%s"), 
-					(item.item_code, bean.doc.company, bean.doc.company))
-			if res:
-				item.expense_account = res[0][0]
-				item.cost_center = res[0][1]
-			elif company_values:
-				item.expense_account = company_values[0] or company_values[1]
-				item.cost_center = company_values[2] or company_values[3]
-		
-			webnotes.conn.set_value(item.doctype, item.name, "expense_account", item.expense_account)
-			webnotes.conn.set_value(item.doctype, item.name, "cost_center", item.cost_center)
-	
-	# remove gl entries
-	webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type=%s
-		and voucher_no=%s""", (doctype, name))
-	bean.run_method("make_gl_entries")
-	
-def validate_item_values(item, company):
-	if item.expense_account and \
-		webnotes.conn.get_value("Account", item.expense_account, "company")!=company:
-			return False
-	elif item.cost_center and \
-		webnotes.conn.get_value("Cost Center", item.cost_center, "company")!=company:
-			return False
-	elif not (item.expense_account and item.cost_center):
-		return False
-		
-	return True
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p01_update_communication.py b/erpnext/patches/september_2013/p01_update_communication.py
deleted file mode 100644
index 1cadf8c..0000000
--- a/erpnext/patches/september_2013/p01_update_communication.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("core", "doctype", "communication")
-	webnotes.conn.sql("""update tabCommunication set communication_date = creation where 
-		ifnull(communication_date, '')='' """)
-	
-	for doctype in ("Contact", "Lead", "Job Applicant", "Supplier", "Customer", "Quotation", "Sales Person", "Support Ticket"):
-		try:
-			fieldname = doctype.replace(" ", '_').lower()
-			webnotes.conn.sql("""update tabCommunication
-				set parenttype=%s, parentfield='communications', 
-				parent=`%s` 
-				where ifnull(`%s`, '')!=''""" % ("%s", fieldname, fieldname), doctype)
-		except webnotes.SQLError, e:
-			if e.args[0] != 1054:
-				raise
diff --git a/erpnext/patches/september_2013/p02_fix_serial_no_status.py b/erpnext/patches/september_2013/p02_fix_serial_no_status.py
deleted file mode 100644
index c1a6f30..0000000
--- a/erpnext/patches/september_2013/p02_fix_serial_no_status.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	stock_entries = webnotes.conn.sql("""select ste_item.serial_no, ste.name 
-		from `tabStock Entry Detail` ste_item, `tabStock Entry` ste
-		where ste.name = ste_item.parent
-		and ifnull(ste_item.serial_no, '') != '' 
-		and ste.purpose='Material Transfer'
-		and ste.modified>='2013-08-14'
-		order by ste.posting_date desc, ste.posting_time desc, ste.name desc""", as_dict=1)
-		
-	for d in stock_entries:
-		serial_nos = d.serial_no.split("\n")
-		for sr in serial_nos:
-			serial_no = sr.strip()
-			if serial_no and webnotes.conn.exists("Serial No", serial_no):
-				serial_bean = webnotes.bean("Serial No", serial_no)
-				if serial_bean.doc.status == "Not Available":
-					latest_sle = webnotes.conn.sql("""select voucher_no from `tabStock Ledger Entry`
-						where item_code=%s and warehouse=%s and serial_no like %s 
-						order by name desc limit 1""", (serial_bean.doc.item_code, 
-							serial_bean.doc.warehouse, "%%%s%%" % serial_no))
-					
-					if latest_sle and latest_sle[0][0] == d.name:
-						serial_bean.doc.status = "Available"
-						serial_bean.save()
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p03_modify_item_price_include_in_price_list.py b/erpnext/patches/september_2013/p03_modify_item_price_include_in_price_list.py
deleted file mode 100644
index 63cc695..0000000
--- a/erpnext/patches/september_2013/p03_modify_item_price_include_in_price_list.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-
-def execute():
-	webnotes.reload_doc("stock", "doctype", "price_list")
-	webnotes.reload_doc("stock", "doctype", "item_price")
-	webnotes.reload_doc("stock", "doctype", "item")
-	
-	webnotes.conn.sql("""update `tabItem Price` set parenttype='Price List', 
-		parentfield='item_prices', `item_code`=`parent`""")
-	
-	# re-arranging idx of items
-	webnotes.conn.sql("""update `tabItem Price` set `parent`=`price_list`, idx=0""")
-	for pl in webnotes.conn.sql("""select name from `tabPrice List`"""):
-		webnotes.conn.sql("""set @name=0""")
-		webnotes.conn.sql("""update `tabItem Price` set idx = @name := IF(ISNULL( @name ), 0, @name + 1) 
-			where idx=0 and parent=%s""", pl[0])
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p03_move_website_to_framework.py b/erpnext/patches/september_2013/p03_move_website_to_framework.py
deleted file mode 100644
index 98f1683..0000000
--- a/erpnext/patches/september_2013/p03_move_website_to_framework.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import get_base_path
-import os, shutil
-
-def execute():
-	# remove pyc files
-	utils_pyc = os.path.join(get_base_path(), "app", "selling", "utils.pyc")
-	if os.path.exists(utils_pyc):
-		os.remove(utils_pyc)
-	
-	old_path = os.path.join(get_base_path(), "app", "website")
-	if os.path.exists(old_path):
-		shutil.rmtree(old_path)
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p03_update_stock_uom_in_sle.py b/erpnext/patches/september_2013/p03_update_stock_uom_in_sle.py
deleted file mode 100644
index ae07ab8..0000000
--- a/erpnext/patches/september_2013/p03_update_stock_uom_in_sle.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabStock Ledger Entry` sle, tabItem i 
-		set sle.stock_uom = i.stock_uom 
-		where sle.item_code = i.name and ifnull(sle.stock_uom, '') = ''""")
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p04_unsubmit_serial_nos.py b/erpnext/patches/september_2013/p04_unsubmit_serial_nos.py
deleted file mode 100644
index 04be238..0000000
--- a/erpnext/patches/september_2013/p04_unsubmit_serial_nos.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	webnotes.conn.sql("""update `tabSerial No` set docstatus=0 where docstatus=1""")
\ No newline at end of file
diff --git a/erpnext/patches/september_2013/p05_fix_customer_in_pos.py b/erpnext/patches/september_2013/p05_fix_customer_in_pos.py
deleted file mode 100644
index 4df582e..0000000
--- a/erpnext/patches/september_2013/p05_fix_customer_in_pos.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-def execute():
-	si_list = webnotes.conn.sql("""select name, debit_to from `tabSales Invoice` 
-		where ifnull(is_pos, 1)=1 and docstatus=1 and modified > '2013-09-03'""", as_dict=1)
-		
-	for si in si_list:
-		if not webnotes.conn.get_value("GL Entry", {"voucher_type": "Sales Invoice", 
-			"voucher_no": si.name, "account": si.debit_to}):
-				debit_to = webnotes.conn.sql("""select account from `tabGL Entry` gle
-					where voucher_type='Sales Invoice' and voucher_no=%s 
-					and (select master_type from tabAccount where name=gle.account)='Customer'
-				""", si.name)
-				if debit_to:
-					si_bean = webnotes.bean("Sales Invoice", si.name)
-					si_bean.doc.debit_to = debit_to[0][0]
-					si_bean.doc.customer = None
-					si_bean.run_method("set_customer_defaults")
-					si_bean.update_after_submit()
\ No newline at end of file
diff --git a/erpnext/projects/doctype/activity_type/activity_type.py b/erpnext/projects/doctype/activity_type/activity_type.py
index cb6190f..26c87f1 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.py
+++ b/erpnext/projects/doctype/activity_type/activity_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index a77866e..46de4f0 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -4,13 +4,13 @@
 // show tasks
 cur_frm.cscript.refresh = function(doc) {
 	if(!doc.__islocal) {
-		cur_frm.appframe.add_button(wn._("Gantt Chart"), function() {
-			wn.route_options = {"project": doc.name}
-			wn.set_route("Gantt", "Task");
+		cur_frm.appframe.add_button(frappe._("Gantt Chart"), function() {
+			frappe.route_options = {"project": doc.name}
+			frappe.set_route("Gantt", "Task");
 		}, "icon-tasks");
-		cur_frm.add_custom_button(wn._("Tasks"), function() {
-			wn.route_options = {"project": doc.name}
-			wn.set_route("List", "Task");
+		cur_frm.add_custom_button(frappe._("Tasks"), function() {
+			frappe.route_options = {"project": doc.name}
+			frappe.set_route("List", "Task");
 		}, "icon-list");
 	}
 }
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index f159452..13d98e9 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt, getdate
-from webnotes import msgprint
+from frappe.utils import flt, getdate
+from frappe import msgprint
 from erpnext.utilities.transaction_base import delete_events
 
 class DocType:
@@ -32,12 +32,12 @@
 		self.add_calendar_event()
 		
 	def update_percent_complete(self):
-		total = webnotes.conn.sql("""select count(*) from tabTask where project=%s""", 
+		total = frappe.conn.sql("""select count(*) from tabTask where project=%s""", 
 			self.doc.name)[0][0]
 		if total:
-			completed = webnotes.conn.sql("""select count(*) from tabTask where
+			completed = frappe.conn.sql("""select count(*) from tabTask where
 				project=%s and status in ('Closed', 'Cancelled')""", self.doc.name)[0][0]
-			webnotes.conn.set_value("Project", self.doc.name, "percent_complete",
+			frappe.conn.set_value("Project", self.doc.name, "percent_complete",
 			 	int(float(completed) / total * 100))
 
 	def add_calendar_event(self):
@@ -48,7 +48,7 @@
 		for milestone in self.doclist.get({"parentfield": "project_milestones"}):
 			if milestone.milestone_date:
 				description = (milestone.milestone or "Milestone") + " for " + self.doc.name
-				webnotes.bean({
+				frappe.bean({
 					"doctype": "Event",
 					"owner": self.doc.owner,
 					"subject": description,
diff --git a/erpnext/projects/doctype/project_milestone/project_milestone.py b/erpnext/projects/doctype/project_milestone/project_milestone.py
index cb6190f..26c87f1 100644
--- a/erpnext/projects/doctype/project_milestone/project_milestone.py
+++ b/erpnext/projects/doctype/project_milestone/project_milestone.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js
index 9055003..81eeacd 100644
--- a/erpnext/projects/doctype/task/task.js
+++ b/erpnext/projects/doctype/task/task.js
@@ -1,11 +1,11 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.projects");
+frappe.provide("erpnext.projects");
 
 cur_frm.add_fetch("project", "company", "company");
 
-erpnext.projects.Task = wn.ui.form.Controller.extend({
+erpnext.projects.Task = frappe.ui.form.Controller.extend({
 	setup: function() {
 		this.frm.fields_dict.project.get_query = function() {
 			return {
@@ -22,7 +22,7 @@
 	},
 
 	validate: function() {
-		this.frm.doc.project && wn.model.remove_from_locals("Project",
+		this.frm.doc.project && frappe.model.remove_from_locals("Project",
 			this.frm.doc.project);
 	},
 });
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index a811562..d423d16 100644
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes, json
+import frappe, json
 
-from webnotes.utils import getdate, today
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
-from webnotes import msgprint
+from frappe.utils import getdate, today
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
+from frappe import msgprint
 
 
 class DocType:
@@ -21,7 +21,7 @@
 		}
 		
 	def get_customer_details(self):
-		cust = webnotes.conn.sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
+		cust = frappe.conn.sql("select customer_name from `tabCustomer` where name=%s", self.doc.customer)
 		if cust:
 			ret = {'customer_name': cust and cust[0][0] or ''}
 			return ret
@@ -38,7 +38,7 @@
 		self.update_status()
 
 	def update_status(self):
-		status = webnotes.conn.get_value("Task", self.doc.name, "status")
+		status = frappe.conn.get_value("Task", self.doc.name, "status")
 		if self.doc.status=="Working" and status !="Working" and not self.doc.act_start_date:
 			self.doc.act_start_date = today()
 			
@@ -48,14 +48,14 @@
 	def on_update(self):
 		"""update percent complete in project"""
 		if self.doc.project:
-			project = webnotes.bean("Project", self.doc.project)
+			project = frappe.bean("Project", self.doc.project)
 			project.run_method("update_percent_complete")
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_events(start, end, filters=None):
-	from webnotes.widgets.reportview import build_match_conditions
-	if not webnotes.has_permission("Task"):
-		webnotes.msgprint(_("No Permission"), raise_exception=1)
+	from frappe.widgets.reportview import build_match_conditions
+	if not frappe.has_permission("Task"):
+		frappe.msgprint(_("No Permission"), raise_exception=1)
 
 	conditions = build_match_conditions("Task")
 	conditions and (" and " + conditions) or ""
@@ -66,7 +66,7 @@
 			if filters[key]:
 				conditions += " and " + key + ' = "' + filters[key].replace('"', '\"') + '"'
 	
-	data = webnotes.conn.sql("""select name, exp_start_date, exp_end_date, 
+	data = frappe.conn.sql("""select name, exp_start_date, exp_end_date, 
 		subject, status, project from `tabTask`
 		where ((exp_start_date between '%(start)s' and '%(end)s') \
 			or (exp_end_date between '%(start)s' and '%(end)s'))
@@ -80,7 +80,7 @@
 
 def get_project(doctype, txt, searchfield, start, page_len, filters):
 	from erpnext.controllers.queries import get_match_cond
-	return webnotes.conn.sql(""" select name from `tabProject`
+	return frappe.conn.sql(""" select name from `tabProject`
 			where %(key)s like "%(txt)s"
 				%(mcond)s
 			order by name 
diff --git a/erpnext/projects/doctype/task/task_calendar.js b/erpnext/projects/doctype/task/task_calendar.js
index f6adf58..029a48f 100644
--- a/erpnext/projects/doctype/task/task_calendar.js
+++ b/erpnext/projects/doctype/task/task_calendar.js
@@ -1,12 +1,12 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.views.calendar["Task"] = {
+frappe.views.calendar["Task"] = {
 	field_map: {
 		"start": "exp_start_date",
 		"end": "exp_end_date",
 		"id": "name",
-		"title": wn._("subject"),
+		"title": frappe._("subject"),
 		"allDay": "allDay"
 	},
 	gantt: true,
@@ -15,7 +15,7 @@
 			"fieldtype": "Link", 
 			"fieldname": "project", 
 			"options": "Project", 
-			"label": wn._("Project")
+			"label": frappe._("Project")
 		}
 	],
 	get_events_method: "erpnext.projects.doctype.task.task.get_events"
diff --git a/erpnext/projects/doctype/time_log/test_time_log.py b/erpnext/projects/doctype/time_log/test_time_log.py
index 23206d6..41f0171 100644
--- a/erpnext/projects/doctype/time_log/test_time_log.py
+++ b/erpnext/projects/doctype/time_log/test_time_log.py
@@ -1,14 +1,14 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
+import frappe
 import unittest
 
 from erpnext.projects.doctype.time_log.time_log import OverlapError
 
 class TestTimeLog(unittest.TestCase):
 	def test_duplication(self):		
-		ts = webnotes.bean(webnotes.copy_doclist(test_records[0]))
+		ts = frappe.bean(frappe.copy_doclist(test_records[0]))
 		self.assertRaises(OverlapError, ts.insert)
 
 test_records = [[{
diff --git a/erpnext/projects/doctype/time_log/time_log.js b/erpnext/projects/doctype/time_log/time_log.js
index d25451c..eb5fc09 100644
--- a/erpnext/projects/doctype/time_log/time_log.js
+++ b/erpnext/projects/doctype/time_log/time_log.js
@@ -1,9 +1,9 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.projects");
+frappe.provide("erpnext.projects");
 
-erpnext.projects.TimeLog = wn.ui.form.Controller.extend({
+erpnext.projects.TimeLog = frappe.ui.form.Controller.extend({
 	onload: function() {
 		this.frm.set_query("task", erpnext.queries.task);
 	}
diff --git a/erpnext/projects/doctype/time_log/time_log.py b/erpnext/projects/doctype/time_log/time_log.py
index bd9f91f..6f385ef 100644
--- a/erpnext/projects/doctype/time_log/time_log.py
+++ b/erpnext/projects/doctype/time_log/time_log.py
@@ -4,12 +4,12 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import cstr
+import frappe
+from frappe import _
+from frappe.utils import cstr
 
 
-class OverlapError(webnotes.ValidationError): pass
+class OverlapError(frappe.ValidationError): pass
 
 class DocType:
 	def __init__(self, d, dl):
@@ -21,7 +21,7 @@
 		self.calculate_total_hours()
 		
 	def calculate_total_hours(self):
-		from webnotes.utils import time_diff_in_hours
+		from frappe.utils import time_diff_in_hours
 		self.doc.hours = time_diff_in_hours(self.doc.to_time, self.doc.from_time)
 
 	def set_status(self):
@@ -38,7 +38,7 @@
 			self.doc.status="Billed"
 			
 	def validate_overlap(self):		
-		existing = webnotes.conn.sql_list("""select name from `tabTime Log` where owner=%s and
+		existing = frappe.conn.sql_list("""select name from `tabTime Log` where owner=%s and
 			(
 				(from_time between %s and %s) or 
 				(to_time between %s and %s) or 
@@ -51,7 +51,7 @@
 				cstr(self.doc.task)))
 
 		if existing:
-			webnotes.msgprint(_("This Time Log conflicts with") + ":" + ', '.join(existing),
+			frappe.msgprint(_("This Time Log conflicts with") + ":" + ', '.join(existing),
 				raise_exception=OverlapError)
 	
 	def before_cancel(self):
@@ -60,14 +60,14 @@
 	def before_update_after_submit(self):
 		self.set_status()
 				
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_events(start, end):
-	from webnotes.widgets.reportview import build_match_conditions
-	if not webnotes.has_permission("Time Log"):
-		webnotes.msgprint(_("No Permission"), raise_exception=1)
+	from frappe.widgets.reportview import build_match_conditions
+	if not frappe.has_permission("Time Log"):
+		frappe.msgprint(_("No Permission"), raise_exception=1)
 
 	match = build_match_conditions("Time Log")
-	data = webnotes.conn.sql("""select name, from_time, to_time, 
+	data = frappe.conn.sql("""select name, from_time, to_time, 
 		activity_type, task, project from `tabTime Log`
 		where from_time between '%(start)s' and '%(end)s' or to_time between '%(start)s' and '%(end)s'
 		%(match)s""" % {
diff --git a/erpnext/projects/doctype/time_log/time_log_calendar.js b/erpnext/projects/doctype/time_log/time_log_calendar.js
index ea14074..5b947ef 100644
--- a/erpnext/projects/doctype/time_log/time_log_calendar.js
+++ b/erpnext/projects/doctype/time_log/time_log_calendar.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.views.calendar["Time Log"] = {
+frappe.views.calendar["Time Log"] = {
 	field_map: {
 		"start": "from_time",
 		"end": "to_time",
diff --git a/erpnext/projects/doctype/time_log/time_log_list.js b/erpnext/projects/doctype/time_log/time_log_list.js
index 74cfdf5..af7f8ab 100644
--- a/erpnext/projects/doctype/time_log/time_log_list.js
+++ b/erpnext/projects/doctype/time_log/time_log_list.js
@@ -2,34 +2,34 @@
 // License: GNU General Public License v3. See license.txt
 
 // render
-wn.listview_settings['Time Log'] = {
+frappe.listview_settings['Time Log'] = {
 	add_fields: ["`tabTime Log`.`status`", "`tabTime Log`.`billable`", "`tabTime Log`.`activity_type`"],
 	selectable: true,
 	onload: function(me) {
-		me.appframe.add_button(wn._("Make Time Log Batch"), function() {
+		me.appframe.add_button(frappe._("Make Time Log Batch"), function() {
 			var selected = me.get_checked_items() || [];
 
 			if(!selected.length) {
-				msgprint(wn._("Please select Time Logs."))
+				msgprint(frappe._("Please select Time Logs."))
 			}
 			
 			// select only billable time logs
 			for(var i in selected) {
 				var d = selected[i];
 				if(!d.billable) {
-					msgprint(wn._("Time Log is not billable") + ": " + d.name);
+					msgprint(frappe._("Time Log is not billable") + ": " + d.name);
 					return;
 				}
 				if(d.status!="Submitted") {
-					msgprint(wn._("Time Log Status must be Submitted."));
+					msgprint(frappe._("Time Log Status must be Submitted."));
 				}
 			}
 			
 			// make batch
-			wn.model.with_doctype("Time Log Batch", function() {
-				var tlb = wn.model.get_new_doc("Time Log Batch");
+			frappe.model.with_doctype("Time Log Batch", function() {
+				var tlb = frappe.model.get_new_doc("Time Log Batch");
 				$.each(selected, function(i, d) {
-					var detail = wn.model.get_new_doc("Time Log Batch Detail");
+					var detail = frappe.model.get_new_doc("Time Log Batch Detail");
 					$.extend(detail, {
 						"parenttype": "Time Log Batch",
 						"parentfield": "time_log_batch_details",
@@ -40,7 +40,7 @@
 						"idx": i+1
 					});
 				})
-				wn.set_route("Form", "Time Log Batch", tlb.name);
+				frappe.set_route("Form", "Time Log Batch", tlb.name);
 			})
 			
 		}, "icon-file-alt");
diff --git a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
index 9fbf709..979cffd 100644
--- a/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
+++ b/erpnext/projects/doctype/time_log_batch/test_time_log_batch.py
@@ -1,12 +1,12 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes, unittest
+import frappe, unittest
 
 class TimeLogBatchTest(unittest.TestCase):
 	def test_time_log_status(self):
 		from erpnext.projects.doctype.time_log.test_time_log import test_records as time_log_records
-		time_log = webnotes.bean(copy=time_log_records[0])
+		time_log = frappe.bean(copy=time_log_records[0])
 		time_log.doc.fields.update({
 			"from_time": "2013-01-02 10:00:00",
 			"to_time": "2013-01-02 11:00:00",
@@ -15,15 +15,15 @@
 		time_log.insert()
 		time_log.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
-		tlb = webnotes.bean(copy=test_records[0])
+		self.assertEquals(frappe.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
+		tlb = frappe.bean(copy=test_records[0])
 		tlb.doclist[1].time_log = time_log.doc.name
 		tlb.insert()
 		tlb.submit()
 
-		self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Batched for Billing")
+		self.assertEquals(frappe.conn.get_value("Time Log", time_log.doc.name, "status"), "Batched for Billing")
 		tlb.cancel()
-		self.assertEquals(webnotes.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
+		self.assertEquals(frappe.conn.get_value("Time Log", time_log.doc.name, "status"), "Submitted")
 
 test_records = [[
 	{
diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.js b/erpnext/projects/doctype/time_log_batch/time_log_batch.js
index 1be3927..7aa3e16 100644
--- a/erpnext/projects/doctype/time_log_batch/time_log_batch.js
+++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.js
@@ -18,21 +18,21 @@
 $.extend(cur_frm.cscript, {
 	refresh: function(doc) {
 		cur_frm.set_intro({
-			"Draft": wn._("Select Time Logs and Submit to create a new Sales Invoice."),
-			"Submitted": wn._("Click on 'Make Sales Invoice' button to create a new Sales Invoice."),
-			"Billed": wn._("This Time Log Batch has been billed."),
-			"Cancelled": wn._("This Time Log Batch has been cancelled.")
+			"Draft": frappe._("Select Time Logs and Submit to create a new Sales Invoice."),
+			"Submitted": frappe._("Click on 'Make Sales Invoice' button to create a new Sales Invoice."),
+			"Billed": frappe._("This Time Log Batch has been billed."),
+			"Cancelled": frappe._("This Time Log Batch has been cancelled.")
 		}[doc.status]);
 		
 		if(doc.status=="Submitted") {
-			cur_frm.add_custom_button(wn._("Make Sales Invoice"), function() { cur_frm.cscript.make_invoice() }, 
+			cur_frm.add_custom_button(frappe._("Make Sales Invoice"), function() { cur_frm.cscript.make_invoice() }, 
 				"icon-file-alt");
 		}
 	},
 	make_invoice: function() {
 		var doc = cur_frm.doc;
-		wn.model.map({
-			source: wn.model.get_doclist(doc.doctype, doc.name),
+		frappe.model.map({
+			source: frappe.model.get_doclist(doc.doctype, doc.name),
 			target: "Sales Invoice"
 		});
 	}
diff --git a/erpnext/projects/doctype/time_log_batch/time_log_batch.py b/erpnext/projects/doctype/time_log_batch/time_log_batch.py
index 593dc22..3c3e6e0 100644
--- a/erpnext/projects/doctype/time_log_batch/time_log_batch.py
+++ b/erpnext/projects/doctype/time_log_batch/time_log_batch.py
@@ -4,8 +4,8 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
 class DocType:
 	def __init__(self, d, dl):
@@ -15,7 +15,7 @@
 		self.set_status()
 		self.doc.total_hours = 0.0
 		for d in self.doclist.get({"doctype":"Time Log Batch Detail"}):
-			tl = webnotes.doc("Time Log", d.time_log)
+			tl = frappe.doc("Time Log", d.time_log)
 			self.update_time_log_values(d, tl)
 			self.validate_time_log_is_submitted(tl)
 			self.doc.total_hours += float(tl.hours or 0.0)
@@ -29,7 +29,7 @@
 
 	def validate_time_log_is_submitted(self, tl):
 		if tl.status != "Submitted" and self.doc.docstatus == 0:
-			webnotes.msgprint(_("Time Log must have status 'Submitted'") + \
+			frappe.msgprint(_("Time Log must have status 'Submitted'") + \
 				" :" + tl.name + " (" + _(tl.status) + ")", raise_exception=True)
 	
 	def set_status(self):
@@ -54,7 +54,7 @@
 	def update_status(self, time_log_batch):
 		self.set_status()
 		for d in self.doclist.get({"doctype":"Time Log Batch Detail"}):
-			tl = webnotes.bean("Time Log", d.time_log)
+			tl = frappe.bean("Time Log", d.time_log)
 			tl.doc.time_log_batch = time_log_batch
 			tl.doc.sales_invoice = self.doc.sales_invoice
 			tl.update_after_submit()
\ No newline at end of file
diff --git a/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.py b/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.py
index e5468e5..968a25b 100644
--- a/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.py
+++ b/erpnext/projects/doctype/time_log_batch_detail/time_log_batch_detail.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/projects/page/projects_home/projects_home.js b/erpnext/projects/page/projects_home/projects_home.js
index 51f14fb..9ee4dce 100644
--- a/erpnext/projects/page/projects_home/projects_home.js
+++ b/erpnext/projects/page/projects_home/projects_home.js
@@ -1,74 +1,74 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Projects"] = [
+frappe.module_page["Projects"] = [
 	{
-		title: wn._("Top"),
+		title: frappe._("Top"),
 		icon: "icon-copy",
 		top: true,
 		items: [
 			{
-				label: wn._("Task"),
-				description: wn._("Project activity / task."),
+				label: frappe._("Task"),
+				description: frappe._("Project activity / task."),
 				doctype:"Task"
 			},
 			{
-				label: wn._("Project"),
-				description: wn._("Project master."),
+				label: frappe._("Project"),
+				description: frappe._("Project master."),
 				doctype:"Project"
 			},
 			{
-				label: wn._("Time Log"),
-				description: wn._("Time Log for tasks."),
+				label: frappe._("Time Log"),
+				description: frappe._("Time Log for tasks."),
 				doctype:"Time Log"
 			},
 		]
 	},
 	{
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Time Log Batch"),
-				description: wn._("Batch Time Logs for billing."),
+				label: frappe._("Time Log Batch"),
+				description: frappe._("Batch Time Logs for billing."),
 				doctype:"Time Log Batch"
 			},
 		]
 	},
 	{
-		title: wn._("Tools"),
+		title: frappe._("Tools"),
 		icon: "icon-wrench",
 		items: [
 			{
 				route: "Gantt/Task",
-				label: wn._("Gantt Chart"),
-				"description":wn._("Gantt chart of all tasks.")
+				label: frappe._("Gantt Chart"),
+				"description":frappe._("Gantt chart of all tasks.")
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Activity Type"),
-				description: wn._("Types of activities for Time Sheets"),
+				label: frappe._("Activity Type"),
+				description: frappe._("Types of activities for Time Sheets"),
 				doctype:"Activity Type"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Daily Time Log Summary"),
+				"label":frappe._("Daily Time Log Summary"),
 				route: "query-report/Daily Time Log Summary",
 				doctype: "Time Log"
 			},
 			{
-				"label":wn._("Project wise Stock Tracking"),
+				"label":frappe._("Project wise Stock Tracking"),
 				route: "query-report/Project wise Stock Tracking",
 				doctype: "Project"
 			},
@@ -76,5 +76,5 @@
 	}]
 
 pscript['onload_projects-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Projects");
+	frappe.views.moduleview.make(wrapper, "Projects");
 }
\ No newline at end of file
diff --git a/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.js b/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.js
index 2615023..11bd736 100644
--- a/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.js
+++ b/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.js
@@ -1,19 +1,19 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Daily Time Log Summary"] = {
+frappe.query_reports["Daily Time Log Summary"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.get_today()
+			"default": frappe.datetime.get_today()
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.get_today()
+			"default": frappe.datetime.get_today()
 		},
 	]
 }
\ No newline at end of file
diff --git a/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py b/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py
index 230d21e..cab2b53 100644
--- a/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py
+++ b/erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters:
@@ -19,7 +19,7 @@
 	task_map = get_task_map()
 		
 	conditions = build_conditions(filters)
-	time_logs = webnotes.conn.sql("""select * from `tabTime Log` 
+	time_logs = frappe.conn.sql("""select * from `tabTime Log` 
 		where docstatus < 2 %s order by owner asc""" % (conditions, ), filters, as_dict=1)
 
 	if time_logs:
@@ -49,7 +49,7 @@
 	return columns, data
 	
 def get_profile_map():
-	profiles = webnotes.conn.sql("""select name, 
+	profiles = frappe.conn.sql("""select name, 
 		concat(first_name, if(last_name, (' ' + last_name), '')) as fullname 
 		from tabProfile""", as_dict=1)
 	profile_map = {}
@@ -59,7 +59,7 @@
 	return profile_map
 	
 def get_task_map():
-	tasks = webnotes.conn.sql("""select name, subject from tabTask""", as_dict=1)
+	tasks = frappe.conn.sql("""select name, subject from tabTask""", as_dict=1)
 	task_map = {}
 	for t in tasks:
 		task_map.setdefault(t.name, []).append(t.subject)
@@ -73,7 +73,7 @@
 	if filters.get("to_date"):
 		conditions += " and to_time <= %(to_date)s"
 	
-	from webnotes.widgets.reportview import build_match_conditions
+	from frappe.widgets.reportview import build_match_conditions
 	match_conditions = build_match_conditions("Time Log")
 	if match_conditions:
 		conditions += " and %s" % match_conditions
diff --git a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
index d21bf3d..2cd4d4d 100644
--- a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
+++ b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
@@ -1,7 +1,7 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes 
+import frappe 
 
 def execute(filters=None):
 	columns = get_columns()
@@ -28,11 +28,11 @@
 		"Project Start Date:Date:120", "Completion Date:Date:120"]
 
 def get_project_details():
-	return webnotes.conn.sql(""" select name, project_name, status, company, customer, project_value,
+	return frappe.conn.sql(""" select name, project_name, status, company, customer, project_value,
 		project_start_date, completion_date from tabProject where docstatus < 2""", as_dict=1)
 
 def get_purchased_items_cost():
-	pr_items = webnotes.conn.sql("""select project_name, sum(base_amount) as amount
+	pr_items = frappe.conn.sql("""select project_name, sum(base_amount) as amount
 		from `tabPurchase Receipt Item` where ifnull(project_name, '') != '' 
 		and docstatus = 1 group by project_name""", as_dict=1)
 
@@ -43,7 +43,7 @@
 	return pr_item_map
 
 def get_issued_items_cost():
-	se_items = webnotes.conn.sql("""select se.project_name, sum(se_item.amount) as amount
+	se_items = frappe.conn.sql("""select se.project_name, sum(se_item.amount) as amount
 		from `tabStock Entry` se, `tabStock Entry Detail` se_item
 		where se.name = se_item.parent and se.docstatus = 1 and ifnull(se_item.t_warehouse, '') = '' 
 		and ifnull(se.project_name, '') != '' group by se.project_name""", as_dict=1)
@@ -55,12 +55,12 @@
 	return se_item_map
 
 def get_delivered_items_cost():
-	dn_items = webnotes.conn.sql("""select dn.project_name, sum(dn_item.base_amount) as amount
+	dn_items = frappe.conn.sql("""select dn.project_name, sum(dn_item.base_amount) as amount
 		from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
 		where dn.name = dn_item.parent and dn.docstatus = 1 and ifnull(dn.project_name, '') != ''
 		group by dn.project_name""", as_dict=1)
 
-	si_items = webnotes.conn.sql("""select si.project_name, sum(si_item.base_amount) as amount
+	si_items = frappe.conn.sql("""select si.project_name, sum(si_item.base_amount) as amount
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
 		where si.name = si_item.parent and si.docstatus = 1 and ifnull(si.update_stock, 0) = 1 
 		and ifnull(si.is_pos, 0) = 1 and ifnull(si.project_name, '') != ''
diff --git a/erpnext/projects/utils.py b/erpnext/projects/utils.py
index 7a0c50c..12ffb00 100644
--- a/erpnext/projects/utils.py
+++ b/erpnext/projects/utils.py
@@ -4,22 +4,22 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_time_log_list(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])
+	return frappe.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def query_task(doctype, txt, searchfield, start, page_len, filters):
-	from webnotes.widgets.reportview import build_match_conditions
+	from frappe.widgets.reportview import build_match_conditions
 	
 	search_string = "%%%s%%" % txt
 	order_by_string = "%s%%" % txt
 	match_conditions = build_match_conditions("Task")
 	match_conditions = ("and" + match_conditions) if match_conditions else ""
 	
-	return webnotes.conn.sql("""select name, subject from `tabTask`
+	return frappe.conn.sql("""select name, subject from `tabTask`
 		where (`%s` like %s or `subject` like %s) %s
 		order by
 			case when `subject` like %s then 0 else 1 end,
diff --git a/erpnext/public/js/account_tree_grid.js b/erpnext/public/js/account_tree_grid.js
index 1cd9aa6..6b234db 100644
--- a/erpnext/public/js/account_tree_grid.js
+++ b/erpnext/public/js/account_tree_grid.js
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with this program.	If not, see <http://www.gnu.org/licenses/>.
 
-erpnext.AccountTreeGrid = wn.views.TreeGridReport.extend({
+erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
 	init: function(wrapper, title) {
 		this._super({
 			title: title,
@@ -27,7 +27,7 @@
 				parent_field: "parent_account", 
 				formatter: function(item) {
 					return repl("<a \
-						onclick='wn.cur_grid_report.show_general_ledger(\"%(value)s\")'>\
+						onclick='frappe.cur_grid_report.show_general_ledger(\"%(value)s\")'>\
 						%(value)s</a>", {
 							value: item.name,
 						});
@@ -37,39 +37,39 @@
 	},
 	setup_columns: function() {
 		this.columns = [
-			{id: "name", name: wn._("Account"), field: "name", width: 300, cssClass: "cell-title", 
+			{id: "name", name: frappe._("Account"), field: "name", width: 300, cssClass: "cell-title", 
 				formatter: this.tree_formatter},
-			{id: "opening_debit", name: wn._("Opening (Dr)"), field: "opening_debit", width: 100,
+			{id: "opening_debit", name: frappe._("Opening (Dr)"), field: "opening_debit", width: 100,
 				formatter: this.currency_formatter},
-			{id: "opening_credit", name: wn._("Opening (Cr)"), field: "opening_credit", width: 100,
+			{id: "opening_credit", name: frappe._("Opening (Cr)"), field: "opening_credit", width: 100,
 				formatter: this.currency_formatter},
-			{id: "debit", name: wn._("Debit"), field: "debit", width: 100,
+			{id: "debit", name: frappe._("Debit"), field: "debit", width: 100,
 				formatter: this.currency_formatter},
-			{id: "credit", name: wn._("Credit"), field: "credit", width: 100,
+			{id: "credit", name: frappe._("Credit"), field: "credit", width: 100,
 				formatter: this.currency_formatter},
-			{id: "closing_debit", name: wn._("Closing (Dr)"), field: "closing_debit", width: 100,
+			{id: "closing_debit", name: frappe._("Closing (Dr)"), field: "closing_debit", width: 100,
 				formatter: this.currency_formatter},
-			{id: "closing_credit", name: wn._("Closing (Cr)"), field: "closing_credit", width: 100,
+			{id: "closing_credit", name: frappe._("Closing (Cr)"), field: "closing_credit", width: 100,
 				formatter: this.currency_formatter}
 		];
 
 	},
 	filters: [
-		{fieldtype: "Select", label: wn._("Company"), link:"Company", default_value: "Select Company...",
+		{fieldtype: "Select", label: frappe._("Company"), link:"Company", default_value: "Select Company...",
 			filter: function(val, item, opts, me) {
 				if (item.company == val || val == opts.default_value) {
 					return me.apply_zero_filter(val, item, opts, me);
 				}
 				return false;
 			}},
-		{fieldtype: "Select", label: wn._("Fiscal Year"), link:"Fiscal Year", 
+		{fieldtype: "Select", label: frappe._("Fiscal Year"), link:"Fiscal Year", 
 			default_value: "Select Fiscal Year..."},
-		{fieldtype: "Date", label: wn._("From Date")},
-		{fieldtype: "Label", label: wn._("To")},
-		{fieldtype: "Date", label: wn._("To Date")},
-		{fieldtype: "Button", label: wn._("Refresh"), icon:"icon-refresh icon-white",
+		{fieldtype: "Date", label: frappe._("From Date")},
+		{fieldtype: "Label", label: frappe._("To")},
+		{fieldtype: "Date", label: frappe._("To Date")},
+		{fieldtype: "Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white",
 		 	cssClass:"btn-info"},
-		{fieldtype: "Button", label: wn._("Reset Filters")},
+		{fieldtype: "Button", label: frappe._("Reset Filters")},
 	],
 	setup_filters: function() {
 		this._super();
@@ -77,7 +77,7 @@
 		// default filters
 		this.filter_inputs.fiscal_year.change(function() {
 			var fy = $(this).val();
-			$.each(wn.report_dump.data["Fiscal Year"], function(i, v) {
+			$.each(frappe.report_dump.data["Fiscal Year"], function(i, v) {
 				if (v.name==fy) {
 					me.filter_inputs.from_date.val(dateutil.str_to_user(v.year_start_date));
 					me.filter_inputs.to_date.val(dateutil.str_to_user(v.year_end_date));
@@ -96,7 +96,7 @@
 			me.parent_map = {};
 			me.item_by_name = {};
 
-			$.each(wn.report_dump.data["Account"], function(i, v) {
+			$.each(frappe.report_dump.data["Account"], function(i, v) {
 				var d = copy_dict(v);
 
 				me.data.push(d);
@@ -123,7 +123,7 @@
 	},
 
 	prepare_balances: function() {
-		var gl = wn.report_dump.data['GL Entry'];
+		var gl = frappe.report_dump.data['GL Entry'];
 		var me = this;
 
 		this.opening_date = dateutil.user_to_obj(this.filter_inputs.from_date.val());
@@ -194,13 +194,13 @@
 
 	set_fiscal_year: function() {
 		if (this.opening_date > this.closing_date) {
-			msgprint(wn._("Opening Date should be before Closing Date"));
+			msgprint(frappe._("Opening Date should be before Closing Date"));
 			return;
 		}
 
 		this.fiscal_year = null;
 		var me = this;
-		$.each(wn.report_dump.data["Fiscal Year"], function(i, v) {
+		$.each(frappe.report_dump.data["Fiscal Year"], function(i, v) {
 			if (me.opening_date >= dateutil.str_to_obj(v.year_start_date) && 
 				me.closing_date <= dateutil.str_to_obj(v.year_end_date)) {
 					me.fiscal_year = v;
@@ -208,18 +208,18 @@
 		});
 
 		if (!this.fiscal_year) {
-			msgprint(wn._("Opening Date and Closing Date should be within same Fiscal Year"));
+			msgprint(frappe._("Opening Date and Closing Date should be within same Fiscal Year"));
 			return;
 		}
 	},
 	
 	show_general_ledger: function(account) {
-		wn.route_options = {
+		frappe.route_options = {
 			account: account,
 			company: this.company,
 			from_date: this.from_date,
 			to_date: this.to_date
 		};
-		wn.set_route("query-report", "General Ledger");
+		frappe.set_route("query-report", "General Ledger");
 	}
 });
\ No newline at end of file
diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js
index 58e9f97..e976052 100644
--- a/erpnext/public/js/conf.js
+++ b/erpnext/public/js/conf.js
@@ -1,13 +1,13 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide('erpnext');
+frappe.provide('erpnext');
 
 // add toolbar icon
 $(document).bind('toolbar_setup', function() {
-	wn.app.name = "ERPNext";
+	frappe.app.name = "ERPNext";
 	
-	var brand = ($("<div></div>").append(wn.boot.website_settings.brand_html).text() || 'erpnext');
+	var brand = ($("<div></div>").append(frappe.boot.website_settings.brand_html).text() || 'erpnext');
 	$('.navbar-brand').html('<div style="display: inline-block;">\
 			<object type="image/svg+xml" data="assets/erpnext/images/splash.svg" class="toolbar-splash"></object>\
 		</div>' + brand)
@@ -20,23 +20,23 @@
 	});
 });
 
-wn.provide('wn.ui.misc');
-wn.ui.misc.about = function() {
-	if(!wn.ui.misc.about_dialog) {
-		var d = new wn.ui.Dialog({title: wn._('About')})
+frappe.provide('frappe.ui.misc');
+frappe.ui.misc.about = function() {
+	if(!frappe.ui.misc.about_dialog) {
+		var d = new frappe.ui.Dialog({title: frappe._('About')})
 	
 		$(d.body).html(repl("<div>\
 		<h2>ERPNext</h2>  \
-		<p>"+wn._("An open source ERP made for the web.</p>") +
-		"<p>"+wn._("To report an issue, go to ")+"<a href='https://github.com/webnotes/erpnext/issues'>GitHub Issues</a></p> \
+		<p>"+frappe._("An open source ERP made for the web.</p>") +
+		"<p>"+frappe._("To report an issue, go to ")+"<a href='https://github.com/frappe/erpnext/issues'>GitHub Issues</a></p> \
 		<p><a href='http://erpnext.org' target='_blank'>http://erpnext.org</a>.</p>\
 		<p><a href='http://www.gnu.org/copyleft/gpl.html'>License: GNU General Public License Version 3</a></p>\
 		<hr>\
 		<p>&copy; 2014 Web Notes Technologies Pvt. Ltd and contributers </p> \
-		</div>", wn.app));
+		</div>", frappe.app));
 	
-		wn.ui.misc.about_dialog = d;		
+		frappe.ui.misc.about_dialog = d;		
 	}
 	
-	wn.ui.misc.about_dialog.show();
+	frappe.ui.misc.about_dialog.show();
 }
diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js
index 789d72b..03e1890 100644
--- a/erpnext/public/js/controllers/accounts.js
+++ b/erpnext/public/js/controllers/accounts.js
@@ -4,14 +4,14 @@
 	var d = locals[cdt][cdn];
 	if(!d.charge_type && d.account_head){
 		msgprint("Please select Charge Type first");
-		wn.model.set_value(cdt, cdn, "account_head", "");
+		frappe.model.set_value(cdt, cdn, "account_head", "");
 	} else if(d.account_head && d.charge_type!=="Actual") {
-		wn.call({
+		frappe.call({
 			type:"GET",
 			method: "erpnext.controllers.accounts_controller.get_tax_rate", 
 			args: {"account_head":d.account_head},
 			callback: function(r) {
-			  wn.model.set_value(cdt, cdn, "rate", r.message || 0);
+			  frappe.model.set_value(cdt, cdn, "rate", r.message || 0);
 			}
 		})
 	}
diff --git a/erpnext/public/js/controllers/stock_controller.js b/erpnext/public/js/controllers/stock_controller.js
index 6a4261c..9f793e4 100644
--- a/erpnext/public/js/controllers/stock_controller.js
+++ b/erpnext/public/js/controllers/stock_controller.js
@@ -1,20 +1,20 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.stock");
+frappe.provide("erpnext.stock");
 
-erpnext.stock.StockController = wn.ui.form.Controller.extend({
+erpnext.stock.StockController = frappe.ui.form.Controller.extend({
 	show_stock_ledger: function() {
 		var me = this;
 		if(this.frm.doc.docstatus===1) {
-			this.frm.appframe.add_button(wn._("Stock Ledger"), function() {
-				wn.route_options = {
+			this.frm.appframe.add_button(frappe._("Stock Ledger"), function() {
+				frappe.route_options = {
 					voucher_no: me.frm.doc.name,
 					from_date: me.frm.doc.posting_date,
 					to_date: me.frm.doc.posting_date,
 					company: me.frm.doc.company
 				};
-				wn.set_route("query-report", "Stock Ledger");
+				frappe.set_route("query-report", "Stock Ledger");
 			}, "icon-bar-chart");
 		}
 		
@@ -22,16 +22,16 @@
 
 	show_general_ledger: function() {
 		var me = this;
-		if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) { 
-			cur_frm.appframe.add_button(wn._('Accounting Ledger'), function() {
-				wn.route_options = {
+		if(this.frm.doc.docstatus===1 && cint(frappe.defaults.get_default("auto_accounting_for_stock"))) { 
+			cur_frm.appframe.add_button(frappe._('Accounting Ledger'), function() {
+				frappe.route_options = {
 					voucher_no: me.frm.doc.name,
 					from_date: me.frm.doc.posting_date,
 					to_date: me.frm.doc.posting_date,
 					company: me.frm.doc.company,
 					group_by_voucher: false
 				};
-				wn.set_route("query-report", "General Ledger");
+				frappe.set_route("query-report", "General Ledger");
 			}, "icon-table");
 		}
 	},
diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js
index f3545d1..84e8c7b 100644
--- a/erpnext/public/js/feature_setup.js
+++ b/erpnext/public/js/feature_setup.js
@@ -198,7 +198,7 @@
 					} else if(cur_frm.fields_dict[fort]) {
 						cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort], false);						
 					} else {
-						msgprint(wn._('Grid "')+fort+wn._('" does not exists'));
+						msgprint(frappe._('Grid "')+fort+frappe._('" does not exists'));
 					}
 				}
 			}
diff --git a/erpnext/public/js/purchase_trends_filters.js b/erpnext/public/js/purchase_trends_filters.js
index feb3d49..db4b15d 100644
--- a/erpnext/public/js/purchase_trends_filters.js
+++ b/erpnext/public/js/purchase_trends_filters.js
@@ -5,38 +5,38 @@
 	return [
 		{
 			"fieldname":"period",
-			"label": wn._("Period"),
+			"label": frappe._("Period"),
 			"fieldtype": "Select",
 			"options": ["Monthly", "Quarterly", "Half-Yearly", "Yearly"].join("\n"),
 			"default": "Monthly"
 		},
 		{
 			"fieldname":"based_on",
-			"label": wn._("Based On"),
+			"label": frappe._("Based On"),
 			"fieldtype": "Select",
 			"options": ["Item", "Item Group", "Supplier", "Supplier Type", "Project"].join("\n"),
 			"default": "Item"
 		},
 		{
 			"fieldname":"group_by",
-			"label": wn._("Group By"),
+			"label": frappe._("Group By"),
 			"fieldtype": "Select",
 			"options": ["Item", "Supplier"].join("\n"),
 			"default": ""
 		},
 		{
 			"fieldname":"fiscal_year",
-			"label": wn._("Fiscal Year"),
+			"label": frappe._("Fiscal Year"),
 			"fieldtype": "Link",
 			"options":'Fiscal Year',
 			"default": sys_defaults.fiscal_year
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		},
 	];
 }
\ No newline at end of file
diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js
index dab5828..86db28e 100644
--- a/erpnext/public/js/queries.js
+++ b/erpnext/public/js/queries.js
@@ -2,10 +2,10 @@
 // License: GNU General Public License v3. See license.txt
 
 // searches for enabled profiles
-wn.provide("erpnext.queries");
+frappe.provide("erpnext.queries");
 $.extend(erpnext.queries, {
 	profile: function() {
-		return { query: "webnotes.core.doctype.profile.profile.profile_query" };
+		return { query: "frappe.core.doctype.profile.profile.profile_query" };
 	},
 
 	lead: function() {
@@ -38,8 +38,8 @@
 
 	customer_filter: function(doc) {
 		if(!doc.customer) {
-			wn.throw(wn._("Please specify a") + " " + 
-				wn._(wn.meta.get_label(doc.doctype, "customer", doc.name)));
+			frappe.throw(frappe._("Please specify a") + " " + 
+				frappe._(frappe.meta.get_label(doc.doctype, "customer", doc.name)));
 		}
 		
 		return { filters: { customer: doc.customer } };
@@ -47,8 +47,8 @@
 
 	supplier_filter: function(doc) {
 		if(!doc.supplier) {
-			wn.throw(wn._("Please specify a") + " " + 
-				wn._(wn.meta.get_label(doc.doctype, "supplier", doc.name)));
+			frappe.throw(frappe._("Please specify a") + " " + 
+				frappe._(frappe.meta.get_label(doc.doctype, "supplier", doc.name)));
 		}
 		
 		return { filters: { supplier: doc.supplier } };
@@ -56,8 +56,8 @@
 
 	lead_filter: function(doc) {
 		if(!doc.lead) {
-			wn.throw(wn._("Please specify a") + " " + 
-				wn._(wn.meta.get_label(doc.doctype, "lead", doc.name)));
+			frappe.throw(frappe._("Please specify a") + " " + 
+				frappe._(frappe.meta.get_label(doc.doctype, "lead", doc.name)));
 		}
 
 		return { filters: { lead: doc.lead } };
diff --git a/erpnext/public/js/sales_trends_filters.js b/erpnext/public/js/sales_trends_filters.js
index fe3b338..65b6bcf 100644
--- a/erpnext/public/js/sales_trends_filters.js
+++ b/erpnext/public/js/sales_trends_filters.js
@@ -5,38 +5,38 @@
  	return[
 		{
 			"fieldname":"period",
-			"label": wn._("Period"),
+			"label": frappe._("Period"),
 			"fieldtype": "Select",
 			"options": ["Monthly", "Quarterly", "Half-Yearly", "Yearly"].join("\n"),
 			"default": "Monthly"
 		},
 		{
 			"fieldname":"based_on",
-			"label": wn._("Based On"),
+			"label": frappe._("Based On"),
 			"fieldtype": "Select",
 			"options": ["Item", "Item Group", "Customer", "Customer Group", "Territory", "Project"].join("\n"),
 			"default": "Item"
 		},
 		{
 			"fieldname":"group_by",
-			"label": wn._("Group By"),
+			"label": frappe._("Group By"),
 			"fieldtype": "Select",
 			"options": ["Item", "Customer"].join("\n"),
 			"default": ""
 		},
 		{
 			"fieldname":"fiscal_year",
-			"label": wn._("Fiscal Year"),
+			"label": frappe._("Fiscal Year"),
 			"fieldtype": "Link",
 			"options":'Fiscal Year',
 			"default": sys_defaults.fiscal_year
 		},
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_default("company")
+			"default": frappe.defaults.get_default("company")
 		},	
 	];
 }
\ No newline at end of file
diff --git a/erpnext/public/js/startup.js b/erpnext/public/js/startup.js
index 166c379..f7b0d7a 100644
--- a/erpnext/public/js/startup.js
+++ b/erpnext/public/js/startup.js
@@ -3,36 +3,36 @@
 
 var current_module;
 
-wn.provide('erpnext.startup');
+frappe.provide('erpnext.startup');
 
 erpnext.startup.start = function() {
-	console.log(wn._('Starting up...'));
+	console.log(frappe._('Starting up...'));
 	$('#startup_div').html('Starting up...').toggle(true);
 	
 	erpnext.toolbar.setup();
 	
-	if(wn.boot.expires_on && in_list(user_roles, 'System Manager')) {
+	if(frappe.boot.expires_on && in_list(user_roles, 'System Manager')) {
 		erpnext.startup.show_expiry_banner();
 	}
 }
 
 erpnext.startup.show_expiry_banner = function() {
-	var today = dateutil.str_to_obj(wn.boot.server_date);
-	var expires_on = dateutil.str_to_obj(wn.boot.expires_on);
+	var today = dateutil.str_to_obj(frappe.boot.server_date);
+	var expires_on = dateutil.str_to_obj(frappe.boot.expires_on);
 	var diff = dateutil.get_diff(expires_on, today);
 	var payment_link = "<a href=\"https://erpnext.com/modes-of-payment.html\" target=\"_blank\">"+
-		wn._("Click here to buy subscription.")+"</a>";
+		frappe._("Click here to buy subscription.")+"</a>";
 	
 	var msg = "";
 	if (0 <= diff && diff <= 10) {
 		var expiry_string = diff==0 ? "today" : repl("in %(diff)s day(s)", { diff: diff });
-		msg = repl(wn._('Your ERPNext subscription will')+' <b>expire %(expiry_string)s</b>. %(payment_link)s',
+		msg = repl(frappe._('Your ERPNext subscription will')+' <b>expire %(expiry_string)s</b>. %(payment_link)s',
 			{ expiry_string: expiry_string, payment_link: payment_link });
 	} else if (diff < 0) {
-		msg = repl(wn._('This ERPNext subscription')+'<b>'+wn._('has expired')+'</b>. %(payment_link)s', {payment_link: payment_link});
+		msg = repl(frappe._('This ERPNext subscription')+'<b>'+frappe._('has expired')+'</b>. %(payment_link)s', {payment_link: payment_link});
 	}
 	
-	if(msg) wn.ui.toolbar.show_banner(msg);
+	if(msg) frappe.ui.toolbar.show_banner(msg);
 }
 
 // start
diff --git a/erpnext/public/js/stock_analytics.js b/erpnext/public/js/stock_analytics.js
index 48deeb4..6e40b4f 100644
--- a/erpnext/public/js/stock_analytics.js
+++ b/erpnext/public/js/stock_analytics.js
@@ -1,12 +1,12 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/stock_grid_report.js");
+frappe.require("assets/erpnext/js/stock_grid_report.js");
 
 erpnext.StockAnalytics = erpnext.StockGridReport.extend({
 	init: function(wrapper, opts) {
 		var args = {
-			title: wn._("Stock Analytics"),
+			title: frappe._("Stock Analytics"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -18,7 +18,7 @@
 				formatter: function(item) {
 					if(!item.is_group) {
 						return repl("<a \
-							onclick='wn.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
+							onclick='frappe.cur_grid_report.show_stock_ledger(\"%(value)s\")'>\
 							%(value)s</a>", {
 								value: item.name,
 							});
@@ -36,13 +36,13 @@
 	},
 	setup_columns: function() {
 		var std_columns = [
-			{id: "check", name: wn._("Plot"), field: "check", width: 30,
+			{id: "check", name: frappe._("Plot"), field: "check", width: 30,
 				formatter: this.check_formatter},
-			{id: "name", name: wn._("Item"), field: "name", width: 300,
+			{id: "name", name: frappe._("Item"), field: "name", width: 300,
 				formatter: this.tree_formatter},
-			{id: "brand", name: wn._("Brand"), field: "brand", width: 100},
-			{id: "stock_uom", name: wn._("UOM"), field: "stock_uom", width: 100},
-			{id: "opening", name: wn._("Opening"), field: "opening", hidden: true,
+			{id: "brand", name: frappe._("Brand"), field: "brand", width: 100},
+			{id: "stock_uom", name: frappe._("UOM"), field: "stock_uom", width: 100},
+			{id: "opening", name: frappe._("Opening"), field: "opening", hidden: true,
 				formatter: this.currency_formatter}
 		];
 
@@ -50,23 +50,23 @@
 		this.columns = std_columns.concat(this.columns);
 	},
 	filters: [
-		{fieldtype:"Select", label: wn._("Value or Qty"), options:["Value", "Quantity"],
+		{fieldtype:"Select", label: frappe._("Value or Qty"), options:["Value", "Quantity"],
 			filter: function(val, item, opts, me) {
 				return me.apply_zero_filter(val, item, opts, me);
 			}},
-		{fieldtype:"Select", label: wn._("Brand"), link:"Brand", 
+		{fieldtype:"Select", label: frappe._("Brand"), link:"Brand", 
 			default_value: "Select Brand...", filter: function(val, item, opts) {
 				return val == opts.default_value || item.brand == val || item._show;
 			}, link_formatter: {filter_input: "brand"}},
-		{fieldtype:"Select", label: wn._("Warehouse"), link:"Warehouse", 
+		{fieldtype:"Select", label: frappe._("Warehouse"), link:"Warehouse", 
 			default_value: "Select Warehouse..."},
-		{fieldtype:"Date", label: wn._("From Date")},
-		{fieldtype:"Label", label: wn._("To")},
-		{fieldtype:"Date", label: wn._("To Date")},
-		{fieldtype:"Select", label: wn._("Range"), 
+		{fieldtype:"Date", label: frappe._("From Date")},
+		{fieldtype:"Label", label: frappe._("To")},
+		{fieldtype:"Date", label: frappe._("To Date")},
+		{fieldtype:"Select", label: frappe._("Range"), 
 			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	setup_filters: function() {
 		var me = this;
@@ -118,7 +118,7 @@
 		var me = this;
 		var from_date = dateutil.str_to_obj(this.from_date);
 		var to_date = dateutil.str_to_obj(this.to_date);
-		var data = wn.report_dump.data["Stock Ledger Entry"];
+		var data = frappe.report_dump.data["Stock Ledger Entry"];
 
 		this.item_warehouse = {};
 		this.serialized_buying_rates = this.get_serialized_buying_rates();
@@ -185,11 +185,11 @@
 		return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
 	},
 	show_stock_ledger: function(item_code) {
-		wn.route_options = {
+		frappe.route_options = {
 			item_code: item_code,
 			from_date: this.from_date,
 			to_date: this.to_date
 		};
-		wn.set_route("query-report", "Stock Ledger");
+		frappe.set_route("query-report", "Stock Ledger");
 	}
 });
\ No newline at end of file
diff --git a/erpnext/public/js/stock_grid_report.js b/erpnext/public/js/stock_grid_report.js
index b727123..f58c1ab 100644
--- a/erpnext/public/js/stock_grid_report.js
+++ b/erpnext/public/js/stock_grid_report.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-erpnext.StockGridReport = wn.views.TreeGridReport.extend({
+erpnext.StockGridReport = frappe.views.TreeGridReport.extend({
 	get_item_warehouse: function(warehouse, item) {
 		if(!this.item_warehouse[item]) this.item_warehouse[item] = {};
 		if(!this.item_warehouse[item][warehouse]) this.item_warehouse[item][warehouse] = {
@@ -110,8 +110,8 @@
 	get_serialized_buying_rates: function() {
 		var serialized_buying_rates = {};
 		
-		if (wn.report_dump.data["Serial No"]) {
-			$.each(wn.report_dump.data["Serial No"], function(i, sn) {
+		if (frappe.report_dump.data["Serial No"]) {
+			$.each(frappe.report_dump.data["Serial No"], function(i, sn) {
 				serialized_buying_rates[sn.name.toLowerCase()] = flt(sn.incoming_rate);
 			});
 		}
diff --git a/erpnext/public/js/toolbar.js b/erpnext/public/js/toolbar.js
index 1d6fa91..53efe30 100644
--- a/erpnext/public/js/toolbar.js
+++ b/erpnext/public/js/toolbar.js
@@ -2,25 +2,25 @@
 // License: GNU General Public License v3. See license.txt
 
 /* toolbar settings */
-wn.provide('erpnext.toolbar');
+frappe.provide('erpnext.toolbar');
 
 erpnext.toolbar.setup = function() {
 	// profile
 	var $user = $('#toolbar-user');
 	$user.append('<li><a href="#Form/Profile/'+user+'"><i class="icon-fixed-width icon-user"></i> '
-		+wn._("My Settings")+'...</a></li>');
+		+frappe._("My Settings")+'...</a></li>');
 	$user.append('<li class="divider"></li>');
 	$user.append('<li><a href="https://erpnext.com/manual" target="_blank">\
-		<i class="icon-fixed-width icon-file"></i> '+wn._('Documentation')+'</a></li>');
+		<i class="icon-fixed-width icon-file"></i> '+frappe._('Documentation')+'</a></li>');
 	$user.append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\
-		<i class="icon-fixed-width icon-quote-left"></i> '+wn._('Forum')+'</a></li>');
+		<i class="icon-fixed-width icon-quote-left"></i> '+frappe._('Forum')+'</a></li>');
 	
-	if(wn.boot.expires_on || wn.boot.commercial_support) {
+	if(frappe.boot.expires_on || frappe.boot.commercial_support) {
 		$user.append('<li>\
 			<a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
-			<i class="icon-fixed-width icon-comments"></i> '+wn._('Live Chat')+'</a></li>');
+			<i class="icon-fixed-width icon-comments"></i> '+frappe._('Live Chat')+'</a></li>');
 	}
 	
-	$("#toolbar-tools").append('<li><a href="https://github.com/webnotes/erpnext/releases" target="_blank">\
+	$("#toolbar-tools").append('<li><a href="https://github.com/frappe/erpnext/releases" target="_blank">\
 		<i class="icon-fixed-width icon-rss"></i> Latest Updates</li>');
 }
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index d77819f..14d23d3 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -1,15 +1,15 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext");
-wn.require("assets/erpnext/js/controllers/stock_controller.js");
+frappe.provide("erpnext");
+frappe.require("assets/erpnext/js/controllers/stock_controller.js");
 
 erpnext.TransactionController = erpnext.stock.StockController.extend({
 	onload: function() {
 		var me = this;
 		if(this.frm.doc.__islocal) {
 			var today = get_today(),
-				currency = wn.defaults.get_default("currency");
+				currency = frappe.defaults.get_default("currency");
 			
 			$.each({
 				posting_date: today,
@@ -18,8 +18,8 @@
 				currency: currency,
 				price_list_currency: currency,
 				status: "Draft",
-				company: wn.defaults.get_default("company"),
-				fiscal_year: wn.defaults.get_default("fiscal_year"),
+				company: frappe.defaults.get_default("company"),
+				fiscal_year: frappe.defaults.get_default("fiscal_year"),
 				is_subcontracted: "No",
 			}, function(fieldname, value) {
 				if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
@@ -71,10 +71,10 @@
 
 	make_pos_btn: function() {
 		if(!this.pos_active) {
-			var btn_label = wn._("POS View"),
+			var btn_label = frappe._("POS View"),
 				icon = "icon-desktop";
 		} else {
-			var btn_label = wn._(this.frm.doctype) + wn._(" View"),
+			var btn_label = frappe._(this.frm.doctype) + frappe._(" View"),
 				icon = "icon-file-text";
 		}
 		var me = this;
@@ -86,11 +86,11 @@
 
 	toggle_pos: function(show) {
 		// Check whether it is Selling or Buying cycle
-		var price_list = wn.meta.has_field(cur_frm.doc.doctype, "selling_price_list") ?
+		var price_list = frappe.meta.has_field(cur_frm.doc.doctype, "selling_price_list") ?
 			this.frm.doc.selling_price_list : this.frm.doc.buying_price_list;
 		
 		if (!price_list)
-			msgprint(wn._("Please select Price List"))
+			msgprint(frappe._("Please select Price List"))
 		else {
 			if((show===true && this.pos_active) || (show===false && !this.pos_active)) return;
 
@@ -114,7 +114,7 @@
 	
 	item_code: function(doc, cdt, cdn) {
 		var me = this;
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(item.item_code || item.barcode || item.serial_no) {
 			if(!this.validate_company_and_party()) {
 				cur_frm.fields_dict[me.frm.cscript.fname].grid.grid_rows[item.idx - 1].remove();
@@ -157,7 +157,7 @@
 
 	serial_no: function(doc, cdt, cdn) {
 		var me = this;
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 
 		if (item.serial_no) {
 			if (!item.item_code) {
@@ -184,7 +184,7 @@
 					item.serial_no += sr_no[x] + '\n';
 
 				refresh_field("serial_no", item.name, item.parentfield);
-				wn.model.set_value(item.doctype, item.name, "qty", sr_no.length);
+				frappe.model.set_value(item.doctype, item.name, "qty", sr_no.length);
 			}
 		}
 	},
@@ -194,8 +194,8 @@
 	},
 	
 	set_default_values: function() {
-		$.each(wn.model.get_doclist(this.frm.doctype, this.frm.docname), function(i, doc) {
-			var updated = wn.model.set_default_values(doc);
+		$.each(frappe.model.get_doclist(this.frm.doctype, this.frm.docname), function(i, doc) {
+			var updated = frappe.model.set_default_values(doc);
 			if(doc.parentfield) {
 				refresh_field(doc.parentfield);
 			} else {
@@ -273,8 +273,8 @@
 	
 	get_exchange_rate: function(from_currency, to_currency, callback) {
 		var exchange_name = from_currency + "-" + to_currency;
-		wn.model.with_doc("Currency Exchange", exchange_name, function(name) {
-			var exchange_doc = wn.model.get_doc("Currency Exchange", exchange_name);
+		frappe.model.with_doc("Currency Exchange", exchange_name, function(name) {
+			var exchange_doc = frappe.model.get_doc("Currency Exchange", exchange_name);
 			callback(exchange_doc ? flt(exchange_doc.exchange_rate) : 0);
 		});
 	},
@@ -316,7 +316,7 @@
 	},
 
 	row_id: function(doc, cdt, cdn) {
-		var tax = wn.model.get_doc(cdt, cdn);
+		var tax = frappe.model.get_doc(cdt, cdn);
 		try {
 			this.validate_on_previous_row(tax);
 			this.calculate_taxes_and_totals();
@@ -351,7 +351,7 @@
 	},
 	
 	included_in_print_rate: function(doc, cdt, cdn) {
-		var tax = wn.model.get_doc(cdt, cdn);
+		var tax = frappe.model.get_doc(cdt, cdn);
 		try {
 			this.validate_on_previous_row(tax);
 			this.validate_inclusive_tax(tax);
@@ -366,15 +366,15 @@
 	validate_on_previous_row: function(tax) {
 		// validate if a valid row id is mentioned in case of
 		// On Previous Row Amount and On Previous Row Total
-		if(([wn._("On Previous Row Amount"), wn._("On Previous Row Total")].indexOf(tax.charge_type) != -1) &&
+		if(([frappe._("On Previous Row Amount"), frappe._("On Previous Row Total")].indexOf(tax.charge_type) != -1) &&
 			(!tax.row_id || cint(tax.row_id) >= tax.idx)) {
-				var msg = repl(wn._("Row") + " # %(idx)s [%(doctype)s]: " +
-					wn._("Please specify a valid") + " %(row_id_label)s", {
+				var msg = repl(frappe._("Row") + " # %(idx)s [%(doctype)s]: " +
+					frappe._("Please specify a valid") + " %(row_id_label)s", {
 						idx: tax.idx,
 						doctype: tax.doctype,
-						row_id_label: wn.meta.get_label(tax.doctype, "row_id", tax.name)
+						row_id_label: frappe.meta.get_label(tax.doctype, "row_id", tax.name)
 					});
-				wn.throw(msg);
+				frappe.throw(msg);
 			}
 	},
 	
@@ -382,30 +382,30 @@
 		if(!this.frm.tax_doclist) this.frm.tax_doclist = this.get_tax_doclist();
 		
 		var actual_type_error = function() {
-			var msg = repl(wn._("For row") + " # %(idx)s [%(doctype)s]: " + 
+			var msg = repl(frappe._("For row") + " # %(idx)s [%(doctype)s]: " + 
 				"%(charge_type_label)s = \"%(charge_type)s\" " +
-				wn._("cannot be included in Item's rate"), {
+				frappe._("cannot be included in Item's rate"), {
 					idx: tax.idx,
 					doctype: tax.doctype,
-					charge_type_label: wn.meta.get_label(tax.doctype, "charge_type", tax.name),
+					charge_type_label: frappe.meta.get_label(tax.doctype, "charge_type", tax.name),
 					charge_type: tax.charge_type
 				});
-			wn.throw(msg);
+			frappe.throw(msg);
 		};
 		
 		var on_previous_row_error = function(row_range) {
-			var msg = repl(wn._("For row") + " # %(idx)s [%(doctype)s]: " + 
-				wn._("to be included in Item's rate, it is required that: ") + 
-				" [" + wn._("Row") + " # %(row_range)s] " + wn._("also be included in Item's rate"), {
+			var msg = repl(frappe._("For row") + " # %(idx)s [%(doctype)s]: " + 
+				frappe._("to be included in Item's rate, it is required that: ") + 
+				" [" + frappe._("Row") + " # %(row_range)s] " + frappe._("also be included in Item's rate"), {
 					idx: tax.idx,
 					doctype: tax.doctype,
-					charge_type_label: wn.meta.get_label(tax.doctype, "charge_type", tax.name),
+					charge_type_label: frappe.meta.get_label(tax.doctype, "charge_type", tax.name),
 					charge_type: tax.charge_type,
-					inclusive_label: wn.meta.get_label(tax.doctype, "included_in_print_rate", tax.name),
+					inclusive_label: frappe.meta.get_label(tax.doctype, "included_in_print_rate", tax.name),
 					row_range: row_range,
 				});
 			
-			wn.throw(msg);
+			frappe.throw(msg);
 		};
 		
 		if(cint(tax.included_in_print_rate)) {
@@ -466,7 +466,7 @@
 			tax_accounts.push([tax.name, tax.account_head]);
 		});
 		
-		var headings = $.map([wn._("Item Name")].concat($.map(tax_accounts, function(head) { return head[1]; })), 
+		var headings = $.map([frappe._("Item Name")].concat($.map(tax_accounts, function(head) { return head[1]; })), 
 			function(head) { return '<th style="min-width: 100px;">' + (head || "") + "</th>" }).join("\n");
 			
 		var distinct_item_names = [];
@@ -504,11 +504,11 @@
 		var valid = true;
 		
 		$.each(["company", "customer", "supplier"], function(i, fieldname) {
-			if(wn.meta.has_field(me.frm.doc.doctype, fieldname)) {
+			if(frappe.meta.has_field(me.frm.doc.doctype, fieldname)) {
 				if (!me.frm.doc[fieldname]) {
-					msgprint(wn._("Please specify") + ": " + 
-						wn.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) + 
-						". " + wn._("It is needed to fetch Item Details."));
+					msgprint(frappe._("Please specify") + ": " + 
+						frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) + 
+						". " + frappe._("It is needed to fetch Item Details."));
 						valid = false;
 				}
 			}
@@ -517,25 +517,25 @@
 	},
 	
 	get_item_doclist: function() {
-		return wn.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
+		return frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
 			{parentfield: this.fname});
 	},
 	
 	get_tax_doclist: function() {
-		return wn.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
+		return frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name,
 			{parentfield: this.other_fname});
 	},
 	
 	validate_conversion_rate: function() {
 		this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
-		var conversion_rate_label = wn.meta.get_label(this.frm.doc.doctype, "conversion_rate", 
+		var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate", 
 			this.frm.doc.name);
 		var company_currency = this.get_company_currency();
 		
 		if(!this.frm.doc.conversion_rate) {
-			wn.throw(repl('%(conversion_rate_label)s' + 
-				wn._(' is mandatory. Maybe Currency Exchange record is not created for ') + 
-				'%(from_currency)s' + wn._(" to ") + '%(to_currency)s', 
+			frappe.throw(repl('%(conversion_rate_label)s' + 
+				frappe._(' is mandatory. Maybe Currency Exchange record is not created for ') + 
+				'%(from_currency)s' + frappe._(" to ") + '%(to_currency)s', 
 				{
 					"conversion_rate_label": conversion_rate_label,
 					"from_currency": this.frm.doc.currency,
@@ -547,7 +547,7 @@
 	calculate_taxes_and_totals: function() {
 		this.discount_amount_applied = false;
 		this._calculate_taxes_and_totals();
-		if (wn.meta.get_docfield(this.frm.doc.doctype, "discount_amount"))
+		if (frappe.meta.get_docfield(this.frm.doc.doctype, "discount_amount"))
 			this.apply_discount_amount();
 	},
 
@@ -583,7 +583,7 @@
 			
 			me.validate_on_previous_row(tax);
 			me.validate_inclusive_tax(tax);
-			wn.model.round_floats_in(tax);
+			frappe.model.round_floats_in(tax);
 		});
 	},
 	
@@ -716,9 +716,9 @@
 
 	calculate_total_advance: function(parenttype, advance_parentfield) {
 		if(this.frm.doc.doctype == parenttype && this.frm.doc.docstatus < 2) {
-			var advance_doclist = wn.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, 
+			var advance_doclist = frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, 
 				{parentfield: advance_parentfield});
-			this.frm.doc.total_advance = flt(wn.utils.sum(
+			this.frm.doc.total_advance = flt(frappe.utils.sum(
 				$.map(advance_doclist, function(adv) { return adv.allocated_amount })
 			), precision("total_advance"));
 			
@@ -736,7 +736,7 @@
 		var me = this;
 		if(this.frm.doc.tc_name) {
 			return this.frm.call({
-				method: "webnotes.client.get_value",
+				method: "frappe.client.get_value",
 				args: {
 					doctype: "Terms and Conditions",
 					fieldname: "terms",
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 0ee3ce0..622e1c4 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -1,19 +1,19 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
-wn.provide("erpnext");
+frappe.provide("erpnext");
 
 $.extend(erpnext, {
 	get_currency: function(company) {
 		if(!company && cur_frm)
 			company = cur_frm.doc.company;
 		if(company)
-			return wn.model.get_doc(":Company", company).default_currency || wn.boot.sysdefaults.currency;
+			return frappe.model.get_doc(":Company", company).default_currency || frappe.boot.sysdefaults.currency;
 		else
-			return wn.boot.sysdefaults.currency;
+			return frappe.boot.sysdefaults.currency;
 	},
 	
 	hide_naming_series: function() {
-		if(cur_frm.fields_dict.naming_series && !wn.meta.get_docfield(cur_frm.doctype, "naming_series")) {
+		if(cur_frm.fields_dict.naming_series && !frappe.meta.get_docfield(cur_frm.doctype, "naming_series")) {
 			cur_frm.toggle_display("naming_series", cur_frm.doc.__islocal?true:false);
 		}
 	},
@@ -30,10 +30,10 @@
 	
 	add_applicable_territory: function() {
 		if(cur_frm.doc.__islocal && 
-			wn.model.get_doclist(cur_frm.doc.doctype, cur_frm.doc.name).length === 1) {
-				var territory = wn.model.add_child(cur_frm.doc, "Applicable Territory", 
+			frappe.model.get_doclist(cur_frm.doc.doctype, cur_frm.doc.name).length === 1) {
+				var territory = frappe.model.add_child(cur_frm.doc, "Applicable Territory", 
 					"valid_for_territories");
-				territory.territory = wn.defaults.get_default("territory");
+				territory.territory = frappe.defaults.get_default("territory");
 		}
 	},
 	
@@ -41,19 +41,19 @@
 		if(!grid_row.fields_dict.serial_no || 
 			grid_row.fields_dict.serial_no.get_status()!=="Write") return;
 		
-		var $btn = $('<button class="btn btn-sm btn-default">'+wn._("Add Serial No")+'</button>')
+		var $btn = $('<button class="btn btn-sm btn-default">'+frappe._("Add Serial No")+'</button>')
 			.appendTo($("<div>")
 				.css({"margin-bottom": "10px", "margin-left": "15px"})
 				.appendTo(grid_row.fields_dict.serial_no.$wrapper));
 				
 		$btn.on("click", function() {
-			var d = new wn.ui.Dialog({
-				title: wn._("Add Serial No"),
+			var d = new frappe.ui.Dialog({
+				title: frappe._("Add Serial No"),
 				fields: [
 					{
 						"fieldtype": "Link",
 						"options": "Serial No",
-						"label": wn._("Serial No"),
+						"label": frappe._("Serial No"),
 						"get_query": {
 							item_code: grid_row.doc.item_code,
 							warehouse: grid_row.doc.warehouse
@@ -61,7 +61,7 @@
 					},
 					{
 						"fieldtype": "Button",
-						"label": wn._("Add")
+						"label": frappe._("Add")
 					}
 				]
 			});
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index c01dee6..cbd9186 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.utils");
+frappe.provide("erpnext.utils");
 erpnext.utils.get_party_details = function(frm, method, args) {
 	if(!method) {
 		method = "erpnext.accounts.party.get_party_details";
@@ -23,7 +23,7 @@
 	}
 	args.currency = frm.doc.currency;
 	args.company = frm.doc.company;
-	wn.call({
+	frappe.call({
 		method: method,
 		args: args,
 		callback: function(r) {
@@ -46,7 +46,7 @@
 		}
 	} 
 	if(frm.doc[address_field]) {
-		wn.call({
+		frappe.call({
 			method: "erpnext.utilities.doctype.address.address.get_address_display",
 			args: {address: frm.doc[address_field] },
 			callback: function(r) {
@@ -61,7 +61,7 @@
 	if(frm.updating_party_details) return;
 	
 	if(frm.doc[address_field]) {
-		wn.call({
+		frappe.call({
 			method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
 			args: {contact: frm.doc.contact_person },
 			callback: function(r) {
diff --git a/erpnext/public/js/website_utils.js b/erpnext/public/js/website_utils.js
index 1c797dc..70f3018 100644
--- a/erpnext/public/js/website_utils.js
+++ b/erpnext/public/js/website_utils.js
@@ -5,8 +5,8 @@
 
 // Add / update a new Lead / Communication
 // subject, sender, description
-wn.send_message = function(opts, btn) {
-	return wn.call({
+frappe.send_message = function(opts, btn) {
+	return frappe.call({
 		type: "POST",
 		method: "erpnext.templates.utils.send_message",
 		btn: btn,
@@ -16,4 +16,4 @@
 };
 
 // for backward compatibility
-erpnext.send_message = wn.send_message;
\ No newline at end of file
+erpnext.send_message = frappe.send_message;
\ No newline at end of file
diff --git a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
index 67fd5d8..c858c26 100644
--- a/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
+++ b/erpnext/selling/Print Format/Quotation Classic/Quotation Classic.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Quotation", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td>\n\t\t\t\t\t<script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script>\n\t\t\t</td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td>\n\t\t\t\t\t<script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script>\n\t\t\t</td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
index d31f8c3..b7c3830 100644
--- a/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
+++ b/erpnext/selling/Print Format/Quotation Modern/Quotation Modern.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Quotation", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Quotation No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Quotation No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
index 075b978..f4be36e 100644
--- a/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
+++ b/erpnext/selling/Print Format/Quotation Spartan/Quotation Spartan.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Quotation", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Quotation',\n\t\t\t\tdoc.name,\n\t\t\t\t'quotation_details',\n\t\t\t\t'Quotation Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td></td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Quotation') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Quotation Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
index 26aa89b..8c0b807 100644
--- a/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
+++ b/erpnext/selling/Print Format/Sales Order Classic/Sales Order Classic.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
index 17f9c04..a901ae2 100644
--- a/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
+++ b/erpnext/selling/Print Format/Sales Order Modern/Sales Order Modern.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
index bbb18b4..481da0d 100644
--- a/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
+++ b/erpnext/selling/Print Format/Sales Order Spartan/Sales Order Spartan.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Sales Order", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Sales Order',\n\t\t\t\tdoc.name,\n\t\t\t\t'sales_order_details',\n\t\t\t\t'Sales Order Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '20%', '37%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tif(data_row.discount_percentage) {\n\t\t\t\t\t\t\tvar to_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' + \n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\treturn data_row.description + to_append;\n\t\t\t\t\t\t\t} else { return data_row.description; }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Sales Order') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=39%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Sales Order Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Delivery Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.delivery_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Selling", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/selling/doctype/campaign/campaign.py b/erpnext/selling/doctype/campaign/campaign.py
index b0215d5..5015bed 100644
--- a/erpnext/selling/doctype/campaign/campaign.py
+++ b/erpnext/selling/doctype/campaign/campaign.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index f3b388b..308e8f1 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -11,7 +11,7 @@
 	doc = locals[doc.doctype][doc.name];
 	if(!(doc.__islocal && doc.lead_name)) { return; }
 
-	var fields_to_refresh = wn.model.set_default_values(doc);
+	var fields_to_refresh = frappe.model.set_default_values(doc);
 	if(fields_to_refresh) { refresh_many(fields_to_refresh); }
 }
 
@@ -30,7 +30,7 @@
 		cur_frm.cscript.make_address(doc, dt, dn);
 		cur_frm.cscript.make_contact(doc, dt, dn);
 
-		cur_frm.communication_view = new wn.views.CommunicationList({
+		cur_frm.communication_view = new frappe.views.CommunicationList({
 			parent: cur_frm.fields_dict.communication_html.wrapper,
 			doc: doc,
 		});
@@ -42,7 +42,7 @@
 	if(doc.__islocal) 
 		return;
 	if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager"))
-		cur_frm.dashboard.set_headline('<span class="text-muted">'+ wn._('Loading...')+ '</span>')
+		cur_frm.dashboard.set_headline('<span class="text-muted">'+ frappe._('Loading...')+ '</span>')
 	
 	cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
 	cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
@@ -50,7 +50,7 @@
 	cur_frm.dashboard.add_doctype_badge("Delivery Note", "customer");
 	cur_frm.dashboard.add_doctype_badge("Sales Invoice", "customer");
 	
-	return wn.call({
+	return frappe.call({
 		type: "GET",
 		method: "erpnext.selling.doctype.customer.customer.get_dashboard_info",
 		args: {
@@ -59,9 +59,9 @@
 		callback: function(r) {
 			if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
 				cur_frm.dashboard.set_headline(
-					wn._("Total Billing This Year: ") + "<b>" 
+					frappe._("Total Billing This Year: ") + "<b>" 
 					+ format_currency(r.message.total_billing, erpnext.get_currency(cur_frm.doc.company))
-					+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" 
+					+ '</b> / <span class="text-muted">' + frappe._("Unpaid") + ": <b>" 
 					+ format_currency(r.message.total_unpaid, erpnext.get_currency(cur_frm.doc.company)) 
 					+ '</b></span>');
 			}
@@ -72,7 +72,7 @@
 
 cur_frm.cscript.make_address = function() {
 	if(!cur_frm.address_list) {
-		cur_frm.address_list = new wn.ui.Listing({
+		cur_frm.address_list = new frappe.ui.Listing({
 			parent: cur_frm.fields_dict['address_html'].wrapper,
 			page_length: 5,
 			new_doctype: "Address",
@@ -80,7 +80,7 @@
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
 			as_dict: 1,
-			no_results_message: wn._('No addresses created'),
+			no_results_message: frappe._('No addresses created'),
 			render_row: cur_frm.cscript.render_address_row,
 		});
 		// note: render_address_row is defined in contact_control.js
@@ -90,7 +90,7 @@
 
 cur_frm.cscript.make_contact = function() {
 	if(!cur_frm.contact_list) {
-		cur_frm.contact_list = new wn.ui.Listing({
+		cur_frm.contact_list = new frappe.ui.Listing({
 			parent: cur_frm.fields_dict['contact_html'].wrapper,
 			page_length: 5,
 			new_doctype: "Contact",
@@ -98,7 +98,7 @@
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
 			as_dict: 1,
-			no_results_message: wn._('No contacts created'),
+			no_results_message: frappe._('No contacts created'),
 			render_row: cur_frm.cscript.render_contact_row,
 		});
 		// note: render_contact_row is defined in contact_control.js
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index d574fe7..19cad39 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.model.doc import Document, make_autoname
-from webnotes import msgprint, _
-import webnotes.defaults
+import frappe
+from frappe.model.doc import Document, make_autoname
+from frappe import msgprint, _
+import frappe.defaults
 
 
 from erpnext.utilities.transaction_base import TransactionBase
@@ -17,48 +17,48 @@
 		self.doclist = doclist
 				
 	def autoname(self):
-		cust_master_name = webnotes.defaults.get_global_default('cust_master_name')
+		cust_master_name = frappe.defaults.get_global_default('cust_master_name')
 		if cust_master_name == 'Customer Name':
-			if webnotes.conn.exists("Supplier", self.doc.customer_name):
+			if frappe.conn.exists("Supplier", self.doc.customer_name):
 				msgprint(_("A Supplier exists with same name"), raise_exception=1)
 			self.doc.name = self.doc.customer_name
 		else:
 			self.doc.name = make_autoname(self.doc.naming_series+'.#####')
 
 	def get_company_abbr(self):
-		return webnotes.conn.get_value('Company', self.doc.company, 'abbr')
+		return frappe.conn.get_value('Company', self.doc.company, 'abbr')
 	
 	def validate_values(self):
-		if webnotes.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.doc.naming_series:
-			webnotes.throw("Series is Mandatory.", webnotes.MandatoryError)
+		if frappe.defaults.get_global_default('cust_master_name') == 'Naming Series' and not self.doc.naming_series:
+			frappe.throw("Series is Mandatory.", frappe.MandatoryError)
 
 	def validate(self):
 		self.validate_values()
 
 	def update_lead_status(self):
 		if self.doc.lead_name:
-			webnotes.conn.sql("update `tabLead` set status='Converted' where name = %s", self.doc.lead_name)
+			frappe.conn.sql("update `tabLead` set status='Converted' where name = %s", self.doc.lead_name)
 
 	def update_address(self):
-		webnotes.conn.sql("""update `tabAddress` set customer_name=%s, modified=NOW() 
+		frappe.conn.sql("""update `tabAddress` set customer_name=%s, modified=NOW() 
 			where customer=%s""", (self.doc.customer_name, self.doc.name))
 
 	def update_contact(self):
-		webnotes.conn.sql("""update `tabContact` set customer_name=%s, modified=NOW() 
+		frappe.conn.sql("""update `tabContact` set customer_name=%s, modified=NOW() 
 			where customer=%s""", (self.doc.customer_name, self.doc.name))
 
 	def update_credit_days_limit(self):
-		webnotes.conn.sql("""update tabAccount set credit_days = %s, credit_limit = %s 
+		frappe.conn.sql("""update tabAccount set credit_days = %s, credit_limit = %s 
 			where master_type='Customer' and master_name = %s""", 
 			(self.doc.credit_days or 0, self.doc.credit_limit or 0, self.doc.name))
 
 	def create_lead_address_contact(self):
 		if self.doc.lead_name:
-			if not webnotes.conn.get_value("Address", {"lead": self.doc.lead_name, "customer": self.doc.customer}):
-				webnotes.conn.sql("""update `tabAddress` set customer=%s, customer_name=%s where lead=%s""", 
+			if not frappe.conn.get_value("Address", {"lead": self.doc.lead_name, "customer": self.doc.customer}):
+				frappe.conn.sql("""update `tabAddress` set customer=%s, customer_name=%s where lead=%s""", 
 					(self.doc.name, self.doc.customer_name, self.doc.lead_name))
 
-			lead = webnotes.conn.get_value("Lead", self.doc.lead_name, ["lead_name", "email_id", "phone", "mobile_no"], as_dict=True)
+			lead = frappe.conn.get_value("Lead", self.doc.lead_name, ["lead_name", "email_id", "phone", "mobile_no"], as_dict=True)
 			c = Document('Contact') 
 			c.first_name = lead.lead_name 
 			c.email_id = lead.email_id
@@ -88,40 +88,40 @@
 		self.create_lead_address_contact()
 		
 	def validate_name_with_customer_group(self):
-		if webnotes.conn.exists("Customer Group", self.doc.name):
-			webnotes.msgprint("An Customer Group exists with same name (%s), \
+		if frappe.conn.exists("Customer Group", self.doc.name):
+			frappe.msgprint("An Customer Group exists with same name (%s), \
 				please change the Customer name or rename the Customer Group" % 
 				self.doc.name, raise_exception=1)
 
 	def delete_customer_address(self):
-		addresses = webnotes.conn.sql("""select name, lead from `tabAddress`
+		addresses = frappe.conn.sql("""select name, lead from `tabAddress`
 			where customer=%s""", (self.doc.name,))
 		
 		for name, lead in addresses:
 			if lead:
-				webnotes.conn.sql("""update `tabAddress` set customer=null, customer_name=null
+				frappe.conn.sql("""update `tabAddress` set customer=null, customer_name=null
 					where name=%s""", name)
 			else:
-				webnotes.conn.sql("""delete from `tabAddress` where name=%s""", name)
+				frappe.conn.sql("""delete from `tabAddress` where name=%s""", name)
 	
 	def delete_customer_contact(self):
-		for contact in webnotes.conn.sql_list("""select name from `tabContact` 
+		for contact in frappe.conn.sql_list("""select name from `tabContact` 
 			where customer=%s""", self.doc.name):
-				webnotes.delete_doc("Contact", contact)
+				frappe.delete_doc("Contact", contact)
 	
 	def delete_customer_account(self):
 		"""delete customer's ledger if exist and check balance before deletion"""
-		acc = webnotes.conn.sql("select name from `tabAccount` where master_type = 'Customer' \
+		acc = frappe.conn.sql("select name from `tabAccount` where master_type = 'Customer' \
 			and master_name = %s and docstatus < 2", self.doc.name)
 		if acc:
-			webnotes.delete_doc('Account', acc[0][0])
+			frappe.delete_doc('Account', acc[0][0])
 
 	def on_trash(self):
 		self.delete_customer_address()
 		self.delete_customer_contact()
 		self.delete_customer_account()
 		if self.doc.lead_name:
-			webnotes.conn.sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
+			frappe.conn.sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
 			
 	def before_rename(self, olddn, newdn, merge=False):
 		from erpnext.accounts.utils import rename_account_for
@@ -129,32 +129,32 @@
 
 	def after_rename(self, olddn, newdn, merge=False):
 		set_field = ''
-		if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
-			webnotes.conn.set(self.doc, "customer_name", newdn)
+		if frappe.defaults.get_global_default('cust_master_name') == 'Customer Name':
+			frappe.conn.set(self.doc, "customer_name", newdn)
 			self.update_contact()
 			set_field = ", customer_name=%(newdn)s"
 		self.update_customer_address(newdn, set_field)
 
 	def update_customer_address(self, newdn, set_field):
-		webnotes.conn.sql("""update `tabAddress` set address_title=%(newdn)s 
+		frappe.conn.sql("""update `tabAddress` set address_title=%(newdn)s 
 			{set_field} where customer=%(newdn)s"""\
 			.format(set_field=set_field), ({"newdn": newdn}))
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_dashboard_info(customer):
-	if not webnotes.has_permission("Customer", "read", customer):
-		webnotes.msgprint("No Permission", raise_exception=True)
+	if not frappe.has_permission("Customer", "read", customer):
+		frappe.msgprint("No Permission", raise_exception=True)
 	
 	out = {}
 	for doctype in ["Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
-		out[doctype] = webnotes.conn.get_value(doctype, 
+		out[doctype] = frappe.conn.get_value(doctype, 
 			{"customer": customer, "docstatus": ["!=", 2] }, "count(*)")
 	
-	billing = webnotes.conn.sql("""select sum(grand_total), sum(outstanding_amount) 
+	billing = frappe.conn.sql("""select sum(grand_total), sum(outstanding_amount) 
 		from `tabSales Invoice` 
 		where customer=%s 
 			and docstatus = 1
-			and fiscal_year = %s""", (customer, webnotes.conn.get_default("fiscal_year")))
+			and fiscal_year = %s""", (customer, frappe.conn.get_default("fiscal_year")))
 	
 	out["total_billing"] = billing[0][0]
 	out["total_unpaid"] = billing[0][1]
@@ -163,12 +163,12 @@
 
 
 def get_customer_list(doctype, txt, searchfield, start, page_len, filters):
-	if webnotes.conn.get_default("cust_master_name") == "Customer Name":
+	if frappe.conn.get_default("cust_master_name") == "Customer Name":
 		fields = ["name", "customer_group", "territory"]
 	else:
 		fields = ["name", "customer_name", "customer_group", "territory"]
 		
-	return webnotes.conn.sql("""select %s from `tabCustomer` where docstatus < 2 
+	return frappe.conn.sql("""select %s from `tabCustomer` where docstatus < 2 
 		and (%s like %s or customer_name like %s) order by 
 		case when name like %s then 0 else 1 end,
 		case when customer_name like %s then 0 else 1 end,
diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py
index b35aa7c..b515777 100644
--- a/erpnext/selling/doctype/customer/test_customer.py
+++ b/erpnext/selling/doctype/customer/test_customer.py
@@ -3,10 +3,10 @@
 
 from __future__ import unicode_literals
 
-import webnotes
+import frappe
 import unittest
 
-from webnotes.test_runner import make_test_records
+from frappe.test_runner import make_test_records
 
 
 class TestCustomer(unittest.TestCase):
@@ -39,12 +39,12 @@
 			self.assertEquals(value, details.get(key))
 		
 	def test_rename(self):
-		webnotes.rename_doc("Customer", "_Test Customer 1", "_Test Customer 1 Renamed")
+		frappe.rename_doc("Customer", "_Test Customer 1", "_Test Customer 1 Renamed")
 
-		self.assertTrue(webnotes.conn.exists("Customer", "_Test Customer 1 Renamed"))
-		self.assertFalse(webnotes.conn.exists("Customer", "_Test Customer 1"))
+		self.assertTrue(frappe.conn.exists("Customer", "_Test Customer 1 Renamed"))
+		self.assertFalse(frappe.conn.exists("Customer", "_Test Customer 1"))
 		
-		webnotes.rename_doc("Customer", "_Test Customer 1 Renamed", "_Test Customer 1")
+		frappe.rename_doc("Customer", "_Test Customer 1 Renamed", "_Test Customer 1")
 		
 
 test_ignore = ["Price List"]
diff --git a/erpnext/selling/doctype/customer_discount/customer_discount.py b/erpnext/selling/doctype/customer_discount/customer_discount.py
index e5468e5..968a25b 100644
--- a/erpnext/selling/doctype/customer_discount/customer_discount.py
+++ b/erpnext/selling/doctype/customer_discount/customer_discount.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/industry_type/industry_type.py b/erpnext/selling/doctype/industry_type/industry_type.py
index b0215d5..5015bed 100644
--- a/erpnext/selling/doctype/industry_type/industry_type.py
+++ b/erpnext/selling/doctype/industry_type/industry_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js
index 1373225..911ca32 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.js
+++ b/erpnext/selling/doctype/installation_note/installation_note.js
@@ -5,18 +5,18 @@
 cur_frm.cscript.fname = "installed_item_details";
 
 
-wn.ui.form.on_change("Installation Note", "customer", 
+frappe.ui.form.on_change("Installation Note", "customer", 
 	function(frm) { erpnext.utils.get_party_details(frm); });
 
-wn.ui.form.on_change("Installation Note", "customer_address", 
+frappe.ui.form.on_change("Installation Note", "customer_address", 
 	function(frm) { erpnext.utils.get_address_display(frm); });
 
-wn.ui.form.on_change("Installation Note", "contact_person", 
+frappe.ui.form.on_change("Installation Note", "contact_person", 
 	function(frm) { erpnext.utils.get_contact_details(frm); });
 
-wn.provide("erpnext.selling");
+frappe.provide("erpnext.selling");
 // TODO commonify this code
-erpnext.selling.InstallationNote = wn.ui.form.Controller.extend({
+erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
 	onload: function() {
 		if(!this.frm.doc.status) set_multiple(dt,dn,{ status:'Draft'});
 		if(this.frm.doc.__islocal) set_multiple(this.frm.doc.doctype, this.frm.doc.name, 
@@ -49,9 +49,9 @@
 	
 	refresh: function() {
 		if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Delivery Note'), 
+			cur_frm.add_custom_button(frappe._('From Delivery Note'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.stock.doctype.delivery_note.delivery_note.make_installation_note",
 						source_doctype: "Delivery Note",
 						get_query_filters: {
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index 253e43e..ba00672 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, getdate
-from webnotes.model.bean import getlist
-from webnotes import msgprint
+from frappe.utils import cstr, getdate
+from frappe.model.bean import getlist
+from frappe import msgprint
 from erpnext.stock.utils import get_valid_serial_nos	
 
 from erpnext.utilities.transaction_base import TransactionBase
@@ -44,7 +44,7 @@
 		validate_fiscal_year(self.doc.inst_date, self.doc.fiscal_year, "Installation Date")
 	
 	def is_serial_no_added(self, item_code, serial_no):
-		ar_required = webnotes.conn.get_value("Item", item_code, "has_serial_no")
+		ar_required = frappe.conn.get_value("Item", item_code, "has_serial_no")
 		if ar_required == 'Yes' and not serial_no:
 			msgprint("Serial No is mandatory for item: " + item_code, raise_exception=1)
 		elif ar_required != 'Yes' and cstr(serial_no).strip():
@@ -53,12 +53,12 @@
 	
 	def is_serial_no_exist(self, item_code, serial_no):
 		for x in serial_no:
-			if not webnotes.conn.exists("Serial No", x):
+			if not frappe.conn.exists("Serial No", x):
 				msgprint("Serial No " + x + " does not exist in the system", raise_exception=1)
 	
 	def is_serial_no_installed(self,cur_s_no,item_code):
 		for x in cur_s_no:
-			status = webnotes.conn.sql("select status from `tabSerial No` where name = %s", x)
+			status = frappe.conn.sql("select status from `tabSerial No` where name = %s", x)
 			status = status and status[0][0] or ''
 			
 			if status == 'Installed':
@@ -66,7 +66,7 @@
 					raise_exception=1)
 	
 	def get_prevdoc_serial_no(self, prevdoc_detail_docname):
-		serial_nos = webnotes.conn.get_value("Delivery Note Item", 
+		serial_nos = frappe.conn.get_value("Delivery Note Item", 
 			prevdoc_detail_docname, "serial_no")
 		return get_valid_serial_nos(serial_nos)
 		
@@ -94,7 +94,7 @@
 	def validate_installation_date(self):
 		for d in getlist(self.doclist, 'installed_item_details'):
 			if d.prevdoc_docname:
-				d_date = webnotes.conn.get_value("Delivery Note", d.prevdoc_docname, "posting_date")				
+				d_date = frappe.conn.get_value("Delivery Note", d.prevdoc_docname, "posting_date")				
 				if d_date > getdate(self.doc.inst_date):
 					msgprint("Installation Date can not be before Delivery Date " + cstr(d_date) + 
 						" for item "+d.item_code, raise_exception=1)
@@ -104,26 +104,26 @@
 			msgprint("Please fetch items from Delivery Note selected", raise_exception=1)
 	
 	def on_update(self):
-		webnotes.conn.set(self.doc, 'status', 'Draft')
+		frappe.conn.set(self.doc, 'status', 'Draft')
 	
 	def on_submit(self):
 		valid_lst = []
 		valid_lst = self.validate_serial_no()
 		
 		for x in valid_lst:
-			if webnotes.conn.get_value("Serial No", x, "warranty_period"):
-				webnotes.conn.set_value("Serial No", x, "maintenance_status", "Under Warranty")
-			webnotes.conn.set_value("Serial No", x, "status", "Installed")
+			if frappe.conn.get_value("Serial No", x, "warranty_period"):
+				frappe.conn.set_value("Serial No", x, "maintenance_status", "Under Warranty")
+			frappe.conn.set_value("Serial No", x, "status", "Installed")
 
 		self.update_prevdoc_status()
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 	
 	def on_cancel(self):
 		for d in getlist(self.doclist, 'installed_item_details'):
 			if d.serial_no:
 				d.serial_no = d.serial_no.replace(",", "\n")
 				for sr_no in d.serial_no.split("\n"):
-					webnotes.conn.set_value("Serial No", sr_no, "status", "Delivered")
+					frappe.conn.set_value("Serial No", sr_no, "status", "Delivered")
 
 		self.update_prevdoc_status()
-		webnotes.conn.set(self.doc, 'status', 'Cancelled')
+		frappe.conn.set(self.doc, 'status', 'Cancelled')
diff --git a/erpnext/selling/doctype/installation_note_item/installation_note_item.py b/erpnext/selling/doctype/installation_note_item/installation_note_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/selling/doctype/installation_note_item/installation_note_item.py
+++ b/erpnext/selling/doctype/installation_note_item/installation_note_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/lead/get_leads.py b/erpnext/selling/doctype/lead/get_leads.py
index ccb691c..4cdeaf1 100644
--- a/erpnext/selling/doctype/lead/get_leads.py
+++ b/erpnext/selling/doctype/lead/get_leads.py
@@ -2,19 +2,19 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, cint
-from webnotes.utils.email_lib.receive import POP3Mailbox
-from webnotes.core.doctype.communication.communication import _make
+import frappe
+from frappe.utils import cstr, cint
+from frappe.utils.email_lib.receive import POP3Mailbox
+from frappe.core.doctype.communication.communication import _make
 
 def add_sales_communication(subject, content, sender, real_name, mail=None, 
 	status="Open", date=None):
-	lead_name = webnotes.conn.get_value("Lead", {"email_id": sender})
-	contact_name = webnotes.conn.get_value("Contact", {"email_id": sender})
+	lead_name = frappe.conn.get_value("Lead", {"email_id": sender})
+	contact_name = frappe.conn.get_value("Contact", {"email_id": sender})
 
 	if not (lead_name or contact_name):
 		# none, create a new Lead
-		lead = webnotes.bean({
+		lead = frappe.bean({
 			"doctype":"Lead",
 			"lead_name": real_name or sender,
 			"email_id": sender,
@@ -33,12 +33,12 @@
 	
 	if mail:
 		# save attachments to parent if from mail
-		bean = webnotes.bean(parent_doctype, parent_name)
+		bean = frappe.bean(parent_doctype, parent_name)
 		mail.save_attachments_in_doc(bean.doc)
 
 class SalesMailbox(POP3Mailbox):	
 	def setup(self, args=None):
-		self.settings = args or webnotes.doc("Sales Email Settings", "Sales Email Settings")
+		self.settings = args or frappe.doc("Sales Email Settings", "Sales Email Settings")
 		
 	def process_message(self, mail):
 		if mail.from_email == self.settings.email_id:
@@ -48,5 +48,5 @@
 			mail.from_real_name, mail=mail, date=mail.date)
 
 def get_leads():
-	if cint(webnotes.conn.get_value('Sales Email Settings', None, 'extract_emails')):
+	if cint(frappe.conn.get_value('Sales Email Settings', None, 'extract_emails')):
 		SalesMailbox()
\ No newline at end of file
diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js
index 228d790..532b778 100644
--- a/erpnext/selling/doctype/lead/lead.js
+++ b/erpnext/selling/doctype/lead/lead.js
@@ -4,8 +4,8 @@
 {% include 'setup/doctype/contact_control/contact_control.js' %};
 {% include 'utilities/doctype/sms_control/sms_control.js' %}
 
-wn.provide("erpnext");
-erpnext.LeadController = wn.ui.form.Controller.extend({
+frappe.provide("erpnext");
+erpnext.LeadController = frappe.ui.form.Controller.extend({
 	setup: function() {
 		this.frm.fields_dict.customer.get_query = function(doc, cdt, cdn) {
 				return { query: "erpnext.controllers.queries.customer_query" } }
@@ -14,17 +14,17 @@
 	onload: function() {
 		if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) {
 			cur_frm.fields_dict.lead_owner.get_query = function(doc, cdt, cdn) {
-				return { query:"webnotes.core.doctype.profile.profile.profile_query" } }
+				return { query:"frappe.core.doctype.profile.profile.profile_query" } }
 		}
 
 		if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
 			cur_frm.fields_dict.contact_by.get_query = function(doc, cdt, cdn) {
-				return { query:"webnotes.core.doctype.profile.profile.profile_query" } }
+				return { query:"frappe.core.doctype.profile.profile.profile_query" } }
 		}
 
 		if(in_list(user_roles,'System Manager')) {
-			cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Sales Email Settings">'+wn._('Sales Email Settings')+'</a><br>\
-				<span class="help">'+wn._('Automatically extract Leads from a mail box e.g.')+' "sales@example.com"</span></p>';
+			cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Sales Email Settings">'+frappe._('Sales Email Settings')+'</a><br>\
+				<span class="help">'+frappe._('Automatically extract Leads from a mail box e.g.')+' "sales@example.com"</span></p>';
 		}
 	},
 	
@@ -35,13 +35,13 @@
 
 		this.frm.__is_customer = this.frm.__is_customer || this.frm.doc.__is_customer;
 		if(!this.frm.doc.__islocal && !this.frm.doc.__is_customer) {
-			this.frm.add_custom_button(wn._("Create Customer"), this.create_customer);
-			this.frm.add_custom_button(wn._("Create Opportunity"), this.create_opportunity);
-			this.frm.appframe.add_button(wn._("Send SMS"), this.frm.cscript.send_sms, "icon-mobile-phone");
+			this.frm.add_custom_button(frappe._("Create Customer"), this.create_customer);
+			this.frm.add_custom_button(frappe._("Create Opportunity"), this.create_opportunity);
+			this.frm.appframe.add_button(frappe._("Send SMS"), this.frm.cscript.send_sms, "icon-mobile-phone");
 		}
 		
-		cur_frm.communication_view = new wn.views.CommunicationList({
-			list: wn.model.get("Communication", {"parenttype": "Lead", "parent":this.frm.doc.name}),
+		cur_frm.communication_view = new frappe.views.CommunicationList({
+			list: frappe.model.get("Communication", {"parenttype": "Lead", "parent":this.frm.doc.name}),
 			parent: this.frm.fields_dict.communication_html.wrapper,
 			doc: this.frm.doc,
 			recipients: this.frm.doc.email_id
@@ -55,7 +55,7 @@
 	make_address_list: function() {
 		var me = this;
 		if(!this.frm.address_list) {
-			this.frm.address_list = new wn.ui.Listing({
+			this.frm.address_list = new frappe.ui.Listing({
 				parent: this.frm.fields_dict['address_html'].wrapper,
 				page_length: 5,
 				new_doctype: "Address",
@@ -67,7 +67,7 @@
 					order by is_primary_address, is_shipping_address desc'
 				},
 				as_dict: 1,
-				no_results_message: wn._('No addresses created'),
+				no_results_message: frappe._('No addresses created'),
 				render_row: this.render_address_row,
 			});
 			// note: render_address_row is defined in contact_control.js
@@ -76,14 +76,14 @@
 	}, 
 	
 	create_customer: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.lead.lead.make_customer",
 			source_name: cur_frm.doc.name
 		})
 	}, 
 	
 	create_opportunity: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.lead.lead.make_opportunity",
 			source_name: cur_frm.doc.name
 		})
diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py
index e5f2b62..f0374da 100644
--- a/erpnext/selling/doctype/lead/lead.py
+++ b/erpnext/selling/doctype/lead/lead.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import cstr, validate_email_add, cint, extract_email_id
-from webnotes import session, msgprint
+import frappe
+from frappe import _
+from frappe.utils import cstr, validate_email_add, cint, extract_email_id
+from frappe import session, msgprint
 
 	
 from erpnext.controllers.selling_controller import SellingController
@@ -15,15 +15,15 @@
 		self.doc = doc
 		self.doclist = doclist
 
-		self._prev = webnotes._dict({
-			"contact_date": webnotes.conn.get_value("Lead", self.doc.name, "contact_date") if \
+		self._prev = frappe._dict({
+			"contact_date": frappe.conn.get_value("Lead", self.doc.name, "contact_date") if \
 				(not cint(self.doc.fields.get("__islocal"))) else None,
-			"contact_by": webnotes.conn.get_value("Lead", self.doc.name, "contact_by") if \
+			"contact_by": frappe.conn.get_value("Lead", self.doc.name, "contact_by") if \
 				(not cint(self.doc.fields.get("__islocal"))) else None,
 		})
 
 	def onload(self):
-		customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
+		customer = frappe.conn.get_value("Customer", {"lead_name": self.doc.name})
 		if customer:
 			self.doc.fields["__is_customer"] = customer
 	
@@ -31,11 +31,11 @@
 		self.set_status()
 		
 		if self.doc.source == 'Campaign' and not self.doc.campaign_name and session['user'] != 'Guest':
-			webnotes.throw("Please specify campaign name")
+			frappe.throw("Please specify campaign name")
 		
 		if self.doc.email_id:
 			if not validate_email_add(self.doc.email_id):
-				webnotes.throw('Please enter valid email id.')
+				frappe.throw('Please enter valid email id.')
 				
 	def on_update(self):
 		self.check_email_id_is_unique()
@@ -53,32 +53,32 @@
 	def check_email_id_is_unique(self):
 		if self.doc.email_id:
 			# validate email is unique
-			email_list = webnotes.conn.sql("""select name from tabLead where email_id=%s""", 
+			email_list = frappe.conn.sql("""select name from tabLead where email_id=%s""", 
 				self.doc.email_id)
 			if len(email_list) > 1:
 				items = [e[0] for e in email_list if e[0]!=self.doc.name]
-				webnotes.msgprint(_("""Email Id must be unique, already exists for: """) + \
+				frappe.msgprint(_("""Email Id must be unique, already exists for: """) + \
 					", ".join(items), raise_exception=True)
 
 	def on_trash(self):
-		webnotes.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""",
+		frappe.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""",
 			self.doc.name)
 		
 		self.delete_events()
 		
 	def has_customer(self):
-		return webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
+		return frappe.conn.get_value("Customer", {"lead_name": self.doc.name})
 		
 	def has_opportunity(self):
-		return webnotes.conn.get_value("Opportunity", {"lead": self.doc.name, "docstatus": 1,
+		return frappe.conn.get_value("Opportunity", {"lead": self.doc.name, "docstatus": 1,
 			"status": ["!=", "Lost"]})
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_customer(source_name, target_doclist=None):
 	return _make_customer(source_name, target_doclist)
 
 def _make_customer(source_name, target_doclist=None, ignore_permissions=False):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
 		if source.doc.company_name:
@@ -88,7 +88,7 @@
 			target[0].customer_type = "Individual"
 			target[0].customer_name = source.doc.lead_name
 			
-		target[0].customer_group = webnotes.conn.get_default("customer_group")
+		target[0].customer_group = frappe.conn.get_default("customer_group")
 			
 	doclist = get_mapped_doclist("Lead", source_name, 
 		{"Lead": {
@@ -103,9 +103,9 @@
 		
 	return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_opportunity(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 		
 	doclist = get_mapped_doclist("Lead", source_name, 
 		{"Lead": {
diff --git a/erpnext/selling/doctype/lead/test_lead.py b/erpnext/selling/doctype/lead/test_lead.py
index d3f6f03..3589939 100644
--- a/erpnext/selling/doctype/lead/test_lead.py
+++ b/erpnext/selling/doctype/lead/test_lead.py
@@ -14,7 +14,7 @@
 		"email_id":"test_lead3@example.com"}],
 ]
 
-import webnotes
+import frappe
 import unittest
 
 class TestLead(unittest.TestCase):
@@ -26,5 +26,5 @@
 		self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
 		
 		customer[0].customer_group = "_Test Customer Group"
-		webnotes.bean(customer).insert()
+		frappe.bean(customer).insert()
 		
\ No newline at end of file
diff --git a/erpnext/selling/doctype/opportunity/opportunity.js b/erpnext/selling/doctype/opportunity/opportunity.js
index 3de7f1e..2828932 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.js
+++ b/erpnext/selling/doctype/opportunity/opportunity.js
@@ -3,15 +3,15 @@
 
 {% include 'utilities/doctype/sms_control/sms_control.js' %};
 
-wn.ui.form.on_change("Opportunity", "customer", function(frm) { 
+frappe.ui.form.on_change("Opportunity", "customer", function(frm) { 
 	erpnext.utils.get_party_details(frm) });
-wn.ui.form.on_change("Opportunity", "customer_address", erpnext.utils.get_address_display);
-wn.ui.form.on_change("Opportunity", "contact_person", erpnext.utils.get_contact_details);	
+frappe.ui.form.on_change("Opportunity", "customer_address", erpnext.utils.get_address_display);
+frappe.ui.form.on_change("Opportunity", "contact_person", erpnext.utils.get_contact_details);	
 
 
-wn.provide("erpnext.selling");
+frappe.provide("erpnext.selling");
 // TODO commonify this code
-erpnext.selling.Opportunity = wn.ui.form.Controller.extend({
+erpnext.selling.Opportunity = frappe.ui.form.Controller.extend({
 	onload: function() {
 		if(!this.frm.doc.enquiry_from && this.frm.doc.customer)
 			this.frm.doc.enquiry_from = "Customer";
@@ -22,15 +22,15 @@
 			set_multiple(cdt, cdn, { status:'Draft' });
 		if(!this.frm.doc.date) 
 			this.frm.doc.transaction_date = date.obj_to_str(new Date());
-		if(!this.frm.doc.company && wn.defaults.get_default("company")) 
-			set_multiple(cdt, cdn, { company:wn.defaults.get_default("company") });
+		if(!this.frm.doc.company && frappe.defaults.get_default("company")) 
+			set_multiple(cdt, cdn, { company:frappe.defaults.get_default("company") });
 		if(!this.frm.doc.fiscal_year && sys_defaults.fiscal_year)
 			set_multiple(cdt, cdn, { fiscal_year:sys_defaults.fiscal_year });
 	
 
 		if(!this.frm.doc.__islocal) {
-			cur_frm.communication_view = new wn.views.CommunicationList({
-				list: wn.model.get("Communication", {"opportunity": this.frm.doc.name}),
+			cur_frm.communication_view = new frappe.views.CommunicationList({
+				list: frappe.model.get("Communication", {"opportunity": this.frm.doc.name}),
 				parent: cur_frm.fields_dict.communication_html.wrapper,
 				doc: this.frm.doc,
 				recipients: this.frm.doc.contact_email
@@ -71,7 +71,7 @@
 	},
 		
 	create_quotation: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.opportunity.opportunity.make_quotation",
 			source_name: cur_frm.doc.name
 		})
@@ -85,11 +85,11 @@
 	cur_frm.clear_custom_buttons();
 	
 	if(doc.docstatus === 1 && doc.status!=="Lost") {
-		cur_frm.add_custom_button(wn._('Create Quotation'), cur_frm.cscript.create_quotation);
+		cur_frm.add_custom_button(frappe._('Create Quotation'), cur_frm.cscript.create_quotation);
 		if(doc.status!=="Quotation")
-			cur_frm.add_custom_button(wn._('Opportunity Lost'), cur_frm.cscript['Declare Opportunity Lost']);
+			cur_frm.add_custom_button(frappe._('Opportunity Lost'), cur_frm.cscript['Declare Opportunity Lost']);
 
-		cur_frm.add_custom_button(wn._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
+		cur_frm.add_custom_button(frappe._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
 	}	
 }
 
@@ -108,19 +108,19 @@
 
 cur_frm.cscript.lead = function(doc, cdt, cdn) {
 	cur_frm.toggle_display("contact_info", doc.customer || doc.lead);
-	wn.model.map_current_doc({
+	frappe.model.map_current_doc({
 		method: "erpnext.selling.doctype.lead.lead.make_opportunity",
 		source_name: cur_frm.doc.lead
 	});
 }
 
 cur_frm.cscript['Declare Opportunity Lost'] = function() {
-	var dialog = new wn.ui.Dialog({
-		title: wn._("Set as Lost"),
+	var dialog = new frappe.ui.Dialog({
+		title: frappe._("Set as Lost"),
 		fields: [
-			{"fieldtype": "Text", "label": wn._("Reason for losing"), "fieldname": "reason",
+			{"fieldtype": "Text", "label": frappe._("Reason for losing"), "fieldname": "reason",
 				"reqd": 1 },
-			{"fieldtype": "Button", "label": wn._("Update"), "fieldname": "update"},
+			{"fieldtype": "Button", "label": frappe._("Update"), "fieldname": "update"},
 		]
 	});
 
@@ -133,7 +133,7 @@
 			args: args.reason,
 			callback: function(r) {
 				if(r.exc) {
-					msgprint(wn._("There were errors."));
+					msgprint(frappe._("There were errors."));
 					return;
 				}
 				dialog.hide();
diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py
index 00a447f..39a06ff 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.py
+++ b/erpnext/selling/doctype/opportunity/opportunity.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, cint
-from webnotes.model.bean import getlist
-from webnotes import msgprint, _
+from frappe.utils import cstr, cint
+from frappe.model.bean import getlist
+from frappe import msgprint, _
 
 	
 from erpnext.utilities.transaction_base import TransactionBase
@@ -18,15 +18,15 @@
 		self.fname = 'enq_details'
 		self.tname = 'Opportunity Item'
 		
-		self._prev = webnotes._dict({
-			"contact_date": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_date") if \
+		self._prev = frappe._dict({
+			"contact_date": frappe.conn.get_value("Opportunity", self.doc.name, "contact_date") if \
 				(not cint(self.doc.fields.get("__islocal"))) else None,
-			"contact_by": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_by") if \
+			"contact_by": frappe.conn.get_value("Opportunity", self.doc.name, "contact_by") if \
 				(not cint(self.doc.fields.get("__islocal"))) else None,
 		})
 		
 	def get_item_details(self, item_code):
-		item = webnotes.conn.sql("""select item_name, stock_uom, description_html, description, item_group, brand
+		item = frappe.conn.sql("""select item_name, stock_uom, description_html, description, item_group, brand
 			from `tabItem` where name = %s""", item_code, as_dict=1)
 		ret = {
 			'item_name': item and item[0]['item_name'] or '',
@@ -38,7 +38,7 @@
 		return ret
 
 	def get_cust_address(self,name):
-		details = webnotes.conn.sql("select customer_name, address, territory, customer_group from `tabCustomer` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
+		details = frappe.conn.sql("select customer_name, address, territory, customer_group from `tabCustomer` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
 		if details:
 			ret = {
 				'customer_name':	details and details[0]['customer_name'] or '',
@@ -48,7 +48,7 @@
 			}
 			# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
 
-			contact_det = webnotes.conn.sql("select contact_name, contact_no, email_id from `tabContact` where customer = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
+			contact_det = frappe.conn.sql("select contact_name, contact_no, email_id from `tabContact` where customer = '%s' and is_customer = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
 
 			ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
 			ret['contact_no']		 = contact_det and contact_det[0]['contact_no'] or ''
@@ -64,7 +64,7 @@
 
 	def add_calendar_event(self, opts=None, force=False):
 		if not opts:
-			opts = webnotes._dict()
+			opts = frappe._dict()
 		
 		opts.description = ""
 		
@@ -109,32 +109,32 @@
 
 	def on_submit(self):
 		if self.doc.lead:
-			webnotes.bean("Lead", self.doc.lead).get_controller().set_status(update=True)
+			frappe.bean("Lead", self.doc.lead).get_controller().set_status(update=True)
 	
 	def on_cancel(self):
 		if self.has_quotation():
-			webnotes.throw(_("Cannot Cancel Opportunity as Quotation Exists"))
+			frappe.throw(_("Cannot Cancel Opportunity as Quotation Exists"))
 		self.set_status(update=True)
 		
 	def declare_enquiry_lost(self,arg):
 		if not self.has_quotation():
-			webnotes.conn.set(self.doc, 'status', 'Lost')
-			webnotes.conn.set(self.doc, 'order_lost_reason', arg)
+			frappe.conn.set(self.doc, 'status', 'Lost')
+			frappe.conn.set(self.doc, 'order_lost_reason', arg)
 		else:
-			webnotes.throw(_("Cannot declare as lost, because Quotation has been made."))
+			frappe.throw(_("Cannot declare as lost, because Quotation has been made."))
 
 	def on_trash(self):
 		self.delete_events()
 		
 	def has_quotation(self):
-		return webnotes.conn.get_value("Quotation Item", {"prevdoc_docname": self.doc.name, "docstatus": 1})
+		return frappe.conn.get_value("Quotation Item", {"prevdoc_docname": self.doc.name, "docstatus": 1})
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_quotation(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
-		quotation = webnotes.bean(target)
+		quotation = frappe.bean(target)
 		quotation.run_method("onload_post_render")
 		quotation.run_method("calculate_taxes_and_totals")
 	
diff --git a/erpnext/selling/doctype/opportunity_item/opportunity_item.py b/erpnext/selling/doctype/opportunity_item/opportunity_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/selling/doctype/opportunity_item/opportunity_item.py
+++ b/erpnext/selling/doctype/opportunity_item/opportunity_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index e04a68e..75a6312 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -35,19 +35,19 @@
 		this._super(doc, dt, dn);
 		
 		if(doc.docstatus == 1 && doc.status!=='Lost') {
-			cur_frm.add_custom_button(wn._('Make Sales Order'), 
+			cur_frm.add_custom_button(frappe._('Make Sales Order'), 
 				cur_frm.cscript['Make Sales Order']);
 			if(doc.status!=="Ordered") {
-				cur_frm.add_custom_button(wn._('Set as Lost'), 
+				cur_frm.add_custom_button(frappe._('Set as Lost'), 
 					cur_frm.cscript['Declare Order Lost'], "icon-exclamation");
 			}
-			cur_frm.appframe.add_button(wn._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
+			cur_frm.appframe.add_button(frappe._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
 		}
 		
 		if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Opportunity'), 
+			cur_frm.add_custom_button(frappe._('From Opportunity'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.selling.doctype.opportunity.opportunity.make_quotation",
 						source_doctype: "Opportunity",
 						get_query_filters: {
@@ -63,8 +63,8 @@
 		}
 
 		if (!doc.__islocal) {
-			cur_frm.communication_view = new wn.views.CommunicationList({
-				list: wn.model.get("Communication", {"parent": doc.name, "parenttype": "Quotation"}),
+			cur_frm.communication_view = new frappe.views.CommunicationList({
+				list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Quotation"}),
 				parent: cur_frm.fields_dict.communication_html.wrapper,
 				doc: doc,
 				recipients: doc.contact_email
@@ -91,8 +91,8 @@
 	
 	validate_company_and_party: function(party_field) {
 		if(!this.frm.doc.quotation_to) {
-			msgprint(wn._("Please select a value for" + " " + 
-				wn.meta.get_label(this.frm.doc.doctype, "quotation_to", this.frm.doc.name)));
+			msgprint(frappe._("Please select a value for" + " " + 
+				frappe.meta.get_label(this.frm.doc.doctype, "quotation_to", this.frm.doc.name)));
 			return false;
 		} else if (this.frm.doc.quotation_to == "Lead") {
 			return true;
@@ -127,7 +127,7 @@
 // Make Sales Order
 // =====================================================================================
 cur_frm.cscript['Make Sales Order'] = function() {
-	wn.model.open_mapped_doc({
+	frappe.model.open_mapped_doc({
 		method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
 		source_name: cur_frm.doc.name
 	})
@@ -136,12 +136,12 @@
 // declare order lost
 //-------------------------
 cur_frm.cscript['Declare Order Lost'] = function(){
-	var dialog = new wn.ui.Dialog({
+	var dialog = new frappe.ui.Dialog({
 		title: "Set as Lost",
 		fields: [
-			{"fieldtype": "Text", "label": wn._("Reason for losing"), "fieldname": "reason",
+			{"fieldtype": "Text", "label": frappe._("Reason for losing"), "fieldname": "reason",
 				"reqd": 1 },
-			{"fieldtype": "Button", "label": wn._("Update"), "fieldname": "update"},
+			{"fieldtype": "Button", "label": frappe._("Update"), "fieldname": "update"},
 		]
 	});
 
@@ -154,7 +154,7 @@
 			args: args.reason,
 			callback: function(r) {
 				if(r.exc) {
-					msgprint(wn._("There were errors."));
+					msgprint(frappe._("There were errors."));
 					return;
 				}
 				dialog.hide();
@@ -168,6 +168,6 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings.quotation))
-		cur_frm.email_doc(wn.boot.notification_settings.quotation_message);
+	if(cint(frappe.boot.notification_settings.quotation))
+		cur_frm.email_doc(frappe.boot.notification_settings.quotation_message);
 }
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index ba571ae..eb135f6 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import _, msgprint
+import frappe
+from frappe.utils import cstr
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import _, msgprint
 
 from erpnext.controllers.selling_controller import SellingController
 
@@ -18,7 +18,7 @@
 		self.fname = 'quotation_details'
 
 	def has_sales_order(self):
-		return webnotes.conn.get_value("Sales Order Item", {"prevdoc_docname": self.doc.name, "docstatus": 1})
+		return frappe.conn.get_value("Sales Order Item", {"prevdoc_docname": self.doc.name, "docstatus": 1})
 
 	def validate_for_items(self):
 		chk_dupl_itm = []
@@ -34,7 +34,7 @@
 		
 		if self.doc.order_type in ['Maintenance', 'Service']:
 			for d in getlist(self.doclist, 'quotation_details'):
-				is_service_item = webnotes.conn.sql("select is_service_item from `tabItem` where name=%s", d.item_code)
+				is_service_item = frappe.conn.sql("select is_service_item from `tabItem` where name=%s", d.item_code)
 				is_service_item = is_service_item and is_service_item[0][0] or 'No'
 				
 				if is_service_item == 'No':
@@ -42,7 +42,7 @@
 					raise Exception
 		else:
 			for d in getlist(self.doclist, 'quotation_details'):
-				is_sales_item = webnotes.conn.sql("select is_sales_item from `tabItem` where name=%s", d.item_code)
+				is_sales_item = frappe.conn.sql("select is_sales_item from `tabItem` where name=%s", d.item_code)
 				is_sales_item = is_sales_item and is_sales_item[0][0] or 'No'
 				
 				if is_sales_item == 'No':
@@ -58,15 +58,15 @@
 
 	def update_opportunity(self):
 		for opportunity in self.doclist.get_distinct_values("prevdoc_docname"):
-			webnotes.bean("Opportunity", opportunity).get_controller().set_status(update=True)
+			frappe.bean("Opportunity", opportunity).get_controller().set_status(update=True)
 	
 	def declare_order_lost(self, arg):
 		if not self.has_sales_order():
-			webnotes.conn.set(self.doc, 'status', 'Lost')
-			webnotes.conn.set(self.doc, 'order_lost_reason', arg)
+			frappe.conn.set(self.doc, 'status', 'Lost')
+			frappe.conn.set(self.doc, 'order_lost_reason', arg)
 			self.update_opportunity()
 		else:
-			webnotes.throw(_("Cannot set as Lost as Sales Order is made."))
+			frappe.throw(_("Cannot set as Lost as Sales Order is made."))
 	
 	def check_item_table(self):
 		if not getlist(self.doclist, 'quotation_details'):
@@ -97,12 +97,12 @@
 		return print_lst
 		
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_sales_order(source_name, target_doclist=None):
 	return _make_sales_order(source_name, target_doclist)
 	
 def _make_sales_order(source_name, target_doclist=None, ignore_permissions=False):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	customer = _make_customer(source_name, ignore_permissions)
 	
@@ -111,7 +111,7 @@
 			target[0].customer = customer.doc.name
 			target[0].customer_name = customer.doc.customer_name
 			
-		si = webnotes.bean(target)
+		si = frappe.bean(target)
 		si.run_method("onload_post_render")
 			
 	doclist = get_mapped_doclist("Quotation", source_name, {
@@ -142,31 +142,31 @@
 	return [d.fields for d in doclist]
 
 def _make_customer(source_name, ignore_permissions=False):
-	quotation = webnotes.conn.get_value("Quotation", source_name, ["lead", "order_type"])
+	quotation = frappe.conn.get_value("Quotation", source_name, ["lead", "order_type"])
 	if quotation and quotation[0]:
 		lead_name = quotation[0]
-		customer_name = webnotes.conn.get_value("Customer", {"lead_name": lead_name})
+		customer_name = frappe.conn.get_value("Customer", {"lead_name": lead_name})
 		if not customer_name:
 			from erpnext.selling.doctype.lead.lead import _make_customer
 			customer_doclist = _make_customer(lead_name, ignore_permissions=ignore_permissions)
-			customer = webnotes.bean(customer_doclist)
+			customer = frappe.bean(customer_doclist)
 			customer.ignore_permissions = ignore_permissions
 			if quotation[1] == "Shopping Cart":
-				customer.doc.customer_group = webnotes.conn.get_value("Shopping Cart Settings", None,
+				customer.doc.customer_group = frappe.conn.get_value("Shopping Cart Settings", None,
 					"default_customer_group")
 			
 			try:
 				customer.insert()
 				return customer
 			except NameError, e:
-				if webnotes.defaults.get_global_default('cust_master_name') == "Customer Name":
+				if frappe.defaults.get_global_default('cust_master_name') == "Customer Name":
 					customer.run_method("autoname")
 					customer.doc.name += "-" + lead_name
 					customer.insert()
 					return customer
 				else:
 					raise
-			except webnotes.MandatoryError:
-				from webnotes.utils import get_url_to_form
-				webnotes.throw(_("Before proceeding, please create Customer from Lead") + \
+			except frappe.MandatoryError:
+				from frappe.utils import get_url_to_form
+				frappe.throw(_("Before proceeding, please create Customer from Lead") + \
 					(" - %s" % get_url_to_form("Lead", lead_name)))
diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py
index 5bdc4d5..9bc75d6 100644
--- a/erpnext/selling/doctype/quotation/test_quotation.py
+++ b/erpnext/selling/doctype/quotation/test_quotation.py
@@ -1,8 +1,8 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes, json
-from webnotes.utils import flt
+import frappe, json
+from frappe.utils import flt
 import unittest
 
 test_dependencies = ["Sales BOM"]
@@ -11,10 +11,10 @@
 	def test_make_sales_order(self):
 		from erpnext.selling.doctype.quotation.quotation import make_sales_order
 		
-		quotation = webnotes.bean(copy=test_records[0])
+		quotation = frappe.bean(copy=test_records[0])
 		quotation.insert()
 		
-		self.assertRaises(webnotes.ValidationError, make_sales_order, quotation.doc.name)
+		self.assertRaises(frappe.ValidationError, make_sales_order, quotation.doc.name)
 		
 		quotation.submit()
 
@@ -29,7 +29,7 @@
 		sales_order[0]["delivery_date"] = "2014-01-01"
 		sales_order[0]["naming_series"] = "_T-Quotation-"
 		sales_order[0]["transaction_date"] = "2013-05-12"
-		webnotes.bean(sales_order).insert()
+		frappe.bean(sales_order).insert()
 
 
 test_records = [
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.py b/erpnext/selling/doctype/quotation_item/quotation_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.py
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/sales_bom/sales_bom.js b/erpnext/selling/doctype/sales_bom/sales_bom.js
index e6e1bb4..0033d00 100644
--- a/erpnext/selling/doctype/sales_bom/sales_bom.js
+++ b/erpnext/selling/doctype/sales_bom/sales_bom.js
@@ -4,7 +4,7 @@
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
 	cur_frm.toggle_enable('new_item_code', doc.__islocal);
 	if(!doc.__islocal) {
-		cur_frm.add_custom_button(wn._("Check for Duplicates"), function() {
+		cur_frm.add_custom_button(frappe._("Check for Duplicates"), function() {
 			return cur_frm.call_server('check_duplicate', 1)			
 		}, 'icon-search')
 	}
@@ -15,8 +15,8 @@
 		query: "selling.doctype.sales_bom.sales_bom.get_new_item_code"
 	}
 }
-cur_frm.fields_dict.new_item_code.query_description = wn._('Select Item where "Is Stock Item" is "No"')+ 
-wn._('and "Is Sales Item" is "Yes" and there is no other Sales BOM');
+cur_frm.fields_dict.new_item_code.query_description = frappe._('Select Item where "Is Stock Item" is "No"')+ 
+frappe._('and "Is Sales Item" is "Yes" and there is no other Sales BOM');
 
 cur_frm.cscript.item_code = function(doc, dt, dn) {
 	var d = locals[dt][dn];
diff --git a/erpnext/selling/doctype/sales_bom/sales_bom.py b/erpnext/selling/doctype/sales_bom/sales_bom.py
index 2f47be3..a74c064 100644
--- a/erpnext/selling/doctype/sales_bom/sales_bom.py
+++ b/erpnext/selling/doctype/sales_bom/sales_bom.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self,d,dl):
@@ -19,13 +19,13 @@
 
 	def validate_main_item(self):
 		"""main item must have Is Stock Item as No and Is Sales Item as Yes"""
-		if not webnotes.conn.sql("""select name from tabItem where name=%s and
+		if not frappe.conn.sql("""select name from tabItem where name=%s and
 			ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'""", self.doc.new_item_code):
-			webnotes.msgprint("""Parent Item %s is either a Stock Item or a not a Sales Item""",
+			frappe.msgprint("""Parent Item %s is either a Stock Item or a not a Sales Item""",
 				raise_exception=1)
 
 	def get_item_details(self, name):
-		det = webnotes.conn.sql("""select description, stock_uom from `tabItem` 
+		det = frappe.conn.sql("""select description, stock_uom from `tabItem` 
 			where name = %s""", name)
 		return {
 			'description' : det and det[0][0] or '', 
@@ -35,7 +35,7 @@
 def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
 	from erpnext.controllers.queries import get_match_cond
 	
-	return webnotes.conn.sql("""select name, item_name, description from tabItem 
+	return frappe.conn.sql("""select name, item_name, description from tabItem 
 		where is_stock_item="No" and is_sales_item="Yes"
 		and name not in (select name from `tabSales BOM`) and %s like %s
 		%s limit %s, %s""" % (searchfield, "%s", 
diff --git a/erpnext/selling/doctype/sales_bom_item/sales_bom_item.py b/erpnext/selling/doctype/sales_bom_item/sales_bom_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/selling/doctype/sales_bom_item/sales_bom_item.py
+++ b/erpnext/selling/doctype/sales_bom_item/sales_bom_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 1402049..0a3ca99 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -21,46 +21,46 @@
 		if(doc.docstatus==1) {
 			if(doc.status != 'Stopped') {
 				
-				cur_frm.dashboard.add_progress(cint(doc.per_delivered) + wn._("% Delivered"), 
+				cur_frm.dashboard.add_progress(cint(doc.per_delivered) + frappe._("% Delivered"), 
 					doc.per_delivered);
-				cur_frm.dashboard.add_progress(cint(doc.per_billed) + wn._("% Billed"), 
+				cur_frm.dashboard.add_progress(cint(doc.per_billed) + frappe._("% Billed"), 
 					doc.per_billed);
 
-				cur_frm.add_custom_button(wn._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
+				cur_frm.add_custom_button(frappe._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
 				// delivery note
 				if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales')
-					cur_frm.add_custom_button(wn._('Make Delivery'), this.make_delivery_note);
+					cur_frm.add_custom_button(frappe._('Make Delivery'), this.make_delivery_note);
 			
 				// maintenance
 				if(flt(doc.per_delivered, 2) < 100 && (doc.order_type !='Sales')) {
-					cur_frm.add_custom_button(wn._('Make Maint. Visit'), this.make_maintenance_visit);
-					cur_frm.add_custom_button(wn._('Make Maint. Schedule'), 
+					cur_frm.add_custom_button(frappe._('Make Maint. Visit'), this.make_maintenance_visit);
+					cur_frm.add_custom_button(frappe._('Make Maint. Schedule'), 
 						this.make_maintenance_schedule);
 				}
 
 				// indent
 				if(!doc.order_type || (doc.order_type == 'Sales'))
-					cur_frm.add_custom_button(wn._('Make ') + wn._('Material Request'), 
+					cur_frm.add_custom_button(frappe._('Make ') + frappe._('Material Request'), 
 						this.make_material_request);
 			
 				// sales invoice
 				if(flt(doc.per_billed, 2) < 100)
-					cur_frm.add_custom_button(wn._('Make Invoice'), this.make_sales_invoice);
+					cur_frm.add_custom_button(frappe._('Make Invoice'), this.make_sales_invoice);
 			
 				// stop
 				if(flt(doc.per_delivered, 2) < 100 || doc.per_billed < 100)
-					cur_frm.add_custom_button(wn._('Stop!'), cur_frm.cscript['Stop Sales Order'],"icon-exclamation");
+					cur_frm.add_custom_button(frappe._('Stop!'), cur_frm.cscript['Stop Sales Order'],"icon-exclamation");
 			} else {	
 				// un-stop
-				cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop");
-				cur_frm.add_custom_button(wn._('Unstop'), cur_frm.cscript['Unstop Sales Order'], "icon-check");
+				cur_frm.dashboard.set_headline_alert(frappe._("Stopped"), "alert-danger", "icon-stop");
+				cur_frm.add_custom_button(frappe._('Unstop'), cur_frm.cscript['Unstop Sales Order'], "icon-check");
 			}
 		}
 
 		if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Quotation'), 
+			cur_frm.add_custom_button(frappe._('From Quotation'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.selling.doctype.quotation.quotation.make_sales_order",
 						source_doctype: "Quotation",
 						get_query_filters: {
@@ -86,7 +86,7 @@
 	},
 	
 	warehouse: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(item.item_code && item.warehouse) {
 			return this.frm.call({
 				method: "erpnext.selling.utils.get_available_qty",
@@ -100,35 +100,35 @@
 	},
 
 	make_material_request: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request",
 			source_name: cur_frm.doc.name
 		})
 	},
 
 	make_delivery_note: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note",
 			source_name: cur_frm.doc.name
 		})
 	},
 
 	make_sales_invoice: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice",
 			source_name: cur_frm.doc.name
 		})
 	},
 	
 	make_maintenance_schedule: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
 			source_name: cur_frm.doc.name
 		})
 	}, 
 	
 	make_maintenance_visit: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
 			source_name: cur_frm.doc.name
 		})
@@ -139,7 +139,7 @@
 $.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
 
 cur_frm.cscript.new_contact = function(){
-	tn = wn.model.make_new_doc_and_get_name('Contact');
+	tn = frappe.model.make_new_doc_and_get_name('Contact');
 	locals['Contact'][tn].is_customer = 1;
 	if(doc.customer) locals['Contact'][tn].customer = doc.customer;
 	loaddoc('Contact', tn);
@@ -157,12 +157,12 @@
 cur_frm.cscript['Stop Sales Order'] = function() {
 	var doc = cur_frm.doc;
 
-	var check = confirm(wn._("Are you sure you want to STOP ") + doc.name);
+	var check = confirm(frappe._("Are you sure you want to STOP ") + doc.name);
 
 	if (check) {
 		return $c('runserverobj', {
 			'method':'stop_sales_order', 
-			'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
+			'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))
 			}, function(r,rt) {
 			cur_frm.refresh();
 		});
@@ -172,12 +172,12 @@
 cur_frm.cscript['Unstop Sales Order'] = function() {
 	var doc = cur_frm.doc;
 
-	var check = confirm(wn._("Are you sure you want to UNSTOP ") + doc.name);
+	var check = confirm(frappe._("Are you sure you want to UNSTOP ") + doc.name);
 
 	if (check) {
 		return $c('runserverobj', {
 			'method':'unstop_sales_order', 
-			'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))
+			'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))
 		}, function(r,rt) {
 			cur_frm.refresh();
 		});
@@ -185,7 +185,7 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings.sales_order)) {
-		cur_frm.email_doc(wn.boot.notification_settings.sales_order_message);
+	if(cint(frappe.boot.notification_settings.sales_order)) {
+		cur_frm.email_doc(frappe.boot.notification_settings.sales_order_message);
 	}
 };
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 2b61dd7..5878c0c 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -2,14 +2,14 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.utils
+import frappe
+import frappe.utils
 
-from webnotes.utils import cstr, flt, getdate
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint
-from webnotes.model.mapper import get_mapped_doclist
+from frappe.utils import cstr, flt, getdate
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint
+from frappe.model.mapper import get_mapped_doclist
 
 from erpnext.controllers.selling_controller import SellingController
 
@@ -38,7 +38,7 @@
 			raise Exception	
 		
 		if self.doc.po_no and self.doc.customer:
-			so = webnotes.conn.sql("select name from `tabSales Order` \
+			so = frappe.conn.sql("select name from `tabSales Order` \
 				where ifnull(po_no, '') = %s and name != %s and docstatus < 2\
 				and customer = %s", (self.doc.po_no, self.doc.name, self.doc.customer))
 			if so and so[0][0]:
@@ -52,7 +52,7 @@
 			e = [d.item_code, d.description, d.warehouse, d.prevdoc_docname or '']
 			f = [d.item_code, d.description]
 
-			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
+			if frappe.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
 				if not d.warehouse:
 					msgprint("""Please enter Reserved Warehouse for item %s 
 						as it is stock Item""" % d.item_code, raise_exception=1)
@@ -70,14 +70,14 @@
 			# used for production plan
 			d.transaction_date = self.doc.transaction_date
 			
-			tot_avail_qty = webnotes.conn.sql("select projected_qty from `tabBin` \
+			tot_avail_qty = frappe.conn.sql("select projected_qty from `tabBin` \
 				where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.warehouse))
 			d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
 
 	def validate_sales_mntc_quotation(self):
 		for d in getlist(self.doclist, 'sales_order_details'):
 			if d.prevdoc_docname:
-				res = webnotes.conn.sql("select name from `tabQuotation` where name=%s and order_type = %s", (d.prevdoc_docname, self.doc.order_type))
+				res = frappe.conn.sql("select name from `tabQuotation` where name=%s and order_type = %s", (d.prevdoc_docname, self.doc.order_type))
 				if not res:
 					msgprint("""Order Type (%s) should be same in Quotation: %s \
 						and current Sales Order""" % (self.doc.order_type, d.prevdoc_docname))
@@ -94,7 +94,7 @@
 
 	def validate_proj_cust(self):
 		if self.doc.project_name and self.doc.customer_name:
-			res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+			res = frappe.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
 			if not res:
 				msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
 				raise Exception
@@ -146,15 +146,15 @@
 
 		
 	def update_enquiry_status(self, prevdoc, flag):
-		enq = webnotes.conn.sql("select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.name=%s", prevdoc)
+		enq = frappe.conn.sql("select t2.prevdoc_docname from `tabQuotation` t1, `tabQuotation Item` t2 where t2.parent = t1.name and t1.name=%s", prevdoc)
 		if enq:
-			webnotes.conn.sql("update `tabOpportunity` set status = %s where name=%s",(flag,enq[0][0]))
+			frappe.conn.sql("update `tabOpportunity` set status = %s where name=%s",(flag,enq[0][0]))
 
 	def update_prevdoc_status(self, flag):				
 		for quotation in self.doclist.get_distinct_values("prevdoc_docname"):
-			bean = webnotes.bean("Quotation", quotation)
+			bean = frappe.bean("Quotation", quotation)
 			if bean.doc.docstatus==2:
-				webnotes.throw(quotation + ": " + webnotes._("Quotation is cancelled."))
+				frappe.throw(quotation + ": " + frappe._("Quotation is cancelled."))
 				
 			bean.get_controller().set_status(update=True)
 
@@ -166,7 +166,7 @@
 		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.grand_total, self)
 		
 		self.update_prevdoc_status('submit')
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 	
 	def on_cancel(self):
 		# Cannot cancel stopped SO
@@ -178,39 +178,39 @@
 		
 		self.update_prevdoc_status('cancel')
 		
-		webnotes.conn.set(self.doc, 'status', 'Cancelled')
+		frappe.conn.set(self.doc, 'status', 'Cancelled')
 		
 	def check_nextdoc_docstatus(self):
 		# Checks Delivery Note
-		submit_dn = webnotes.conn.sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.against_sales_order = %s and t1.docstatus = 1", self.doc.name)
+		submit_dn = frappe.conn.sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.against_sales_order = %s and t1.docstatus = 1", self.doc.name)
 		if submit_dn:
 			msgprint("Delivery Note : " + cstr(submit_dn[0][0]) + " has been submitted against " + cstr(self.doc.doctype) + ". Please cancel Delivery Note : " + cstr(submit_dn[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
 			
 		# Checks Sales Invoice
-		submit_rv = webnotes.conn.sql("select t1.name from `tabSales Invoice` t1,`tabSales Invoice Item` t2 where t1.name = t2.parent and t2.sales_order = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_rv = frappe.conn.sql("select t1.name from `tabSales Invoice` t1,`tabSales Invoice Item` t2 where t1.name = t2.parent and t2.sales_order = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_rv:
 			msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Sales Invoice : "+ cstr(submit_rv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
 			
 		#check maintenance schedule
-		submit_ms = webnotes.conn.sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
+		submit_ms = frappe.conn.sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
 		if submit_ms:
 			msgprint("Maintenance Schedule : " + cstr(submit_ms[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Schedule : "+ cstr(submit_ms[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
 			
 		# check maintenance visit
-		submit_mv = webnotes.conn.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
+		submit_mv = frappe.conn.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname = %s and t1.docstatus = 1",self.doc.name)
 		if submit_mv:
 			msgprint("Maintenance Visit : " + cstr(submit_mv[0][0]) + " has already been submitted against " +cstr(self.doc.doctype)+ ". Please cancel Maintenance Visit : " + cstr(submit_mv[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
 		
 		# check production order
-		pro_order = webnotes.conn.sql("""select name from `tabProduction Order` where sales_order = %s and docstatus = 1""", self.doc.name)
+		pro_order = frappe.conn.sql("""select name from `tabProduction Order` where sales_order = %s and docstatus = 1""", self.doc.name)
 		if pro_order:
 			msgprint("""Production Order: %s exists against this sales order. 
 				Please cancel production order first and then cancel this sales order""" % 
 				pro_order[0][0], raise_exception=1)
 
 	def check_modified_date(self):
-		mod_db = webnotes.conn.sql("select modified from `tabSales Order` where name = '%s'" % self.doc.name)
-		date_diff = webnotes.conn.sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
+		mod_db = frappe.conn.sql("select modified from `tabSales Order` where name = '%s'" % self.doc.name)
+		date_diff = frappe.conn.sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
 		if date_diff and date_diff[0][0]:
 			msgprint("%s: %s has been modified after you have opened. Please Refresh"
 				% (self.doc.doctype, self.doc.name), raise_exception=1)
@@ -218,21 +218,21 @@
 	def stop_sales_order(self):
 		self.check_modified_date()
 		self.update_stock_ledger(-1)
-		webnotes.conn.set(self.doc, 'status', 'Stopped')
+		frappe.conn.set(self.doc, 'status', 'Stopped')
 		msgprint("""%s: %s has been Stopped. To make transactions against this Sales Order 
 			you need to Unstop it.""" % (self.doc.doctype, self.doc.name))
 
 	def unstop_sales_order(self):
 		self.check_modified_date()
 		self.update_stock_ledger(1)
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 		msgprint("%s: %s has been Unstopped" % (self.doc.doctype, self.doc.name))
 
 
 	def update_stock_ledger(self, update_stock):
 		from erpnext.stock.utils import update_bin
 		for d in self.get_item_list():
-			if webnotes.conn.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
+			if frappe.conn.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
 				args = {
 					"item_code": d['item_code'],
 					"warehouse": d['reserved_warehouse'], 
@@ -251,10 +251,10 @@
 		return "order" if self.doc.docstatus==1 else None
 		
 def set_missing_values(source, target):
-	bean = webnotes.bean(target)
+	bean = frappe.bean(target)
 	bean.run_method("onload_post_render")
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_material_request(source_name, target_doclist=None):	
 	def postprocess(source, doclist):
 		doclist[0].material_request_type = "Purchase"
@@ -277,7 +277,7 @@
 	
 	return [(d if isinstance(d, dict) else d.fields) for d in doclist]
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_delivery_note(source_name, target_doclist=None):	
 	def update_item(obj, target, source_parent):
 		target.base_amount = (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.base_rate)
@@ -317,10 +317,10 @@
 	
 	return [d.fields for d in doclist]
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_sales_invoice(source_name, target_doclist=None):
 	def set_missing_values(source, target):
-		bean = webnotes.bean(target)
+		bean = frappe.bean(target)
 		bean.doc.is_pos = 0
 		bean.run_method("onload_post_render")
 		
@@ -357,9 +357,9 @@
 	
 	return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_maintenance_schedule(source_name, target_doclist=None):
-	maint_schedule = webnotes.conn.sql("""select t1.name 
+	maint_schedule = frappe.conn.sql("""select t1.name 
 		from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 
 		where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1""", source_name)
 		
@@ -385,9 +385,9 @@
 	
 		return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_maintenance_visit(source_name, target_doclist=None):
-	visit = webnotes.conn.sql("""select t1.name 
+	visit = frappe.conn.sql("""select t1.name 
 		from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 
 		where t2.parent=t1.name and t2.prevdoc_docname=%s 
 		and t1.docstatus=1 and t1.completion_status='Fully Completed'""", source_name)
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index ee667ce..20b1309 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -1,23 +1,23 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 import unittest
 
 class TestSalesOrder(unittest.TestCase):
 	def tearDown(self):
-		webnotes.set_user("Administrator")
+		frappe.set_user("Administrator")
 		
 	def test_make_material_request(self):
 		from erpnext.selling.doctype.sales_order.sales_order import make_material_request
 		
-		so = webnotes.bean(copy=test_records[0]).insert()
+		so = frappe.bean(copy=test_records[0]).insert()
 		
-		self.assertRaises(webnotes.ValidationError, make_material_request, 
+		self.assertRaises(frappe.ValidationError, make_material_request, 
 			so.doc.name)
 
-		sales_order = webnotes.bean("Sales Order", so.doc.name)
+		sales_order = frappe.bean("Sales Order", so.doc.name)
 		sales_order.submit()
 		mr = make_material_request(so.doc.name)
 		
@@ -27,12 +27,12 @@
 	def test_make_delivery_note(self):
 		from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note
 
-		so = webnotes.bean(copy=test_records[0]).insert()
+		so = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_delivery_note, 
+		self.assertRaises(frappe.ValidationError, make_delivery_note, 
 			so.doc.name)
 
-		sales_order = webnotes.bean("Sales Order", so.doc.name)
+		sales_order = frappe.bean("Sales Order", so.doc.name)
 		sales_order.submit()
 		dn = make_delivery_note(so.doc.name)
 		
@@ -42,12 +42,12 @@
 	def test_make_sales_invoice(self):
 		from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
 
-		so = webnotes.bean(copy=test_records[0]).insert()
+		so = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_sales_invoice, 
+		self.assertRaises(frappe.ValidationError, make_sales_invoice, 
 			so.doc.name)
 
-		sales_order = webnotes.bean("Sales Order", so.doc.name)
+		sales_order = frappe.bean("Sales Order", so.doc.name)
 		sales_order.submit()
 		si = make_sales_invoice(so.doc.name)
 		
@@ -55,7 +55,7 @@
 		self.assertEquals(len(si), len(sales_order.doclist))
 		self.assertEquals(len([d for d in si if d["doctype"]=="Sales Invoice Item"]), 1)
 		
-		si = webnotes.bean(si)
+		si = frappe.bean(si)
 		si.doc.posting_date = "2013-10-10"
 		si.insert()
 		si.submit()
@@ -68,7 +68,7 @@
 		if not so_doclist:
 			so_doclist = test_records[0]
 		
-		w = webnotes.bean(copy=so_doclist)
+		w = frappe.bean(copy=so_doclist)
 		w.insert()
 		w.submit()
 
@@ -80,7 +80,7 @@
 
 		_insert_purchase_receipt(so.doclist[1].item_code)
 		
-		dn = webnotes.bean(webnotes.copy_doclist(dn_test_records[0]))
+		dn = frappe.bean(frappe.copy_doclist(dn_test_records[0]))
 		dn.doclist[1].item_code = so.doclist[1].item_code
 		dn.doclist[1].against_sales_order = so.doc.name
 		dn.doclist[1].prevdoc_detail_docname = so.doclist[1].name
@@ -91,14 +91,14 @@
 		return dn
 		
 	def get_bin_reserved_qty(self, item_code, warehouse):
-		return flt(webnotes.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, 
+		return flt(frappe.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, 
 			"reserved_qty"))
 	
 	def delete_bin(self, item_code, warehouse):
-		bin = webnotes.conn.exists({"doctype": "Bin", "item_code": item_code, 
+		bin = frappe.conn.exists({"doctype": "Bin", "item_code": item_code, 
 			"warehouse": warehouse})
 		if bin:
-			webnotes.delete_doc("Bin", bin[0][0])
+			frappe.delete_doc("Bin", bin[0][0])
 			
 	def check_reserved_qty(self, item_code, warehouse, qty):
 		bin_reserved_qty = self.get_bin_reserved_qty(item_code, warehouse)
@@ -125,7 +125,7 @@
 		so = self.create_so()
 		
 		# allow negative stock
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
 		# submit dn
 		dn = self.create_dn_against_so(so)
@@ -154,10 +154,10 @@
 		so = self.create_so()
 		
 		# allow negative stock
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
 		# set over-delivery tolerance
-		webnotes.conn.set_value('Item', so.doclist[1].item_code, 'tolerance', 50)
+		frappe.conn.set_value('Item', so.doclist[1].item_code, 'tolerance', 50)
 		
 		# submit dn
 		dn = self.create_dn_against_so(so, 15)
@@ -199,7 +199,7 @@
 		
 		# change item in test so record
 		
-		test_record = webnotes.copy_doclist(test_records[0])
+		test_record = frappe.copy_doclist(test_records[0])
 		test_record[1]["item_code"] = "_Test Sales BOM Item"
 
 		# reset bin
@@ -210,7 +210,7 @@
 		so = self.create_so(test_record)
 		
 		# allow negative stock
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
 		# submit dn
 		dn = self.create_dn_against_so(so)
@@ -248,7 +248,7 @@
 		from erpnext.selling.doctype.sales_bom.test_sales_bom import test_records as sbom_test_records
 		
 		# change item in test so record
-		test_record = webnotes.copy_doclist(test_records[0])
+		test_record = frappe.copy_doclist(test_records[0])
 		test_record[1]["item_code"] = "_Test Sales BOM Item"
 
 		# reset bin
@@ -259,10 +259,10 @@
 		so = self.create_so(test_record)
 		
 		# allow negative stock
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
 		# set over-delivery tolerance
-		webnotes.conn.set_value('Item', so.doclist[1].item_code, 'tolerance', 50)
+		frappe.conn.set_value('Item', so.doclist[1].item_code, 'tolerance', 50)
 		
 		# submit dn
 		dn = self.create_dn_against_so(so, 15)
@@ -280,27 +280,27 @@
 			so.doclist[1].warehouse, 20.0)
 
 	def test_warehouse_user(self):
-		webnotes.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
-		webnotes.bean("Profile", "test@example.com").get_controller()\
+		frappe.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
+		frappe.bean("Profile", "test@example.com").get_controller()\
 			.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
 			
-		webnotes.bean("Profile", "test2@example.com").get_controller()\
+		frappe.bean("Profile", "test2@example.com").get_controller()\
 			.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
 		
-		webnotes.set_user("test@example.com")
+		frappe.set_user("test@example.com")
 
-		from webnotes.model.bean import BeanPermissionError
-		so = webnotes.bean(copy = test_records[0])
+		from frappe.model.bean import BeanPermissionError
+		so = frappe.bean(copy = test_records[0])
 		so.doc.company = "_Test Company 1"
 		so.doc.conversion_rate = 0.02
 		so.doc.plc_conversion_rate = 0.02
 		so.doclist[1].warehouse = "_Test Warehouse 2 - _TC1"
 		self.assertRaises(BeanPermissionError, so.insert)
 
-		webnotes.set_user("test2@example.com")
+		frappe.set_user("test2@example.com")
 		so.insert()
 		
-		webnotes.defaults.clear_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", parenttype="Restriction")
+		frappe.defaults.clear_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", parenttype="Restriction")
 
 test_dependencies = ["Sales BOM", "Currency Exchange"]
 	
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.py b/erpnext/selling/doctype/sales_order_item/sales_order_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.py
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/sales_team/sales_team.py b/erpnext/selling/doctype/sales_team/sales_team.py
index cb6190f..26c87f1 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.py
+++ b/erpnext/selling/doctype/sales_team/sales_team.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.py b/erpnext/selling/doctype/selling_settings/selling_settings.py
index c280619..a190584 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.py
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
@@ -13,7 +13,7 @@
 	def validate(self):
 		for key in ["cust_master_name", "customer_group", "territory", "maintain_same_sales_rate",
 			"editable_price_list_rate", "selling_price_list"]:
-				webnotes.conn.set_default(key, self.doc.fields.get(key, ""))
+				frappe.conn.set_default(key, self.doc.fields.get(key, ""))
 
 		from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
 		set_by_naming_series("Customer", "customer_name", 
diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py
index 8681b9c..bfdc7d4 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.py
+++ b/erpnext/selling/doctype/sms_center/sms_center.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import cstr
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -25,23 +25,23 @@
 			where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''"
 
 		if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
-			rec = webnotes.conn.sql("""select CONCAT(ifnull(first_name,''), '', ifnull(last_name,'')), 
+			rec = frappe.conn.sql("""select CONCAT(ifnull(first_name,''), '', ifnull(last_name,'')), 
 				mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and 
 				docstatus != 2 %s""", where_clause)
 		
 		elif self.doc.send_to == 'All Lead (Open)':
-			rec = webnotes.conn.sql("""select lead_name, mobile_no from `tabLead` where 
+			rec = frappe.conn.sql("""select lead_name, mobile_no from `tabLead` where 
 				ifnull(mobile_no,'')!='' and docstatus != 2 and status='Open'""")
 		
 		elif self.doc.send_to == 'All Employee (Active)':
 			where_clause = self.doc.department and " and department = '%s'" % self.doc.department or ""
 			where_clause += self.doc.branch and " and branch = '%s'" % self.doc.branch or ""
-			rec = webnotes.conn.sql("""select employee_name, cell_number from 
+			rec = frappe.conn.sql("""select employee_name, cell_number from 
 				`tabEmployee` where status = 'Active' and docstatus < 2 and 
 				ifnull(cell_number,'')!='' %s""", where_clause)
 		
 		elif self.doc.send_to == 'All Sales Person':
-			rec = webnotes.conn.sql("""select sales_person_name, mobile_no from 
+			rec = frappe.conn.sql("""select sales_person_name, mobile_no from 
 				`tabSales Person` where docstatus!=2 and ifnull(mobile_no,'')!=''""")
 			rec_list = ''
 		
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js
index 2742e15..46df93d 100644
--- a/erpnext/selling/page/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/page/sales_analytics/sales_analytics.js
@@ -1,10 +1,10 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['sales-analytics'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['sales-analytics'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Sales Analytics'),
+		title: frappe._('Sales Analytics'),
 		single_column: true
 	});
 	new erpnext.SalesAnalytics(wrapper);
@@ -14,10 +14,10 @@
 	
 }
 
-erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
+erpnext.SalesAnalytics = frappe.views.TreeGridReport.extend({
 	init: function(wrapper) {
 		this._super({
-			title: wn._("Sales Analytics"),
+			title: frappe._("Sales Analytics"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -30,14 +30,14 @@
 		
 		this.tree_grids = {
 			"Customer Group": {
-				label: wn._("Customer Group / Customer"),
+				label: frappe._("Customer Group / Customer"),
 				show: true, 
 				item_key: "customer",
 				parent_field: "parent_customer_group", 
 				formatter: function(item) { return item.name; }
 			},
 			"Customer": {
-				label: wn._("Customer"),
+				label: frappe._("Customer"),
 				show: false, 
 				item_key: "customer",
 				formatter: function(item) {
@@ -45,7 +45,7 @@
 				}
 			},	
 			"Item Group": {
-				label: wn._("Item"),
+				label: frappe._("Item"),
 				show: true, 
 				parent_field: "parent_item_group", 
 				item_key: "item_code",
@@ -54,7 +54,7 @@
 				}
 			},	
 			"Item": {
-				label: wn._("Item"),
+				label: frappe._("Item"),
 				show: false, 
 				item_key: "item_code",
 				formatter: function(item) {
@@ -62,7 +62,7 @@
 				}
 			},	
 			"Territory": {
-				label: wn._("Territory / Customer"),
+				label: frappe._("Territory / Customer"),
 				show: true, 
 				item_key: "customer",
 				parent_field: "parent_territory", 
@@ -88,23 +88,23 @@
 		this.columns = std_columns.concat(this.columns);
 	},
 	filters: [
-		{fieldtype:"Select", fieldname: "tree_type", label: wn._("Tree Type"), options:["Customer Group", "Customer", 
+		{fieldtype:"Select", fieldname: "tree_type", label: frappe._("Tree Type"), options:["Customer Group", "Customer", 
 			"Item Group", "Item", "Territory"],
 			filter: function(val, item, opts, me) {
 				return me.apply_zero_filter(val, item, opts, me);
 			}},
-		{fieldtype:"Select", fieldname: "based_on", label: wn._("Based On"), options:["Sales Invoice", 
+		{fieldtype:"Select", fieldname: "based_on", label: frappe._("Based On"), options:["Sales Invoice", 
 			"Sales Order", "Delivery Note"]},
-		{fieldtype:"Select", fieldname: "value_or_qty", label:  wn._("Value or Qty"), options:["Value", "Quantity"]},
-		{fieldtype:"Select", fieldname: "company", label: wn._("Company"), link:"Company", 
+		{fieldtype:"Select", fieldname: "value_or_qty", label:  frappe._("Value or Qty"), options:["Value", "Quantity"]},
+		{fieldtype:"Select", fieldname: "company", label: frappe._("Company"), link:"Company", 
 			default_value: "Select Company..."},
-		{fieldtype:"Date", fieldname: "from_date", label: wn._("From Date")},
-		{fieldtype:"Label", fieldname: "to", label: wn._("To")},
-		{fieldtype:"Date", fieldname: "to_date", label: wn._("To Date")},
-		{fieldtype:"Select", fieldname: "range", label: wn._("Range"), 
+		{fieldtype:"Date", fieldname: "from_date", label: frappe._("From Date")},
+		{fieldtype:"Label", fieldname: "to", label: frappe._("To")},
+		{fieldtype:"Date", fieldname: "to_date", label: frappe._("To Date")},
+		{fieldtype:"Select", fieldname: "range", label: frappe._("Range"), 
 			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
-		{fieldtype:"Button", fieldname: "refresh", label: wn._("Refresh"), icon:"icon-refresh"},
-		{fieldtype:"Button", fieldname: "reset_filters", label: wn._("Reset Filters"), icon:"icon-filter"}
+		{fieldtype:"Button", fieldname: "refresh", label: frappe._("Refresh"), icon:"icon-refresh"},
+		{fieldtype:"Button", fieldname: "reset_filters", label: frappe._("Reset Filters"), icon:"icon-filter"}
 	],
 	setup_filters: function() {
 		var me = this;
@@ -124,14 +124,14 @@
 		if (!this.tl) {
 			// add 'Not Set' Customer & Item
 			// (Customer / Item are not mandatory!!)
-			wn.report_dump.data["Customer"].push({
+			frappe.report_dump.data["Customer"].push({
 				name: "Not Set", 
 				parent_customer_group: "All Customer Groups",
 				parent_territory: "All Territories",
 				id: "Not Set",
 			});
 
-			wn.report_dump.data["Item"].push({
+			frappe.report_dump.data["Item"].push({
 				name: "Not Set", 
 				parent_item_group: "All Item Groups",
 				id: "Not Set",
@@ -144,13 +144,13 @@
 		
 		if(!this.data || me.item_type != me.tree_type) {
 			if(me.tree_type=='Customer') {
-				var items = wn.report_dump.data["Customer"];
+				var items = frappe.report_dump.data["Customer"];
 			} if(me.tree_type=='Customer Group') {
 				var items = this.prepare_tree("Customer", "Customer Group");
 			} else if(me.tree_type=="Item Group") {
 				var items = this.prepare_tree("Item", "Item Group");
 			} else if(me.tree_type=="Item") {
-				var items = wn.report_dump.data["Item"];
+				var items = frappe.report_dump.data["Item"];
 			} else if(me.tree_type=="Territory") {
 				var items = this.prepare_tree("Customer", "Territory");
 			}
diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js
index 1b7d9aa..57a7ee6 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.js
+++ b/erpnext/selling/page/sales_browser/sales_browser.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 pscript['onload_Sales Browser'] = function(wrapper){
-	wn.ui.make_app_page({
+	frappe.ui.make_app_page({
 		parent: wrapper,
 	})
 	
@@ -16,12 +16,12 @@
 	$(wrapper)
 		.find(".layout-side-section")
 		.html('<div class="text-muted">'+ 
-			wn._('Click on a link to get options to expand get options ') + 
-			wn._('Add') + ' / ' + wn._('Edit') + ' / '+ wn._('Delete') + '.</div>')
+			frappe._('Click on a link to get options to expand get options ') + 
+			frappe._('Add') + ' / ' + frappe._('Edit') + ' / '+ frappe._('Delete') + '.</div>')
 
 	wrapper.make_tree = function() {
-		var ctype = wn.get_route()[1] || 'Territory';
-		return wn.call({
+		var ctype = frappe.get_route()[1] || 'Territory';
+		return frappe.call({
 			method: 'erpnext.selling.page.sales_browser.sales_browser.get_children',
 			args: {ctype: ctype},
 			callback: function(r) {
@@ -42,7 +42,7 @@
 
 pscript['onshow_Sales Browser'] = function(wrapper){
 	// set route
-	var ctype = wn.get_route()[1] || 'Territory';
+	var ctype = frappe.get_route()[1] || 'Territory';
 
 	wrapper.appframe.set_title(ctype+' Tree')
 
@@ -56,7 +56,7 @@
 		$(parent).empty();
 		var me = this;
 		me.ctype = ctype;
-		this.tree = new wn.ui.Tree({
+		this.tree = new frappe.ui.Tree({
 			parent: $(parent), 
 			label: root,
 			args: {ctype: ctype},
@@ -87,23 +87,23 @@
 		// edit
 		var node_links = [];
 		
-		if (wn.model.can_read(this.ctype)) {
-			node_links.push('<a onclick="erpnext.sales_chart.open();">'+wn._('Edit')+'</a>');
+		if (frappe.model.can_read(this.ctype)) {
+			node_links.push('<a onclick="erpnext.sales_chart.open();">'+frappe._('Edit')+'</a>');
 		}
 
 		if(data.expandable) {
-			if (wn.boot.profile.can_create.indexOf(this.ctype) !== -1 ||
-					wn.boot.profile.in_create.indexOf(this.ctype) !== -1) {
-				node_links.push('<a onclick="erpnext.sales_chart.new_node();">' + wn._('Add Child') + '</a>');
+			if (frappe.boot.profile.can_create.indexOf(this.ctype) !== -1 ||
+					frappe.boot.profile.in_create.indexOf(this.ctype) !== -1) {
+				node_links.push('<a onclick="erpnext.sales_chart.new_node();">' + frappe._('Add Child') + '</a>');
 			}
 		}
 
-		if (wn.model.can_write(this.ctype)) {
-			node_links.push('<a onclick="erpnext.sales_chart.rename()">' + wn._('Rename') + '</a>');
+		if (frappe.model.can_write(this.ctype)) {
+			node_links.push('<a onclick="erpnext.sales_chart.rename()">' + frappe._('Rename') + '</a>');
 		};
 	
-		if (wn.model.can_delete(this.ctype)) {
-			node_links.push('<a onclick="erpnext.sales_chart.delete()">' + wn._('Delete') + '</a>');
+		if (frappe.model.can_delete(this.ctype)) {
+			node_links.push('<a onclick="erpnext.sales_chart.delete()">' + frappe._('Delete') + '</a>');
 		};
 		
 		link.toolbar.append(node_links.join(" | "));
@@ -115,18 +115,18 @@
 			{fieldtype:'Data', fieldname: 'name_field', 
 				label:'New ' + me.ctype + ' Name', reqd:true},
 			{fieldtype:'Select', fieldname:'is_group', label:'Group Node', options:'No\nYes', 
-				description: wn._("Further nodes can be only created under 'Group' type nodes")}, 
+				description: frappe._("Further nodes can be only created under 'Group' type nodes")}, 
 			{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
 		]
 		
 		if(me.ctype == "Sales Person") {
 			fields.splice(-1, 0, {fieldtype:'Link', fieldname:'employee', label:'Employee',
-				options:'Employee', description: wn._("Please enter Employee Id of this sales parson")});
+				options:'Employee', description: frappe._("Please enter Employee Id of this sales parson")});
 		}
 		
 		// the dialog
-		var d = new wn.ui.Dialog({
-			title: wn._('New ') + wn._(me.ctype),
+		var d = new frappe.ui.Dialog({
+			title: frappe._('New ') + frappe._(me.ctype),
 			fields: fields
 		})		
 	
@@ -143,7 +143,7 @@
 			v.parent = node.data('label');
 			v.ctype = me.ctype;
 			
-			return wn.call({
+			return frappe.call({
 				method: 'erpnext.selling.page.sales_browser.sales_browser.add_node',
 				args: v,
 				callback: function() {
@@ -160,17 +160,17 @@
 	},
 	open: function() {
 		var node = this.selected_node();
-		wn.set_route("Form", this.ctype, node.data("label"));
+		frappe.set_route("Form", this.ctype, node.data("label"));
 	},
 	rename: function() {
 		var node = this.selected_node();
-		wn.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
+		frappe.model.rename_doc(this.ctype, node.data('label'), function(new_name) {
 			node.data('label', new_name).find(".tree-label").html(new_name);
 		});
 	},
 	delete: function() {
 		var node = this.selected_node();
-		wn.model.delete_doc(this.ctype, node.data('label'), function() {
+		frappe.model.delete_doc(this.ctype, node.data('label'), function() {
 			node.parent().remove();
 		});
 	},
diff --git a/erpnext/selling/page/sales_browser/sales_browser.py b/erpnext/selling/page/sales_browser/sales_browser.py
index bb1a094..bcd9146 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.py
+++ b/erpnext/selling/page/sales_browser/sales_browser.py
@@ -2,38 +2,38 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_children():
-	ctype = webnotes.local.form_dict.get('ctype')
-	webnotes.local.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
-	if not webnotes.form_dict.get('parent'):
-		webnotes.local.form_dict['parent'] = ''
+	ctype = frappe.local.form_dict.get('ctype')
+	frappe.local.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
+	if not frappe.form_dict.get('parent'):
+		frappe.local.form_dict['parent'] = ''
 		
-	return webnotes.conn.sql("""select name as value, 
+	return frappe.conn.sql("""select name as value, 
 		if(is_group='Yes', 1, 0) as expandable
 		from `tab%(ctype)s`
 		where docstatus < 2
 		and ifnull(%(parent_field)s,'') = "%(parent)s"
-		order by name""" % webnotes.local.form_dict, as_dict=1)
+		order by name""" % frappe.local.form_dict, as_dict=1)
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def add_node():
-	# from webnotes.model.doc import Document
-	ctype = webnotes.form_dict.get('ctype')
+	# from frappe.model.doc import Document
+	ctype = frappe.form_dict.get('ctype')
 	parent_field = 'parent_' + ctype.lower().replace(' ', '_')
 	name_field = ctype.lower().replace(' ', '_') + '_name'
 	
 	doclist = [{
 		"doctype": ctype,
 		"__islocal": 1,
-		name_field: webnotes.form_dict['name_field'],
-		parent_field: webnotes.form_dict['parent'],
-		"is_group": webnotes.form_dict['is_group']
+		name_field: frappe.form_dict['name_field'],
+		parent_field: frappe.form_dict['parent'],
+		"is_group": frappe.form_dict['is_group']
 	}]
 	if ctype == "Sales Person":
-		doclist[0]["employee"] = webnotes.form_dict.get('employee')
+		doclist[0]["employee"] = frappe.form_dict.get('employee')
 		
-	webnotes.bean(doclist).save()
\ No newline at end of file
+	frappe.bean(doclist).save()
\ No newline at end of file
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.js b/erpnext/selling/page/sales_funnel/sales_funnel.js
index 7464c49..cc46c04 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.js
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['sales-funnel'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['sales-funnel'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: 'Sales Funnel',
 		single_column: true
@@ -11,7 +11,7 @@
 	wrapper.sales_funnel = new erpnext.SalesFunnel(wrapper);
 	
 	wrapper.appframe.add_module_icon("Selling", "sales-funnel", function() {
-		wn.set_route("selling-home");
+		frappe.set_route("selling-home");
 	});
 }
 
@@ -44,15 +44,15 @@
 			.appendTo(this.elements.layout);
 		
 		this.options = {
-			from_date: wn.datetime.add_months(wn.datetime.get_today(), -1),
-			to_date: wn.datetime.get_today()
+			from_date: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
+			to_date: frappe.datetime.get_today()
 		};
 		
 		// set defaults and bind on change
 		$.each(this.options, function(k, v) { 
-			me.elements[k].val(wn.datetime.str_to_user(v)); 
+			me.elements[k].val(frappe.datetime.str_to_user(v)); 
 			me.elements[k].on("change", function() {
-				me.options[k] = wn.datetime.user_to_str($(this).val());
+				me.options[k] = frappe.datetime.user_to_str($(this).val());
 				me.get_data();
 			});
 		});
@@ -70,7 +70,7 @@
 	
 	get_data: function(btn) {
 		var me = this;
-		wn.call({
+		frappe.call({
 			method: "erpnext.selling.page.sales_funnel.sales_funnel.get_funnel_data",
 			args: {
 				from_date: this.options.from_date,
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.py b/erpnext/selling/page/sales_funnel/sales_funnel.py
index c5b5e87..9b3ff68 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.py
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.py
@@ -2,27 +2,27 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_funnel_data(from_date, to_date):
-	active_leads = webnotes.conn.sql("""select count(*) from `tabLead`
+	active_leads = frappe.conn.sql("""select count(*) from `tabLead`
 		where (date(`modified`) between %s and %s)
 		and status != "Do Not Contact" """, (from_date, to_date))[0][0]
 		
-	active_leads += webnotes.conn.sql("""select count(distinct customer) from `tabContact`
+	active_leads += frappe.conn.sql("""select count(distinct customer) from `tabContact`
 		where (date(`modified`) between %s and %s)
 		and status != "Passive" """, (from_date, to_date))[0][0]
 	
-	opportunities = webnotes.conn.sql("""select count(*) from `tabOpportunity`
+	opportunities = frappe.conn.sql("""select count(*) from `tabOpportunity`
 		where docstatus = 1 and (date(`creation`) between %s and %s)
 		and status != "Lost" """, (from_date, to_date))[0][0]
 	
-	quotations = webnotes.conn.sql("""select count(*) from `tabQuotation`
+	quotations = frappe.conn.sql("""select count(*) from `tabQuotation`
 		where docstatus = 1 and (date(`creation`) between %s and %s)
 		and status != "Lost" """, (from_date, to_date))[0][0]
 	
-	sales_orders = webnotes.conn.sql("""select count(*) from `tabQuotation`
+	sales_orders = frappe.conn.sql("""select count(*) from `tabQuotation`
 		where docstatus = 1 and (date(`creation`) between %s and %s)""", (from_date, to_date))[0][0]
 	
 	return [
diff --git a/erpnext/selling/page/selling_home/selling_home.js b/erpnext/selling/page/selling_home/selling_home.js
index 54b4edc..765ef40 100644
--- a/erpnext/selling/page/selling_home/selling_home.js
+++ b/erpnext/selling/page/selling_home/selling_home.js
@@ -1,232 +1,232 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Selling"] = [
+frappe.module_page["Selling"] = [
 	{
 		top: true,
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Customer"),
-				description: wn._("Customer database."),
+				label: frappe._("Customer"),
+				description: frappe._("Customer database."),
 				doctype:"Customer"
 			},
 			{
-				label: wn._("Lead"),
-				description: wn._("Database of potential customers."),
+				label: frappe._("Lead"),
+				description: frappe._("Database of potential customers."),
 				doctype:"Lead"
 			},
 			{
-				label: wn._("Opportunity"),
-				description: wn._("Potential opportunities for selling."),
+				label: frappe._("Opportunity"),
+				description: frappe._("Potential opportunities for selling."),
 				doctype:"Opportunity"
 			},
 			{
-				label: wn._("Quotation"),
-				description: wn._("Quotes to Leads or Customers."),
+				label: frappe._("Quotation"),
+				description: frappe._("Quotes to Leads or Customers."),
 				doctype:"Quotation"
 			},
 			{
-				label: wn._("Sales Order"),
-				description: wn._("Confirmed orders from Customers."),
+				label: frappe._("Sales Order"),
+				description: frappe._("Confirmed orders from Customers."),
 				doctype:"Sales Order"
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Contact"),
-				description: wn._("All Contacts."),
+				label: frappe._("Contact"),
+				description: frappe._("All Contacts."),
 				doctype:"Contact"
 			},
 			{
-				label: wn._("Address"),
-				description: wn._("All Addresses."),
+				label: frappe._("Address"),
+				description: frappe._("All Addresses."),
 				doctype:"Address"
 			},
 			{
-				label: wn._("Item"),
-				description: wn._("All Products or Services."),
+				label: frappe._("Item"),
+				description: frappe._("All Products or Services."),
 				doctype:"Item"
 			},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				"label": wn._("Selling Settings"),
+				"label": frappe._("Selling Settings"),
 				"route": "Form/Selling Settings",
 				"doctype":"Selling Settings",
-				"description": wn._("Settings for Selling Module")
+				"description": frappe._("Settings for Selling Module")
 			},
 			{
-				label: wn._("Sales Taxes and Charges Master"),
-				description: wn._("Sales taxes template."),
+				label: frappe._("Sales Taxes and Charges Master"),
+				description: frappe._("Sales taxes template."),
 				doctype:"Sales Taxes and Charges Master"
 			},
 			{
-				label: wn._("Shipping Rules"),
-				description: wn._("Rules to calculate shipping amount for a sale"),
+				label: frappe._("Shipping Rules"),
+				description: frappe._("Rules to calculate shipping amount for a sale"),
 				doctype:"Shipping Rule"
 			},
 			{
-				label: wn._("Price List"),
-				description: wn._("Multiple Price list."),
+				label: frappe._("Price List"),
+				description: frappe._("Multiple Price list."),
 				doctype:"Price List"
 			},
 			{
-				label: wn._("Item Price"),
-				description: wn._("Multiple Item prices."),
+				label: frappe._("Item Price"),
+				description: frappe._("Multiple Item prices."),
 				doctype:"Item Price"
 			},
 			{
-				label: wn._("Sales BOM"),
-				description: wn._("Bundle items at time of sale."),
+				label: frappe._("Sales BOM"),
+				description: frappe._("Bundle items at time of sale."),
 				doctype:"Sales BOM"
 			},
 			{
-				label: wn._("Terms and Conditions"),
-				description: wn._("Template of terms or contract."),
+				label: frappe._("Terms and Conditions"),
+				description: frappe._("Template of terms or contract."),
 				doctype:"Terms and Conditions"
 			},
 			{
-				label: wn._("Customer Group"),
-				description: wn._("Customer classification tree."),
+				label: frappe._("Customer Group"),
+				description: frappe._("Customer classification tree."),
 				route: "Sales Browser/Customer Group",
 				doctype:"Customer Group"
 			},
 			{
-				label: wn._("Territory"),
-				description: wn._("Sales territories."),
+				label: frappe._("Territory"),
+				description: frappe._("Sales territories."),
 				route: "Sales Browser/Territory",
 				doctype:"Territory"
 			},
 			{
 				"route":"Sales Browser/Sales Person",
-				"label":wn._("Sales Person"),
-				"description": wn._("Sales persons and targets"),
+				"label":frappe._("Sales Person"),
+				"description": frappe._("Sales persons and targets"),
 				doctype:"Sales Person"
 			},
 			{
 				"route":"List/Sales Partner",
-				"label": wn._("Sales Partner"),
-				"description":wn._("Commission partners and targets"),
+				"label": frappe._("Sales Partner"),
+				"description":frappe._("Commission partners and targets"),
 				doctype:"Sales Partner"
 			},
 			{
 				"route":"Sales Browser/Item Group",
-				"label":wn._("Item Group"),
-				"description": wn._("Tree of item classification"),
+				"label":frappe._("Item Group"),
+				"description": frappe._("Tree of item classification"),
 				doctype:"Item Group"
 			},
 			{
 				"route":"List/Campaign",
-				"label":wn._("Campaign"),
-				"description":wn._("Sales campaigns"),
+				"label":frappe._("Campaign"),
+				"description":frappe._("Sales campaigns"),
 				doctype:"Campaign"
 			},
 		]
 	},
 	{
-		title: wn._("Tools"),
+		title: frappe._("Tools"),
 		icon: "icon-wrench",
 		items: [
 			{
 				"route":"Form/SMS Center/SMS Center",
-				"label":wn._("SMS Center"),
-				"description":wn._("Send mass SMS to your contacts"),
+				"label":frappe._("SMS Center"),
+				"description":frappe._("Send mass SMS to your contacts"),
 				doctype:"SMS Center"
 			},
 		]
 	},
 	{
-		title: wn._("Analytics"),
+		title: frappe._("Analytics"),
 		right: true,
 		icon: "icon-bar-chart",
 		items: [
 			{
-				"label":wn._("Sales Analytics"),
+				"label":frappe._("Sales Analytics"),
 				page: "sales-analytics"
 			},
 			{
-				"label":wn._("Sales Funnel"),
+				"label":frappe._("Sales Funnel"),
 				page: "sales-funnel"
 			},
 			{
-				"label":wn._("Customer Acquisition and Loyalty"),
+				"label":frappe._("Customer Acquisition and Loyalty"),
 				route: "query-report/Customer Acquisition and Loyalty",
 				doctype: "Customer"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Lead Details"),
+				"label":frappe._("Lead Details"),
 				route: "query-report/Lead Details",
 				doctype: "Lead"
 			},
 			{
-				"label":wn._("Customer Addresses And Contacts"),
+				"label":frappe._("Customer Addresses And Contacts"),
 				route: "query-report/Customer Addresses And Contacts",
 				doctype: "Contact"
 			},
 			{
-				"label":wn._("Ordered Items To Be Delivered"),
+				"label":frappe._("Ordered Items To Be Delivered"),
 				route: "query-report/Ordered Items To Be Delivered",
 				doctype: "Sales Order"
 			},
 			{
-				"label":wn._("Sales Person-wise Transaction Summary"),
+				"label":frappe._("Sales Person-wise Transaction Summary"),
 				route: "query-report/Sales Person-wise Transaction Summary",
 				doctype: "Sales Order"
 			},
 			{
-				"label":wn._("Item-wise Sales History"),
+				"label":frappe._("Item-wise Sales History"),
 				route: "query-report/Item-wise Sales History",
 				doctype: "Item"
 			},
 			{
-				"label":wn._("Territory Target Variance (Item Group-Wise)"),
+				"label":frappe._("Territory Target Variance (Item Group-Wise)"),
 				route: "query-report/Territory Target Variance Item Group-Wise",
 				doctype: "Territory"
 			},
 			{
-				"label":wn._("Sales Person Target Variance (Item Group-Wise)"),
+				"label":frappe._("Sales Person Target Variance (Item Group-Wise)"),
 				route: "query-report/Sales Person Target Variance Item Group-Wise",
 				doctype: "Sales Person",
 			},
 			{
-				"label":wn._("Customers Not Buying Since Long Time"),
+				"label":frappe._("Customers Not Buying Since Long Time"),
 				route: "query-report/Customers Not Buying Since Long Time",
 				doctype: "Sales Order"
 			},
 			{
-				"label":wn._("Quotation Trend"),
+				"label":frappe._("Quotation Trend"),
 				route: "query-report/Quotation Trends",
 				doctype: "Quotation"
 			},
 			{
-				"label":wn._("Sales Order Trend"),
+				"label":frappe._("Sales Order Trend"),
 				route: "query-report/Sales Order Trends",
 				doctype: "Sales Order"
 			},
 			{
-				"label":wn._("Available Stock for Packing Items"),
+				"label":frappe._("Available Stock for Packing Items"),
 				route: "query-report/Available Stock for Packing Items",
 				doctype: "Item",
 			},
 			{
-				"label":wn._("Pending SO Items For Purchase Request"),
+				"label":frappe._("Pending SO Items For Purchase Request"),
 				route: "query-report/Pending SO Items For Purchase Request",
 				doctype: "Sales Order"
 			},
@@ -235,5 +235,5 @@
 ]
 
 pscript['onload_selling-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Selling");
+	frappe.views.moduleview.make(wrapper, "Selling");
 }
\ No newline at end of file
diff --git a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
index 8b0bc23..19cee5e 100644
--- a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
+++ b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -41,7 +41,7 @@
 
 def get_sales_bom_items():
 	sbom_item_map = {}
-	for sbom in webnotes.conn.sql("""select parent, item_code, qty from `tabSales BOM Item` 
+	for sbom in frappe.conn.sql("""select parent, item_code, qty from `tabSales BOM Item` 
 		where docstatus < 2""", as_dict=1):
 			sbom_item_map.setdefault(sbom.parent, {}).setdefault(sbom.item_code, sbom.qty)
 			
@@ -49,7 +49,7 @@
 
 def get_item_details():
 	item_map = {}
-	for item in webnotes.conn.sql("""select name, item_name, description, stock_uom 
+	for item in frappe.conn.sql("""select name, item_name, description, stock_uom 
 		from `tabItem`""", as_dict=1):
 			item_map.setdefault(item.name, item)
 			
@@ -57,7 +57,7 @@
 
 def get_item_warehouse_quantity():
 	iwq_map = {}
-	bin = webnotes.conn.sql("""select item_code, warehouse, actual_qty from `tabBin` 
+	bin = frappe.conn.sql("""select item_code, warehouse, actual_qty from `tabBin` 
 		where actual_qty > 0""")
 	for item, wh, qty in bin:
 		iwq_map.setdefault(item, {}).setdefault(wh, qty)
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
index 00f935e..b9b26d7 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
@@ -1,26 +1,26 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Customer Acquisition and Loyalty"] = {
+frappe.query_reports["Customer Acquisition and Loyalty"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company")
+			"default": frappe.defaults.get_user_default("company")
 		},
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_start_date")
+			"default": frappe.defaults.get_user_default("year_start_date")
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_end_date")
+			"default": frappe.defaults.get_user_default("year_end_date")
 		},
 	]
 }
\ No newline at end of file
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
index 2b17c85..9e216a6 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import getdate, cint
+import frappe
+from frappe.utils import getdate, cint
 import calendar
 
 def execute(filters=None):
@@ -16,7 +16,7 @@
 	if filters.get("company"):
 		company_condition = ' and company=%(company)s'
 
-	for si in webnotes.conn.sql("""select posting_date, customer, grand_total from `tabSales Invoice`
+	for si in frappe.conn.sql("""select posting_date, customer, grand_total from `tabSales Invoice`
 		where docstatus=1 and posting_date <= %(to_date)s 
 		{company_condition} order by posting_date""".format(company_condition=company_condition), 
 		filters, as_dict=1):
diff --git a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
index b9f6633..e0f405f 100644
--- a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
+++ b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
@@ -1,11 +1,11 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Customers Not Buying Since Long Time"] = {
+frappe.query_reports["Customers Not Buying Since Long Time"] = {
 	"filters": [
 		{
 			"fieldname":"days_since_last_order",
-			"label": wn._("Days Since Last Order"),
+			"label": frappe._("Days Since Last Order"),
 			"fieldtype": "Int",
 			"default": 60
 		}
diff --git a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
index 608ae5f..5fca755 100644
--- a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
+++ b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
@@ -2,15 +2,15 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import getdate, cint
+import frappe
+from frappe.utils import getdate, cint
 
 def execute(filters=None):
 	if not filters: filters ={}
 
 	days_since_last_order = filters.get("days_since_last_order")
 	if cint(days_since_last_order) <= 0:
-		webnotes.msgprint("Please mention positive value in 'Days Since Last Order' field",raise_exception=1)
+		frappe.msgprint("Please mention positive value in 'Days Since Last Order' field",raise_exception=1)
 
 	columns = get_columns() 
 	customers = get_so_details()
@@ -23,7 +23,7 @@
 	return columns, data 
 
 def get_so_details():
-	return webnotes.conn.sql("""select 
+	return frappe.conn.sql("""select 
 			cust.name, 
 			cust.customer_name, 
 			cust.territory, 
@@ -41,7 +41,7 @@
 		order by 'days_since_last_order' desc """,as_list=1)
 
 def get_last_so_amt(customer):
-	res =  webnotes.conn.sql("""select net_total from `tabSales Order`
+	res =  frappe.conn.sql("""select net_total from `tabSales Order`
 		where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc 
 		limit 1""" % {'customer':customer})
 
diff --git a/erpnext/selling/report/quotation_trends/quotation_trends.js b/erpnext/selling/report/quotation_trends/quotation_trends.js
index 59f8b46..fe04fd1 100644
--- a/erpnext/selling/report/quotation_trends/quotation_trends.js
+++ b/erpnext/selling/report/quotation_trends/quotation_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/sales_trends_filters.js");
+frappe.require("assets/erpnext/js/sales_trends_filters.js");
 
-wn.query_reports["Quotation Trends"] = {
+frappe.query_reports["Quotation Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/selling/report/quotation_trends/quotation_trends.py b/erpnext/selling/report/quotation_trends/quotation_trends.py
index ea0d3db..f307076 100644
--- a/erpnext/selling/report/quotation_trends/quotation_trends.py
+++ b/erpnext/selling/report/quotation_trends/quotation_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns, get_data
 
 def execute(filters=None):
diff --git a/erpnext/selling/report/sales_order_trends/sales_order_trends.js b/erpnext/selling/report/sales_order_trends/sales_order_trends.js
index 6ff31a2..d61ea4e 100644
--- a/erpnext/selling/report/sales_order_trends/sales_order_trends.js
+++ b/erpnext/selling/report/sales_order_trends/sales_order_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/sales_trends_filters.js");
+frappe.require("assets/erpnext/js/sales_trends_filters.js");
 
-wn.query_reports["Sales Order Trends"] = {
+frappe.query_reports["Sales Order Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/selling/report/sales_order_trends/sales_order_trends.py b/erpnext/selling/report/sales_order_trends/sales_order_trends.py
index e9354e6..0aa29fc 100644
--- a/erpnext/selling/report/sales_order_trends/sales_order_trends.py
+++ b/erpnext/selling/report/sales_order_trends/sales_order_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns,get_data
 
 def execute(filters=None):
diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js
index 9836dd3..b6d2b7b 100644
--- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js
+++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js
@@ -1,25 +1,25 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Sales Person Target Variance Item Group-Wise"] = {
+frappe.query_reports["Sales Person Target Variance Item Group-Wise"] = {
 	"filters": [
 		{
 			fieldname: "fiscal_year",
-			label: wn._("Fiscal Year"),
+			label: frappe._("Fiscal Year"),
 			fieldtype: "Link",
 			options: "Fiscal Year",
 			default: sys_defaults.fiscal_year
 		},
 		{
 			fieldname: "period",
-			label: wn._("Period"),
+			label: frappe._("Period"),
 			fieldtype: "Select",
 			options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
 			default: "Monthly"
 		},
 		{
 			fieldname: "target_on",
-			label: wn._("Target On"),
+			label: frappe._("Target On"),
 			fieldtype: "Select",
 			options: "Quantity\nAmount",
 			default: "Quantity"
diff --git a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
index ae38de2..8addff2 100644
--- a/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.utils import flt
+import frappe
+from frappe import _, msgprint
+from frappe.utils import flt
 import time
 from erpnext.accounts.utils import get_fiscal_year
 from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
-from webnotes.model.meta import get_field_precision
+from frappe.model.meta import get_field_precision
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -63,7 +63,7 @@
 
 #Get sales person & item group details
 def get_salesperson_details(filters):
-	return webnotes.conn.sql("""select sp.name, td.item_group, td.target_qty, 
+	return frappe.conn.sql("""select sp.name, td.item_group, td.target_qty, 
 		td.target_amount, sp.distribution_id 
 		from `tabSales Person` sp, `tabTarget Detail` td 
 		where td.parent=sp.name and td.fiscal_year=%s order by sp.name""", 
@@ -73,7 +73,7 @@
 def get_target_distribution_details(filters):
 	target_details = {}
 	
-	for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation 
+	for d in frappe.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation 
 		from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd 
 		where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
 			target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
@@ -84,7 +84,7 @@
 def get_achieved_details(filters):
 	start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
 	
-	item_details = webnotes.conn.sql("""select soi.item_code, soi.qty, soi.base_amount, so.transaction_date, 
+	item_details = frappe.conn.sql("""select soi.item_code, soi.qty, soi.base_amount, so.transaction_date, 
 		st.sales_person, MONTHNAME(so.transaction_date) as month_name 
 		from `tabSales Order Item` soi, `tabSales Order` so, `tabSales Team` st 
 		where soi.parent=so.name and so.docstatus=1 and 
@@ -110,7 +110,7 @@
 		for month_id in range(1, 13):
 			month = datetime.date(2013, month_id, 1).strftime('%B')
 			sim_map.setdefault(sd.name, {}).setdefault(sd.item_group, {})\
-				.setdefault(month, webnotes._dict({
+				.setdefault(month, frappe._dict({
 					"target": 0.0, "achieved": 0.0
 				}))
 
@@ -132,4 +132,4 @@
 	return sim_map
 
 def get_item_group(item_name):
-	return webnotes.conn.get_value("Item", item_name, "item_group")
\ No newline at end of file
+	return frappe.conn.get_value("Item", item_name, "item_group")
\ No newline at end of file
diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
index 88bbd6d..608097d 100644
--- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
+++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
@@ -1,61 +1,61 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Sales Person-wise Transaction Summary"] = {
+frappe.query_reports["Sales Person-wise Transaction Summary"] = {
 	"filters": [
 		{
 			fieldname: "sales_person",
-			label: wn._("Sales Person"),
+			label: frappe._("Sales Person"),
 			fieldtype: "Link",
 			options: "Sales Person"
 		},
 		{
 			fieldname: "doc_type",
-			label: wn._("Document Type"),
+			label: frappe._("Document Type"),
 			fieldtype: "Select",
 			options: "Sales Order\nDelivery Note\nSales Invoice",
 			default: "Sales Order"
 		},
 		{
 			fieldname: "from_date",
-			label: wn._("From Date"),
+			label: frappe._("From Date"),
 			fieldtype: "Date",
-			default: wn.defaults.get_user_default("year_start_date"),
+			default: frappe.defaults.get_user_default("year_start_date"),
 		},
 		{
 			fieldname:"to_date",
-			label: wn._("To Date"),
+			label: frappe._("To Date"),
 			fieldtype: "Date",
 			default: get_today()
 		},
 		{
 			fieldname:"company",
-			label: wn._("Company"),
+			label: frappe._("Company"),
 			fieldtype: "Link",
 			options: "Company",
-			default: wn.defaults.get_default("company")
+			default: frappe.defaults.get_default("company")
 		},
 		{
 			fieldname:"item_group",
-			label: wn._("Item Group"),
+			label: frappe._("Item Group"),
 			fieldtype: "Link",
 			options: "Item Group",
 		},
 		{
 			fieldname:"brand",
-			label: wn._("Brand"),
+			label: frappe._("Brand"),
 			fieldtype: "Link",
 			options: "Brand",
 		},
 		{
 			fieldname:"customer",
-			label: wn._("Customer"),
+			label: frappe._("Customer"),
 			fieldtype: "Link",
 			options: "Customer",
 		},
 		{
 			fieldname:"territory",
-			label: wn._("Territory"),
+			label: frappe._("Territory"),
 			fieldtype: "Link",
 			options: "Territory",
 		},
diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
index b7c030f..03e23b0 100644
--- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
+++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
+import frappe
+from frappe import msgprint, _
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -26,7 +26,7 @@
 def get_entries(filters):
 	date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"
 	conditions, items = get_conditions(filters, date_field)
-	entries = webnotes.conn.sql("""select dt.name, dt.customer, dt.territory, dt.%s, 
+	entries = frappe.conn.sql("""select dt.name, dt.customer, dt.territory, dt.%s, 
 		dt_item.item_code, dt_item.qty, dt_item.base_amount, st.sales_person, 
 		st.allocated_percentage, dt_item.base_amount*st.allocated_percentage/100
 		from `tab%s` dt, `tab%s Item` dt_item, `tabSales Team` st 
@@ -63,7 +63,7 @@
 
 	items = []
 	if key:
-		items = webnotes.conn.sql_list("""select name from tabItem where %s = %s""" % 
+		items = frappe.conn.sql_list("""select name from tabItem where %s = %s""" % 
 			(key, '%s'), (filters[key]))
 			
 	return items
\ No newline at end of file
diff --git a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js
index 621f41d..8a521b8 100644
--- a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js
+++ b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js
@@ -1,25 +1,25 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Territory Target Variance Item Group-Wise"] = {
+frappe.query_reports["Territory Target Variance Item Group-Wise"] = {
 	"filters": [
 		{
 			fieldname: "fiscal_year",
-			label: wn._("Fiscal Year"),
+			label: frappe._("Fiscal Year"),
 			fieldtype: "Link",
 			options: "Fiscal Year",
 			default: sys_defaults.fiscal_year
 		},
 		{
 			fieldname: "period",
-			label: wn._("Period"),
+			label: frappe._("Period"),
 			fieldtype: "Select",
 			options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
 			default: "Monthly"
 		},
 		{
 			fieldname: "target_on",
-			label: wn._("Target On"),
+			label: frappe._("Target On"),
 			fieldtype: "Select",
 			options: "Quantity\nAmount",
 			default: "Quantity"
diff --git a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
index 9861db3..12f22dd 100644
--- a/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
+++ b/erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.utils import flt
+import frappe
+from frappe import _, msgprint
+from frappe.utils import flt
 import time
 from erpnext.accounts.utils import get_fiscal_year
 from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
@@ -60,7 +60,7 @@
 
 #Get territory & item group details
 def get_territory_details(filters):
-	return webnotes.conn.sql("""select t.name, td.item_group, td.target_qty, 
+	return frappe.conn.sql("""select t.name, td.item_group, td.target_qty, 
 		td.target_amount, t.distribution_id 
 		from `tabTerritory` t, `tabTarget Detail` td 
 		where td.parent=t.name and td.fiscal_year=%s order by t.name""", 
@@ -70,7 +70,7 @@
 def get_target_distribution_details(filters):
 	target_details = {}
 
-	for d in webnotes.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation 
+	for d in frappe.conn.sql("""select bd.name, bdd.month, bdd.percentage_allocation 
 		from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd
 		where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
 			target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
@@ -81,7 +81,7 @@
 def get_achieved_details(filters):
 	start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
 
-	item_details = webnotes.conn.sql("""select soi.item_code, soi.qty, soi.base_amount, so.transaction_date, 
+	item_details = frappe.conn.sql("""select soi.item_code, soi.qty, soi.base_amount, so.transaction_date, 
 		so.territory, MONTHNAME(so.transaction_date) as month_name 
 		from `tabSales Order Item` soi, `tabSales Order` so 
 		where soi.parent=so.name and so.docstatus=1 and so.transaction_date>=%s and 
@@ -108,7 +108,7 @@
 			month = datetime.date(2013, month_id, 1).strftime('%B')
 			
 			tim_map.setdefault(td.name, {}).setdefault(td.item_group, {})\
-				.setdefault(month, webnotes._dict({
+				.setdefault(month, frappe._dict({
 					"target": 0.0, "achieved": 0.0
 				}))
 
@@ -130,4 +130,4 @@
 	return tim_map
 
 def get_item_group(item_name):
-	return webnotes.conn.get_value("Item", item_name, "item_group")
\ No newline at end of file
+	return frappe.conn.get_value("Item", item_name, "item_group")
\ No newline at end of file
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 0f7bc67..6eb2136 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -8,8 +8,8 @@
 // cur_frm.cscript.other_fname - fieldname
 // cur_frm.cscript.sales_team_fname - Sales Team fieldname
 
-wn.provide("erpnext.selling");
-wn.require("assets/erpnext/js/transaction.js");
+frappe.provide("erpnext.selling");
+frappe.require("assets/erpnext/js/transaction.js");
 
 {% include "public/js/controllers/accounts.js" %}
 
@@ -70,9 +70,9 @@
 		
 		if(this.frm.fields_dict[this.fname].grid.get_field('batch_no')) {
 			this.frm.set_query("batch_no", this.fname, function(doc, cdt, cdn) {
-				var item = wn.model.get_doc(cdt, cdn);
+				var item = frappe.model.get_doc(cdt, cdn);
 				if(!item.item_code) {
-					wn.throw(wn._("Please enter Item Code to get batch no"));
+					frappe.throw(frappe._("Please enter Item Code to get batch no"));
 				} else {
 					filters = {
 						'item_code': item.item_code,
@@ -124,8 +124,8 @@
 	},
 	
 	price_list_rate: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]);
 		
 		item.rate = flt(item.price_list_rate * (1 - item.discount_percentage / 100.0),
 			precision("rate", item));
@@ -134,7 +134,7 @@
 	},
 	
 	discount_percentage: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(!item.price_list_rate) {
 			item.discount_percentage = 0.0;
 		} else {
@@ -143,8 +143,8 @@
 	},
 	
 	rate: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["rate", "price_list_rate"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["rate", "price_list_rate"]);
 		
 		if(item.price_list_rate) {
 			item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
@@ -167,13 +167,13 @@
 	
 	total_commission: function() {
 		if(this.frm.doc.net_total) {
-			wn.model.round_floats_in(this.frm.doc, ["net_total", "total_commission"]);
+			frappe.model.round_floats_in(this.frm.doc, ["net_total", "total_commission"]);
 			
 			if(this.frm.doc.net_total < this.frm.doc.total_commission) {
-				var msg = (wn._("[Error]") + " " + 
-					wn._(wn.meta.get_label(this.frm.doc.doctype, "total_commission", 
+				var msg = (frappe._("[Error]") + " " + 
+					frappe._(frappe.meta.get_label(this.frm.doc.doctype, "total_commission", 
 						this.frm.doc.name)) + " > " + 
-					wn._(wn.meta.get_label(this.frm.doc.doctype, "net_total", this.frm.doc.name)));
+					frappe._(frappe.meta.get_label(this.frm.doc.doctype, "net_total", this.frm.doc.name)));
 				msgprint(msg);
 				throw msg;
 			}
@@ -184,7 +184,7 @@
 	},
 	
 	allocated_percentage: function(doc, cdt, cdn) {
-		var sales_person = wn.model.get_doc(cdt, cdn);
+		var sales_person = frappe.model.get_doc(cdt, cdn);
 		
 		if(sales_person.allocated_percentage) {
 			sales_person.allocated_percentage = flt(sales_person.allocated_percentage,
@@ -199,7 +199,7 @@
 	},
 	
 	warehouse: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
+		var item = frappe.model.get_doc(cdt, cdn);
 		if(item.item_code && item.warehouse) {
 			return this.frm.call({
 				method: "erpnext.selling.utils.get_available_qty",
@@ -214,7 +214,7 @@
 	
 	toggle_rounded_total: function() {
 		var me = this;
-		if(cint(wn.defaults.get_global_default("disable_rounded_total"))) {
+		if(cint(frappe.defaults.get_global_default("disable_rounded_total"))) {
 			$.each(["rounded_total", "rounded_total_export"], function(i, fieldname) {
 				me.frm.set_df_property(fieldname, "print_hide", 1);
 				me.frm.toggle_display(fieldname, false);
@@ -223,8 +223,8 @@
 	},
 	
 	toggle_editable_price_list_rate: function() {
-		var df = wn.meta.get_docfield(this.tname, "price_list_rate", this.frm.doc.name);
-		var editable_price_list_rate = cint(wn.defaults.get_default("editable_price_list_rate"));
+		var df = frappe.meta.get_docfield(this.tname, "price_list_rate", this.frm.doc.name);
+		var editable_price_list_rate = cint(frappe.defaults.get_default("editable_price_list_rate"));
 		
 		if(df && editable_price_list_rate) {
 			df.read_only = 0;
@@ -247,7 +247,7 @@
 		
 		if (!this.discount_amount_applied) {
 			$.each(this.frm.item_doclist, function(i, item) {
-				wn.model.round_floats_in(item);
+				frappe.model.round_floats_in(item);
 				item.amount = flt(item.rate * item.qty, precision("amount", item));
 
 				me._set_in_company_currency(item, "price_list_rate", "base_price_list_rate");
@@ -328,7 +328,7 @@
 			me.frm.doc.net_total_export += item.amount;
 		});
 
-		wn.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]);
+		frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]);
 	},
 	
 	calculate_totals: function() {
@@ -399,7 +399,7 @@
 		// paid_amount and write_off_amount is only for POS Invoice
 		// total_advance is only for non POS Invoice
 		if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) {
-			wn.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
+			frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount",
 				"paid_amount"]);
 			var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount - this.frm.doc.total_advance;
 			this.frm.doc.paid_amount = this.frm.doc.is_pos? flt(total_amount_to_pay): 0.0;
@@ -412,8 +412,8 @@
 	calculate_commission: function() {
 		if(this.frm.fields_dict.commission_rate) {
 			if(this.frm.doc.commission_rate > 100) {
-				var msg = wn._(wn.meta.get_label(this.frm.doc.doctype, "commission_rate", this.frm.doc.name)) +
-					" " + wn._("cannot be greater than 100");
+				var msg = frappe._(frappe.meta.get_label(this.frm.doc.doctype, "commission_rate", this.frm.doc.name)) +
+					" " + frappe._("cannot be greater than 100");
 				msgprint(msg);
 				throw msg;
 			}
@@ -425,9 +425,9 @@
 	
 	calculate_contribution: function() {
 		var me = this;
-		$.each(wn.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, 
+		$.each(frappe.model.get_doclist(this.frm.doc.doctype, this.frm.doc.name, 
 			{parentfield: "sales_team"}), function(i, sales_person) {
-				wn.model.round_floats_in(sales_person);
+				frappe.model.round_floats_in(sales_person);
 				if(sales_person.allocated_percentage) {
 					sales_person.allocated_amount = flt(
 						me.frm.doc.net_total * sales_person.allocated_percentage / 100.0,
@@ -467,9 +467,9 @@
 		
 		var setup_field_label_map = function(fields_list, currency) {
 			$.each(fields_list, function(i, fname) {
-				var docfield = wn.meta.docfield_map[me.frm.doc.doctype][fname];
+				var docfield = frappe.meta.docfield_map[me.frm.doc.doctype][fname];
 				if(docfield) {
-					var label = wn._(docfield.label || "").replace(/\([^\)]*\)/g, "");
+					var label = frappe._(docfield.label || "").replace(/\([^\)]*\)/g, "");
 					field_label_map[fname] = label.trim() + " (" + currency + ")";
 				}
 			});
@@ -511,9 +511,9 @@
 		var setup_field_label_map = function(fields_list, currency, parentfield) {
 			var grid_doctype = me.frm.fields_dict[parentfield].grid.doctype;
 			$.each(fields_list, function(i, fname) {
-				var docfield = wn.meta.docfield_map[grid_doctype][fname];
+				var docfield = frappe.meta.docfield_map[grid_doctype][fname];
 				if(docfield) {
-					var label = wn._(docfield.label || "").replace(/\([^\)]*\)/g, "");
+					var label = frappe._(docfield.label || "").replace(/\([^\)]*\)/g, "");
 					field_label_map[grid_doctype + "-" + fname] = 
 						label.trim() + " (" + currency + ")";
 				}
@@ -536,11 +536,11 @@
 		// toggle columns
 		var item_grid = this.frm.fields_dict[this.fname].grid;
 		var show = (this.frm.doc.currency != company_currency) || 
-			(wn.model.get_doclist(cur_frm.doctype, cur_frm.docname, 
+			(frappe.model.get_doclist(cur_frm.doctype, cur_frm.docname, 
 				{parentfield: "other_charges", included_in_print_rate: 1}).length);
 		
 		$.each(["base_rate", "base_price_list_rate", "base_amount"], function(i, fname) {
-			if(wn.meta.get_docfield(item_grid.doctype, fname))
+			if(frappe.meta.get_docfield(item_grid.doctype, fname))
 				item_grid.set_column_disp(fname, show);
 		});
 		
@@ -548,7 +548,7 @@
 		var $wrapper = $(this.frm.wrapper);
 		$.each(field_label_map, function(fname, label) {
 			fname = fname.split("-");
-			var df = wn.meta.get_docfield(fname[0], fname[1], me.frm.doc.name);
+			var df = frappe.meta.get_docfield(fname[0], fname[1], me.frm.doc.name);
 			if(df) df.label = label;
 		});
 	},
@@ -556,8 +556,8 @@
 	shipping_address_name: function () {
 		var me = this;
 		if(this.frm.doc.shipping_address_name) {
-			wn.model.with_doc("Address", this.frm.doc.shipping_address_name, function(name) {
-				var address = wn.model.get_doc("Address", name);
+			frappe.model.with_doc("Address", this.frm.doc.shipping_address_name, function(name) {
+				var address = frappe.model.get_doc("Address", name);
 			
 				var out = $.map(["address_line1", "address_line2", "city"], 
 					function(f) { return address[f]; });
@@ -584,17 +584,17 @@
 		
 		if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
 			help_msg = "<div class='alert alert-warning'>" +
-				wn._("For 'Sales BOM' items, warehouse, serial no and batch no \
+				frappe._("For 'Sales BOM' items, warehouse, serial no and batch no \
 				will be considered from the 'Packing List' table. \
 				If warehouse and batch no are same for all packing items for any 'Sales BOM' item, \
 				those values can be entered in the main item table, values will be copied to 'Packing List' table.")+
 			"</div>";
-			wn.meta.get_docfield(doc.doctype, 'sales_bom_help', doc.name).options = help_msg;
+			frappe.meta.get_docfield(doc.doctype, 'sales_bom_help', doc.name).options = help_msg;
 		} 
 	} else {
 		$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(false);
 		if (inList(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
-			wn.meta.get_docfield(doc.doctype, 'sales_bom_help', doc.name).options = '';
+			frappe.meta.get_docfield(doc.doctype, 'sales_bom_help', doc.name).options = '';
 		}
 	}
 	refresh_field('sales_bom_help');
diff --git a/erpnext/setup/doctype/applicable_territory/applicable_territory.py b/erpnext/setup/doctype/applicable_territory/applicable_territory.py
index eaa0f46..cb42e2e 100644
--- a/erpnext/setup/doctype/applicable_territory/applicable_territory.py
+++ b/erpnext/setup/doctype/applicable_territory/applicable_territory.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index 98d99b1..cdc3d6f 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, has_common, make_esc
-from webnotes.model.bean import getlist
-from webnotes import session, msgprint
+from frappe.utils import cstr, flt, has_common, make_esc
+from frappe.model.bean import getlist
+from frappe import session, msgprint
 from erpnext.setup.utils import get_company_currency
 
 	
@@ -27,15 +27,15 @@
 				amt_list.append(flt(x[0]))
 			max_amount = max(amt_list)
 			
-			app_dtl = webnotes.conn.sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and company = %s %s" % ('%s', '%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on, company))
+			app_dtl = frappe.conn.sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and company = %s %s" % ('%s', '%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on, company))
 			
 			if not app_dtl:
-				app_dtl = webnotes.conn.sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and ifnull(company,'') = '' %s" % ('%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on)) 
+				app_dtl = frappe.conn.sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and ifnull(company,'') = '' %s" % ('%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on)) 
 			for d in app_dtl:
 				if(d[0]): appr_users.append(d[0])
 				if(d[1]): appr_roles.append(d[1])
 			
-			if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, [session['user']]):
+			if not has_common(appr_roles, frappe.user.get_roles()) and not has_common(appr_users, [session['user']]):
 				msg, add_msg = '',''
 				if max_amount:
 					dcc = get_company_currency(self.doc.company)
@@ -57,18 +57,18 @@
 		add_cond1,add_cond2	= '',''
 		if based_on == 'Itemwise Discount':
 			add_cond1 += " and master_name = '"+cstr(item)+"'"
-			itemwise_exists = webnotes.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s" % ('%s', '%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on, company))
+			itemwise_exists = frappe.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s" % ('%s', '%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on, company))
 			if not itemwise_exists:
-				itemwise_exists = webnotes.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and ifnull(company,'') = '' and docstatus != 2 %s %s" % ('%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on))
+				itemwise_exists = frappe.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and ifnull(company,'') = '' and docstatus != 2 %s %s" % ('%s', '%s', '%s', cond, add_cond1), (doctype_name, total, based_on))
 			if itemwise_exists:
 				self.get_appr_user_role(itemwise_exists, doctype_name, total, based_on, cond+add_cond1, item,company)
 				chk = 0
 		if chk == 1:
 			if based_on == 'Itemwise Discount': add_cond2 += " and ifnull(master_name,'') = ''"
-			appr = webnotes.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s" % ('%s', '%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on, company))
+			appr = frappe.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and company = %s and docstatus != 2 %s %s" % ('%s', '%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on, company))
 			
 			if not appr:
-				appr = webnotes.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and ifnull(company,'') = '' and docstatus != 2 %s %s"% ('%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on))
+				appr = frappe.conn.sql("select value from `tabAuthorization Rule` where transaction = %s and value <= %s and based_on = %s and ifnull(company,'') = '' and docstatus != 2 %s %s"% ('%s', '%s', '%s', cond, add_cond2), (doctype_name, total, based_on))
 			self.get_appr_user_role(appr, doctype_name, total, based_on, cond+add_cond2, item, company)
 			
 			
@@ -78,7 +78,7 @@
 		add_cond = ''
 		auth_value = av_dis
 		if val == 1: add_cond += " and system_user = '"+session['user']+"'"
-		elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(webnotes.user.get_roles())+"')")
+		elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(frappe.user.get_roles())+"')")
 		else: add_cond += " and ifnull(system_user,'') = '' and ifnull(system_role,'') = ''"
 		if based_on == 'Grand Total': auth_value = total
 		elif based_on == 'Customerwise Discount':
@@ -111,7 +111,7 @@
 		# ================
 		# Check for authorization set for individual user
 	 
-		based_on = [x[0] for x in webnotes.conn.sql("select distinct based_on from `tabAuthorization Rule` where transaction = %s and system_user = %s and (company = %s or ifnull(company,'')='') and docstatus != 2", (doctype_name, session['user'], company))]
+		based_on = [x[0] for x in frappe.conn.sql("select distinct based_on from `tabAuthorization Rule` where transaction = %s and system_user = %s and (company = %s or ifnull(company,'')='') and docstatus != 2", (doctype_name, session['user'], company))]
 
 		for d in based_on:
 			self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 1, company)
@@ -123,12 +123,12 @@
 		# Specific Role
 		# ===============
 		# Check for authorization set on particular roles
-		based_on = [x[0] for x in webnotes.conn.sql("""select based_on 
+		based_on = [x[0] for x in frappe.conn.sql("""select based_on 
 			from `tabAuthorization Rule` 
 			where transaction = %s and system_role IN (%s) and based_on IN (%s) 
 			and (company = %s or ifnull(company,'')='') 
 			and docstatus != 2
-		""" % ('%s', "'"+"','".join(webnotes.user.get_roles())+"'", "'"+"','".join(final_based_on)+"'", '%s'), (doctype_name, company))]
+		""" % ('%s', "'"+"','".join(frappe.user.get_roles())+"'", "'"+"','".join(final_based_on)+"'", '%s'), (doctype_name, company))]
 		
 		for d in based_on:
 			self.bifurcate_based_on_type(doctype_name, total, av_dis, d, doc_obj, 2, company)
@@ -147,9 +147,9 @@
 	# payroll related check
 	def get_value_based_rule(self,doctype_name,employee,total_claimed_amount,company):
 		val_lst =[]
-		val = webnotes.conn.sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and company = %s and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount,company))
+		val = frappe.conn.sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and company = %s and docstatus!=2",(doctype_name,employee,employee,total_claimed_amount,company))
 		if not val:
-			val = webnotes.conn.sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and ifnull(company,'') = '' and docstatus!=2",(doctype_name, employee, employee, total_claimed_amount))
+			val = frappe.conn.sql("select value from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)< %s and ifnull(company,'') = '' and docstatus!=2",(doctype_name, employee, employee, total_claimed_amount))
 
 		if val:
 			val_lst = [y[0] for y in val]
@@ -157,9 +157,9 @@
 			val_lst.append(0)
 	
 		max_val = max(val_lst)
-		rule = webnotes.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and company = %s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,company,employee,employee,flt(max_val)), as_dict=1)
+		rule = frappe.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and company = %s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,company,employee,employee,flt(max_val)), as_dict=1)
 		if not rule:
-			rule = webnotes.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and ifnull(company,'') = '' and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,employee,employee,flt(max_val)), as_dict=1)
+			rule = frappe.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and ifnull(company,'') = '' and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(value,0)= %s and docstatus!=2",(doctype_name,employee,employee,flt(max_val)), as_dict=1)
 
 		return rule
 	
@@ -174,9 +174,9 @@
 			if doctype_name == 'Expense Claim':
 				rule = self.get_value_based_rule(doctype_name,doc_obj.doc.employee,doc_obj.doc.total_claimed_amount, doc_obj.doc.company)
 			elif doctype_name == 'Appraisal':
-				rule = webnotes.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and company = %s and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee, doc_obj.doc.company),as_dict=1)				
+				rule = frappe.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and company = %s and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee, doc_obj.doc.company),as_dict=1)				
 				if not rule:
-					rule = webnotes.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(company,'') = '' and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee),as_dict=1)				
+					rule = frappe.conn.sql("select name, to_emp, to_designation, approving_role, approving_user from `tabAuthorization Rule` where transaction=%s and (to_emp=%s or to_designation IN (select designation from `tabEmployee` where name=%s)) and ifnull(company,'') = '' and docstatus!=2",(doctype_name,doc_obj.doc.employee, doc_obj.doc.employee),as_dict=1)				
 			
 			if rule:
 				for m in rule:
@@ -184,7 +184,7 @@
 						if m['approving_user']:
 							app_specific_user.append(m['approving_user'])
 						elif m['approving_role']:
-							user_lst = [z[0] for z in webnotes.conn.sql("select distinct t1.name from `tabProfile` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])]
+							user_lst = [z[0] for z in frappe.conn.sql("select distinct t1.name from `tabProfile` t1, `tabUserRole` t2 where t2.role=%s and t2.parent=t1.name and t1.name !='Administrator' and t1.name != 'Guest' and t1.docstatus !=2",m['approving_role'])]
 							for x in user_lst:
 								if not x in app_user:
 									app_user.append(x)
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.js b/erpnext/setup/doctype/authorization_rule/authorization_rule.js
index b814965..dd639ab 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.js
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.js
@@ -65,11 +65,11 @@
 }
 
 cur_frm.fields_dict.system_user.get_query = function(doc, cdt, cdn) {
-	return { query:"webnotes.core.doctype.profile.profile.profile_query" }
+	return { query:"frappe.core.doctype.profile.profile.profile_query" }
 }
 
 cur_frm.fields_dict.approving_user.get_query = function(doc, cdt, cdn) {
-	return { query:"webnotes.core.doctype.profile.profile.profile_query" }
+	return { query:"frappe.core.doctype.profile.profile.profile_query" }
 }
 
 cur_frm.fields_dict['approving_role'].get_query = cur_frm.fields_dict['system_role'].get_query;
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.py b/erpnext/setup/doctype/authorization_rule/authorization_rule.py
index 319e325..196b3b0 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.py
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cint, cstr, flt, has_common
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
-from webnotes import msgprint
+from frappe.utils import cint, cstr, flt, has_common
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
+from frappe import msgprint
 
 	
 
@@ -18,7 +18,7 @@
 
 
 	def check_duplicate_entry(self):
-		exists = webnotes.conn.sql("""select name, docstatus from `tabAuthorization Rule` 
+		exists = frappe.conn.sql("""select name, docstatus from `tabAuthorization Rule` 
 			where transaction = %s and based_on = %s and system_user = %s 
 			and system_role = %s and approving_user = %s and approving_role = %s 
 			and to_emp =%s and to_designation=%s and name != %s""", 
@@ -38,12 +38,12 @@
 
 	def validate_master_name(self):
 		if self.doc.based_on == 'Customerwise Discount' and \
-				not webnotes.conn.sql("select name from tabCustomer where name = '%s' and docstatus != 2" % \
+				not frappe.conn.sql("select name from tabCustomer where name = '%s' and docstatus != 2" % \
 				 	(self.doc.master_name)):
 			msgprint("Please select valid Customer Name for Customerwise Discount", 
 			 	raise_exception=1)
 		elif self.doc.based_on == 'Itemwise Discount' and \
-				not webnotes.conn.sql("select name from tabItem where name = '%s' and docstatus != 2" % \
+				not frappe.conn.sql("select name from tabItem where name = '%s' and docstatus != 2" % \
 				 	(self.doc.master_name)):
 			msgprint("Please select valid Item Name for Itemwise Discount", raise_exception=1)
 		elif (self.doc.based_on == 'Grand Total' or \
@@ -64,7 +64,7 @@
 					Applicable To (Role).", raise_exception=1)
 			elif self.doc.system_user and self.doc.approving_role and \
 			 		has_common([self.doc.approving_role], [x[0] for x in \
-					webnotes.conn.sql("select role from `tabUserRole` where parent = '%s'" % \
+					frappe.conn.sql("select role from `tabUserRole` where parent = '%s'" % \
 					 	(self.doc.system_user))]):
 				msgprint("System User : %s is assigned role : %s. So rule does not make sense" % 
 				 	(self.doc.system_user,self.doc.approving_role), raise_exception=1)
diff --git a/erpnext/setup/doctype/backup_manager/backup_dropbox.py b/erpnext/setup/doctype/backup_manager/backup_dropbox.py
index 9c1decf..4ee0183 100644
--- a/erpnext/setup/doctype/backup_manager/backup_dropbox.py
+++ b/erpnext/setup/doctype/backup_manager/backup_dropbox.py
@@ -12,11 +12,11 @@
 
 from __future__ import unicode_literals
 import os
-import webnotes
-from webnotes.utils import get_request_site_address, cstr
-from webnotes import _
+import frappe
+from frappe.utils import get_request_site_address, cstr
+from frappe import _
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_dropbox_authorize_url():
 	sess = get_dropbox_session()
 	request_token = sess.obtain_request_token()
@@ -31,21 +31,21 @@
 		"secret": request_token.secret,
 	}
 
-@webnotes.whitelist(allow_guest=True)
+@frappe.whitelist(allow_guest=True)
 def dropbox_callback(oauth_token=None, not_approved=False):
 	from dropbox import client
 	if not not_approved:
-		if webnotes.conn.get_value("Backup Manager", None, "dropbox_access_key")==oauth_token:		
+		if frappe.conn.get_value("Backup Manager", None, "dropbox_access_key")==oauth_token:		
 			allowed = 1
 			message = "Dropbox access allowed."
 
 			sess = get_dropbox_session()
-			sess.set_request_token(webnotes.conn.get_value("Backup Manager", None, "dropbox_access_key"), 
-				webnotes.conn.get_value("Backup Manager", None, "dropbox_access_secret"))
+			sess.set_request_token(frappe.conn.get_value("Backup Manager", None, "dropbox_access_key"), 
+				frappe.conn.get_value("Backup Manager", None, "dropbox_access_secret"))
 			access_token = sess.obtain_access_token()
-			webnotes.conn.set_value("Backup Manager", "Backup Manager", "dropbox_access_key", access_token.key)
-			webnotes.conn.set_value("Backup Manager", "Backup Manager", "dropbox_access_secret", access_token.secret)
-			webnotes.conn.set_value("Backup Manager", "Backup Manager", "dropbox_access_allowed", allowed)
+			frappe.conn.set_value("Backup Manager", "Backup Manager", "dropbox_access_key", access_token.key)
+			frappe.conn.set_value("Backup Manager", "Backup Manager", "dropbox_access_secret", access_token.secret)
+			frappe.conn.set_value("Backup Manager", "Backup Manager", "dropbox_access_allowed", allowed)
 			dropbox_client = client.DropboxClient(sess)
 			try:
 				dropbox_client.file_create_folder("files")
@@ -59,28 +59,28 @@
 		allowed = 0
 		message = "Dropbox Access not approved."
 
-	webnotes.local.message_title = "Dropbox Approval"
-	webnotes.local.message = "<h3>%s</h3><p>Please close this window.</p>" % message
+	frappe.local.message_title = "Dropbox Approval"
+	frappe.local.message = "<h3>%s</h3><p>Please close this window.</p>" % message
 	
 	if allowed:
-		webnotes.local.message_success = True
+		frappe.local.message_success = True
 	
-	webnotes.conn.commit()
-	webnotes.response['type'] = 'page'
-	webnotes.response['page_name'] = 'message.html'
+	frappe.conn.commit()
+	frappe.response['type'] = 'page'
+	frappe.response['page_name'] = 'message.html'
 
 def backup_to_dropbox():
 	from dropbox import client, session
 	from conf import dropbox_access_key, dropbox_secret_key
-	from webnotes.utils.backups import new_backup
-	from webnotes.utils import get_files_path, get_backups_path
-	if not webnotes.conn:
-		webnotes.connect()
+	from frappe.utils.backups import new_backup
+	from frappe.utils import get_files_path, get_backups_path
+	if not frappe.conn:
+		frappe.connect()
 
 	sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
 
-	sess.set_token(webnotes.conn.get_value("Backup Manager", None, "dropbox_access_key"),
-		webnotes.conn.get_value("Backup Manager", None, "dropbox_access_secret"))
+	sess.set_token(frappe.conn.get_value("Backup Manager", None, "dropbox_access_key"),
+		frappe.conn.get_value("Backup Manager", None, "dropbox_access_secret"))
 	
 	dropbox_client = client.DropboxClient(sess)
 
@@ -89,7 +89,7 @@
 	filename = os.path.join(get_backups_path(), os.path.basename(backup.backup_path_db))
 	upload_file_to_dropbox(filename, "/database", dropbox_client)
 
-	webnotes.conn.close()
+	frappe.conn.close()
 	response = dropbox_client.metadata("/files")
 	
 	# upload files to files folder
@@ -110,21 +110,21 @@
 				upload_file_to_dropbox(filepath, "/files", dropbox_client)
 			except Exception:
 				did_not_upload.append(filename)
-				error_log.append(webnotes.get_traceback())
+				error_log.append(frappe.get_traceback())
 	
-	webnotes.connect()
+	frappe.connect()
 	return did_not_upload, list(set(error_log))
 
 def get_dropbox_session():
 	try:
 		from dropbox import session
 	except:
-		webnotes.msgprint(_("Please install dropbox python module"), raise_exception=1)
+		frappe.msgprint(_("Please install dropbox python module"), raise_exception=1)
 		
 	try:
 		from conf import dropbox_access_key, dropbox_secret_key
 	except ImportError:
-		webnotes.msgprint(_("Please set Dropbox access keys in") + " conf.py", 
+		frappe.msgprint(_("Please set Dropbox access keys in") + " conf.py", 
 		raise_exception=True)
 	sess = session.DropboxSession(dropbox_access_key, dropbox_secret_key, "app_folder")
 	return sess
diff --git a/erpnext/setup/doctype/backup_manager/backup_googledrive.py b/erpnext/setup/doctype/backup_manager/backup_googledrive.py
index 3f89126..8532e74 100644
--- a/erpnext/setup/doctype/backup_manager/backup_googledrive.py
+++ b/erpnext/setup/doctype/backup_manager/backup_googledrive.py
@@ -17,10 +17,10 @@
 import httplib2
 import os
 import mimetypes
-import webnotes
+import frappe
 import oauth2client.client
-from webnotes.utils import cstr
-from webnotes import _, msgprint
+from frappe.utils import cstr
+from frappe import _, msgprint
 from apiclient.discovery import build
 from apiclient.http import MediaFileUpload
 
@@ -29,7 +29,7 @@
 import logging
 logging.basicConfig()
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_gdrive_authorize_url():
 	flow = get_gdrive_flow()
 	authorize_url = flow.step1_get_authorize_url()
@@ -38,8 +38,8 @@
 	}
 
 def upload_files(name, mimetype, service, folder_id):
-	if not webnotes.conn:
-		webnotes.connect()
+	if not frappe.conn:
+		frappe.connect()
 	file_name = os.path.basename(name)
 	media_body = MediaFileUpload(name, mimetype=mimetype, resumable=True)
 	body = {
@@ -57,11 +57,11 @@
 		status, response = request.next_chunk()
 
 def backup_to_gdrive():
-	from webnotes.utils.backups import new_backup
-	if not webnotes.conn:
-		webnotes.connect()
+	from frappe.utils.backups import new_backup
+	if not frappe.conn:
+		frappe.connect()
 	get_gdrive_flow()
-	credentials_json = webnotes.conn.get_value("Backup Manager", None, "gdrive_credentials")
+	credentials_json = frappe.conn.get_value("Backup Manager", None, "gdrive_credentials")
 	credentials = oauth2client.client.Credentials.new_from_json(credentials_json)
 	http = httplib2.Http()
 	http = credentials.authorize(http)
@@ -69,21 +69,21 @@
 
 	# upload database
 	backup = new_backup()
-	path = os.path.join(webnotes.local.site_path, "public", "backups")
+	path = os.path.join(frappe.local.site_path, "public", "backups")
 	filename = os.path.join(path, os.path.basename(backup.backup_path_db))
 	
 	# upload files to database folder
 	upload_files(filename, 'application/x-gzip', drive_service, 
-		webnotes.conn.get_value("Backup Manager", None, "database_folder_id"))
+		frappe.conn.get_value("Backup Manager", None, "database_folder_id"))
 	
 	# upload files to files folder
 	did_not_upload = []
 	error_log = []
 	
-	files_folder_id = webnotes.conn.get_value("Backup Manager", None, "files_folder_id")
+	files_folder_id = frappe.conn.get_value("Backup Manager", None, "files_folder_id")
 	
-	webnotes.conn.close()
-	path = os.path.join(webnotes.local.site_path, "public", "files")
+	frappe.conn.close()
+	path = os.path.join(frappe.local.site_path, "public", "files")
 	for filename in os.listdir(path):
 		filename = cstr(filename)
 		found = False
@@ -109,22 +109,22 @@
 				did_not_upload.append(filename)
 				error_log.append(cstr(e))
 	
-	webnotes.connect()
+	frappe.connect()
 	return did_not_upload, list(set(error_log))
 
 def get_gdrive_flow():
 	from oauth2client.client import OAuth2WebServerFlow
-	from webnotes import conf
+	from frappe import conf
 	
 	if not "gdrive_client_id" in conf:
-		webnotes.msgprint(_("Please set Google Drive access keys in") + " conf.py", 
+		frappe.msgprint(_("Please set Google Drive access keys in") + " conf.py", 
 		raise_exception=True)
 
 	flow = OAuth2WebServerFlow(conf.gdrive_client_id, conf.gdrive_client_secret, 
 		"https://www.googleapis.com/auth/drive", 'urn:ietf:wg:oauth:2.0:oob')
 	return flow
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def gdrive_callback(verification_code = None):
 	flow = get_gdrive_flow()
 	if verification_code:
@@ -139,17 +139,17 @@
 	database_folder_id = create_folder('database', drive_service, erpnext_folder_id)
 	files_folder_id = create_folder('files', drive_service, erpnext_folder_id)
 
-	webnotes.conn.set_value("Backup Manager", "Backup Manager", "gdrive_access_allowed", allowed)
-	webnotes.conn.set_value("Backup Manager", "Backup Manager", "database_folder_id", database_folder_id)
-	webnotes.conn.set_value("Backup Manager", "Backup Manager", "files_folder_id", files_folder_id)
+	frappe.conn.set_value("Backup Manager", "Backup Manager", "gdrive_access_allowed", allowed)
+	frappe.conn.set_value("Backup Manager", "Backup Manager", "database_folder_id", database_folder_id)
+	frappe.conn.set_value("Backup Manager", "Backup Manager", "files_folder_id", files_folder_id)
 	final_credentials = credentials.to_json()
-	webnotes.conn.set_value("Backup Manager", "Backup Manager", "gdrive_credentials", final_credentials)
+	frappe.conn.set_value("Backup Manager", "Backup Manager", "gdrive_credentials", final_credentials)
 
-	webnotes.msgprint("Updated")
+	frappe.msgprint("Updated")
 
 def create_erpnext_folder(service):
-	if not webnotes.conn:
-		webnotes.connect()
+	if not frappe.conn:
+		frappe.connect()
 	erpnext = {
 		'title': 'erpnext',
 		'mimeType': 'application/vnd.google-apps.folder'
diff --git a/erpnext/setup/doctype/backup_manager/backup_manager.js b/erpnext/setup/doctype/backup_manager/backup_manager.js
index dfe6bd5..9fd16dc 100644
--- a/erpnext/setup/doctype/backup_manager/backup_manager.js
+++ b/erpnext/setup/doctype/backup_manager/backup_manager.js
@@ -7,12 +7,12 @@
 		
 		if(!(cint(cur_frm.doc.dropbox_access_allowed) || 
 			cint(cur_frm.doc.gdrive_access_allowed))) {
-				cur_frm.set_intro(wn._("You can start by selecting backup frequency and \
+				cur_frm.set_intro(frappe._("You can start by selecting backup frequency and \
 					granting access for sync"));
 		} else {
 			var services = {
-				"dropbox": wn._("Dropbox"),
-				"gdrive": wn._("Google Drive")
+				"dropbox": frappe._("Dropbox"),
+				"gdrive": frappe._("Google Drive")
 			}
 			var active_services = [];
 			
@@ -25,8 +25,8 @@
 			});
 			
 			if(active_services.length > 0) {
-				cur_frm.set_intro(wn._("Backups will be uploaded to") + ": " + 
-					wn.utils.comma_and(active_services));
+				cur_frm.set_intro(frappe._("Backups will be uploaded to") + ": " + 
+					frappe.utils.comma_and(active_services));
 			} else {
 				cur_frm.set_intro("");
 			}
@@ -36,8 +36,8 @@
 	
 	validate_send_notifications_to: function() {
 		if(!cur_frm.doc.send_notifications_to) {
-			msgprint(wn._("Please specify") + ": " + 
-				wn._(wn.meta.get_label(cur_frm.doctype, "send_notifications_to")));
+			msgprint(frappe._("Please specify") + ": " + 
+				frappe._(frappe.meta.get_label(cur_frm.doctype, "send_notifications_to")));
 			return false;
 		}
 		
@@ -46,7 +46,7 @@
 	
 	allow_dropbox_access: function() {
 		if(cur_frm.cscript.validate_send_notifications_to()) {
-			return wn.call({
+			return frappe.call({
 				method: "erpnext.setup.doctype.backup_manager.backup_dropbox.get_dropbox_authorize_url",
 				callback: function(r) {
 					if(!r.exc) {
@@ -63,7 +63,7 @@
 	
 	allow_gdrive_access: function() {
 		if(cur_frm.cscript.validate_send_notifications_to()) {
-			return wn.call({
+			return frappe.call({
 				method: "erpnext.setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
 				callback: function(r) {
 					if(!r.exc) {
@@ -75,7 +75,7 @@
 	},
 	
 	validate_gdrive: function() {
-		return wn.call({
+		return frappe.call({
 			method: "erpnext.setup.doctype.backup_manager.backup_googledrive.gdrive_callback",
 			args: {
 				verification_code: cur_frm.doc.verification_code
diff --git a/erpnext/setup/doctype/backup_manager/backup_manager.py b/erpnext/setup/doctype/backup_manager/backup_manager.py
index b6a5ace..f6abdb1 100644
--- a/erpnext/setup/doctype/backup_manager/backup_manager.py
+++ b/erpnext/setup/doctype/backup_manager/backup_manager.py
@@ -4,8 +4,8 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
 class DocType:
 	def __init__(self, d, dl):
@@ -18,13 +18,13 @@
 	take_backups_if("Weekly")
 
 def take_backups_if(freq):
-	if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_dropbox")==freq:
+	if frappe.conn.get_value("Backup Manager", None, "upload_backups_to_dropbox")==freq:
 		take_backups_dropbox()
 		
-	# if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
+	# if frappe.conn.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
 	# 	take_backups_gdrive()
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def take_backups_dropbox():
 	did_not_upload, error_log = [], []
 	try:
@@ -35,12 +35,12 @@
 		send_email(True, "Dropbox")
 	except Exception:
 		file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
-		error_message = ("\n".join(file_and_error) + "\n" + webnotes.get_traceback())
-		webnotes.errprint(error_message)
+		error_message = ("\n".join(file_and_error) + "\n" + frappe.get_traceback())
+		frappe.errprint(error_message)
 		send_email(False, "Dropbox", error_message)
 
 #backup to gdrive 
-@webnotes.whitelist()
+@frappe.whitelist()
 def take_backups_gdrive():
 	did_not_upload, error_log = [], []
 	try:
@@ -51,12 +51,12 @@
 		send_email(True, "Google Drive")
 	except Exception:
 		file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
-		error_message = ("\n".join(file_and_error) + "\n" + webnotes.get_traceback())
-		webnotes.errprint(error_message)
+		error_message = ("\n".join(file_and_error) + "\n" + frappe.get_traceback())
+		frappe.errprint(error_message)
 		send_email(False, "Google Drive", error_message)
 
 def send_email(success, service_name, error_status=None):
-	from webnotes.utils.email_lib import sendmail
+	from frappe.utils.email_lib import sendmail
 	if success:
 		subject = "Backup Upload Successful"
 		message ="""<h3>Backup Uploaded Successfully</h3><p>Hi there, this is just to inform you 
@@ -71,8 +71,8 @@
 		<p>Please contact your system manager for more information.</p>
 		""" % (service_name, error_status)
 	
-	if not webnotes.conn:
-		webnotes.connect()
+	if not frappe.conn:
+		frappe.connect()
 	
-	recipients = webnotes.conn.get_value("Backup Manager", None, "send_notifications_to").split(",")
+	recipients = frappe.conn.get_value("Backup Manager", None, "send_notifications_to").split(",")
 	sendmail(recipients, subject=subject, msg=message)
diff --git a/erpnext/setup/doctype/brand/brand.py b/erpnext/setup/doctype/brand/brand.py
index 576da8e..d30eab6 100644
--- a/erpnext/setup/doctype/brand/brand.py
+++ b/erpnext/setup/doctype/brand/brand.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/company/charts/import_from_openerp.py b/erpnext/setup/doctype/company/charts/import_from_openerp.py
index f77b02c..c583531 100644
--- a/erpnext/setup/doctype/company/charts/import_from_openerp.py
+++ b/erpnext/setup/doctype/company/charts/import_from_openerp.py
@@ -8,8 +8,8 @@
 
 import os, json
 from xml.etree import ElementTree as ET
-from webnotes.utils.datautils import read_csv_content
-from webnotes.utils import cstr
+from frappe.utils.datautils import read_csv_content
+from frappe.utils import cstr
 
 path = "/Users/rmehta/Downloads/openerp/openerp/addons"
 chart_roots = []
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index e047c97..7ce369c 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -14,7 +14,7 @@
 }
 
 cur_frm.cscript.replace_abbr = function() {
-	var dialog = new wn.ui.Dialog({
+	var dialog = new frappe.ui.Dialog({
 		title: "Replace Abbr",
 		fields: [
 			{"fieldtype": "Data", "label": "New Abbreviation", "fieldname": "new_abbr",
@@ -26,7 +26,7 @@
 	dialog.fields_dict.update.$input.click(function() {
 		args = dialog.get_values();
 		if(!args) return;
-		return wn.call({
+		return frappe.call({
 			method: "erpnext.setup.doctype.company.company.replace_abbr",
 			args: {
 				"company": cur_frm.doc.name,
@@ -35,7 +35,7 @@
 			},
 			callback: function(r) {
 				if(r.exc) {
-					msgprint(wn._("There were errors."));
+					msgprint(frappe._("There were errors."));
 					return;
 				} else {
 					cur_frm.set_value("abbr", args.new_abbr);
@@ -61,8 +61,8 @@
 
 cur_frm.cscript.company_name = function(doc){
   if(doc.company_name && cur_frm.cscript.has_special_chars(doc.company_name)){   
-    msgprint(("<font color=red>"+wn._("Special Characters")+" <b>! @ # $ % ^ * + = - [ ] ' ; , / { } | : < > ?</b> "+
-    	wn._("are not allowed for ")+"</font>\n"+wn._("Company Name")+" <b> "+ doc.company_name +"</b>"))        
+    msgprint(("<font color=red>"+frappe._("Special Characters")+" <b>! @ # $ % ^ * + = - [ ] ' ; , / { } | : < > ?</b> "+
+    	frappe._("are not allowed for ")+"</font>\n"+frappe._("Company Name")+" <b> "+ doc.company_name +"</b>"))        
     doc.company_name = '';
     refresh_field('company_name');
   }
@@ -70,8 +70,8 @@
 
 cur_frm.cscript.abbr = function(doc){
   if(doc.abbr && cur_frm.cscript.has_special_chars(doc.abbr)){   
-    msgprint("<font color=red>"+wn._("Special Characters ")+"<b>! @ # $ % ^ * + = - [ ] ' ; , / { } | : < > ?</b>" +
-    	wn._("are not allowed for")+ "</font>\nAbbr <b>" + doc.abbr +"</b>")        
+    msgprint("<font color=red>"+frappe._("Special Characters ")+"<b>! @ # $ % ^ * + = - [ ] ' ; , / { } | : < > ?</b>" +
+    	frappe._("are not allowed for")+ "</font>\nAbbr <b>" + doc.abbr +"</b>")        
     doc.abbr = '';
     refresh_field('abbr');
   }
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 34e5ca4..9279be6 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
+import frappe
+from frappe import _, msgprint
 
-from webnotes.utils import cstr, cint
-import webnotes.defaults
+from frappe.utils import cstr, cint
+import frappe.defaults
 
 
 class DocType:
@@ -20,7 +20,7 @@
 		exists = False
 		for doctype in ["Sales Invoice", "Delivery Note", "Sales Order", "Quotation",
 			"Purchase Invoice", "Purchase Receipt", "Purchase Order", "Supplier Quotation"]:
-				if webnotes.conn.sql("""select name from `tab%s` where company=%s and docstatus=1
+				if frappe.conn.sql("""select name from `tab%s` where company=%s and docstatus=1
 					limit 1""" % (doctype, "%s"), self.doc.name):
 						exists = True
 						break
@@ -29,35 +29,35 @@
 		
 	def validate(self):
 		if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5:
-			webnotes.msgprint("Abbreviation cannot have more than 5 characters",
+			frappe.msgprint("Abbreviation cannot have more than 5 characters",
 				raise_exception=1)
 				
-		self.previous_default_currency = webnotes.conn.get_value("Company", self.doc.name, "default_currency")
+		self.previous_default_currency = frappe.conn.get_value("Company", self.doc.name, "default_currency")
 		if self.doc.default_currency and self.previous_default_currency and \
 			self.doc.default_currency != self.previous_default_currency and \
 			self.check_if_transactions_exist():
 				msgprint(_("Sorry! You cannot change company's default currency, because there are existing transactions against it. You will need to cancel those transactions if you want to change the default currency."), raise_exception=True)
 
 	def on_update(self):
-		if not webnotes.conn.sql("""select name from tabAccount 
+		if not frappe.conn.sql("""select name from tabAccount 
 			where company=%s and docstatus<2 limit 1""", self.doc.name):
 			self.create_default_accounts()
 			self.create_default_warehouses()
 			self.create_default_web_page()
 		
-		if not webnotes.conn.get_value("Cost Center", {"group_or_ledger": "Ledger", 
+		if not frappe.conn.get_value("Cost Center", {"group_or_ledger": "Ledger", 
 				"company": self.doc.name}):
 			self.create_default_cost_center()
 			
 		self.set_default_accounts()
 
 		if self.doc.default_currency:
-			webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
+			frappe.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
 
 	def create_default_warehouses(self):
 		for whname in ("Stores", "Work In Progress", "Finished Goods"):
-			if not webnotes.conn.exists("Warehouse", whname + " - " + self.doc.abbr):
-				webnotes.bean({
+			if not frappe.conn.exists("Warehouse", whname + " - " + self.doc.abbr):
+				frappe.bean({
 					"doctype":"Warehouse",
 					"warehouse_name": whname,
 					"company": self.doc.name,
@@ -65,11 +65,11 @@
 				}).insert()
 			
 	def create_default_web_page(self):
-		if not webnotes.conn.get_value("Website Settings", None, "home_page") and \
-				not webnotes.conn.sql("select name from tabCompany where name!=%s", self.doc.name):
+		if not frappe.conn.get_value("Website Settings", None, "home_page") and \
+				not frappe.conn.sql("select name from tabCompany where name!=%s", self.doc.name):
 			import os
 			with open(os.path.join(os.path.dirname(__file__), "sample_home_page.html"), "r") as webfile:
-				webpage = webnotes.bean({
+				webpage = frappe.bean({
 					"doctype": "Web Page",
 					"title": self.doc.name + " Home",
 					"published": 1,
@@ -78,7 +78,7 @@
 				}).insert()
 			
 				# update in home page in settings
-				website_settings = webnotes.bean("Website Settings", "Website Settings")
+				website_settings = frappe.bean("Website Settings", "Website Settings")
 				website_settings.doc.home_page = webpage.doc.name
 				website_settings.doc.brand_html = self.doc.name
 				website_settings.doc.copyright = self.doc.name
@@ -95,7 +95,7 @@
 					"url": "blog"
 				})
 				website_settings.save()
-				style_settings = webnotes.bean("Style Settings", "Style Settings")
+				style_settings = frappe.bean("Style Settings", "Style Settings")
 				style_settings.doc.top_bar_background = "F2F2F2"
 				style_settings.doc.font_size = "15px"
 				style_settings.save()
@@ -217,7 +217,7 @@
 		for d in acc_list_common:
 			self.add_acc(d)
 
-		country = webnotes.conn.sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
+		country = frappe.conn.sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
 		country = country and cstr(country[0][0]) or ''
 
 		# load taxes (only for India)
@@ -226,7 +226,7 @@
 				self.add_acc(d)
 
 	def add_acc(self,lst):
-		account = webnotes.bean({
+		account = frappe.bean({
 			"doctype": "Account",
 			"freeze_account": "No",
 			"master_type": "",
@@ -240,8 +240,8 @@
 		def _set_default_accounts(accounts):
 			for a in accounts:
 				account_name = accounts[a] + " - " + self.doc.abbr
-				if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
-					webnotes.conn.set(self.doc, a, account_name)
+				if not self.doc.fields.get(a) and frappe.conn.exists("Account", account_name):
+					frappe.conn.set(self.doc, a, account_name)
 			
 		_set_default_accounts({
 			"receivables_group": "Accounts Receivable",
@@ -249,7 +249,7 @@
 			"default_cash_account": "Cash"
 		})
 		
-		if cint(webnotes.conn.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
+		if cint(frappe.conn.get_value("Accounts Settings", None, "auto_accounting_for_stock")):
 			_set_default_accounts({
 				"stock_received_but_not_billed": "Stock Received But Not Billed",
 				"stock_adjustment_account": "Stock Adjustment",
@@ -273,67 +273,67 @@
 		]
 		for cc in cc_list:
 			cc.update({"doctype": "Cost Center"})
-			cc_bean = webnotes.bean(cc)
+			cc_bean = frappe.bean(cc)
 			cc_bean.ignore_permissions = True
 		
 			if cc.get("cost_center_name") == self.doc.name:
 				cc_bean.ignore_mandatory = True
 			cc_bean.insert()
 			
-		webnotes.conn.set(self.doc, "cost_center", "Main - " + self.doc.abbr)
+		frappe.conn.set(self.doc, "cost_center", "Main - " + self.doc.abbr)
 
 	def on_trash(self):
 		"""
 			Trash accounts and cost centers for this company if no gl entry exists
 		"""
-		rec = webnotes.conn.sql("SELECT name from `tabGL Entry` where company = %s", self.doc.name)
+		rec = frappe.conn.sql("SELECT name from `tabGL Entry` where company = %s", self.doc.name)
 		if not rec:
 			#delete tabAccount
-			webnotes.conn.sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
+			frappe.conn.sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
 			
 			#delete cost center child table - budget detail
-			webnotes.conn.sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company = %s", self.doc.name)
+			frappe.conn.sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company = %s", self.doc.name)
 			#delete cost center
-			webnotes.conn.sql("delete from `tabCost Center` WHERE company = %s order by lft desc, rgt desc", self.doc.name)
+			frappe.conn.sql("delete from `tabCost Center` WHERE company = %s order by lft desc, rgt desc", self.doc.name)
 			
-		if not webnotes.conn.get_value("Stock Ledger Entry", {"company": self.doc.name}):
-			webnotes.conn.sql("""delete from `tabWarehouse` where company=%s""", self.doc.name)
+		if not frappe.conn.get_value("Stock Ledger Entry", {"company": self.doc.name}):
+			frappe.conn.sql("""delete from `tabWarehouse` where company=%s""", self.doc.name)
 			
-		webnotes.defaults.clear_default("company", value=self.doc.name)
+		frappe.defaults.clear_default("company", value=self.doc.name)
 			
-		webnotes.conn.sql("""update `tabSingles` set value=""
+		frappe.conn.sql("""update `tabSingles` set value=""
 			where doctype='Global Defaults' and field='default_company' 
 			and value=%s""", self.doc.name)
 			
 	def before_rename(self, olddn, newdn, merge=False):
 		if merge:
-			webnotes.throw(_("Sorry, companies cannot be merged"))
+			frappe.throw(_("Sorry, companies cannot be merged"))
 	
 	def after_rename(self, olddn, newdn, merge=False):
-		webnotes.conn.set(self.doc, "company_name", newdn)
+		frappe.conn.set(self.doc, "company_name", newdn)
 
-		webnotes.conn.sql("""update `tabDefaultValue` set defvalue=%s 
+		frappe.conn.sql("""update `tabDefaultValue` set defvalue=%s 
 			where defkey='Company' and defvalue=%s""", (newdn, olddn))
 
-		webnotes.defaults.clear_cache()
+		frappe.defaults.clear_cache()
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def replace_abbr(company, old, new):
-	webnotes.conn.set_value("Company", company, "abbr", new)
+	frappe.conn.set_value("Company", company, "abbr", new)
 	
 	def _rename_record(dt):
-		for d in webnotes.conn.sql("select name from `tab%s` where company=%s" % (dt, '%s'), company):
+		for d in frappe.conn.sql("select name from `tab%s` where company=%s" % (dt, '%s'), company):
 			parts = d[0].split(" - ")
 			if parts[-1].lower() == old.lower():
 				name_without_abbr = " - ".join(parts[:-1])
-				webnotes.rename_doc(dt, d[0], name_without_abbr + " - " + new)
+				frappe.rename_doc(dt, d[0], name_without_abbr + " - " + new)
 		
 	for dt in ["Account", "Cost Center", "Warehouse"]:
 		_rename_record(dt)
-		webnotes.conn.commit()
+		frappe.conn.commit()
 
 def get_name_with_abbr(name, company):
-	company_abbr = webnotes.conn.get_value("Company", company, "abbr")		
+	company_abbr = frappe.conn.get_value("Company", company, "abbr")		
 	parts = name.split(" - ")
 
 	if parts[-1].lower() != company_abbr.lower():
diff --git a/erpnext/setup/doctype/contact_control/contact_control.js b/erpnext/setup/doctype/contact_control/contact_control.js
index 2e45df6..9498449 100755
--- a/erpnext/setup/doctype/contact_control/contact_control.js
+++ b/erpnext/setup/doctype/contact_control/contact_control.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 cur_frm.cscript.get_states=function(doc, dt, dn) {
-	return $c('runserverobj', args={'method': 'check_state', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
+	return $c('runserverobj', args={'method': 'check_state', 'docs':frappe.model.compress(make_doclist(doc.doctype, doc.name))},
 		function(r, rt) {
 			if(r.message)
 				set_field_options('state', r.message);
@@ -121,7 +121,7 @@
 
 	// show delete
 	var $delete_doc = $wrapper.find('a.delete');
-	if (wn.model.can_delete(doctype))
+	if (frappe.model.can_delete(doctype))
 		$delete_doc.toggle(true);
 	else
 		$delete_doc.toggle(false);
@@ -142,8 +142,8 @@
 	}));
 	if (!go_ahead) return;
 
-	return wn.call({
-		method: 'webnotes.model.delete_doc',
+	return frappe.call({
+		method: 'frappe.model.delete_doc',
 		args: {
 			dt: doctype,
 			dn: name
@@ -161,11 +161,11 @@
 
 // Render List
 cur_frm.cscript.render_list = function(doc, doctype, wrapper, ListView, make_new_doc) {
-	wn.model.with_doctype(doctype, function(r) {
-		if((r && r['403']) || wn.boot.profile.all_read.indexOf(doctype)===-1) {
+	frappe.model.with_doctype(doctype, function(r) {
+		if((r && r['403']) || frappe.boot.profile.all_read.indexOf(doctype)===-1) {
 			return;
 		}
-		var RecordListView = wn.views.RecordListView.extend({
+		var RecordListView = frappe.views.RecordListView.extend({
 			default_docstatus: ['0', '1', '2'],
 			default_filters: [
 				[doctype, doc.doctype.toLowerCase().replace(" ", "_"), '=', doc.name],
diff --git a/erpnext/setup/doctype/contact_control/contact_control.py b/erpnext/setup/doctype/contact_control/contact_control.py
index 3b04c10..35bd61c 100644
--- a/erpnext/setup/doctype/contact_control/contact_control.py
+++ b/erpnext/setup/doctype/contact_control/contact_control.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self,doc,doclist=[]):
diff --git a/erpnext/setup/doctype/country/country.py b/erpnext/setup/doctype/country/country.py
index 576da8e..d30eab6 100644
--- a/erpnext/setup/doctype/country/country.py
+++ b/erpnext/setup/doctype/country/country.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/currency/currency.js b/erpnext/setup/doctype/currency/currency.js
index 6d11a8e..bdda70e 100644
--- a/erpnext/setup/doctype/currency/currency.js
+++ b/erpnext/setup/doctype/currency/currency.js
@@ -4,6 +4,6 @@
 cur_frm.cscript.refresh = function(doc) {
 	cur_frm.set_intro("");
 	if(!cur_frm.doc.enabled) {
-		cur_frm.set_intro(wn._("This Currency is disabled. Enable to use in transactions"))
+		cur_frm.set_intro(frappe._("This Currency is disabled. Enable to use in transactions"))
 	}
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/currency/currency.py b/erpnext/setup/doctype/currency/currency.py
index 8eb964b..5c7097d 100644
--- a/erpnext/setup/doctype/currency/currency.py
+++ b/erpnext/setup/doctype/currency/currency.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import throw, _
+import frappe
+from frappe import throw, _
 
 class DocType:
 	def __init__(self, d, dl):
@@ -12,7 +12,7 @@
 def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
 	"""common validation for currency and price list currency"""
 
-	company_currency = webnotes.conn.get_value("Company", company, "default_currency")
+	company_currency = frappe.conn.get_value("Company", company, "default_currency")
 
 	if not conversion_rate:
 		throw(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange record is not created for %(from_currency)s to %(to_currency)s') % {
diff --git a/erpnext/setup/doctype/currency_exchange/currency_exchange.js b/erpnext/setup/doctype/currency_exchange/currency_exchange.js
index 253b5b1..b4187ef 100644
--- a/erpnext/setup/doctype/currency_exchange/currency_exchange.js
+++ b/erpnext/setup/doctype/currency_exchange/currency_exchange.js
@@ -4,7 +4,7 @@
 $.extend(cur_frm.cscript, {
 	onload: function() {
 		if(cur_frm.doc.__islocal) {
-			cur_frm.set_value("to_currency", wn.defaults.get_global_default("currency"));
+			cur_frm.set_value("to_currency", frappe.defaults.get_global_default("currency"));
 		}
 	},
 	
@@ -22,7 +22,7 @@
 	
 	set_exchange_rate_label: function() {
 		if(cur_frm.doc.from_currency && cur_frm.doc.to_currency) {
-			var default_label = wn._(wn.meta.docfield_map[cur_frm.doctype]["exchange_rate"].label);
+			var default_label = frappe._(frappe.meta.docfield_map[cur_frm.doctype]["exchange_rate"].label);
 			cur_frm.fields_dict.exchange_rate.set_label(default_label + 
 				repl(" (1 %(from_currency)s = [?] %(to_currency)s)", cur_frm.doc));
 		}
diff --git a/erpnext/setup/doctype/currency_exchange/currency_exchange.py b/erpnext/setup/doctype/currency_exchange/currency_exchange.py
index 3a52e5d..93f4419 100644
--- a/erpnext/setup/doctype/currency_exchange/currency_exchange.py
+++ b/erpnext/setup/doctype/currency_exchange/currency_exchange.py
@@ -4,9 +4,9 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.model.controller import DocListController
+import frappe
+from frappe import _, msgprint
+from frappe.model.controller import DocListController
 
 class DocType(DocListController):
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/customer_group/customer_group.js b/erpnext/setup/doctype/customer_group/customer_group.js
index 17a08c6..13abd8c 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.js
+++ b/erpnext/setup/doctype/customer_group/customer_group.js
@@ -9,7 +9,7 @@
 	// read-only for root customer group
 	if(!doc.parent_customer_group) {
 		cur_frm.set_read_only();
-		cur_frm.set_intro(wn._("This is a root customer group and cannot be edited."));
+		cur_frm.set_intro(frappe._("This is a root customer group and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
 	}
diff --git a/erpnext/setup/doctype/customer_group/customer_group.py b/erpnext/setup/doctype/customer_group/customer_group.py
index 6bb0aa6..676e425 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.py
+++ b/erpnext/setup/doctype/customer_group/customer_group.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint
+import frappe
+from frappe import msgprint
 
 	
-from webnotes.utils.nestedset import DocTypeNestedSet
+from frappe.utils.nestedset import DocTypeNestedSet
 class DocType(DocTypeNestedSet):
 	def __init__(self, doc, doclist=[]):
 		self.doc = doc
@@ -14,7 +14,7 @@
 		self.nsm_parent_field = 'parent_customer_group';
 
 	def validate(self): 
-		if webnotes.conn.sql("select name from `tabCustomer Group` where name = %s and docstatus = 2", 
+		if frappe.conn.sql("select name from `tabCustomer Group` where name = %s and docstatus = 2", 
 		 		(self.doc.customer_group_name)):
 			msgprint("""Another %s record is trashed. 
 				To untrash please go to Setup -> Recycle Bin.""" % 
@@ -26,13 +26,13 @@
 		self.validate_one_root()
 		
 	def validate_name_with_customer(self):
-		if webnotes.conn.exists("Customer", self.doc.name):
-			webnotes.msgprint("An Customer exists with same name (%s), \
+		if frappe.conn.exists("Customer", self.doc.name):
+			frappe.msgprint("An Customer exists with same name (%s), \
 				please change the Customer Group name or rename the Customer" % 
 				self.doc.name, raise_exception=1)
 
 	def on_trash(self):
-		cust = webnotes.conn.sql("select name from `tabCustomer` where ifnull(customer_group, '') = %s", 
+		cust = frappe.conn.sql("select name from `tabCustomer` where ifnull(customer_group, '') = %s", 
 		 	self.doc.name)
 		cust = [d[0] for d in cust]
 		if cust:
@@ -41,7 +41,7 @@
 				To trash/delete this, remove/change customer group in customer master""" %
 				(self.doc.name, cust or ''), raise_exception=1)
 
-		if webnotes.conn.sql("select name from `tabCustomer Group` where parent_customer_group = %s \
+		if frappe.conn.sql("select name from `tabCustomer Group` where parent_customer_group = %s \
 				and docstatus != 2", self.doc.name):
 			msgprint("Child customer group exists for this customer group. \
 				You can not trash/cancel/delete this customer group.", raise_exception=1)
diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js
index 79cc681..31ba66a 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.js
+++ b/erpnext/setup/doctype/email_digest/email_digest.js
@@ -3,10 +3,10 @@
 
 cur_frm.cscript.refresh = function(doc, dt, dn) {
 	doc = locals[dt][dn];
-	var save_msg = wn._("You must ")+ "<b>"+wn._("Save ")+"</b>"+wn._("the form before proceeding");
-	var err_msg = wn._("There was an error. One probable reason could be that you haven't saved the form. Please contact support@erpnext.com if the problem persists.")
+	var save_msg = frappe._("You must ")+ "<b>"+frappe._("Save ")+"</b>"+frappe._("the form before proceeding");
+	var err_msg = frappe._("There was an error. One probable reason could be that you haven't saved the form. Please contact support@erpnext.com if the problem persists.")
 	
-	cur_frm.add_custom_button(wn._('View Now'), function() {
+	cur_frm.add_custom_button(frappe._('View Now'), function() {
 		doc = locals[dt][dn];
 		if(doc.__unsaved != 1) {
 			return $c_obj(make_doclist(dt, dn), 'get_digest_msg', '', function(r, rt) {
@@ -15,8 +15,8 @@
 					console.log(r.exc);
 				} else {
 					//console.log(arguments);
-					var d = new wn.ui.Dialog({
-						title: wn._('Email Digest: ') + dn,
+					var d = new frappe.ui.Dialog({
+						title: frappe._('Email Digest: ') + dn,
 						width: 800
 					});
 
@@ -29,7 +29,7 @@
 			msgprint(save_msg);
 		}	
 	}, 1);
-	cur_frm.add_custom_button(wn._('Send Now'), function() {
+	cur_frm.add_custom_button(frappe._('Send Now'), function() {
 		doc = locals[dt][dn];
 		if(doc.__unsaved != 1) {
 			return $c_obj(make_doclist(dt, dn), 'send', '', function(r, rt) {
@@ -38,7 +38,7 @@
 					console.log(r.exc);
 				} else {
 					//console.log(arguments);
-					msgprint(wn._('Message Sent'));
+					msgprint(frappe._('Message Sent'));
 				}
 			});
 		} else {
@@ -55,8 +55,8 @@
 		} else {
 			// Open a dialog and display checkboxes against email addresses
 			doc = locals[dt][dn];
-			var d = new wn.ui.Dialog({
-				title: wn._('Add/Remove Recipients'),
+			var d = new frappe.ui.Dialog({
+				title: frappe._('Add/Remove Recipients'),
 				width: 400
 			});
 			var dialog_div = $a(d.body, 'div', 'dialog-div', '', '');
@@ -70,7 +70,7 @@
 					check.checked = 1;
 					add_or_update = 'Update';
 				}
-				var fullname = wn.user.full_name(v.name);
+				var fullname = frappe.user.full_name(v.name);
 				if(fullname !== v.name) v.name = fullname + " &lt;" + v.name + "&gt;";
 				if(v.enabled==0) {
 					v.name = repl("<span style='color: red'> %(name)s (disabled user)</span>", {name: v.name});
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index b9125c9..6632a9e 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -2,14 +2,14 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import fmt_money, formatdate, now_datetime, cstr, esc, \
+import frappe
+from frappe import _
+from frappe.utils import fmt_money, formatdate, now_datetime, cstr, esc, \
 	get_url_to_form, get_fullname
-from webnotes.utils.dateutils import datetime_in_user_format
+from frappe.utils.dateutils import datetime_in_user_format
 from datetime import timedelta
 from dateutil.relativedelta import relativedelta
-from webnotes.utils.email_lib import sendmail
+from frappe.utils.email_lib import sendmail
 
 content_sequence = [
 	["Income / Expenses", ["income_year_to_date", "bank_balance",
@@ -43,18 +43,18 @@
 	<span style="color: grey">%(currency)s</span>%(value)s
 </span></p>"""
 
-from webnotes.model.controller import DocListController
+from frappe.model.controller import DocListController
 class DocType(DocListController):
 	def __init__(self, doc, doclist=[]):
 		self.doc, self.doclist = doc, doclist
 		self.from_date, self.to_date = self.get_from_to_date()
 		self.future_from_date, self.future_to_date = self.get_future_from_to_date()
-		self.currency = webnotes.conn.get_value("Company", self.doc.company,
+		self.currency = frappe.conn.get_value("Company", self.doc.company,
 			"default_currency")
 
 	def get_profiles(self):
 		"""get list of profiles"""
-		profile_list = webnotes.conn.sql("""
+		profile_list = frappe.conn.sql("""
 			select name, enabled from tabProfile
 			where docstatus=0 and name not in ('Administrator', 'Guest')
 			and user_type = "System User"
@@ -67,11 +67,11 @@
 		for p in profile_list:
 			p["checked"] = p["name"] in recipient_list and 1 or 0
 
-		webnotes.response['profile_list'] = profile_list
+		frappe.response['profile_list'] = profile_list
 	
 	def send(self):
 		# send email only to enabled users
-		valid_users = [p[0] for p in webnotes.conn.sql("""select name from `tabProfile`
+		valid_users = [p[0] for p in frappe.conn.sql("""select name from `tabProfile`
 			where enabled=1""")]
 		recipients = filter(lambda r: r in valid_users,
 			self.doc.recipient_list.split("\n"))
@@ -88,7 +88,7 @@
 						msg=msg_for_this_receipient)
 			
 	def get_digest_msg(self):
-		return self.get_msg_html(self.get_user_specific_content(webnotes.session.user) + \
+		return self.get_msg_html(self.get_user_specific_content(frappe.session.user) + \
 			self.get_common_content(), send_only_if_updates=False)
 	
 	def get_common_content(self):
@@ -106,17 +106,17 @@
 		return out
 		
 	def get_user_specific_content(self, user_id):
-		original_session_user = webnotes.session.user
+		original_session_user = frappe.session.user
 		
 		# setting session user for role base event fetching
-		webnotes.session.user = user_id
+		frappe.session.user = user_id
 		
 		out = []
 		for ctype in user_specific_content:
 			if self.doc.fields.get(ctype) and hasattr(self, "get_"+ctype):
 				out.append(getattr(self, "get_"+ctype)(user_id))
 				
-		webnotes.session.user = original_session_user
+		frappe.session.user = original_session_user
 		
 		return out
 				
@@ -153,7 +153,7 @@
 		return msg
 	
 	def get_income_year_to_date(self):
-		return self.get_income(webnotes.conn.get_defaults("year_start_date"), 
+		return self.get_income(frappe.conn.get_defaults("year_start_date"), 
 			self.meta.get_label("income_year_to_date"))
 			
 	def get_bank_balance(self):
@@ -293,7 +293,7 @@
 			filter_by_company=False)
 		
 	def get_calendar_events(self, user_id):
-		from webnotes.core.doctype.event.event import get_events
+		from frappe.core.doctype.event.event import get_events
 		events = get_events(self.future_from_date.strftime("%Y-%m-%d"), self.future_to_date.strftime("%Y-%m-%d"))
 		
 		html = ""
@@ -314,7 +314,7 @@
 			return 0, "<p>Calendar Events</p>"
 	
 	def get_todo_list(self, user_id):
-		from webnotes.core.page.todo.todo import get
+		from frappe.core.page.todo.todo import get
 		todo_list = get()
 		
 		html = ""
@@ -339,7 +339,7 @@
 			company = """and company="%s" """ % self.doc.company
 		else:
 			company = ""
-		count = webnotes.conn.sql("""select count(*) from `tab%s`
+		count = frappe.conn.sql("""select count(*) from `tab%s`
 			where docstatus=%s %s and
 			date(creation)>=%s and date(creation)<=%s""" % 
 			(doctype, docstatus, company, "%s", "%s"), (self.from_date, self.to_date))
@@ -348,7 +348,7 @@
 		return count, self.get_html(label, None, count)
 		
 	def get_new_sum(self, doctype, label, sum_field):
-		count_sum = webnotes.conn.sql("""select count(*), sum(ifnull(`%s`, 0))
+		count_sum = frappe.conn.sql("""select count(*), sum(ifnull(`%s`, 0))
 			from `tab%s` where docstatus=1 and company = %s and
 			date(creation)>=%s and date(creation)<=%s""" % (sum_field, doctype, "%s",
 			"%s", "%s"), (self.doc.company, self.from_date, self.to_date))
@@ -372,7 +372,7 @@
 				hasattr(self, "gl_entries"):
 			return self.gl_entries
 		
-		gl_entries = webnotes.conn.sql("""select `account`, 
+		gl_entries = frappe.conn.sql("""select `account`, 
 			ifnull(credit, 0) as credit, ifnull(debit, 0) as debit, `against`
 			from `tabGL Entry`
 			where company=%s 
@@ -388,7 +388,7 @@
 		
 	def get_accounts(self):
 		if not hasattr(self, "accounts"):
-			self.accounts = webnotes.conn.sql("""select name, is_pl_account,
+			self.accounts = frappe.conn.sql("""select name, is_pl_account,
 				debit_or_credit, account_type, account_name, master_type
 				from `tabAccount` where company=%s and docstatus < 2
 				and group_or_ledger = "Ledger" order by lft""",
@@ -451,7 +451,7 @@
 		return send_date
 	
 	def get_open_tickets(self):
-		open_tickets = webnotes.conn.sql("""select name, subject, modified, raised_by
+		open_tickets = frappe.conn.sql("""select name, subject, modified, raised_by
 			from `tabSupport Ticket` where status='Open'
 			order by modified desc limit 10""", as_dict=True)
 			
@@ -463,23 +463,23 @@
 			return 0, "No Open Tickets!"
 			
 	def get_scheduler_errors(self):
-		import webnotes.utils.scheduler
-		return webnotes.utils.scheduler.get_error_report(self.from_date, self.to_date)
+		import frappe.utils.scheduler
+		return frappe.utils.scheduler.get_error_report(self.from_date, self.to_date)
 	
 	def onload(self):
 		self.get_next_sending()
 	
 def send():
-	from webnotes.model.code import get_obj
-	from webnotes.utils import getdate
+	from frappe.model.code import get_obj
+	from frappe.utils import getdate
 	now_date = now_datetime().date()
 	
-	from webnotes import conf
+	from frappe import conf
 	if "expires_on" in conf and now_date > getdate(conf.expires_on):
 		# do not send email digests to expired accounts
 		return
 	
-	for ed in webnotes.conn.sql("""select name from `tabEmail Digest`
+	for ed in frappe.conn.sql("""select name from `tabEmail Digest`
 			where enabled=1 and docstatus<2""", as_list=1):
 		ed_obj = get_obj('Email Digest', ed[0])
 		if (now_date == ed_obj.get_next_sending()):
diff --git a/erpnext/setup/doctype/email_settings/email_settings.py b/erpnext/setup/doctype/email_settings/email_settings.py
index 7183497..17ae283 100644
--- a/erpnext/setup/doctype/email_settings/email_settings.py
+++ b/erpnext/setup/doctype/email_settings/email_settings.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 	
-from webnotes.utils import cint
+from frappe.utils import cint
 
 class DocType:
 	def __init__(self,doc,doclist):
@@ -19,8 +19,8 @@
 		"""Checks incoming email settings"""
 		self.doc.encode()
 		if self.doc.outgoing_mail_server:
-			from webnotes.utils import cint
-			from webnotes.utils.email_lib.smtp import SMTPServer
+			from frappe.utils import cint
+			from frappe.utils.email_lib.smtp import SMTPServer
 			smtpserver = SMTPServer(login = self.doc.mail_login,
 				password = self.doc.mail_password,
 				server = self.doc.outgoing_mail_server,
@@ -36,8 +36,8 @@
 			Checks support ticket email settings
 		"""
 		if self.doc.sync_support_mails and self.doc.support_host:
-			from webnotes.utils.email_lib.receive import POP3Mailbox
-			from webnotes.model.doc import Document
+			from frappe.utils.email_lib.receive import POP3Mailbox
+			from frappe.model.doc import Document
 			import _socket, poplib
 			
 			inc_email = Document('Incoming Email Settings')
@@ -51,7 +51,7 @@
 				inc_email.username = self.doc.support_username
 				inc_email.password = self.doc.support_password
 			except AttributeError, e:
-				webnotes.msgprint(err_msg)
+				frappe.msgprint(err_msg)
 				raise
 
 			pop_mb = POP3Mailbox(inc_email)
@@ -60,8 +60,8 @@
 				pop_mb.connect()
 			except _socket.error, e:
 				# Invalid mail server -- due to refusing connection
-				webnotes.msgprint('Invalid POP3 Mail Server. Please rectify and try again.')
+				frappe.msgprint('Invalid POP3 Mail Server. Please rectify and try again.')
 				raise
 			except poplib.error_proto, e:
-				webnotes.msgprint('Invalid User Name or Support Password. Please rectify and try again.')
+				frappe.msgprint('Invalid User Name or Support Password. Please rectify and try again.')
 				raise
diff --git a/erpnext/setup/doctype/features_setup/features_setup.py b/erpnext/setup/doctype/features_setup/features_setup.py
index f700d8d..0c9d6e4 100644
--- a/erpnext/setup/doctype/features_setup/features_setup.py
+++ b/erpnext/setup/doctype/features_setup/features_setup.py
@@ -10,8 +10,8 @@
 		"""
 			update settings in defaults
 		"""
-		from webnotes.model import default_fields 
-		from webnotes.utils import set_default
+		from frappe.model import default_fields 
+		from frappe.utils import set_default
 		for key in self.doc.fields:
 			if key not in default_fields:
 				set_default(key, self.doc.fields[key])
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.js b/erpnext/setup/doctype/global_defaults/global_defaults.js
index 6a2f84a..4b378b3 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.js
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.js
@@ -6,8 +6,8 @@
 		var me = this;
 		this.timezone = doc.time_zone;
 		
-		wn.call({
-			method: "webnotes.country_info.get_country_timezone_info",
+		frappe.call({
+			method: "frappe.country_info.get_country_timezone_info",
 			callback: function(data) {
 				erpnext.country_info = data.message.country_info;
 				erpnext.all_timezones = data.message.all_timezones;
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index 9c5ef86..2bbe507 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -3,9 +3,9 @@
 
 from __future__ import unicode_literals
 """Global Defaults"""
-import webnotes
-import webnotes.defaults
-from webnotes.utils import cint
+import frappe
+import frappe.defaults
+from frappe.utils import cint
 
 keydict = {
 	# "key in defaults": "key in Global Defaults"
@@ -32,35 +32,35 @@
 		self.update_control_panel()
 		
 		for key in keydict:
-			webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
+			frappe.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
 			
 		# update year start date and year end date from fiscal_year
-		year_start_end_date = webnotes.conn.sql("""select year_start_date, year_end_date 
+		year_start_end_date = frappe.conn.sql("""select year_start_date, year_end_date 
 			from `tabFiscal Year` where name=%s""", self.doc.current_fiscal_year)
 
 		ysd = year_start_end_date[0][0] or ''
 		yed = year_start_end_date[0][1] or ''
 
 		if ysd and yed:
-			webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
-			webnotes.conn.set_default('year_end_date', yed.strftime('%Y-%m-%d'))
+			frappe.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
+			frappe.conn.set_default('year_end_date', yed.strftime('%Y-%m-%d'))
 		
 		# enable default currency
 		if self.doc.default_currency:
-			webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
+			frappe.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
 		
 		# clear cache
-		webnotes.clear_cache()
+		frappe.clear_cache()
 	
 	def validate_session_expiry(self):
 		if self.doc.session_expiry:
 			parts = self.doc.session_expiry.split(":")
 			if len(parts)!=2 or not (cint(parts[0]) or cint(parts[1])):
-				webnotes.msgprint("""Session Expiry must be in format hh:mm""",
+				frappe.msgprint("""Session Expiry must be in format hh:mm""",
 					raise_exception=1)
 
 	def update_control_panel(self):
-		cp_bean = webnotes.bean("Control Panel")
+		cp_bean = frappe.bean("Control Panel")
 		if self.doc.country:
 			cp_bean.doc.country = self.doc.country
 		if self.doc.time_zone:
@@ -69,4 +69,4 @@
 		cp_bean.save()
 
 	def get_defaults(self):
-		return webnotes.defaults.get_defaults()
+		return frappe.defaults.get_defaults()
diff --git a/erpnext/setup/doctype/item_group/item_group.js b/erpnext/setup/doctype/item_group/item_group.js
index 65e0588..5e0e843 100644
--- a/erpnext/setup/doctype/item_group/item_group.js
+++ b/erpnext/setup/doctype/item_group/item_group.js
@@ -4,8 +4,8 @@
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
 	cur_frm.cscript.set_root_readonly(doc);
-	cur_frm.appframe.add_button(wn._("Item Group Tree"), function() {
-		wn.set_route("Sales Browser", "Item Group");
+	cur_frm.appframe.add_button(frappe._("Item Group Tree"), function() {
+		frappe.set_route("Sales Browser", "Item Group");
 	}, "icon-sitemap")
 
 	if(!doc.__islocal && doc.show_in_website) {
@@ -19,7 +19,7 @@
 	// read-only for root item group
 	if(!doc.parent_item_group) {
 		cur_frm.set_read_only();
-		cur_frm.set_intro(wn._("This is a root item group and cannot be edited."));
+		cur_frm.set_intro(frappe._("This is a root item group and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
 	}
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index 7e79c95..3c82615 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils.nestedset import DocTypeNestedSet
+from frappe.utils.nestedset import DocTypeNestedSet
 
 class DocType(DocTypeNestedSet):
 	def __init__(self, doc, doclist=[]):
@@ -20,6 +20,6 @@
 		self.validate_one_root()
 		
 	def validate_name_with_item(self):
-		if webnotes.conn.exists("Item", self.doc.name):
-			webnotes.msgprint("An item exists with same name (%s), please change the \
+		if frappe.conn.exists("Item", self.doc.name):
+			frappe.msgprint("An item exists with same name (%s), please change the \
 				item group name or rename the item" % self.doc.name, raise_exception=1)
diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py
index c944a0b..1169734 100644
--- a/erpnext/setup/doctype/item_group/test_item_group.py
+++ b/erpnext/setup/doctype/item_group/test_item_group.py
@@ -3,8 +3,8 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-from webnotes.utils.nestedset import NestedSetRecursionError, NestedSetMultipleRootsError, \
+import frappe
+from frappe.utils.nestedset import NestedSetRecursionError, NestedSetMultipleRootsError, \
 	NestedSetChildExistsError, NestedSetInvalidMergeError, rebuild_tree, get_ancestors_of
 
 test_records = [
@@ -79,18 +79,18 @@
 class TestItem(unittest.TestCase):
 	def test_basic_tree(self, records=None):
 		min_lft = 1
-		max_rgt = webnotes.conn.sql("select max(rgt) from `tabItem Group`")[0][0]
+		max_rgt = frappe.conn.sql("select max(rgt) from `tabItem Group`")[0][0]
 		
 		if not records:
 			records = test_records[2:]
 		
 		for item_group in records:
 			item_group = item_group[0]
-			lft, rgt, parent_item_group = webnotes.conn.get_value("Item Group", item_group["item_group_name"], 
+			lft, rgt, parent_item_group = frappe.conn.get_value("Item Group", item_group["item_group_name"], 
 				["lft", "rgt", "parent_item_group"])
 			
 			if parent_item_group:
-				parent_lft, parent_rgt = webnotes.conn.get_value("Item Group", parent_item_group,
+				parent_lft, parent_rgt = frappe.conn.get_value("Item Group", parent_item_group,
 					["lft", "rgt"])
 			else:
 				# root
@@ -116,7 +116,7 @@
 		def get_no_of_children(item_groups, no_of_children):
 			children = []
 			for ig in item_groups:
-				children += webnotes.conn.sql_list("""select name from `tabItem Group`
+				children += frappe.conn.sql_list("""select name from `tabItem Group`
 				where ifnull(parent_item_group, '')=%s""", ig or '')
 			
 			if len(children):
@@ -127,7 +127,7 @@
 		return get_no_of_children([item_group], 0)
 			
 	def test_recursion(self):
-		group_b = webnotes.bean("Item Group", "_Test Item Group B")
+		group_b = frappe.bean("Item Group", "_Test Item Group B")
 		group_b.doc.parent_item_group = "_Test Item Group B - 3"
 		self.assertRaises(NestedSetRecursionError, group_b.save)
 		
@@ -140,17 +140,17 @@
 		self.test_basic_tree()
 		
 	def move_it_back(self):
-		group_b = webnotes.bean("Item Group", "_Test Item Group B")
+		group_b = frappe.bean("Item Group", "_Test Item Group B")
 		group_b.doc.parent_item_group = "All Item Groups"
 		group_b.save()
 		self.test_basic_tree()
 		
 	def test_move_group_into_another(self):
 		# before move
-		old_lft, old_rgt = webnotes.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
+		old_lft, old_rgt = frappe.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
 		
 		# put B under C
-		group_b = webnotes.bean("Item Group", "_Test Item Group B")
+		group_b = frappe.bean("Item Group", "_Test Item Group B")
 		lft, rgt = group_b.doc.lft, group_b.doc.rgt
 		
 		group_b.doc.parent_item_group = "_Test Item Group C"
@@ -158,7 +158,7 @@
 		self.test_basic_tree()
 		
 		# after move
-		new_lft, new_rgt = webnotes.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
+		new_lft, new_rgt = frappe.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
 		
 		# lft should reduce
 		self.assertEquals(old_lft - new_lft, rgt - lft + 1)
@@ -169,7 +169,7 @@
 		self.move_it_back()
 		
 	def test_move_group_into_root(self):
-		group_b = webnotes.bean("Item Group", "_Test Item Group B")
+		group_b = frappe.bean("Item Group", "_Test Item Group B")
 		group_b.doc.parent_item_group = ""
 		self.assertRaises(NestedSetMultipleRootsError, group_b.save)
 
@@ -180,13 +180,13 @@
 		
 	def print_tree(self):
 		import json
-		print json.dumps(webnotes.conn.sql("select name, lft, rgt from `tabItem Group` order by lft"), indent=1)
+		print json.dumps(frappe.conn.sql("select name, lft, rgt from `tabItem Group` order by lft"), indent=1)
 		
 	def test_move_leaf_into_another_group(self):
 		# before move
-		old_lft, old_rgt = webnotes.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
+		old_lft, old_rgt = frappe.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
 		
-		group_b_3 = webnotes.bean("Item Group", "_Test Item Group B - 3")
+		group_b_3 = frappe.bean("Item Group", "_Test Item Group B - 3")
 		lft, rgt = group_b_3.doc.lft, group_b_3.doc.rgt
 		
 		# child of right sibling is moved into it
@@ -194,7 +194,7 @@
 		group_b_3.save()
 		self.test_basic_tree()
 		
-		new_lft, new_rgt = webnotes.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
+		new_lft, new_rgt = frappe.conn.get_value("Item Group", "_Test Item Group C", ["lft", "rgt"])
 		
 		# lft should remain the same
 		self.assertEquals(old_lft - new_lft, 0)
@@ -203,73 +203,73 @@
 		self.assertEquals(new_rgt - old_rgt, rgt - lft + 1)
 		
 		# move it back
-		group_b_3 = webnotes.bean("Item Group", "_Test Item Group B - 3")
+		group_b_3 = frappe.bean("Item Group", "_Test Item Group B - 3")
 		group_b_3.doc.parent_item_group = "_Test Item Group B"
 		group_b_3.save()
 		self.test_basic_tree()
 		
 	def test_delete_leaf(self):
 		# for checking later
-		parent_item_group = webnotes.conn.get_value("Item Group", "_Test Item Group B - 3", "parent_item_group")
-		rgt = webnotes.conn.get_value("Item Group", parent_item_group, "rgt")
+		parent_item_group = frappe.conn.get_value("Item Group", "_Test Item Group B - 3", "parent_item_group")
+		rgt = frappe.conn.get_value("Item Group", parent_item_group, "rgt")
 		
 		ancestors = get_ancestors_of("Item Group", "_Test Item Group B - 3")
-		ancestors = webnotes.conn.sql("""select name, rgt from `tabItem Group`
+		ancestors = frappe.conn.sql("""select name, rgt from `tabItem Group`
 			where name in ({})""".format(", ".join(["%s"]*len(ancestors))), tuple(ancestors), as_dict=True)
 		
-		webnotes.delete_doc("Item Group", "_Test Item Group B - 3")
+		frappe.delete_doc("Item Group", "_Test Item Group B - 3")
 		records_to_test = test_records[2:]
 		del records_to_test[4]
 		self.test_basic_tree(records=records_to_test)
 		
 		# rgt of each ancestor would reduce by 2
 		for item_group in ancestors:
-			new_lft, new_rgt = webnotes.conn.get_value("Item Group", item_group.name, ["lft", "rgt"])
+			new_lft, new_rgt = frappe.conn.get_value("Item Group", item_group.name, ["lft", "rgt"])
 			self.assertEquals(new_rgt, item_group.rgt - 2)
 		
 		# insert it back
-		webnotes.bean(copy=test_records[6]).insert()
+		frappe.bean(copy=test_records[6]).insert()
 		
 		self.test_basic_tree()
 		
 	def test_delete_group(self):
 		# cannot delete group with child, but can delete leaf
-		self.assertRaises(NestedSetChildExistsError, webnotes.delete_doc, "Item Group", "_Test Item Group B")
+		self.assertRaises(NestedSetChildExistsError, frappe.delete_doc, "Item Group", "_Test Item Group B")
 		
 	def test_merge_groups(self):
-		webnotes.rename_doc("Item Group", "_Test Item Group B", "_Test Item Group C", merge=True)
+		frappe.rename_doc("Item Group", "_Test Item Group B", "_Test Item Group C", merge=True)
 		records_to_test = test_records[2:]
 		del records_to_test[1]
 		self.test_basic_tree(records=records_to_test)
 		
 		# insert Group B back
-		webnotes.bean(copy=test_records[3]).insert()
+		frappe.bean(copy=test_records[3]).insert()
 		self.test_basic_tree()
 		
 		# move its children back
-		for name in webnotes.conn.sql_list("""select name from `tabItem Group`
+		for name in frappe.conn.sql_list("""select name from `tabItem Group`
 			where parent_item_group='_Test Item Group C'"""):
 			
-			bean = webnotes.bean("Item Group", name)
+			bean = frappe.bean("Item Group", name)
 			bean.doc.parent_item_group = "_Test Item Group B"
 			bean.save()
 
 		self.test_basic_tree()
 		
 	def test_merge_leaves(self):
-		webnotes.rename_doc("Item Group", "_Test Item Group B - 2", "_Test Item Group B - 1", merge=True)
+		frappe.rename_doc("Item Group", "_Test Item Group B - 2", "_Test Item Group B - 1", merge=True)
 		records_to_test = test_records[2:]
 		del records_to_test[3]
 		self.test_basic_tree(records=records_to_test)
 		
 		# insert Group B - 2back
-		webnotes.bean(copy=test_records[5]).insert()
+		frappe.bean(copy=test_records[5]).insert()
 		self.test_basic_tree()
 		
 	def test_merge_leaf_into_group(self):
-		self.assertRaises(NestedSetInvalidMergeError, webnotes.rename_doc, "Item Group", "_Test Item Group B - 3", 
+		self.assertRaises(NestedSetInvalidMergeError, frappe.rename_doc, "Item Group", "_Test Item Group B - 3", 
 			"_Test Item Group B", merge=True)
 		
 	def test_merge_group_into_leaf(self):
-		self.assertRaises(NestedSetInvalidMergeError, webnotes.rename_doc, "Item Group", "_Test Item Group B", 
+		self.assertRaises(NestedSetInvalidMergeError, frappe.rename_doc, "Item Group", "_Test Item Group B", 
 			"_Test Item Group B - 3", merge=True)
\ No newline at end of file
diff --git a/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.js b/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.js
index 9ef4762..a8ac0bd 100644
--- a/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.js
+++ b/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.js
@@ -7,9 +7,9 @@
 	refresh: function(doc) {
 		cur_frm.set_intro("");
 		if(doc.extract_emails) {
-			cur_frm.set_intro(wn._("Active: Will extract emails from ") + doc.email_id);
+			cur_frm.set_intro(frappe._("Active: Will extract emails from ") + doc.email_id);
 		} else {
-			cur_frm.set_intro(wn._("Not Active"));
+			cur_frm.set_intro(frappe._("Not Active"));
 		}
 	}
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.py b/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.py
index 197dec6..4d2d1ea 100644
--- a/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.py
+++ b/erpnext/setup/doctype/jobs_email_settings/jobs_email_settings.py
@@ -4,9 +4,9 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import cint
+import frappe
+from frappe import _
+from frappe.utils import cint
 
 class DocType:
 	def __init__(self, d, dl):
@@ -16,5 +16,5 @@
 		if cint(self.doc.extract_emails) and not (self.doc.email_id and self.doc.host and \
 			self.doc.username and self.doc.password):
 			
-			webnotes.msgprint(_("""Host, Email and Password required if emails are to be pulled"""),
+			frappe.msgprint(_("""Host, Email and Password required if emails are to be pulled"""),
 				raise_exception=True)
\ No newline at end of file
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index 10cdac2..5a50b7b 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr
-from webnotes import msgprint, throw, _
-import webnotes.model.doctype
+from frappe.utils import cstr
+from frappe import msgprint, throw, _
+import frappe.model.doctype
 
 class DocType:
 	def __init__(self, d, dl):
@@ -15,13 +15,13 @@
 	def get_transactions(self, arg=None):
 		return {
 			"transactions": "\n".join([''] + sorted(list(set(
-				webnotes.conn.sql_list("""select parent
+				frappe.conn.sql_list("""select parent
 					from `tabDocField` where fieldname='naming_series'""") 
-				+ webnotes.conn.sql_list("""select dt from `tabCustom Field` 
+				+ frappe.conn.sql_list("""select dt from `tabCustom Field` 
 					where fieldname='naming_series'""")
 				)))),
 			"prefixes": "\n".join([''] + [i[0] for i in 
-				webnotes.conn.sql("""select name from tabSeries order by name""")])
+				frappe.conn.sql("""select name from tabSeries order by name""")])
 		}
 
 	def scrub_options_list(self, ol):
@@ -56,10 +56,10 @@
 			default = options[0]
 
 		# update in property setter
-		from webnotes.model.doc import Document
+		from frappe.model.doc import Document
 		prop_dict = {'options': "\n".join(options), 'default': default}
 		for prop in prop_dict:
-			ps_exists = webnotes.conn.sql("""SELECT name FROM `tabProperty Setter`
+			ps_exists = frappe.conn.sql("""SELECT name FROM `tabProperty Setter`
 					WHERE doc_type = %s AND field_name = 'naming_series'
 					AND property = %s""", (doctype, prop))
 			if ps_exists:
@@ -79,23 +79,23 @@
 
 		self.doc.set_options = "\n".join(options)
 
-		webnotes.clear_cache(doctype=doctype)
+		frappe.clear_cache(doctype=doctype)
 
 	def check_duplicate(self):
-		from webnotes.core.doctype.doctype.doctype import DocType
+		from frappe.core.doctype.doctype.doctype import DocType
 		dt = DocType()
 
 		parent = list(set(
-			webnotes.conn.sql_list("""select dt.name 
+			frappe.conn.sql_list("""select dt.name 
 				from `tabDocField` df, `tabDocType` dt 
 				where dt.name = df.parent and df.fieldname='naming_series' and dt.name != %s""",
 				self.doc.select_doc_for_series)
-			+ webnotes.conn.sql_list("""select dt.name 
+			+ frappe.conn.sql_list("""select dt.name 
 				from `tabCustom Field` df, `tabDocType` dt 
 				where dt.name = df.dt and df.fieldname='naming_series' and dt.name != %s""",
 				self.doc.select_doc_for_series)
 			))
-		sr = [[webnotes.model.doctype.get_property(p, 'options', 'naming_series'), p] 
+		sr = [[frappe.model.doctype.get_property(p, 'options', 'naming_series'), p] 
 			for p in parent]
 		options = self.scrub_options_list(self.doc.set_options.split("\n"))
 		for series in options:
@@ -119,39 +119,39 @@
 			throw('Special Characters except "-" and "/" not allowed in naming series')
 
 	def get_options(self, arg=''):
-		sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, 
+		sr = frappe.model.doctype.get_property(self.doc.select_doc_for_series, 
 			'options', 'naming_series')
 		return sr
 
 	def get_current(self, arg=None):
 		"""get series current"""
 		if self.doc.prefix:
-			self.doc.current_value = webnotes.conn.get_value("Series", 
+			self.doc.current_value = frappe.conn.get_value("Series", 
 				self.doc.prefix.split('.')[0], "current")
 
 	def insert_series(self, series):
 		"""insert series if missing"""
-		if not webnotes.conn.exists('Series', series):
-			webnotes.conn.sql("insert into tabSeries (name, current) values (%s, 0)", (series))
+		if not frappe.conn.exists('Series', series):
+			frappe.conn.sql("insert into tabSeries (name, current) values (%s, 0)", (series))
 
 	def update_series_start(self):
 		if self.doc.prefix:
 			prefix = self.doc.prefix.split('.')[0]
 			self.insert_series(prefix)
-			webnotes.conn.sql("update `tabSeries` set current = %s where name = %s", 
+			frappe.conn.sql("update `tabSeries` set current = %s where name = %s", 
 				(self.doc.current_value, prefix))
 			msgprint(_("Series Updated Successfully"))
 		else:
 			msgprint(_("Please select prefix first"))
 
 def set_by_naming_series(doctype, fieldname, naming_series, hide_name_field=True):
-	from webnotes.core.doctype.property_setter.property_setter import make_property_setter
+	from frappe.core.doctype.property_setter.property_setter import make_property_setter
 	if naming_series:
 		make_property_setter(doctype, "naming_series", "hidden", 0, "Check")
 		make_property_setter(doctype, "naming_series", "reqd", 1, "Check")
 
 		# set values for mandatory
-		webnotes.conn.sql("""update `tab{doctype}` set naming_series={s} where 
+		frappe.conn.sql("""update `tab{doctype}` set naming_series={s} where 
 			ifnull(naming_series, '')=''""".format(doctype=doctype, s="%s"), 
 			get_default_naming_series(doctype))
 
@@ -167,11 +167,11 @@
 			make_property_setter(doctype, fieldname, "reqd", 1, "Check")
 
 			# set values for mandatory
-			webnotes.conn.sql("""update `tab{doctype}` set `{fieldname}`=`name` where 
+			frappe.conn.sql("""update `tab{doctype}` set `{fieldname}`=`name` where 
 				ifnull({fieldname}, '')=''""".format(doctype=doctype, fieldname=fieldname))
 
 def get_default_naming_series(doctype):
-	from webnotes.model.doctype import get_property
+	from frappe.model.doctype import get_property
 	naming_series = get_property(doctype, "options", "naming_series")
 	naming_series = naming_series.split("\n")
 	return naming_series[0] or naming_series[1]
\ No newline at end of file
diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py
index 22ad51f..2385067 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.py
+++ b/erpnext/setup/doctype/notification_control/notification_control.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes import msgprint
+from frappe import msgprint
 
 
 class DocType:
@@ -13,11 +13,11 @@
 
 	def get_message(self, arg):
 		fn = arg.lower().replace(' ', '_') + '_message'
-		v = webnotes.conn.sql("select value from tabSingles where field=%s and doctype=%s", (fn, 'Notification Control'))
+		v = frappe.conn.sql("select value from tabSingles where field=%s and doctype=%s", (fn, 'Notification Control'))
 		return v and v[0][0] or ''
 
 	def set_message(self, arg = ''):
 		fn = self.doc.select_transaction.lower().replace(' ', '_') + '_message'
-		webnotes.conn.set(self.doc, fn, self.doc.custom_message)
+		frappe.conn.set(self.doc, fn, self.doc.custom_message)
 		msgprint("Custom Message for %s updated!" % self.doc.select_transaction)
 
diff --git a/erpnext/setup/doctype/print_heading/print_heading.py b/erpnext/setup/doctype/print_heading/print_heading.py
index 6704476..263c31e 100644
--- a/erpnext/setup/doctype/print_heading/print_heading.py
+++ b/erpnext/setup/doctype/print_heading/print_heading.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
 
 	
 
diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
index 576da8e..d30eab6 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
+++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/sales_email_settings/sales_email_settings.js b/erpnext/setup/doctype/sales_email_settings/sales_email_settings.js
index 9ef4762..a8ac0bd 100644
--- a/erpnext/setup/doctype/sales_email_settings/sales_email_settings.js
+++ b/erpnext/setup/doctype/sales_email_settings/sales_email_settings.js
@@ -7,9 +7,9 @@
 	refresh: function(doc) {
 		cur_frm.set_intro("");
 		if(doc.extract_emails) {
-			cur_frm.set_intro(wn._("Active: Will extract emails from ") + doc.email_id);
+			cur_frm.set_intro(frappe._("Active: Will extract emails from ") + doc.email_id);
 		} else {
-			cur_frm.set_intro(wn._("Not Active"));
+			cur_frm.set_intro(frappe._("Not Active"));
 		}
 	}
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_email_settings/sales_email_settings.py b/erpnext/setup/doctype/sales_email_settings/sales_email_settings.py
index 197dec6..4d2d1ea 100644
--- a/erpnext/setup/doctype/sales_email_settings/sales_email_settings.py
+++ b/erpnext/setup/doctype/sales_email_settings/sales_email_settings.py
@@ -4,9 +4,9 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
-from webnotes.utils import cint
+import frappe
+from frappe import _
+from frappe.utils import cint
 
 class DocType:
 	def __init__(self, d, dl):
@@ -16,5 +16,5 @@
 		if cint(self.doc.extract_emails) and not (self.doc.email_id and self.doc.host and \
 			self.doc.username and self.doc.password):
 			
-			webnotes.msgprint(_("""Host, Email and Password required if emails are to be pulled"""),
+			frappe.msgprint(_("""Host, Email and Password required if emails are to be pulled"""),
 				raise_exception=True)
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.js b/erpnext/setup/doctype/sales_partner/sales_partner.js
index 57eca34..9cf2393 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.js
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.js
@@ -23,23 +23,23 @@
 
 cur_frm.cscript.make_address = function() {
 	if(!cur_frm.address_list) {
-		cur_frm.address_list = new wn.ui.Listing({
+		cur_frm.address_list = new frappe.ui.Listing({
 			parent: cur_frm.fields_dict['address_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Address",
 			custom_new_doc: function(doctype) {
-				var address = wn.model.make_new_doc_and_get_name('Address');
+				var address = frappe.model.make_new_doc_and_get_name('Address');
 				address = locals['Address'][address];
 				address.sales_partner = cur_frm.doc.name;
 				address.address_title = cur_frm.doc.name;
 				address.address_type = "Office";
-				wn.set_route("Form", "Address", address.name);
+				frappe.set_route("Form", "Address", address.name);
 			},			
 			get_query: function() {
 				return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
 			},
 			as_dict: 1,
-			no_results_message: wn._('No addresses created'),
+			no_results_message: frappe._('No addresses created'),
 			render_row: function(wrapper, data) {
 				$(wrapper).css('padding','5px 0px');
 				var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
@@ -55,21 +55,21 @@
 
 cur_frm.cscript.make_contact = function() {
 	if(!cur_frm.contact_list) {
-		cur_frm.contact_list = new wn.ui.Listing({
+		cur_frm.contact_list = new frappe.ui.Listing({
 			parent: cur_frm.fields_dict['contact_html'].wrapper,
 			page_length: 2,
 			new_doctype: "Contact",
 			custom_new_doc: function(doctype) {
-				var contact = wn.model.make_new_doc_and_get_name('Contact');
+				var contact = frappe.model.make_new_doc_and_get_name('Contact');
 				contact = locals['Contact'][contact];
 				contact.sales_partner = cur_frm.doc.name;
-				wn.set_route("Form", "Contact", contact.name);
+				frappe.set_route("Form", "Contact", contact.name);
 			},
 			get_query: function() {
 				return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
 			},
 			as_dict: 1,
-			no_results_message: wn._('No contacts created'),
+			no_results_message: frappe._('No contacts created'),
 			render_row: function(wrapper, data) {
 				$(wrapper).css('padding', '5px 0px');
 				var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py
index 3527c28..76eaca2 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.py
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, cstr, filter_strip_join
+import frappe
+from frappe.utils import cint, cstr, filter_strip_join
 
 class DocType():
 	def __init__(self, doc, doclist=None):
@@ -16,7 +16,7 @@
 
 	def get_contacts(self,nm):
 		if nm:
-			contact_details =webnotes.conn.convert_to_lists(webnotes.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm))
+			contact_details =frappe.conn.convert_to_lists(frappe.conn.sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where sales_partner = '%s'"%nm))
 			return contact_details
 		else:
 			return ''
diff --git a/erpnext/setup/doctype/sales_person/sales_person.js b/erpnext/setup/doctype/sales_person/sales_person.js
index 22f3f98..84ce303 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.js
+++ b/erpnext/setup/doctype/sales_person/sales_person.js
@@ -9,7 +9,7 @@
 	// read-only for root
 	if(!doc.parent_sales_person) {
 		cur_frm.set_read_only();
-		cur_frm.set_intro(wn._("This is a root sales person and cannot be edited."));
+		cur_frm.set_intro(frappe._("This is a root sales person and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
 	}
diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py
index 41f461b..6bf2cc3 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.py
+++ b/erpnext/setup/doctype/sales_person/sales_person.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.model.bean import getlist
-from webnotes.utils import flt
-from webnotes.utils.nestedset import DocTypeNestedSet
+import frappe
+from frappe.model.bean import getlist
+from frappe.utils import flt
+from frappe.utils.nestedset import DocTypeNestedSet
 
 class DocType(DocTypeNestedSet):
 	def __init__(self, doc, doclist=[]):
@@ -16,16 +16,16 @@
 	def validate(self): 
 		for d in getlist(self.doclist, 'target_details'):
 			if not flt(d.target_qty) and not flt(d.target_amount):
-				webnotes.throw(_("Either target qty or target amount is mandatory."))
+				frappe.throw(_("Either target qty or target amount is mandatory."))
 	
 	def on_update(self):
 		super(DocType, self).on_update()
 		self.validate_one_root()
 	
 	def get_email_id(self):
-		profile = webnotes.conn.get_value("Employee", self.doc.employee, "user_id")
+		profile = frappe.conn.get_value("Employee", self.doc.employee, "user_id")
 		if not profile:
-			webnotes.throw("User ID (Profile) not set for Employee %s" % self.doc.employee)
+			frappe.throw("User ID (Profile) not set for Employee %s" % self.doc.employee)
 		else:
-			return webnotes.conn.get_value("Profile", profile, "email") or profile
+			return frappe.conn.get_value("Profile", profile, "email") or profile
 		
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sms_parameter/sms_parameter.py b/erpnext/setup/doctype/sms_parameter/sms_parameter.py
index cb6190f..26c87f1 100644
--- a/erpnext/setup/doctype/sms_parameter/sms_parameter.py
+++ b/erpnext/setup/doctype/sms_parameter/sms_parameter.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/sms_settings/sms_settings.py b/erpnext/setup/doctype/sms_settings/sms_settings.py
index cb6190f..26c87f1 100644
--- a/erpnext/setup/doctype/sms_settings/sms_settings.py
+++ b/erpnext/setup/doctype/sms_settings/sms_settings.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.js b/erpnext/setup/doctype/supplier_type/supplier_type.js
index 851aff4..12a77cb 100644
--- a/erpnext/setup/doctype/supplier_type/supplier_type.js
+++ b/erpnext/setup/doctype/supplier_type/supplier_type.js
@@ -2,5 +2,5 @@
 // License: GNU General Public License v3. See license.txt
 
 cur_frm.cscript.refresh = function(doc) {
-	cur_frm.set_intro(doc.__islocal ? "" : wn._("There is nothing to edit."))
+	cur_frm.set_intro(doc.__islocal ? "" : frappe._("There is nothing to edit."))
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.py b/erpnext/setup/doctype/supplier_type/supplier_type.py
index 576da8e..d30eab6 100644
--- a/erpnext/setup/doctype/supplier_type/supplier_type.py
+++ b/erpnext/setup/doctype/supplier_type/supplier_type.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/target_detail/target_detail.py b/erpnext/setup/doctype/target_detail/target_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/setup/doctype/target_detail/target_detail.py
+++ b/erpnext/setup/doctype/target_detail/target_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
index cb6190f..26c87f1 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/territory/territory.js b/erpnext/setup/doctype/territory/territory.js
index 9cb1d70..c027271 100644
--- a/erpnext/setup/doctype/territory/territory.js
+++ b/erpnext/setup/doctype/territory/territory.js
@@ -9,7 +9,7 @@
 	// read-only for root territory
 	if(!doc.parent_territory) {
 		cur_frm.set_read_only();
-		cur_frm.set_intro(wn._("This is a root territory and cannot be edited."));
+		cur_frm.set_intro(frappe._("This is a root territory and cannot be edited."));
 	} else {
 		cur_frm.set_intro(null);
 	}
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index baddd8b..5dfe458 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.model.bean import getlist
-from webnotes.utils import flt
+from frappe.model.bean import getlist
+from frappe.utils import flt
 
-from webnotes.utils.nestedset import DocTypeNestedSet
+from frappe.utils.nestedset import DocTypeNestedSet
 	
 class DocType(DocTypeNestedSet):
 	def __init__(self, doc, doclist=[]):
diff --git a/erpnext/setup/doctype/uom/uom.py b/erpnext/setup/doctype/uom/uom.py
index 576da8e..d30eab6 100644
--- a/erpnext/setup/doctype/uom/uom.py
+++ b/erpnext/setup/doctype/uom/uom.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/doctype/website_item_group/website_item_group.py b/erpnext/setup/doctype/website_item_group/website_item_group.py
index eaa0f46..cb42e2e 100644
--- a/erpnext/setup/doctype/website_item_group/website_item_group.py
+++ b/erpnext/setup/doctype/website_item_group/website_item_group.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 0f18ae5..d65582b 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -3,32 +3,32 @@
 
 from __future__ import unicode_literals
 
-import webnotes
+import frappe
 
 def after_install():
 	import_defaults()
 	import_country_and_currency()
-	webnotes.conn.set_value('Control Panel', None, 'home_page', 'setup-wizard')
+	frappe.conn.set_value('Control Panel', None, 'home_page', 'setup-wizard')
 	feature_setup()
 	from erpnext.setup.page.setup_wizard.setup_wizard import add_all_roles_to
 	add_all_roles_to("Administrator")
-	webnotes.conn.commit()
+	frappe.conn.commit()
 
 def import_country_and_currency():
-	from webnotes.country_info import get_all
+	from frappe.country_info import get_all
 	data = get_all()
 	
 	for name in data:
-		country = webnotes._dict(data[name])
-		webnotes.doc({
+		country = frappe._dict(data[name])
+		frappe.doc({
 			"doctype": "Country",
 			"country_name": name,
 			"date_format": country.date_format or "dd-mm-yyyy",
 			"time_zones": "\n".join(country.timezones or [])
 		}).insert()
 		
-		if country.currency and not webnotes.conn.exists("Currency", country.currency):
-			webnotes.doc({
+		if country.currency and not frappe.conn.exists("Currency", country.currency):
+			frappe.doc({
 				"doctype": "Currency",
 				"currency_name": country.currency,
 				"fraction": country.currency_fraction,
@@ -103,9 +103,9 @@
 		{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'}, 
 	]
 	
-	from webnotes.modules import scrub
+	from frappe.modules import scrub
 	for r in records:
-		bean = webnotes.bean(r)
+		bean = frappe.bean(r)
 		
 		# ignore mandatory for root
 		parent_link_field = ("parent_" + scrub(bean.doc.doctype))
@@ -116,7 +116,7 @@
 		
 def feature_setup():
 	"""save global defaults and features setup"""
-	bean = webnotes.bean("Features Setup", "Features Setup")
+	bean = frappe.bean("Features Setup", "Features Setup")
 	bean.ignore_permissions = True
 
 	# store value as 1 for all these fields
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.js b/erpnext/setup/page/setup_wizard/setup_wizard.js
index b2b45ed..4a88013 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.js
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.js
@@ -1,6 +1,6 @@
-wn.pages['setup-wizard'].onload = function(wrapper) { 
+frappe.pages['setup-wizard'].onload = function(wrapper) { 
 	if(sys_defaults.company) {
-		wn.set_route("desktop");
+		frappe.set_route("desktop");
 		return;
 	}
 	$(".navbar:first").toggle(false);
@@ -12,22 +12,22 @@
 		on_complete: function(wiz) {
 			var values = wiz.get_values();
 			wiz.show_working();
-			wn.call({
+			frappe.call({
 				method: "erpnext.setup.page.setup_wizard.setup_wizard.setup_account",
 				args: values,
 				callback: function(r) {
 					if(r.exc) {
-						var d = msgprint(wn._("There were errors."));
+						var d = msgprint(frappe._("There were errors."));
 						d.custom_onhide = function() {
-							wn.set_route(erpnext.wiz.page_name, "0");
+							frappe.set_route(erpnext.wiz.page_name, "0");
 						}
 					} else {
 						wiz.show_complete();
 						setTimeout(function() {
 							if(user==="Administrator") {
-								msgprint(wn._("Login with your new User ID") + ":" + values.email);
+								msgprint(frappe._("Login with your new User ID") + ":" + values.email);
 								setTimeout(function() {
-									wn.app.logout();
+									frappe.app.logout();
 								}, 2000);
 							} else {
 								window.location = "app.html";
@@ -37,46 +37,46 @@
 				}
 			})
 		},
-		title: wn._("ERPNext Setup Guide"),
+		title: frappe._("ERPNext Setup Guide"),
 		welcome_html: '<h1 class="text-muted text-center"><i class="icon-magic"></i></h1>\
-			<h2 class="text-center">'+wn._('ERPNext Setup')+'</h2>\
+			<h2 class="text-center">'+frappe._('ERPNext Setup')+'</h2>\
 			<p class="text-center">' + 
-			wn._('Welcome to ERPNext. Over the next few minutes we will help you setup your ERPNext account. Try and fill in as much information as you have even if it takes a bit longer. It will save you a lot of time later. Good Luck!') + 
+			frappe._('Welcome to ERPNext. Over the next few minutes we will help you setup your ERPNext account. Try and fill in as much information as you have even if it takes a bit longer. It will save you a lot of time later. Good Luck!') + 
 			'</p>',
 		working_html: '<h3 class="text-muted text-center"><i class="icon-refresh icon-spin"></i></h3>\
-			<h2 class="text-center">'+wn._('Setting up...')+'</h2>\
+			<h2 class="text-center">'+frappe._('Setting up...')+'</h2>\
 			<p class="text-center">' + 
-			wn._('Sit tight while your system is being setup. This may take a few moments.') + 
+			frappe._('Sit tight while your system is being setup. This may take a few moments.') + 
 			'</p>',
 		complete_html: '<h1 class="text-muted text-center"><i class="icon-thumbs-up"></i></h1>\
-			<h2 class="text-center">'+wn._('Setup Complete!')+'</h2>\
+			<h2 class="text-center">'+frappe._('Setup Complete!')+'</h2>\
 			<p class="text-center">' + 
-			wn._('Your setup is complete. Refreshing...') + 
+			frappe._('Your setup is complete. Refreshing...') + 
 			'</p>',
 		slides: [
 			// User
 			{
-				title: wn._("The First User: You"),
+				title: frappe._("The First User: You"),
 				icon: "icon-user",
 				fields: [
-					{"fieldname": "first_name", "label": wn._("First Name"), "fieldtype": "Data", 
+					{"fieldname": "first_name", "label": frappe._("First Name"), "fieldtype": "Data", 
 						reqd:1},
-					{"fieldname": "last_name", "label": wn._("Last Name"), "fieldtype": "Data", 
+					{"fieldname": "last_name", "label": frappe._("Last Name"), "fieldtype": "Data", 
 						reqd:1},
-					{"fieldname": "email", "label": wn._("Email Id"), "fieldtype": "Data", 
+					{"fieldname": "email", "label": frappe._("Email Id"), "fieldtype": "Data", 
 						reqd:1, "description":"Your Login Id", "options":"Email"},
-					{"fieldname": "password", "label": wn._("Password"), "fieldtype": "Password", 
+					{"fieldname": "password", "label": frappe._("Password"), "fieldtype": "Password", 
 						reqd:1},
 					{fieldtype:"Attach Image", fieldname:"attach_profile", 
 						label:"Attach Your Profile..."},
 				],
-				help: wn._('The first user will become the System Manager (you can change that later).'),
+				help: frappe._('The first user will become the System Manager (you can change that later).'),
 				onload: function(slide) {
 					if(user!=="Administrator") {
 						slide.form.fields_dict.password.$wrapper.toggle(false);
 						slide.form.fields_dict.email.$wrapper.toggle(false);
-						slide.form.fields_dict.first_name.set_input(wn.boot.profile.first_name);
-						slide.form.fields_dict.last_name.set_input(wn.boot.profile.last_name);
+						slide.form.fields_dict.first_name.set_input(frappe.boot.profile.first_name);
+						slide.form.fields_dict.last_name.set_input(frappe.boot.profile.last_name);
 					
 						delete slide.form.fields_dict.email;
 						delete slide.form.fields_dict.password;
@@ -86,31 +86,31 @@
 		
 			// Organization
 			{
-				title: wn._("The Organization"),
+				title: frappe._("The Organization"),
 				icon: "icon-building",
 				fields: [
-					{fieldname:'company_name', label: wn._('Company Name'), fieldtype:'Data', reqd:1,
+					{fieldname:'company_name', label: frappe._('Company Name'), fieldtype:'Data', reqd:1,
 						placeholder: 'e.g. "My Company LLC"'},
-					{fieldname:'company_abbr', label: wn._('Company Abbreviation'), fieldtype:'Data',
+					{fieldname:'company_abbr', label: frappe._('Company Abbreviation'), fieldtype:'Data',
 						placeholder:'e.g. "MC"',reqd:1},
 					{fieldname:'fy_start_date', label:'Financial Year Start Date', fieldtype:'Date',
 						description:'Your financial year begins on', reqd:1},
 					{fieldname:'fy_end_date', label:'Financial Year End Date', fieldtype:'Date',
 						description:'Your financial year ends on', reqd:1},
-					{fieldname:'company_tagline', label: wn._('What does it do?'), fieldtype:'Data',
+					{fieldname:'company_tagline', label: frappe._('What does it do?'), fieldtype:'Data',
 						placeholder:'e.g. "Build tools for builders"', reqd:1},
 				],
-				help: wn._('The name of your company for which you are setting up this system.'),
+				help: frappe._('The name of your company for which you are setting up this system.'),
 				onload: function(slide) {
 					slide.get_input("company_name").on("change", function() {
 						var parts = slide.get_input("company_name").val().split(" ");
 						var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
 						slide.get_input("company_abbr").val(abbr.toUpperCase());
-					}).val(wn.boot.control_panel.company_name || "").trigger("change");
+					}).val(frappe.boot.control_panel.company_name || "").trigger("change");
 
 					slide.get_input("fy_start_date").on("change", function() {
 						var year_end_date = 
-							wn.datetime.add_days(wn.datetime.add_months(slide.get_input("fy_start_date").val(), 12), -1);
+							frappe.datetime.add_days(frappe.datetime.add_months(slide.get_input("fy_start_date").val(), 12), -1);
 						slide.get_input("fy_end_date").val(year_end_date);
 					});
 				}
@@ -118,27 +118,27 @@
 		
 			// Country
 			{
-				title: wn._("Country, Timezone and Currency"),
+				title: frappe._("Country, Timezone and Currency"),
 				icon: "icon-flag",
 				fields: [
-					{fieldname:'country', label: wn._('Country'), reqd:1,
+					{fieldname:'country', label: frappe._('Country'), reqd:1,
 						options: "", fieldtype: 'Select'},
-					{fieldname:'currency', label: wn._('Default Currency'), reqd:1,
+					{fieldname:'currency', label: frappe._('Default Currency'), reqd:1,
 						options: "", fieldtype: 'Select'},
-					{fieldname:'timezone', label: wn._('Time Zone'), reqd:1,
+					{fieldname:'timezone', label: frappe._('Time Zone'), reqd:1,
 						options: "", fieldtype: 'Select'},
 				],
-				help: wn._('Select your home country and check the timezone and currency.'),
+				help: frappe._('Select your home country and check the timezone and currency.'),
 				onload: function(slide, form) {
-					wn.call({
-						method:"webnotes.country_info.get_country_timezone_info",
+					frappe.call({
+						method:"frappe.country_info.get_country_timezone_info",
 						callback: function(data) {
 							erpnext.country_info = data.message.country_info;
 							erpnext.all_timezones = data.message.all_timezones;
 							slide.get_input("country").empty()
 								.add_options([""].concat(keys(erpnext.country_info).sort()));
 							slide.get_input("currency").empty()
-								.add_options(wn.utils.unique([""].concat($.map(erpnext.country_info, 
+								.add_options(frappe.utils.unique([""].concat($.map(erpnext.country_info, 
 									function(opts, country) { return opts.currency; }))).sort());
 							slide.get_input("timezone").empty()
 								.add_options([""].concat(erpnext.all_timezones));
@@ -164,8 +164,8 @@
 			// Logo
 			{
 				icon: "icon-bookmark",
-				title: wn._("Logo and Letter Heads"),
-				help: wn._('Upload your letter head and logo - you can edit them later.'),
+				title: frappe._("Logo and Letter Heads"),
+				help: frappe._('Upload your letter head and logo - you can edit them later.'),
 				fields: [
 					{fieldtype:"Attach Image", fieldname:"attach_letterhead", label:"Attach Letterhead..."},
 					{fieldtype:"Attach Image", fieldname:"attach_logo", label:"Attach Logo..."},
@@ -175,40 +175,40 @@
 			// Taxes
 			{
 				icon: "icon-money",
-				"title": wn._("Add Taxes"),
-				"help": wn._("List your tax heads (e.g. VAT, Excise) (upto 3) and their standard rates. This will create a standard template, you can edit and add more later."),
+				"title": frappe._("Add Taxes"),
+				"help": frappe._("List your tax heads (e.g. VAT, Excise) (upto 3) and their standard rates. This will create a standard template, you can edit and add more later."),
 				"fields": [],
 			},
 
 			// Customers
 			{
 				icon: "icon-group",
-				"title": wn._("Your Customers"),
-				"help": wn._("List a few of your customers. They could be organizations or individuals."),
+				"title": frappe._("Your Customers"),
+				"help": frappe._("List a few of your customers. They could be organizations or individuals."),
 				"fields": [],
 			},
 		
 			// Items to Sell
 			{
 				icon: "icon-barcode",
-				"title": wn._("Your Products or Services"),
-				"help": wn._("List your products or services that you sell to your customers. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
+				"title": frappe._("Your Products or Services"),
+				"help": frappe._("List your products or services that you sell to your customers. Make sure to check the Item Group, Unit of Measure and other properties when you start."),
 				"fields": [],
 			},
 
 			// Suppliers
 			{
 				icon: "icon-group",
-				"title": wn._("Your Suppliers"),
-				"help": wn._("List a few of your suppliers. They could be organizations or individuals."),
+				"title": frappe._("Your Suppliers"),
+				"help": frappe._("List a few of your suppliers. They could be organizations or individuals."),
 				"fields": [],
 			},
 
 			// Items to Buy
 			{
 				icon: "icon-barcode",
-				"title": wn._("Products or Services You Buy"),
-				"help": wn._("List a few products or services you buy from your suppliers or vendors. If these are same as your products, then do not add them."),
+				"title": frappe._("Products or Services You Buy"),
+				"help": frappe._("List a few products or services you buy from your suppliers or vendors. If these are same as your products, then do not add them."),
 				"fields": [],
 			},
 
@@ -282,17 +282,17 @@
 		])
 	}
 	
-	erpnext.wiz = new wn.wiz.Wizard(wizard_settings)
+	erpnext.wiz = new frappe.wiz.Wizard(wizard_settings)
 }
 
-wn.pages['setup-wizard'].onshow = function(wrapper) {
-	if(wn.get_route()[1])
-		erpnext.wiz.show(wn.get_route()[1]);
+frappe.pages['setup-wizard'].onshow = function(wrapper) {
+	if(frappe.get_route()[1])
+		erpnext.wiz.show(frappe.get_route()[1]);
 }
 
-wn.provide("wn.wiz");
+frappe.provide("frappe.wiz");
 
-wn.wiz.Wizard = Class.extend({
+frappe.wiz.Wizard = Class.extend({
 	init: function(opts) {
 		$.extend(this, opts);
 		this.slides = this.slides;
@@ -309,20 +309,20 @@
 			return;
 		var me = this;
 		this.$welcome = this.get_message(this.welcome_html + 
-			'<br><p class="text-center"><button class="btn btn-primary">'+wn._("Start")+'</button></p>')
+			'<br><p class="text-center"><button class="btn btn-primary">'+frappe._("Start")+'</button></p>')
 			.appendTo(this.parent);
 		
 		this.$welcome.find(".btn").click(function() {
 			me.$welcome.toggle(false);
 			me.welcomed = true;
-			wn.set_route(me.page_name, "0");
+			frappe.set_route(me.page_name, "0");
 		})
 		
 		this.current_slide = {"$wrapper": this.$welcome};
 	},
 	show_working: function() {
 		this.hide_current_slide();
-		wn.set_route(this.page_name);
+		frappe.set_route(this.page_name);
 		this.current_slide = {"$wrapper": this.get_message(this.working_html).appendTo(this.parent)};
 	},
 	show_complete: function() {
@@ -331,14 +331,14 @@
 	},
 	show: function(id) {
 		if(!this.welcomed) {
-			wn.set_route(this.page_name);
+			frappe.set_route(this.page_name);
 			return;
 		}
 		id = cint(id);
 		if(this.current_slide && this.current_slide.id===id) 
 			return;
 		if(!this.slide_dict[id]) {
-			this.slide_dict[id] = new wn.wiz.WizardSlide($.extend(this.slides[id], {wiz:this, id:id}));
+			this.slide_dict[id] = new frappe.wiz.WizardSlide($.extend(this.slides[id], {wiz:this, id:id}));
 			this.slide_dict[id].make();
 		}
 		
@@ -362,7 +362,7 @@
 	}
 });
 
-wn.wiz.WizardSlide = Class.extend({
+frappe.wiz.WizardSlide = Class.extend({
 	init: function(opts) {
 		$.extend(this, opts);
 	},
@@ -400,7 +400,7 @@
 		this.body = this.$wrapper.find(".form")[0];
 		
 		if(this.fields) {
-			this.form = new wn.ui.FieldGroup({
+			this.form = new frappe.ui.FieldGroup({
 				fields: this.fields,
 				body: this.body,
 				no_submit_on_enter: true
@@ -413,7 +413,7 @@
 		if(this.id > 0) {
 			this.$prev = this.$wrapper.find('.prev-btn').removeClass("hide")
 				.click(function() { 
-					wn.set_route(me.wiz.page_name, me.id-1 + ""); 
+					frappe.set_route(me.wiz.page_name, me.id-1 + ""); 
 				})
 				.css({"margin-right": "10px"});
 			}
@@ -423,7 +423,7 @@
 					me.values = me.form.get_values();
 					if(me.values===null) 
 						return;
-					wn.set_route(me.wiz.page_name, me.id+1 + ""); 
+					frappe.set_route(me.wiz.page_name, me.id+1 + ""); 
 				})
 		} else {
 			this.$complete = this.$wrapper.find('.complete-btn').removeClass("hide")
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.py b/erpnext/setup/page/setup_wizard/setup_wizard.py
index 52c7f5c..3d7b1b5 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.py
@@ -2,22 +2,22 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes, json, base64
+import frappe, json, base64
 
-from webnotes.utils import cint, cstr, getdate, now, nowdate, get_defaults
-from webnotes import _
-from webnotes.utils.file_manager import save_file
+from frappe.utils import cint, cstr, getdate, now, nowdate, get_defaults
+from frappe import _
+from frappe.utils.file_manager import save_file
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def setup_account(args=None):
-	# if webnotes.conn.sql("select name from tabCompany"):
-	# 	webnotes.throw(_("Setup Already Complete!!"))
+	# if frappe.conn.sql("select name from tabCompany"):
+	# 	frappe.throw(_("Setup Already Complete!!"))
 		
 	if not args:
-		args = webnotes.local.form_dict
+		args = frappe.local.form_dict
 	if isinstance(args, basestring):
 		args = json.loads(args)
-	args = webnotes._dict(args)
+	args = frappe._dict(args)
 	
 	update_profile_name(args)
 	create_fiscal_year_and_company(args)
@@ -31,49 +31,49 @@
 	create_items(args)
 	create_customers(args)
 	create_suppliers(args)
-	webnotes.conn.set_value('Control Panel', None, 'home_page', 'desktop')
+	frappe.conn.set_value('Control Panel', None, 'home_page', 'desktop')
 
-	webnotes.clear_cache()
-	webnotes.conn.commit()
+	frappe.clear_cache()
+	frappe.conn.commit()
 	
 	# suppress msgprints
-	webnotes.local.message_log = []
+	frappe.local.message_log = []
 
 	return "okay"
 	
 def update_profile_name(args):
 	if args.get("email"):
 		args['name'] = args.get("email")
-		webnotes.flags.mute_emails = True
-		webnotes.bean({
+		frappe.flags.mute_emails = True
+		frappe.bean({
 			"doctype":"Profile",
 			"email": args.get("email"),
 			"first_name": args.get("first_name"),
 			"last_name": args.get("last_name")
 		}).insert()
-		webnotes.flags.mute_emails = False
-		from webnotes.auth import _update_password
+		frappe.flags.mute_emails = False
+		from frappe.auth import _update_password
 		_update_password(args.get("email"), args.get("password"))
 
 	else:
-		args['name'] = webnotes.session.user
+		args['name'] = frappe.session.user
 
 		# Update Profile
 		if not args.get('last_name') or args.get('last_name')=='None': 
 				args['last_name'] = None
-		webnotes.conn.sql("""update `tabProfile` SET first_name=%(first_name)s,
+		frappe.conn.sql("""update `tabProfile` SET first_name=%(first_name)s,
 			last_name=%(last_name)s WHERE name=%(name)s""", args)
 		
 	if args.get("attach_profile"):
 		filename, filetype, content = args.get("attach_profile").split(",")
 		fileurl = save_file(filename, content, "Profile", args.get("name"), decode=True).file_name
-		webnotes.conn.set_value("Profile", args.get("name"), "user_image", fileurl)
+		frappe.conn.set_value("Profile", args.get("name"), "user_image", fileurl)
 		
 	add_all_roles_to(args.get("name"))
 	
 def create_fiscal_year_and_company(args):
 	curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
-	webnotes.bean([{
+	frappe.bean([{
 		"doctype":"Fiscal Year",
 		'year': curr_fiscal_year,
 		'year_start_date': args.get('fy_start_date'),
@@ -82,7 +82,7 @@
 
 	
 	# Company
-	webnotes.bean([{
+	frappe.bean([{
 		"doctype":"Company",
 		'domain': args.get("industry"),
 		'company_name':args.get('company_name'),
@@ -94,7 +94,7 @@
 	
 def create_price_lists(args):
 	for pl_type in ["Selling", "Buying"]:
-		webnotes.bean([
+		frappe.bean([
 			{
 				"doctype": "Price List",
 				"price_list_name": "Standard " + pl_type,
@@ -112,79 +112,79 @@
 	
 def set_defaults(args):
 	# enable default currency
-	webnotes.conn.set_value("Currency", args.get("currency"), "enabled", 1)
+	frappe.conn.set_value("Currency", args.get("currency"), "enabled", 1)
 	
-	global_defaults = webnotes.bean("Global Defaults", "Global Defaults")
+	global_defaults = frappe.bean("Global Defaults", "Global Defaults")
 	global_defaults.doc.fields.update({
 		'current_fiscal_year': args.curr_fiscal_year,
 		'default_currency': args.get('currency'),
 		'default_company':args.get('company_name'),
-		'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
+		'date_format': frappe.conn.get_value("Country", args.get("country"), "date_format"),
 		"float_precision": 3,
 		"country": args.get("country"),
 		"time_zone": args.get("time_zone")
 	})
 	global_defaults.save()
 	
-	accounts_settings = webnotes.bean("Accounts Settings")
+	accounts_settings = frappe.bean("Accounts Settings")
 	accounts_settings.doc.auto_accounting_for_stock = 1
 	accounts_settings.save()
 
-	stock_settings = webnotes.bean("Stock Settings")
+	stock_settings = frappe.bean("Stock Settings")
 	stock_settings.doc.item_naming_by = "Item Code"
 	stock_settings.doc.valuation_method = "FIFO"
 	stock_settings.doc.stock_uom = "Nos"
 	stock_settings.doc.auto_indent = 1
 	stock_settings.save()
 	
-	selling_settings = webnotes.bean("Selling Settings")
+	selling_settings = frappe.bean("Selling Settings")
 	selling_settings.doc.cust_master_name = "Customer Name"
 	selling_settings.doc.so_required = "No"
 	selling_settings.doc.dn_required = "No"
 	selling_settings.save()
 
-	buying_settings = webnotes.bean("Buying Settings")
+	buying_settings = frappe.bean("Buying Settings")
 	buying_settings.doc.supp_master_name = "Supplier Name"
 	buying_settings.doc.po_required = "No"
 	buying_settings.doc.pr_required = "No"
 	buying_settings.doc.maintain_same_rate = 1
 	buying_settings.save()
 
-	notification_control = webnotes.bean("Notification Control")
+	notification_control = frappe.bean("Notification Control")
 	notification_control.doc.quotation = 1
 	notification_control.doc.sales_invoice = 1
 	notification_control.doc.purchase_order = 1
 	notification_control.save()
 
-	hr_settings = webnotes.bean("HR Settings")
+	hr_settings = frappe.bean("HR Settings")
 	hr_settings.doc.emp_created_by = "Naming Series"
 	hr_settings.save()
 
-	email_settings = webnotes.bean("Email Settings")
+	email_settings = frappe.bean("Email Settings")
 	email_settings.doc.send_print_in_body_and_attachment = 1
 	email_settings.save()
 
 	# control panel
-	cp = webnotes.doc("Control Panel", "Control Panel")
+	cp = frappe.doc("Control Panel", "Control Panel")
 	cp.company_name = args["company_name"]
 	cp.save()
 			
 def create_feed_and_todo():
 	"""update activty feed and create todo for creation of item, customer, vendor"""
 	from erpnext.home import make_feed
-	make_feed('Comment', 'ToDo', '', webnotes.session['user'],
+	make_feed('Comment', 'ToDo', '', frappe.session['user'],
 		'ERNext Setup Complete!', '#6B24B3')
 
 def create_email_digest():
-	from webnotes.profile import get_system_managers
+	from frappe.profile import get_system_managers
 	system_managers = get_system_managers(only_name=True)
 	if not system_managers: 
 		return
 	
-	companies = webnotes.conn.sql_list("select name FROM `tabCompany`")
+	companies = frappe.conn.sql_list("select name FROM `tabCompany`")
 	for company in companies:
-		if not webnotes.conn.exists("Email Digest", "Default Weekly Digest - " + company):
-			edigest = webnotes.bean({
+		if not frappe.conn.exists("Email Digest", "Default Weekly Digest - " + company):
+			edigest = frappe.bean({
 				"doctype": "Email Digest",
 				"name": "Default Weekly Digest - " + company,
 				"company": company,
@@ -200,7 +200,7 @@
 	
 	# scheduler errors digest
 	if companies:
-		edigest = webnotes.new_bean("Email Digest")
+		edigest = frappe.new_bean("Email Digest")
 		edigest.doc.fields.update({
 			"name": "Scheduler Errors",
 			"company": companies[0],
@@ -222,7 +222,7 @@
 def create_taxes(args):
 	for i in xrange(1,6):
 		if args.get("tax_" + str(i)):
-			webnotes.bean({
+			frappe.bean({
 				"doctype":"Account",
 				"company": args.get("company_name"),
 				"parent_account": "Duties and Taxes - " + args.get("company_abbr"),
@@ -238,7 +238,7 @@
 		item = args.get("item_" + str(i))
 		if item:
 			item_group = args.get("item_group_" + str(i))
-			webnotes.bean({
+			frappe.bean({
 				"doctype":"Item",
 				"item_code": item,
 				"item_name": item,
@@ -253,13 +253,13 @@
 			if args.get("item_img_" + str(i)):
 				filename, filetype, content = args.get("item_img_" + str(i)).split(",")
 				fileurl = save_file(filename, content, "Item", item, decode=True).file_name
-				webnotes.conn.set_value("Item", item, "image", fileurl)
+				frappe.conn.set_value("Item", item, "image", fileurl)
 					
 	for i in xrange(1,6):
 		item = args.get("item_buy_" + str(i))
 		if item:
 			item_group = args.get("item_buy_group_" + str(i))
-			webnotes.bean({
+			frappe.bean({
 				"doctype":"Item",
 				"item_code": item,
 				"item_name": item,
@@ -274,14 +274,14 @@
 			if args.get("item_img_" + str(i)):
 				filename, filetype, content = args.get("item_img_" + str(i)).split(",")
 				fileurl = save_file(filename, content, "Item", item, decode=True).file_name
-				webnotes.conn.set_value("Item", item, "image", fileurl)
+				frappe.conn.set_value("Item", item, "image", fileurl)
 
 
 def create_customers(args):
 	for i in xrange(1,6):
 		customer = args.get("customer_" + str(i))
 		if customer:
-			webnotes.bean({
+			frappe.bean({
 				"doctype":"Customer",
 				"customer_name": customer,
 				"customer_type": "Company",
@@ -292,7 +292,7 @@
 			
 			if args.get("customer_contact_" + str(i)):
 				contact = args.get("customer_contact_" + str(i)).split(" ")
-				webnotes.bean({
+				frappe.bean({
 					"doctype":"Contact",
 					"customer": customer,
 					"first_name":contact[0],
@@ -303,7 +303,7 @@
 	for i in xrange(1,6):
 		supplier = args.get("supplier_" + str(i))
 		if supplier:
-			webnotes.bean({
+			frappe.bean({
 				"doctype":"Supplier",
 				"supplier_name": supplier,
 				"supplier_type": "Local",
@@ -312,7 +312,7 @@
 
 			if args.get("supplier_contact_" + str(i)):
 				contact = args.get("supplier_contact_" + str(i)).split(" ")
-				webnotes.bean({
+				frappe.bean({
 					"doctype":"Contact",
 					"supplier": supplier,
 					"first_name":contact[0],
@@ -322,7 +322,7 @@
 
 def create_letter_head(args):
 	if args.get("attach_letterhead"):
-		lh = webnotes.bean({
+		lh = frappe.bean({
 			"doctype":"Letter Head",
 			"letter_head_name": "Standard",
 			"is_default": 1
@@ -330,13 +330,13 @@
 		
 		filename, filetype, content = args.get("attach_letterhead").split(",")
 		fileurl = save_file(filename, content, "Letter Head", "Standard", decode=True).file_name
-		webnotes.conn.set_value("Letter Head", "Standard", "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
+		frappe.conn.set_value("Letter Head", "Standard", "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
 		
 		
 				
 def add_all_roles_to(name):
-	profile = webnotes.doc("Profile", name)
-	for role in webnotes.conn.sql("""select name from tabRole"""):
+	profile = frappe.doc("Profile", name)
+	for role in frappe.conn.sql("""select name from tabRole"""):
 		if role[0] not in ["Administrator", "Guest", "All", "Customer", "Supplier", "Partner"]:
 			d = profile.addchild("user_roles", "UserRole")
 			d.role = role[0]
@@ -344,12 +344,12 @@
 			
 def create_territories():
 	"""create two default territories, one for home country and one named Rest of the World"""
-	from webnotes.utils.nestedset import get_root_of
-	country = webnotes.conn.get_value("Control Panel", None, "country")
+	from frappe.utils.nestedset import get_root_of
+	country = frappe.conn.get_value("Control Panel", None, "country")
 	root_territory = get_root_of("Territory")
 	for name in (country, "Rest Of The World"):
-		if name and not webnotes.conn.exists("Territory", name):
-			webnotes.bean({
+		if name and not frappe.conn.exists("Territory", name):
+			frappe.bean({
 				"doctype": "Territory",
 				"territory_name": name.replace("'", ""),
 				"parent_territory": root_territory,
diff --git a/erpnext/setup/page/setup_wizard/test_setup_wizard.py b/erpnext/setup/page/setup_wizard/test_setup_wizard.py
index a4e5c29..8f6e9f8 100644
--- a/erpnext/setup/page/setup_wizard/test_setup_wizard.py
+++ b/erpnext/setup/page/setup_wizard/test_setup_wizard.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 from erpnext.setup.page.setup_wizard.test_setup_data import args
 from erpnext.setup.page.setup_wizard.setup_wizard import setup_account
 
 if __name__=="__main__":
-	webnotes.connect()
-	webnotes.local.form_dict = webnotes._dict(args)
+	frappe.connect()
+	frappe.local.form_dict = frappe._dict(args)
 	setup_account()
 	
\ No newline at end of file
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index 68a5a5a..30fae1b 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -2,14 +2,14 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint, throw
+import frappe
+from frappe import _, msgprint, throw
 import json
 
 def get_company_currency(company):
-	currency = webnotes.conn.get_value("Company", company, "default_currency")
+	currency = frappe.conn.get_value("Company", company, "default_currency")
 	if not currency:
-		currency = webnotes.conn.get_default("currency")
+		currency = frappe.conn.get_default("currency")
 	if not currency:
 		throw(_('Please specify Default Currency in Company Master \
 			and Global Defaults'))
@@ -18,21 +18,21 @@
 
 def get_root_of(doctype):
 	"""Get root element of a DocType with a tree structure"""
-	result = webnotes.conn.sql_list("""select name from `tab%s` 
+	result = frappe.conn.sql_list("""select name from `tab%s` 
 		where lft=1 and rgt=(select max(rgt) from `tab%s` where docstatus < 2)""" % 
 		(doctype, doctype))
 	return result[0] if result else None
 	
 def get_ancestors_of(doctype, name):
 	"""Get ancestor elements of a DocType with a tree structure"""
-	lft, rgt = webnotes.conn.get_value(doctype, name, ["lft", "rgt"])
-	result = webnotes.conn.sql_list("""select name from `tab%s` 
+	lft, rgt = frappe.conn.get_value(doctype, name, ["lft", "rgt"])
+	result = frappe.conn.sql_list("""select name from `tab%s` 
 		where lft<%s and rgt>%s order by lft desc""" % (doctype, "%s", "%s"), (lft, rgt))
 	return result or []
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_price_list_currency(price_list):
-	price_list_currency = webnotes.conn.get_value("Price List", {"name": price_list, 
+	price_list_currency = frappe.conn.get_value("Price List", {"name": price_list, 
 		"enabled": 1}, "currency")
 
 	if not price_list_currency:
diff --git a/erpnext/startup/__init__.py b/erpnext/startup/__init__.py
index 1d96323..a3fe7ce 100644
--- a/erpnext/startup/__init__.py
+++ b/erpnext/startup/__init__.py
@@ -19,7 +19,7 @@
 # default settings that can be made for a profile.
 from __future__ import unicode_literals
 
-import webnotes
+import frappe
 
 product_name = "ERPNext"
 profile_defaults = {
@@ -32,9 +32,9 @@
 	<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
 	
 def get_monthly_bulk_mail_limit():
-	import webnotes
+	import frappe
 	# if global settings, then 500 or unlimited
-	if webnotes.conn.get_value('Email Settings', None, 'outgoing_mail_server'):
+	if frappe.conn.get_value('Email Settings', None, 'outgoing_mail_server'):
 		return 999999
 	else:
 		return 500
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index e28e5ba..148f373 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -3,52 +3,52 @@
 
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def boot_session(bootinfo):
 	"""boot session - send website info if guest"""
-	import webnotes
-	import webnotes.model.doc
+	import frappe
+	import frappe.model.doc
 	
-	bootinfo['custom_css'] = webnotes.conn.get_value('Style Settings', None, 'custom_css') or ''
-	bootinfo['website_settings'] = webnotes.model.doc.getsingle('Website Settings')
+	bootinfo['custom_css'] = frappe.conn.get_value('Style Settings', None, 'custom_css') or ''
+	bootinfo['website_settings'] = frappe.model.doc.getsingle('Website Settings')
 
-	if webnotes.session['user']!='Guest':
+	if frappe.session['user']!='Guest':
 		bootinfo['letter_heads'] = get_letter_heads()
 		
 		load_country_and_currency(bootinfo)
 		
-		import webnotes.model.doctype
-		bootinfo['notification_settings'] = webnotes.doc("Notification Control", 
+		import frappe.model.doctype
+		bootinfo['notification_settings'] = frappe.doc("Notification Control", 
 			"Notification Control").get_values()
 				
 		# if no company, show a dialog box to create a new company
-		bootinfo["customer_count"] = webnotes.conn.sql("""select count(*) from tabCustomer""")[0][0]
+		bootinfo["customer_count"] = frappe.conn.sql("""select count(*) from tabCustomer""")[0][0]
 
 		if not bootinfo["customer_count"]:
-			bootinfo['setup_complete'] = webnotes.conn.sql("""select name from 
+			bootinfo['setup_complete'] = frappe.conn.sql("""select name from 
 				tabCompany limit 1""") and 'Yes' or 'No'
 		
 		
 		# load subscription info
-		from webnotes import conf
+		from frappe import conf
 		for key in ['max_users', 'expires_on', 'max_space', 'status', 'commercial_support']:
 			if key in conf: bootinfo[key] = conf.get(key)
 
-		bootinfo['docs'] += webnotes.conn.sql("""select name, default_currency, cost_center
+		bootinfo['docs'] += frappe.conn.sql("""select name, default_currency, cost_center
             from `tabCompany`""", as_dict=1, update={"doctype":":Company"})
 
 def load_country_and_currency(bootinfo):
 	if bootinfo.control_panel.country and \
-		webnotes.conn.exists("Country", bootinfo.control_panel.country):
-		bootinfo["docs"] += [webnotes.doc("Country", bootinfo.control_panel.country)]
+		frappe.conn.exists("Country", bootinfo.control_panel.country):
+		bootinfo["docs"] += [frappe.doc("Country", bootinfo.control_panel.country)]
 		
-	bootinfo["docs"] += webnotes.conn.sql("""select * from tabCurrency
+	bootinfo["docs"] += frappe.conn.sql("""select * from tabCurrency
 		where ifnull(enabled,0)=1""", as_dict=1, update={"doctype":":Currency"})
 
 def get_letter_heads():
-	import webnotes
-	ret = webnotes.conn.sql("""select name, content from `tabLetter Head` 
+	import frappe
+	ret = frappe.conn.sql("""select name, content from `tabLetter Head` 
 		where ifnull(disabled,0)=0""")
 	return dict(ret)
 	
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index c69501c..5fd8436 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -3,19 +3,19 @@
 
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def on_session_creation(login_manager):
 	"""
 		called after login
 		update login_from and delete parallel sessions
 	"""
-	if webnotes.session['user'] not in ('Guest'):
+	if frappe.session['user'] not in ('Guest'):
 		# create feed
-		from webnotes.utils import nowtime
-		from webnotes.profile import get_user_fullname
-		webnotes.conn.begin()
+		from frappe.utils import nowtime
+		from frappe.profile import get_user_fullname
+		frappe.conn.begin()
 		make_feed('Login', 'Profile', login_manager.user, login_manager.user,
 			'%s logged in at %s' % (get_user_fullname(login_manager.user), nowtime()), 
 			login_manager.user=='Administrator' and '#8CA2B3' or '#1B750D')
-		webnotes.conn.commit()
\ No newline at end of file
+		frappe.conn.commit()
\ No newline at end of file
diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py
index d4cb4fa..c20e760 100644
--- a/erpnext/startup/notifications.py
+++ b/erpnext/startup/notifications.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def get_notification_config():
 	return { "for_doctype": 
diff --git a/erpnext/startup/webutils.py b/erpnext/startup/webutils.py
index 3abd192..9942b1b 100644
--- a/erpnext/startup/webutils.py
+++ b/erpnext/startup/webutils.py
@@ -3,7 +3,7 @@
 
 from __future__ import unicode_literals
 
-import webnotes
+import frappe
 
 def update_website_context(context):
 	if not context.get("favicon"):
diff --git a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
index 282fa7a..3f29d61 100644
--- a/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
+++ b/erpnext/stock/Print Format/Delivery Note Classic/Delivery Note Classic.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Delivery Note", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Georgia\", serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Georgia\", serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table thead {\n\t\tborder-bottom: 1px solid black;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px 0px;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Stock", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
index 3508746..2c66867 100644
--- a/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
+++ b/erpnext/stock/Print Format/Delivery Note Modern/Delivery Note Modern.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Delivery Note", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Delivery Note No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n        line-height: 150%;\n\t}\n\n\t.common {\n\t\tfont-family: \"Helvetica\", \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 10px 0px;\n\t}\n\n\ttable {\n\t\tborder-collapse: collapse;\n\t\twidth: 100%;\n\t\tvertical-align: top;\n\t\tborder-style: none !important;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t\tborder-style: none !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h1 {\n\t\ttext-transform: uppercase;\n\t\tcolor: white;\n\t\tfont-size: 55px;\n\t\tfont-style: italic;\n\t}\n\n\ttable.header-table thead tr:nth-child(1) div {\n\t\theight: 24px;\n\t\tbackground-color: #696969;\n\t\tvertical-align: middle;\n\t\tpadding: 12px 0px 0px 0px;\n\t\twidth: 100%;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body table tr td {\n\t\tbackground-color: #DCDCDC !important;\n\t}\n\n\tdiv.page-body table tr:nth-child(1) td {\n\t\tbackground-color: #696969 !important;\n\t\tcolor: white !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n\n\ttable.footer-table tfoot td {\n\t\tbackground-color: #696969;\n\t\theight: 10px;\n\t}\n\n\t.imp-details {\n\t\tbackground-color: #DCDCDC;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><div><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></div></td></tr>\n\t\t\t<tr><td colspan=2><div style=\"height:15px\"></div></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr class='imp-details'>\n\t\t\t\t\t\t<td><b>Delivery Note No.</b></td>\n\t\t\t\t\t\t<td><script>cur_frm.docname</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold' class='imp-details'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\t<tr><td colspan=2><div></div></td><tr>\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Stock", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
index 17506f1..4b62d70 100644
--- a/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
+++ b/erpnext/stock/Print Format/Delivery Note Spartan/Delivery Note Spartan.txt
@@ -9,7 +9,7 @@
  {
   "doc_type": "Delivery Note", 
   "doctype": "Print Format", 
-  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/webnotes/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
+  "html": "<!--\n\tSample Print Format for ERPNext\n\tPlease use at your own discretion\n\tFor suggestions and contributions:\n\t\thttps://github.com/frappe/erpnext-print-templates\n\n\tFreely usable under MIT license\n-->\n\n<!-- Style Settings -->\n<style>\n\t/*\n\t\tcommon style for whole page\n\t\tThis should include:\n\t\t+ page size related settings\n\t\t+ font family settings\n\t\t+ line spacing settings\n\t*/\n\t@media screen {\n\t\tbody {\n\t\t\twidth: 8.3in;\n\t\t}\n\t}\n\n\thtml, body, div, span, td {\n\t\tfont-family: \"Arial\", sans-serif;\n\t\tfont-size: 12px;\n\t}\n\n\tbody {\n\t\tpadding: 10px;\n\t\tmargin: auto;\n\t\tfont-size: 12px;\n\t}\n\n\t.common {\n\t\tfont-family: \"Arial\", sans-serif !important;\n\t\tfont-size: 12px;\n\t\tpadding: 0px;\n\t}\n\n\ttable {\n\t\twidth: 100% !important;\n\t\tvertical-align: top;\n\t}\n\n\ttable td {\n\t\tpadding: 2px 0px;\n\t}\n\n\ttable, td {\n\t\tborder-collapse: collapse !important;\n\t\tpadding: 0px;\n\t\tmargin: 0px !important;\n\t}\n\t\n\ttable h1, h2, h3, h4, h5, h6 {\n\t\tpadding: 0px;\n\t\tmargin: 0px;\n\t}\n\n\ttable.header-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.header-table h3 {\n\t\tcolor: gray;\n\t}\n\n\ttable.header-table thead td {\n\t\tpadding: 5px;\n\t}\n\n\ttable.header-table > thead,\n\ttable.header-table > tbody > tr > td,\n\ttable.footer-table > tbody > tr > td {\n\t\tborder: 1px solid black;\n\t\tpadding: 5px;\n\t}\n\n\ttable.footer-table > tbody,\n\ttable.header-table > thead {\n\t\tborder-bottom: 3px solid black;\n\t}\n\n\ttable.header-table > thead {\n\t\tborder-top: 3px solid black;\n\t}\n\n\tdiv.page-body table td:nth-child(6),\n\tdiv.page-body table td:nth-child(7) {\n\t\ttext-align: right;\n\t}\n\n\tdiv.page-body td {\n\t\tbackground-color: white !important;\n\t\tborder: 1px solid black !important;\n\t}\n\n\ttable.footer-table td {\n\t\tvertical-align: top;\n\t}\n\n\ttable.footer-table td table td:nth-child(2),\n\ttable.footer-table td table td:nth-child(3) {\n\t\ttext-align: right;\n\t}\n</style>\n\n\n<!-- Javascript -->\n<script>\n\tsi_std = {\n\t\tprint_item_table: function() {\n\t\t\tvar table = print_table(\n\t\t\t\t'Delivery Note',\n\t\t\t\tdoc.name,\n\t\t\t\t'delivery_note_details',\n\t\t\t\t'Delivery Note Item',\n\t\t\t\t[// Here specify the table columns to be displayed\n\t\t\t\t\t'SR', 'item_code', 'item_name', 'description', 'qty', 'stock_uom',\n\t\t\t\t\t'base_rate', 'amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the labels of column headings\n\t\t\t\t\t'Sr', 'Item Code', 'Item Name', 'Description', 'Qty',\n\t\t\t\t\t'UoM', 'Basic Rate', 'Amount'\n\t\t\t\t],\n\t\t\t\t[// Here specify the column widths\n\t\t\t\t\t'3%', '10%', '15%', '32%', '5%',\n\t\t\t\t\t'5%', '15%', '15%'\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\t{\n\t\t\t\t\t'description' : function(data_row) {\n\t\t\t\t\t\tvar to_append = ''\n\t\t\t\t\t\tif(data_row.discount_percentage){\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Discount: ' + \n\t\t\t\t\t\t\t\tdata_row.discount_percentage + '% on ' +\n\t\t\t\t\t\t\t\tformat_currency(data_row.price_list_rate, doc.currency) + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(data_row.serial_no) {\n\t\t\t\t\t\t\tto_append = '<div style=\"padding-left: 15px;\"><i>Serial No.:' + \n\t\t\t\t\t\t\t\t((data_row.serial_no.indexOf('\\n')>-1)?'<br />':'&nbsp;') + \n\t\t\t\t\t\t\t\tdata_row.serial_no + '</i></div>';\n\t\t\t\t\t\t\tif(data_row.description.indexOf(to_append)==-1) {\n\t\t\t\t\t\t\t\tdata_row.description = data_row.description + to_append;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn data_row.description;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t\t// This code takes care of page breaks\n\t\t\tif(table.appendChild) {\n\t\t\t\tout = table.innerHTML;\n\t\t\t} else {\n\t\t\t\tout = '';\n\t\t\t\tfor(var i=0; i < (table.length-1); i++) {\n\t\t\t\t\tout += table[i].innerHTML + \n\t\t\t\t\t\t'<div style = \"page-break-after: always;\" \\\n\t\t\t\t\t\tclass = \"page_break\"></div>\\\n\t\t\t\t\t\t<div class=\"page-settings\"></div>';\n\t\t\t\t}\n\t\t\t\tout += table[table.length-1].innerHTML;\n\t\t\t}\n\t\t\treturn out;\n\t\t},\n\n\n\t\tprint_other_charges: function(parent) {\n\t\t\tvar oc = getchildren('Sales Taxes and Charges', doc.name, 'other_charges');\n\t\t\tvar rows = '<table width=100%>\\n';\n\t\t\tfor(var i=0; i<oc.length; i++) {\n\t\t\t\tif(!oc[i].included_in_print_rate) {\n\t\t\t\t\trows +=\n\t\t\t\t\t\t'<tr>\\n' +\n\t\t\t\t\t\t\t'\\t<td>' + oc[i].description + '</td>\\n' +\n\t\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(oc[i].tax_amount/doc.conversion_rate, doc.currency) + '</td>\\n' +\n\t\t\t\t\t\t'</tr>\\n';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(doc.discount_amount) {\n\t\t\t\trows += '<tr>\\n' + \n\t\t\t\t\t\t'\\t<td>Discount Amount</td>\\n' + \n\t\t\t\t\t\t'\\t<td style=\"width: 38%; text-align: right;\">' + format_currency(doc.discount_amount, doc.currency) + '</td>\\n' + \n\t\t\t\t\t'</tr>\\n';\n\t\t\t}\n\n\t\t\treturn rows + '</table>\\n';\n\t\t}\n\t};\n</script>\n\n\n<!-- Page Layout Settings -->\n<div class='common page-header'>\n\t<!-- \n\t\tPage Header will contain\n\t\t\t+ table 1\n\t\t\t\t+ table 1a\n\t\t\t\t\t- Name\n\t\t\t\t\t- Address\n\t\t\t\t\t- Contact\n\t\t\t\t\t- Mobile No\n\t\t\t\t+ table 1b\n\t\t\t\t\t- Voucher Date\n\t\t\t\t\t- Due Date\n\t-->\n\t<table class='header-table' cellspacing=0>\n\t\t<thead>\n\t\t\t<tr><td colspan=2><script>'<h1>' + (doc.select_print_heading || 'Delivery Note') + '</h1>'</script></td></tr>\n\t\t\t<tr><td colspan=2><h3><script>cur_frm.docname</script></h3></td></tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60%><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=22%><b>Name</b></td>\n\t\t\t\t\t\t<td><script>doc.customer_name</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Address</b></td>\n\t\t\t\t\t\t<td><script>replace_newlines(doc.address_display)</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Contact</b></td>\n\t\t\t\t\t\t<td><script>doc.contact_display</script></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody></table></td>\n\t\t\t\t<td><table width=100% cellspacing=0><tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=63%><b>Delivery Note Date</b></td>\n\t\t\t\t\t\t<td><script>date.str_to_user(doc.transaction_date)</script></td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Sales Order No.</b></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<script>doc.sales_order_no</script><br />\n\t\t\t\t\t\t\t<i>(<script>date.str_to_user(doc.posting_date)</script>)</i>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<tr>\t\t\t\t\t\n\t\t\t\t</tbody></table></td>\n\t\t\t</tr>\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>\n<div class='common page-body'>\n\t<!-- \n\t\tPage Body will contain\n\t\t\t+ table 2\n\t\t\t\t- Sales Invoice Data\n\t-->\n\t<script>si_std.print_item_table()</script>\n</div>\n<div class='common page-footer'>\n\t<!-- \n\t\tPage Footer will contain\n\t\t\t+ table 3\n\t\t\t\t- Terms and Conditions\n\t\t\t\t- Total Rounded Amount Calculation\n\t\t\t\t- Total Rounded Amount in Words\n\t-->\n\t<table class='footer-table' width=100% cellspacing=0>\n\t\t<thead>\n\t\t\t\n\t\t</thead>\n\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=60% style='padding-right: 10px;'>\n\t\t\t\t\t<b>Terms, Conditions &amp; Other Information:</b><br />\n\t\t\t\t\t<script>doc.terms</script>\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<table cellspacing=0 width=100%><tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Net Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.net_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td colspan=3><script>si_std.print_other_charges()</script></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>Grand Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.grand_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr style='font-weight: bold'>\n\t\t\t\t\t\t\t<td>Rounded Total</td>\n\t\t\t\t\t\t\t<td style=\"width: 38%; text-align: right;\"><script>\n\t\t\t\t\t\t\t\tformat_currency(doc.rounded_total_export, doc.currency)\n\t\t\t\t\t\t\t</script></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody></table>\n\t\t\t\t\t<br /><b>In Words</b><br />\n\t\t\t\t\t<i><script>doc.in_words_export</script></i>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\n\t\t</tbody>\n\t\t<tfoot>\n\t\t\n\t\t</tfoot>\n\t</table>\n</div>", 
   "module": "Stock", 
   "name": "__common__", 
   "print_format_type": "Client", 
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index 1acb3aa..f546911 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import add_days, cint,flt, nowdate, get_url_to_form, formatdate
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import add_days, cint,flt, nowdate, get_url_to_form, formatdate
+from frappe import msgprint, _
 
-import webnotes.defaults
+import frappe.defaults
 
 
 class DocType:	
@@ -16,7 +16,7 @@
 		
 	def validate(self):
 		if self.doc.fields.get("__islocal") or not self.doc.stock_uom:
-			self.doc.stock_uom = webnotes.conn.get_value('Item', self.doc.item_code, 'stock_uom')
+			self.doc.stock_uom = frappe.conn.get_value('Item', self.doc.item_code, 'stock_uom')
 				
 		self.validate_mandatory()
 		
@@ -60,7 +60,7 @@
 		self.doc.save()
 		
 	def get_first_sle(self):
-		sle = webnotes.conn.sql("""
+		sle = frappe.conn.sql("""
 			select * from `tabStock Ledger Entry`
 			where item_code = %s
 			and warehouse = %s
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 6239f28..aa9db09 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -12,7 +12,7 @@
 {% include 'utilities/doctype/sms_control/sms_control.js' %}
 {% include 'accounts/doctype/sales_invoice/pos.js' %}
 
-wn.provide("erpnext.stock");
+frappe.provide("erpnext.stock");
 erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
 	refresh: function(doc, dt, dn) {
 		this._super();
@@ -26,20 +26,20 @@
 				});
 			
 			if(!from_sales_invoice)
-				cur_frm.add_custom_button(wn._('Make Invoice'), this.make_sales_invoice);
+				cur_frm.add_custom_button(frappe._('Make Invoice'), this.make_sales_invoice);
 		}
 	
 		if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1) 
-			cur_frm.add_custom_button(wn._('Make Installation Note'), this.make_installation_note);
+			cur_frm.add_custom_button(frappe._('Make Installation Note'), this.make_installation_note);
 
 		if (doc.docstatus==1) {
-			cur_frm.appframe.add_button(wn._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
+			cur_frm.appframe.add_button(frappe._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
 			this.show_stock_ledger();
 			this.show_general_ledger();
 		}
 
 		if(doc.docstatus==0 && !doc.__islocal) {
-			cur_frm.add_custom_button(wn._('Make Packing Slip'), cur_frm.cscript['Make Packing Slip']);
+			cur_frm.add_custom_button(frappe._('Make Packing Slip'), cur_frm.cscript['Make Packing Slip']);
 		}
 	
 		set_print_hide(doc, dt, dn);
@@ -49,9 +49,9 @@
 		cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(["expense_account", "cost_center"], aii_enabled);
 
 		if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Sales Order'), 
+			cur_frm.add_custom_button(frappe._('From Sales Order'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_delivery_note",
 						source_doctype: "Sales Order",
 						get_query_filters: {
@@ -69,14 +69,14 @@
 	}, 
 	
 	make_sales_invoice: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice",
 			source_name: cur_frm.doc.name
 		})
 	}, 
 	
 	make_installation_note: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.stock.doctype.delivery_note.delivery_note.make_installation_note",
 			source_name: cur_frm.doc.name
 		});
@@ -96,7 +96,7 @@
 $.extend(cur_frm.cscript, new erpnext.stock.DeliveryNoteController({frm: cur_frm}));
 
 cur_frm.cscript.new_contact = function(){
-	tn = wn.model.make_new_doc_and_get_name('Contact');
+	tn = frappe.model.make_new_doc_and_get_name('Contact');
 	locals['Contact'][tn].is_customer = 1;
 	if(doc.customer) locals['Contact'][tn].customer = doc.customer;
 	loaddoc('Contact', tn);
@@ -120,15 +120,15 @@
 }
 
 cur_frm.cscript['Make Packing Slip'] = function() {
-	n = wn.model.make_new_doc_and_get_name('Packing Slip');
+	n = frappe.model.make_new_doc_and_get_name('Packing Slip');
 	ps = locals["Packing Slip"][n];
 	ps.delivery_note = cur_frm.doc.name;
 	loaddoc('Packing Slip', n);
 }
 
 var set_print_hide= function(doc, cdt, cdn){
-	var dn_fields = wn.meta.docfield_map['Delivery Note'];
-	var dn_item_fields = wn.meta.docfield_map['Delivery Note Item'];
+	var dn_fields = frappe.meta.docfield_map['Delivery Note'];
+	var dn_item_fields = frappe.meta.docfield_map['Delivery Note Item'];
 	var dn_fields_copy = dn_fields;
 	var dn_item_fields_copy = dn_item_fields;
 
@@ -195,8 +195,8 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings.delivery_note)) {
-		cur_frm.email_doc(wn.boot.notification_settings.delivery_note_message);
+	if(cint(frappe.boot.notification_settings.delivery_note)) {
+		cur_frm.email_doc(frappe.boot.notification_settings.delivery_note_message);
 	}
 }
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 70f7f49..3eeb4b7 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -2,14 +2,14 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, cint
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
-import webnotes.defaults
-from webnotes.model.mapper import get_mapped_doclist
+from frappe.utils import cstr, flt, cint
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
+import frappe.defaults
+from frappe.model.mapper import get_mapped_doclist
 from erpnext.stock.utils import update_bin
 from erpnext.controllers.selling_controller import SellingController
 
@@ -34,7 +34,7 @@
 		}]
 		
 	def onload(self):
-		billed_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Invoice Item`
+		billed_qty = frappe.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Invoice Item`
 			where docstatus=1 and delivery_note=%s""", self.doc.name)
 		if billed_qty:
 			total_qty = sum((item.qty for item in self.doclist.get({"parentfield": "delivery_note_details"})))
@@ -46,12 +46,12 @@
 	def set_actual_qty(self):
 		for d in getlist(self.doclist, 'delivery_note_details'):
 			if d.item_code and d.warehouse:
-				actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
+				actual_qty = frappe.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code, d.warehouse))
 				d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
 
 	def so_required(self):
 		"""check in manage account if sales order required or not"""
-		if webnotes.conn.get_value("Selling Settings", None, 'so_required') == 'Yes':
+		if frappe.conn.get_value("Selling Settings", None, 'so_required') == 'Yes':
 			 for d in getlist(self.doclist,'delivery_note_details'):
 				 if not d.against_sales_order:
 					 msgprint("Sales Order No. required against item %s"%d.item_code)
@@ -92,7 +92,7 @@
 					},
 				})
 
-				if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
+				if cint(frappe.defaults.get_global_default('maintain_same_sales_rate')):
 					super(DocType, self).validate_with_previous_doc(self.tname, {
 						fn[0] + " Item": {
 							"ref_dn_field": "prevdoc_detail_docname",
@@ -104,7 +104,7 @@
 	def validate_proj_cust(self):
 		"""check for does customer belong to same project as entered.."""
 		if self.doc.project_name and self.doc.customer:
-			res = webnotes.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
+			res = frappe.conn.sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
 			if not res:
 				msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
 				raise Exception
@@ -115,7 +115,7 @@
 			e = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
 			f = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
 
-			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
+			if frappe.conn.get_value("Item", d.item_code, "is_stock_item") == 'Yes':
 				if e in check_list:
 					msgprint("Please check whether item %s has been entered twice wrongly." 
 						% d.item_code)
@@ -130,7 +130,7 @@
 
 	def validate_warehouse(self):
 		for d in self.get_item_list():
-			if webnotes.conn.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
+			if frappe.conn.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
 				if not d['warehouse']:
 					msgprint("Please enter Warehouse for item %s as it is stock item"
 						% d['item_code'], raise_exception=1)
@@ -138,11 +138,11 @@
 
 	def update_current_stock(self):
 		for d in getlist(self.doclist, 'delivery_note_details'):
-			bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+			bin = frappe.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
 			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
 
 		for d in getlist(self.doclist, 'packing_details'):
-			bin = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code =	%s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
+			bin = frappe.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code =	%s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
 			d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
 			d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
 
@@ -163,7 +163,7 @@
 		self.make_gl_entries()
 
 		# set DN status
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 
 
 	def on_cancel(self):
@@ -174,7 +174,7 @@
 		
 		self.update_stock_ledger()
 
-		webnotes.conn.set(self.doc, 'status', 'Cancelled')
+		frappe.conn.set(self.doc, 'status', 'Cancelled')
 		self.cancel_packing_slips()
 		
 		self.make_cancel_gl_entries()
@@ -198,15 +198,15 @@
 		if packing_error_list:
 			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)
+			frappe.msgprint("Packing Error:\n" + err_msg, raise_exception=1)
 
 	def check_next_docstatus(self):
-		submit_rv = webnotes.conn.sql("select t1.name from `tabSales Invoice` t1,`tabSales Invoice Item` t2 where t1.name = t2.parent and t2.delivery_note = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_rv = frappe.conn.sql("select t1.name from `tabSales Invoice` t1,`tabSales Invoice Item` t2 where t1.name = t2.parent and t2.delivery_note = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_rv:
 			msgprint("Sales Invoice : " + cstr(submit_rv[0][0]) + " has already been submitted !")
 			raise Exception , "Validation Error."
 
-		submit_in = webnotes.conn.sql("select t1.name from `tabInstallation Note` t1, `tabInstallation Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_in = frappe.conn.sql("select t1.name from `tabInstallation Note` t1, `tabInstallation Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_in:
 			msgprint("Installation Note : "+cstr(submit_in[0][0]) +" has already been submitted !")
 			raise Exception , "Validation Error."
@@ -215,21 +215,21 @@
 		"""
 			Cancel submitted packing slips related to this delivery note
 		"""
-		res = webnotes.conn.sql("""SELECT name FROM `tabPacking Slip` WHERE delivery_note = %s 
+		res = frappe.conn.sql("""SELECT name FROM `tabPacking Slip` WHERE delivery_note = %s 
 			AND docstatus = 1""", self.doc.name)
 
 		if res:
-			from webnotes.model.bean import Bean
+			from frappe.model.bean import Bean
 			for r in res:
 				ps = Bean(dt='Packing Slip', dn=r[0])
 				ps.cancel()
-			webnotes.msgprint(_("Packing Slip(s) Cancelled"))
+			frappe.msgprint(_("Packing Slip(s) Cancelled"))
 
 
 	def update_stock_ledger(self):
 		sl_entries = []
 		for d in self.get_item_list():
-			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
+			if frappe.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes" \
 					and d.warehouse:
 				self.update_reserved_qty(d)
 										
@@ -243,7 +243,7 @@
 		if d['reserved_qty'] < 0 :
 			# Reduce reserved qty from reserved warehouse mentioned in so
 			if not d["reserved_warehouse"]:
-				webnotes.throw(_("Reserved Warehouse is missing in Sales Order"))
+				frappe.throw(_("Reserved Warehouse is missing in Sales Order"))
 				
 			args = {
 				"item_code": d['item_code'],
@@ -270,7 +270,7 @@
 	"""returns a map: {dn_detail: invoiced_qty}"""
 	invoiced_qty_map = {}
 	
-	for dn_detail, qty in webnotes.conn.sql("""select dn_detail, qty from `tabSales Invoice Item`
+	for dn_detail, qty in frappe.conn.sql("""select dn_detail, qty from `tabSales Invoice Item`
 		where delivery_note=%s and docstatus=1""", delivery_note):
 			if not invoiced_qty_map.get(dn_detail):
 				invoiced_qty_map[dn_detail] = 0
@@ -278,12 +278,12 @@
 	
 	return invoiced_qty_map
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_sales_invoice(source_name, target_doclist=None):
 	invoiced_qty_map = get_invoiced_qty_map(source_name)
 	
 	def update_accounts(source, target):
-		si = webnotes.bean(target)
+		si = frappe.bean(target)
 		si.doc.is_pos = 0
 		si.run_method("onload_post_render")
 		
@@ -291,7 +291,7 @@
 			si.doclist.get({"parentfield": "entries", "qty": [">", 0]}))
 		
 		if len(si.doclist.get({"parentfield": "entries"})) == 0:
-			webnotes.msgprint(_("Hey! All these items have already been invoiced."),
+			frappe.msgprint(_("Hey! All these items have already been invoiced."),
 				raise_exception=True)
 				
 		return si.doclist
@@ -332,7 +332,7 @@
 	
 	return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_installation_note(source_name, target_doclist=None):
 	def update_item(obj, target, source_parent):
 		target.qty = flt(obj.qty) - flt(obj.installed_qty)
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 3ea33ae..30ff38d 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -4,16 +4,16 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-import webnotes.defaults
-from webnotes.utils import cint
+import frappe
+import frappe.defaults
+from frappe.utils import cint
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries, set_perpetual_inventory, test_records as pr_test_records
 
 def _insert_purchase_receipt(item_code=None):
 	if not item_code:
 		item_code = pr_test_records[0][1]["item_code"]
 	
-	pr = webnotes.bean(copy=pr_test_records[0])
+	pr = frappe.bean(copy=pr_test_records[0])
 	pr.doclist[1].item_code = item_code
 	pr.insert()
 	pr.submit()
@@ -25,12 +25,12 @@
 		
 		from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
 		_insert_purchase_receipt()
-		dn = webnotes.bean(copy=test_records[0]).insert()
+		dn = frappe.bean(copy=test_records[0]).insert()
 		
-		self.assertRaises(webnotes.ValidationError, make_sales_invoice, 
+		self.assertRaises(frappe.ValidationError, make_sales_invoice, 
 			dn.doc.name)
 
-		dn = webnotes.bean("Delivery Note", dn.doc.name)
+		dn = frappe.bean("Delivery Note", dn.doc.name)
 		dn.submit()
 		si = make_sales_invoice(dn.doc.name)
 		
@@ -38,21 +38,21 @@
 		
 		# modify amount
 		si[1].rate = 200
-		self.assertRaises(webnotes.ValidationError, webnotes.bean(si).insert)
+		self.assertRaises(frappe.ValidationError, frappe.bean(si).insert)
 		
 	
 	def test_delivery_note_no_gl_entry(self):
 		self.clear_stock_account_balance()
 		set_perpetual_inventory(0)
-		self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 0)
+		self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 0)
 		
 		_insert_purchase_receipt()
 		
-		dn = webnotes.bean(copy=test_records[0])
+		dn = frappe.bean(copy=test_records[0])
 		dn.insert()
 		dn.submit()
 		
-		stock_value, stock_value_difference = webnotes.conn.get_value("Stock Ledger Entry", 
+		stock_value, stock_value_difference = frappe.conn.get_value("Stock Ledger Entry", 
 			{"voucher_type": "Delivery Note", "voucher_no": dn.doc.name, 
 				"item_code": "_Test Item"}, ["stock_value", "stock_value_difference"])
 		self.assertEqual(stock_value, 0)
@@ -63,16 +63,16 @@
 	def test_delivery_note_gl_entry(self):
 		self.clear_stock_account_balance()
 		set_perpetual_inventory()
-		self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
-		webnotes.conn.set_value("Item", "_Test Item", "valuation_method", "FIFO")
+		self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
+		frappe.conn.set_value("Item", "_Test Item", "valuation_method", "FIFO")
 		
 		_insert_purchase_receipt()
 		
-		dn = webnotes.bean(copy=test_records[0])
+		dn = frappe.bean(copy=test_records[0])
 		dn.doclist[1].expense_account = "Cost of Goods Sold - _TC"
 		dn.doclist[1].cost_center = "Main - _TC"
 
-		stock_in_hand_account = webnotes.conn.get_value("Account", 
+		stock_in_hand_account = frappe.conn.get_value("Account", 
 			{"master_name": dn.doclist[1].warehouse})
 		
 		from erpnext.accounts.utils import get_balance_on
@@ -95,7 +95,7 @@
 		self.assertEquals(bal, prev_bal - 375.0)
 				
 		# back dated purchase receipt
-		pr = webnotes.bean(copy=pr_test_records[0])
+		pr = frappe.bean(copy=pr_test_records[0])
 		pr.doc.posting_date = "2013-01-01"
 		pr.doclist[1].rate = 100
 		pr.doclist[1].base_amount = 100
@@ -123,11 +123,11 @@
 		_insert_purchase_receipt()
 		_insert_purchase_receipt("_Test Item Home Desktop 100")
 		
-		dn = webnotes.bean(copy=test_records[0])
+		dn = frappe.bean(copy=test_records[0])
 		dn.doclist[1].item_code = "_Test Sales BOM Item"
 		dn.doclist[1].qty = 1
 	
-		stock_in_hand_account = webnotes.conn.get_value("Account", 
+		stock_in_hand_account = frappe.conn.get_value("Account", 
 			{"master_name": dn.doclist[1].warehouse})
 		
 		from erpnext.accounts.utils import get_balance_on
@@ -162,16 +162,16 @@
 		se = make_serialized_item()
 		serial_nos = get_serial_nos(se.doclist[1].serial_no)
 		
-		dn = webnotes.bean(copy=test_records[0])
+		dn = frappe.bean(copy=test_records[0])
 		dn.doclist[1].item_code = "_Test Serialized Item With Series"
 		dn.doclist[1].qty = 1
 		dn.doclist[1].serial_no = serial_nos[0]
 		dn.insert()
 		dn.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], "status"), "Delivered")
-		self.assertFalse(webnotes.conn.get_value("Serial No", serial_nos[0], "warehouse"))
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], 
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], "status"), "Delivered")
+		self.assertFalse(frappe.conn.get_value("Serial No", serial_nos[0], "warehouse"))
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], 
 			"delivery_document_no"), dn.doc.name)
 			
 		return dn
@@ -183,9 +183,9 @@
 
 		serial_nos = get_serial_nos(dn.doclist[1].serial_no)
 
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], "status"), "Available")
-		self.assertEquals(webnotes.conn.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
-		self.assertFalse(webnotes.conn.get_value("Serial No", serial_nos[0], 
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], "status"), "Available")
+		self.assertEquals(frappe.conn.get_value("Serial No", serial_nos[0], "warehouse"), "_Test Warehouse - _TC")
+		self.assertFalse(frappe.conn.get_value("Serial No", serial_nos[0], 
 			"delivery_document_no"))
 
 	def test_serialize_status(self):
@@ -195,11 +195,11 @@
 		se = make_serialized_item()
 		serial_nos = get_serial_nos(se.doclist[1].serial_no)
 		
-		sr = webnotes.bean("Serial No", serial_nos[0])
+		sr = frappe.bean("Serial No", serial_nos[0])
 		sr.doc.status = "Not Available"
 		sr.save()
 		
-		dn = webnotes.bean(copy=test_records[0])
+		dn = frappe.bean(copy=test_records[0])
 		dn.doclist[1].item_code = "_Test Serialized Item With Series"
 		dn.doclist[1].qty = 1
 		dn.doclist[1].serial_no = serial_nos[0]
@@ -208,9 +208,9 @@
 		self.assertRaises(SerialNoStatusError, dn.submit)
 		
 	def clear_stock_account_balance(self):
-		webnotes.conn.sql("""delete from `tabBin`""")
-		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
-		webnotes.conn.sql("delete from `tabGL Entry`")
+		frappe.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("delete from `tabStock Ledger Entry`")
+		frappe.conn.sql("delete from `tabGL Entry`")
 
 test_dependencies = ["Sales BOM"]
 
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 3a3129c..8f08d5a 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -29,7 +29,7 @@
 
 cur_frm.cscript.edit_prices_button = function() {
 	cur_frm.add_custom_button("Add / Edit Prices", function() {
-		wn.set_route("Report", "Item Price", {"item_code": cur_frm.doc.name});
+		frappe.set_route("Report", "Item Price", {"item_code": cur_frm.doc.name});
 	}, "icon-money");
 }
 
@@ -117,14 +117,14 @@
 
 cur_frm.cscript.add_image = function(doc, dt, dn) {
 	if(!doc.image) {
-		msgprint(wn._('Please select an "Image" first'));
+		msgprint(frappe._('Please select an "Image" first'));
 		return;
 	}
 
 	doc.description_html = repl('<table style="width: 100%; table-layout: fixed;">' +
 		'<tr><td style="width:110px"><img src="%(imgurl)s" width="100px"></td>' +
 		'<td>%(desc)s</td></tr>' +
-		'</table>', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description});
+		'</table>', {imgurl: frappe.utils.get_file_link(doc.image), desc:doc.description});
 
 	refresh_field('description_html');
 }
@@ -132,7 +132,7 @@
 // Quotation to validation - either customer or lead mandatory
 cur_frm.cscript.weight_to_validate = function(doc, cdt, cdn){
 	if((doc.nett_weight || doc.gross_weight) && !doc.weight_uom) {
-		msgprint(wn._('Weight is mentioned,\nPlease mention "Weight UOM" too'));
+		msgprint(frappe._('Weight is mentioned,\nPlease mention "Weight UOM" too'));
 		validated = 0;
 	}
 }
@@ -150,10 +150,10 @@
 }
 
 cur_frm.cscript.copy_from_item_group = function(doc) {
-	wn.model.with_doc("Item Group", doc.item_group, function() {
-		$.each(wn.model.get("Item Website Specification", {parent:doc.item_group}), 
+	frappe.model.with_doc("Item Group", doc.item_group, function() {
+		$.each(frappe.model.get("Item Website Specification", {parent:doc.item_group}), 
 			function(i, d) {
-				var n = wn.model.add_child(doc, "Item Website Specification", 
+				var n = frappe.model.add_child(doc, "Item Website Specification", 
 					"item_website_specifications");
 				n.label = d.label;
 				n.description = d.description;
@@ -169,7 +169,7 @@
 	if(!cur_frm.doc.description_html)
 		cur_frm.cscript.add_image(cur_frm.doc);
 	else {
-		msgprint(wn._("You may need to update: ") + 
-			wn.meta.get_docfield(cur_frm.doc.doctype, "description_html").label);
+		msgprint(frappe._("You may need to update: ") + 
+			frappe.meta.get_docfield(cur_frm.doc.doctype, "description_html").label);
 	}
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 2bb6d82..d1ee4d6 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -2,14 +2,14 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, getdate, now_datetime, formatdate
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes import msgprint, _
+from frappe.utils import cstr, flt, getdate, now_datetime, formatdate
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe import msgprint, _
 
-from webnotes.model.controller import DocListController
+from frappe.model.controller import DocListController
 
 class WarehouseNotSet(Exception): pass
 
@@ -18,8 +18,8 @@
 		self.doc.fields["__sle_exists"] = self.check_if_sle_exists()
 	
 	def autoname(self):
-		if webnotes.conn.get_default("item_naming_by")=="Naming Series":
-			from webnotes.model.doc import make_autoname
+		if frappe.conn.get_default("item_naming_by")=="Naming Series":
+			from frappe.model.doc import make_autoname
 			self.doc.item_code = make_autoname(self.doc.naming_series+'.#####')
 		elif not self.doc.item_code:
 			msgprint(_("Item Code (item_code) is mandatory because Item naming is not sequential."), raise_exception=1)
@@ -43,7 +43,7 @@
 		self.validate_item_type_for_reorder()
 
 		if self.doc.name:
-			self.old_page_name = webnotes.conn.get_value('Item', self.doc.name, 'page_name')
+			self.old_page_name = frappe.conn.get_value('Item', self.doc.name, 'page_name')
 			
 	def on_update(self):
 		self.validate_name_with_item_group()
@@ -51,7 +51,7 @@
 
 	def check_warehouse_is_set_for_stock_item(self):
 		if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse:
-			webnotes.msgprint(_("Default Warehouse is mandatory for Stock Item."),
+			frappe.msgprint(_("Default Warehouse is mandatory for Stock Item."),
 				raise_exception=WarehouseNotSet)
 			
 	def add_default_uom_in_conversion_factor_table(self):
@@ -69,13 +69,13 @@
 	def check_stock_uom_with_bin(self):
 		if not self.doc.fields.get("__islocal"):
 			matched=True
-			ref_uom = webnotes.conn.get_value("Stock Ledger Entry", 
+			ref_uom = frappe.conn.get_value("Stock Ledger Entry", 
 				{"item_code": self.doc.name}, "stock_uom")
 			if ref_uom:
 				if cstr(ref_uom) != cstr(self.doc.stock_uom):
 					matched = False
 			else:
-				bin_list = webnotes.conn.sql("select * from tabBin where item_code=%s", 
+				bin_list = frappe.conn.sql("select * from tabBin where item_code=%s", 
 					self.doc.item_code, as_dict=1)
 				for bin in bin_list:
 					if (bin.reserved_qty > 0 or bin.ordered_qty > 0 or bin.indented_qty > 0 \
@@ -84,11 +84,11 @@
 							break
 						
 				if matched and bin_list:
-					webnotes.conn.sql("""update tabBin set stock_uom=%s where item_code=%s""",
+					frappe.conn.sql("""update tabBin set stock_uom=%s where item_code=%s""",
 						(self.doc.stock_uom, self.doc.name))
 				
 			if not matched:
-				webnotes.throw(_("Default Unit of Measure can not be changed directly because you have already made some transaction(s) with another UOM. To change default UOM, use 'UOM Replace Utility' tool under Stock module."))
+				frappe.throw(_("Default Unit of Measure can not be changed directly because you have already made some transaction(s) with another UOM. To change default UOM, use 'UOM Replace Utility' tool under Stock module."))
 	
 	def validate_conversion_factor(self):
 		check_list = []
@@ -111,7 +111,7 @@
 			self.doc.is_pro_applicable = "No"
 
 		if self.doc.is_pro_applicable == 'Yes' and self.doc.is_stock_item == 'No':
-			webnotes.throw(_("As Production Order can be made for this item, \
+			frappe.throw(_("As Production Order can be made for this item, \
 				it must be a stock item."))
 
 		if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No':
@@ -119,20 +119,20 @@
 			
 	def check_for_active_boms(self):
 		if self.doc.is_purchase_item != "Yes":
-			bom_mat = webnotes.conn.sql("""select distinct t1.parent 
+			bom_mat = frappe.conn.sql("""select distinct t1.parent 
 				from `tabBOM Item` t1, `tabBOM` t2 where t2.name = t1.parent 
 				and t1.item_code =%s and ifnull(t1.bom_no, '') = '' and t2.is_active = 1 
 				and t2.docstatus = 1 and t1.docstatus =1 """, self.doc.name)
 				
 			if bom_mat and bom_mat[0][0]:
-				webnotes.throw(_("Item must be a purchase item, \
+				frappe.throw(_("Item must be a purchase item, \
 					as it is present in one or many Active BOMs"))
 					
 		if self.doc.is_manufactured_item != "Yes":
-			bom = webnotes.conn.sql("""select name from `tabBOM` where item = %s 
+			bom = frappe.conn.sql("""select name from `tabBOM` where item = %s 
 				and is_active = 1""", (self.doc.name,))
 			if bom and bom[0][0]:
-				webnotes.throw(_("""Allow Bill of Materials should be 'Yes'. Because one or many \
+				frappe.throw(_("""Allow Bill of Materials should be 'Yes'. Because one or many \
 					active BOMs present for this item"""))
 					
 	def fill_customer_code(self):
@@ -147,7 +147,7 @@
 		check_list=[]
 		for d in getlist(self.doclist,'item_tax'):
 			if d.tax_type:
-				account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
+				account_type = frappe.conn.get_value("Account", d.tax_type, "account_type")
 				
 				if account_type not in ['Tax', 'Chargeable', 'Income Account', 'Expense Account']:
 					msgprint("'%s' is not Tax / Chargeable / Income / Expense Account" % d.tax_type, raise_exception=1)
@@ -159,7 +159,7 @@
 						
 	def validate_barcode(self):
 		if self.doc.barcode:
-			duplicate = webnotes.conn.sql("""select name from tabItem where barcode = %s 
+			duplicate = frappe.conn.sql("""select name from tabItem where barcode = %s 
 				and name != %s""", (self.doc.barcode, self.doc.name))
 			if duplicate:
 				msgprint("Barcode: %s already used in item: %s" % 
@@ -167,36 +167,36 @@
 
 	def cant_change(self):
 		if not self.doc.fields.get("__islocal"):
-			vals = webnotes.conn.get_value("Item", self.doc.name, 
+			vals = frappe.conn.get_value("Item", self.doc.name, 
 				["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True)
 			
 			if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or 
 				vals.has_serial_no != self.doc.has_serial_no or 
 				cstr(vals.valuation_method) != cstr(self.doc.valuation_method)):
 					if self.check_if_sle_exists() == "exists":
-						webnotes.throw(_("As there are existing stock transactions for this item, you can not change the values of 'Has Serial No', 'Is Stock Item' and 'Valuation Method'"))
+						frappe.throw(_("As there are existing stock transactions for this item, you can not change the values of 'Has Serial No', 'Is Stock Item' and 'Valuation Method'"))
 							
 	def validate_item_type_for_reorder(self):
 		if self.doc.re_order_level or len(self.doclist.get({"parentfield": "item_reorder", 
 				"material_request_type": "Purchase"})):
 			if not self.doc.is_purchase_item:
-				webnotes.msgprint(_("""To set reorder level, item must be Purchase Item"""), 
+				frappe.msgprint(_("""To set reorder level, item must be Purchase Item"""), 
 					raise_exception=1)
 	
 	def check_if_sle_exists(self):
-		sle = webnotes.conn.sql("""select name from `tabStock Ledger Entry` 
+		sle = frappe.conn.sql("""select name from `tabStock Ledger Entry` 
 			where item_code = %s""", self.doc.name)
 		return sle and 'exists' or 'not exists'
 
 	def validate_name_with_item_group(self):
 		# causes problem with tree build
-		if webnotes.conn.exists("Item Group", self.doc.name):
-			webnotes.msgprint("An item group exists with same name (%s), \
+		if frappe.conn.exists("Item Group", self.doc.name):
+			frappe.msgprint("An item group exists with same name (%s), \
 				please change the item name or rename the item group" % 
 				self.doc.name, raise_exception=1)
 
 	def update_item_price(self):
-		webnotes.conn.sql("""update `tabItem Price` set item_name=%s, 
+		frappe.conn.sql("""update `tabItem Price` set item_name=%s, 
 			item_description=%s, modified=NOW() where item_code=%s""",
 			(self.doc.item_name, self.doc.description, self.doc.name))
 
@@ -209,10 +209,10 @@
 		return page_name_from
 		
 	def get_tax_rate(self, tax_type):
-		return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
+		return { "tax_rate": frappe.conn.get_value("Account", tax_type, "tax_rate") }
 
 	def get_file_details(self, arg = ''):
-		file = webnotes.conn.sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
+		file = frappe.conn.sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
 
 		ret = {
 			'file_group'	:	file and file[0]['file_group'] or '',
@@ -221,24 +221,24 @@
 		return ret
 		
 	def on_trash(self):
-		webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
+		frappe.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
 
 	def before_rename(self, olddn, newdn, merge=False):
 		if merge:
 			# Validate properties before merging
-			if not webnotes.conn.exists("Item", newdn):
-				webnotes.throw(_("Item ") + newdn +_(" does not exists"))
+			if not frappe.conn.exists("Item", newdn):
+				frappe.throw(_("Item ") + newdn +_(" does not exists"))
 			
 			field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"]
-			new_properties = [cstr(d) for d in webnotes.conn.get_value("Item", newdn, field_list)]
+			new_properties = [cstr(d) for d in frappe.conn.get_value("Item", newdn, field_list)]
 			if new_properties != [cstr(self.doc.fields[fld]) for fld in field_list]:
-				webnotes.throw(_("To merge, following properties must be same for both items")
+				frappe.throw(_("To merge, following properties must be same for both items")
 					+ ": \n" + ", ".join([self.meta.get_label(fld) for fld in field_list]))
 
-			webnotes.conn.sql("delete from `tabBin` where item_code=%s", olddn)
+			frappe.conn.sql("delete from `tabBin` where item_code=%s", olddn)
 
 	def after_rename(self, olddn, newdn, merge):
-		webnotes.conn.set_value("Item", newdn, "item_code", newdn)
+		frappe.conn.set_value("Item", newdn, "item_code", newdn)
 			
 		if merge:
 			self.set_last_purchase_rate(newdn)
@@ -246,23 +246,23 @@
 			
 	def set_last_purchase_rate(self, newdn):
 		last_purchase_rate = get_last_purchase_details(newdn).get("base_rate", 0)
-		webnotes.conn.set_value("Item", newdn, "last_purchase_rate", last_purchase_rate)
+		frappe.conn.set_value("Item", newdn, "last_purchase_rate", last_purchase_rate)
 			
 	def recalculate_bin_qty(self, newdn):
 		from erpnext.utilities.repost_stock import repost_stock
-		webnotes.conn.auto_commit_on_many_writes = 1
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.auto_commit_on_many_writes = 1
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
-		for warehouse in webnotes.conn.sql("select name from `tabWarehouse`"):
+		for warehouse in frappe.conn.sql("select name from `tabWarehouse`"):
 			repost_stock(newdn, warehouse[0])
 		
-		webnotes.conn.set_default("allow_negative_stock", 
-			webnotes.conn.get_value("Stock Settings", None, "allow_negative_stock"))
-		webnotes.conn.auto_commit_on_many_writes = 0
+		frappe.conn.set_default("allow_negative_stock", 
+			frappe.conn.get_value("Stock Settings", None, "allow_negative_stock"))
+		frappe.conn.auto_commit_on_many_writes = 0
 
 def validate_end_of_life(item_code, end_of_life=None, verbose=1):
 	if not end_of_life:
-		end_of_life = webnotes.conn.get_value("Item", item_code, "end_of_life")
+		end_of_life = frappe.conn.get_value("Item", item_code, "end_of_life")
 	
 	if end_of_life and getdate(end_of_life) <= now_datetime().date():
 		msg = (_("Item") + " %(item_code)s: " + _("reached its end of life on") + \
@@ -270,14 +270,14 @@
 			"in Item master") % {
 				"item_code": item_code,
 				"date": formatdate(end_of_life),
-				"end_of_life_label": webnotes.get_doctype("Item").get_label("end_of_life")
+				"end_of_life_label": frappe.get_doctype("Item").get_label("end_of_life")
 			}
 		
 		_msgprint(msg, verbose)
 		
 def validate_is_stock_item(item_code, is_stock_item=None, verbose=1):
 	if not is_stock_item:
-		is_stock_item = webnotes.conn.get_value("Item", item_code, "is_stock_item")
+		is_stock_item = frappe.conn.get_value("Item", item_code, "is_stock_item")
 		
 	if is_stock_item != "Yes":
 		msg = (_("Item") + " %(item_code)s: " + _("is not a Stock Item")) % {
@@ -288,7 +288,7 @@
 		
 def validate_cancelled_item(item_code, docstatus=None, verbose=1):
 	if docstatus is None:
-		docstatus = webnotes.conn.get_value("Item", item_code, "docstatus")
+		docstatus = frappe.conn.get_value("Item", item_code, "docstatus")
 	
 	if docstatus == 2:
 		msg = (_("Item") + " %(item_code)s: " + _("is a cancelled Item")) % {
@@ -301,13 +301,13 @@
 	if verbose:
 		msgprint(msg, raise_exception=True)
 	else:
-		raise webnotes.ValidationError, msg
+		raise frappe.ValidationError, msg
 		
 		
 def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
 	"""returns last purchase details in stock uom"""
 	# get last purchase order item details
-	last_purchase_order = webnotes.conn.sql("""\
+	last_purchase_order = frappe.conn.sql("""\
 		select po.name, po.transaction_date, po.conversion_rate,
 			po_item.conversion_factor, po_item.base_price_list_rate, 
 			po_item.discount_percentage, po_item.base_rate
@@ -318,7 +318,7 @@
 		limit 1""", (item_code, cstr(doc_name)), as_dict=1)
 
 	# get last purchase receipt item details		
-	last_purchase_receipt = webnotes.conn.sql("""\
+	last_purchase_receipt = frappe.conn.sql("""\
 		select pr.name, pr.posting_date, pr.posting_time, pr.conversion_rate,
 			pr_item.conversion_factor, pr_item.base_price_list_rate, pr_item.discount_percentage,
 			pr_item.base_rate
@@ -346,10 +346,10 @@
 		purchase_date = purchase_receipt_date
 		
 	else:
-		return webnotes._dict()
+		return frappe._dict()
 	
 	conversion_factor = flt(last_purchase.conversion_factor)
-	out = webnotes._dict({
+	out = frappe._dict({
 		"base_price_list_rate": flt(last_purchase.base_price_list_rate) / conversion_factor,
 		"base_rate": flt(last_purchase.base_rate) / conversion_factor,
 		"discount_percentage": flt(last_purchase.discount_percentage),
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 39b77df..f990ec9 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -3,9 +3,9 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
-from webnotes.test_runner import make_test_records
+from frappe.test_runner import make_test_records
 
 test_ignore = ["BOM"]
 test_dependencies = ["Warehouse"]
@@ -13,7 +13,7 @@
 class TestItem(unittest.TestCase):
 	def test_default_warehouse(self):
 		from erpnext.stock.doctype.item.item import WarehouseNotSet
-		item = webnotes.bean(copy=test_records[0])
+		item = frappe.bean(copy=test_records[0])
 		item.doc.is_stock_item = "Yes"
 		item.doc.default_warehouse = None
 		self.assertRaises(WarehouseNotSet, item.insert)
diff --git a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
+++ b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py
index 284c52f..791a7fe 100644
--- a/erpnext/stock/doctype/item_price/item_price.py
+++ b/erpnext/stock/doctype/item_price/item_price.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import throw, _
+import frappe
+from frappe import throw, _
 
-class ItemPriceDuplicateItem(webnotes.ValidationError): pass
+class ItemPriceDuplicateItem(frappe.ValidationError): pass
 
 class DocType:
 	def __init__(self, d, dl):
@@ -19,7 +19,7 @@
 		self.update_item_details()
 		
 	def validate_item(self):
-		if not webnotes.conn.exists("Item", self.doc.item_code):
+		if not frappe.conn.exists("Item", self.doc.item_code):
 			throw("{doctype}: {item} {not_found}".format(**{
 				"doctype": _("Item"), 
 				"item": self.doc.item_code, 
@@ -27,7 +27,7 @@
 			}))
 
 	def validate_price_list(self):
-		enabled = webnotes.conn.get_value("Price List", self.doc.price_list, "enabled")
+		enabled = frappe.conn.get_value("Price List", self.doc.price_list, "enabled")
 		if not enabled:
 			throw("{message}: {price_list} {disabled}".format(**{
 				"message": _("Price List"),
@@ -36,7 +36,7 @@
 			}))
 
 	def check_duplicate_item(self):
-		if webnotes.conn.sql("""select name from `tabItem Price` 
+		if frappe.conn.sql("""select name from `tabItem Price` 
 			where item_code=%s and price_list=%s and name!=%s""", 
 			(self.doc.item_code, self.doc.price_list, self.doc.name)):
 				throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{
@@ -48,10 +48,10 @@
 
 	def update_price_list_details(self):
 		self.doc.buying, self.doc.selling, self.doc.currency = \
-			webnotes.conn.get_value("Price List", {"name": self.doc.price_list, "enabled": 1}, 
+			frappe.conn.get_value("Price List", {"name": self.doc.price_list, "enabled": 1}, 
 				["buying", "selling", "currency"])
 
 	def update_item_details(self):
-		self.doc.item_name, self.doc.item_description = webnotes.conn.get_value("Item", 
+		self.doc.item_name, self.doc.item_description = frappe.conn.get_value("Item", 
 			self.doc.item_code, ["item_name", "description"])
 				
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py
index ee97fc4..4585e38 100644
--- a/erpnext/stock/doctype/item_price/test_item_price.py
+++ b/erpnext/stock/doctype/item_price/test_item_price.py
@@ -3,12 +3,12 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
+import frappe
 
 class TestItem(unittest.TestCase):
 	def test_duplicate_item(self):
 		from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem
-		bean = webnotes.bean(copy=test_records[0])
+		bean = frappe.bean(copy=test_records[0])
 		self.assertRaises(ItemPriceDuplicateItem, bean.insert)
 
 test_records = [
diff --git a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
+++ b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/item_reorder/item_reorder.py b/erpnext/stock/doctype/item_reorder/item_reorder.py
index e5468e5..968a25b 100644
--- a/erpnext/stock/doctype/item_reorder/item_reorder.py
+++ b/erpnext/stock/doctype/item_reorder/item_reorder.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.py b/erpnext/stock/doctype/item_supplier/item_supplier.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/item_supplier/item_supplier.py
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/item_tax/item_tax.py b/erpnext/stock/doctype/item_tax/item_tax.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/item_tax/item_tax.py
+++ b/erpnext/stock/doctype/item_tax/item_tax.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/item_website_specification/item_website_specification.py b/erpnext/stock/doctype/item_website_specification/item_website_specification.py
index e5468e5..968a25b 100644
--- a/erpnext/stock/doctype/item_website_specification/item_website_specification.py
+++ b/erpnext/stock/doctype/item_website_specification/item_website_specification.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
+++ b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
+++ b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
index 86b34c0..68a29a7 100644
--- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
+++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js
@@ -2,15 +2,15 @@
 // License: GNU General Public License v3. See license.txt
 
 
-wn.provide("erpnext.stock");
-wn.require("assets/erpnext/js/controllers/stock_controller.js");
+frappe.provide("erpnext.stock");
+frappe.require("assets/erpnext/js/controllers/stock_controller.js");
 
 erpnext.stock.LandedCostWizard = erpnext.stock.StockController.extend({		
 	setup: function() {
 		var me = this;
 		this.frm.fields_dict.lc_pr_details.grid.get_field('purchase_receipt').get_query = 
 			function() {
-				if(!me.frm.doc.company) msgprint(wn._("Please enter company first"));
+				if(!me.frm.doc.company) msgprint(frappe._("Please enter company first"));
 				return {
 					filters:[
 						['Purchase Receipt', 'docstatus', '=', '1'],
@@ -20,7 +20,7 @@
 		};
 	
 		this.frm.fields_dict.landed_cost_details.grid.get_field('account_head').get_query = 				function() {
-				if(!me.frm.doc.company) msgprint(wn._("Please enter company first"));
+				if(!me.frm.doc.company) msgprint(frappe._("Please enter company first"));
 				return {
 					filters:[
 						['Account', 'group_or_ledger', '=', 'Ledger'],
@@ -34,7 +34,7 @@
 	
 		this.frm.fields_dict.landed_cost_details.grid.get_field('cost_center').get_query =
 			function() {
-				if(!me.frm.doc.company) msgprint(wn._("Please enter company first"));
+				if(!me.frm.doc.company) msgprint(frappe._("Please enter company first"));
 				return {
 					filters:[
 						['Cost Center', 'group_or_ledger', '=', 'Ledger'],
diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
index 523d555..bb8af4a 100644
--- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
+++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, cstr, flt
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+import frappe
+from frappe.utils import cint, cstr, flt
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -30,15 +30,15 @@
 
 	def validate_purchase_receipts(self, purchase_receipts):
 		for pr in purchase_receipts:
-			if webnotes.conn.get_value("Purchase Receipt", pr, "docstatus") != 1:
-				webnotes.throw(_("Purchase Receipt") + ": " + pr + _(" is not submitted document"))
+			if frappe.conn.get_value("Purchase Receipt", pr, "docstatus") != 1:
+				frappe.throw(_("Purchase Receipt") + ": " + pr + _(" is not submitted document"))
 
 	def add_charges_in_pr(self, purchase_receipts):
 		""" Add additional charges in selected pr proportionately"""
 		total_amt = self.get_total_pr_amt(purchase_receipts)
 		
 		for pr in purchase_receipts:
-			pr_bean = webnotes.bean('Purchase Receipt', pr)
+			pr_bean = frappe.bean('Purchase Receipt', pr)
 			idx = max([d.idx for d in pr_bean.doclist.get({"parentfield": "other_charges"})])
 			
 			for lc in self.doclist.get({"parentfield": "landed_cost_details"}):
@@ -76,24 +76,24 @@
 				d.save()
 	
 	def get_total_pr_amt(self, purchase_receipts):
-		return webnotes.conn.sql("""SELECT SUM(net_total) FROM `tabPurchase Receipt` 
+		return frappe.conn.sql("""SELECT SUM(net_total) FROM `tabPurchase Receipt` 
 			WHERE name in (%s)""" % ', '.join(['%s']*len(purchase_receipts)), 
 			tuple(purchase_receipts))[0][0]
 			
 	def cancel_pr(self, purchase_receipts):
 		for pr in purchase_receipts:
-			pr_bean = webnotes.bean("Purchase Receipt", pr)
+			pr_bean = frappe.bean("Purchase Receipt", pr)
 			
 			pr_bean.run_method("update_ordered_qty")
 			
-			webnotes.conn.sql("""delete from `tabStock Ledger Entry` 
+			frappe.conn.sql("""delete from `tabStock Ledger Entry` 
 				where voucher_type='Purchase Receipt' and voucher_no=%s""", pr)
-			webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type='Purchase Receipt' 
+			frappe.conn.sql("""delete from `tabGL Entry` where voucher_type='Purchase Receipt' 
 				and voucher_no=%s""", pr)
 			
 	def submit_pr(self, purchase_receipts):
 		for pr in purchase_receipts:
-			pr_bean = webnotes.bean("Purchase Receipt", pr)
+			pr_bean = frappe.bean("Purchase Receipt", pr)
 			pr_bean.run_method("update_ordered_qty")
 			pr_bean.run_method("update_stock")
 			pr_bean.run_method("make_gl_entries")
\ No newline at end of file
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 31a5753..c7eb888 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -15,40 +15,40 @@
 		cur_frm.dashboard.reset();
 		if(doc.docstatus===1) {
 			if(doc.status==="Stopped") {
-				cur_frm.dashboard.set_headline_alert(wn._("Stopped"), "alert-danger", "icon-stop")
+				cur_frm.dashboard.set_headline_alert(frappe._("Stopped"), "alert-danger", "icon-stop")
 			}
 			cur_frm.dashboard.add_progress(cint(doc.per_ordered) + "% " 
-				+ wn._("Fulfilled"), cint(doc.per_ordered));
+				+ frappe._("Fulfilled"), cint(doc.per_ordered));
 		}
 		
 		if(doc.docstatus==0) {
-			cur_frm.add_custom_button(wn._("Get Items from BOM"), cur_frm.cscript.get_items_from_bom, "icon-sitemap");
+			cur_frm.add_custom_button(frappe._("Get Items from BOM"), cur_frm.cscript.get_items_from_bom, "icon-sitemap");
 		}
 		
 		if(doc.docstatus == 1 && doc.status != 'Stopped') {
 			if(doc.material_request_type === "Purchase")
-				cur_frm.add_custom_button(wn._("Make Supplier Quotation"), 
+				cur_frm.add_custom_button(frappe._("Make Supplier Quotation"), 
 					this.make_supplier_quotation);
 				
 			if(doc.material_request_type === "Transfer" && doc.status === "Submitted")
-				cur_frm.add_custom_button(wn._("Transfer Material"), this.make_stock_entry);
+				cur_frm.add_custom_button(frappe._("Transfer Material"), this.make_stock_entry);
 			
 			if(flt(doc.per_ordered, 2) < 100) {
 				if(doc.material_request_type === "Purchase")
-					cur_frm.add_custom_button(wn._('Make Purchase Order'), 
+					cur_frm.add_custom_button(frappe._('Make Purchase Order'), 
 						this.make_purchase_order);
 				
-				cur_frm.add_custom_button(wn._('Stop Material Request'), 
+				cur_frm.add_custom_button(frappe._('Stop Material Request'), 
 					cur_frm.cscript['Stop Material Request'], "icon-exclamation");
 			}
-			cur_frm.add_custom_button(wn._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
+			cur_frm.add_custom_button(frappe._('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone");
 
 		} 
 		
 		if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Sales Order'), 
+			cur_frm.add_custom_button(frappe._('From Sales Order'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request",
 						source_doctype: "Sales Order",
 						get_query_filters: {
@@ -62,7 +62,7 @@
 		}
 
 		if(doc.docstatus == 1 && doc.status == 'Stopped')
-			cur_frm.add_custom_button(wn._('Unstop Material Request'), 
+			cur_frm.add_custom_button(frappe._('Unstop Material Request'), 
 				cur_frm.cscript['Unstop Material Request'], "icon-check");
 		
 	},
@@ -70,7 +70,7 @@
 	schedule_date: function(doc, cdt, cdn) {
 		var val = locals[cdt][cdn].schedule_date;
 		if(val) {
-			$.each(wn.model.get("Material Request Item", { parent: cur_frm.doc.name }), function(i, d) {
+			$.each(frappe.model.get("Material Request Item", { parent: cur_frm.doc.name }), function(i, d) {
 				if(!d.schedule_date) {
 					d.schedule_date = val;
 				}
@@ -80,26 +80,26 @@
 	},
 	
 	get_items_from_bom: function() {
-		var d = new wn.ui.Dialog({
-			title: wn._("Get Items from BOM"),
+		var d = new frappe.ui.Dialog({
+			title: frappe._("Get Items from BOM"),
 			fields: [
-				{"fieldname":"bom", "fieldtype":"Link", "label":wn._("BOM"), 
+				{"fieldname":"bom", "fieldtype":"Link", "label":frappe._("BOM"), 
 					options:"BOM"},
 				{"fieldname":"fetch_exploded", "fieldtype":"Check", 
-					"label":wn._("Fetch exploded BOM (including sub-assemblies)"), "default":1},
-				{fieldname:"fetch", "label":wn._("Get Items from BOM"), "fieldtype":"Button"}
+					"label":frappe._("Fetch exploded BOM (including sub-assemblies)"), "default":1},
+				{fieldname:"fetch", "label":frappe._("Get Items from BOM"), "fieldtype":"Button"}
 			]
 		});
 		d.get_input("fetch").on("click", function() {
 			var values = d.get_values();
 			if(!values) return;
 			
-			wn.call({
+			frappe.call({
 				method: "erpnext.manufacturing.doctype.bom.bom.get_bom_items",
 				args: values,
 				callback: function(r) {
 					$.each(r.message, function(i, item) {
-						var d = wn.model.add_child(cur_frm.doc, "Material Request Item", "indent_details");
+						var d = frappe.model.add_child(cur_frm.doc, "Material Request Item", "indent_details");
 						d.item_code = item.item_code;
 						d.description = item.description;
 						d.warehouse = item.default_warehouse;
@@ -127,21 +127,21 @@
 	},
 		
 	make_purchase_order: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
 			source_name: cur_frm.doc.name
 		})
 	},
 
 	make_supplier_quotation: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.stock.doctype.material_request.material_request.make_supplier_quotation",
 			source_name: cur_frm.doc.name
 		})
 	},
 
 	make_stock_entry: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.stock.doctype.material_request.material_request.make_stock_entry",
 			source_name: cur_frm.doc.name
 		})
@@ -154,15 +154,15 @@
 cur_frm.cscript.qty = function(doc, cdt, cdn) {
 	var d = locals[cdt][cdn];
 	if (flt(d.qty) < flt(d.min_order_qty))
-		alert(wn._("Warning: Material Requested Qty is less than Minimum Order Qty"));
+		alert(frappe._("Warning: Material Requested Qty is less than Minimum Order Qty"));
 };
 
 cur_frm.cscript['Stop Material Request'] = function() {
 	var doc = cur_frm.doc;
-	var check = confirm(wn._("Do you really want to STOP this Material Request?"));
+	var check = confirm(frappe._("Do you really want to STOP this Material Request?"));
 
 	if (check) {
-		return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+		return $c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
 			cur_frm.refresh();
 		});
 	}
@@ -170,10 +170,10 @@
 
 cur_frm.cscript['Unstop Material Request'] = function(){
 	var doc = cur_frm.doc;
-	var check = confirm(wn._("Do you really want to UNSTOP this Material Request?"));
+	var check = confirm(frappe._("Do you really want to UNSTOP this Material Request?"));
 	
 	if (check) {
-		return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
+		return $c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': frappe.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
 			cur_frm.refresh();
 		});
 	}
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index aec9477..2969766 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -5,12 +5,12 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt
-from webnotes.model.utils import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import cstr, flt
+from frappe.model.utils import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
 from erpnext.controllers.buying_controller import BuyingController
 class DocType(BuyingController):
@@ -37,25 +37,25 @@
 		
 		for so_no in so_items.keys():
 			for item in so_items[so_no].keys():
-				already_indented = webnotes.conn.sql("""select sum(ifnull(qty, 0)) 
+				already_indented = frappe.conn.sql("""select sum(ifnull(qty, 0)) 
 					from `tabMaterial Request Item` 
 					where item_code = %s and sales_order_no = %s and 
 					docstatus = 1 and parent != %s""", (item, so_no, self.doc.name))
 				already_indented = already_indented and flt(already_indented[0][0]) or 0
 				
-				actual_so_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Order Item` 
+				actual_so_qty = frappe.conn.sql("""select sum(ifnull(qty, 0)) from `tabSales Order Item` 
 					where parent = %s and item_code = %s and docstatus = 1""", (so_no, item))
 				actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
 				
 				if actual_so_qty and (flt(so_items[so_no][item]) + already_indented > actual_so_qty):
-					webnotes.throw("You can raise indent of maximum qty: %s for item: %s against sales order: %s\
+					frappe.throw("You can raise indent of maximum qty: %s for item: %s against sales order: %s\
 						\n Anyway, you can add more qty in new row for the same item."
 						% (actual_so_qty - already_indented, item, so_no))
 				
 	def validate_schedule_date(self):
 		for d in getlist(self.doclist, 'indent_details'):
 			if d.schedule_date < self.doc.transaction_date:
-				webnotes.throw(_("Expected Date cannot be before Material Request Date"))
+				frappe.throw(_("Expected Date cannot be before Material Request Date"))
 				
 	# Validate
 	# ---------------------
@@ -85,9 +85,9 @@
 		
 		from erpnext.stock.utils import update_bin
 		for d in getlist(self.doclist, 'indent_details'):
-			if webnotes.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes":
+			if frappe.conn.get_value("Item", d.item_code, "is_stock_item") == "Yes":
 				if not d.warehouse:
-					webnotes.throw("Please Enter Warehouse for Item %s as it is stock item" 
+					frappe.throw("Please Enter Warehouse for Item %s as it is stock item" 
 						% cstr(d.item_code))
 					
 				qty =flt(d.qty)
@@ -103,17 +103,17 @@
 				update_bin(args)		
 		
 	def on_submit(self):
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 		self.update_bin(is_submit = 1, is_stopped = 0)
 	
 	def check_modified_date(self):
-		mod_db = webnotes.conn.sql("""select modified from `tabMaterial Request` where name = %s""", 
+		mod_db = frappe.conn.sql("""select modified from `tabMaterial Request` where name = %s""", 
 			self.doc.name)
-		date_diff = webnotes.conn.sql("""select TIMEDIFF('%s', '%s')"""
+		date_diff = frappe.conn.sql("""select TIMEDIFF('%s', '%s')"""
 			% (mod_db[0][0], cstr(self.doc.modified)))
 		
 		if date_diff and date_diff[0][0]:
-			webnotes.throw(cstr(self.doc.doctype) + " => " + cstr(self.doc.name) + " has been modified. Please Refresh.")
+			frappe.throw(cstr(self.doc.doctype) + " => " + cstr(self.doc.name) + " has been modified. Please Refresh.")
 
 	def update_status(self, status):
 		self.check_modified_date()
@@ -121,7 +121,7 @@
 		self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
 
 		# Step 2:=> Set status 
-		webnotes.conn.set(self.doc, 'status', cstr(status))
+		frappe.conn.set(self.doc, 'status', cstr(status))
 		
 		# Step 3:=> Acknowledge User
 		msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)))
@@ -140,7 +140,7 @@
 		self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0)
 		
 		# Step 5:=> Set Status
-		webnotes.conn.set(self.doc,'status','Cancelled')
+		frappe.conn.set(self.doc,'status','Cancelled')
 		
 	def update_completed_qty(self, mr_items=None):
 		if self.doc.material_request_type != "Transfer":
@@ -154,11 +154,11 @@
 		per_ordered = 0.0
 		for d in item_doclist:
 			if d.name in mr_items:
-				d.ordered_qty =  flt(webnotes.conn.sql("""select sum(transfer_qty) 
+				d.ordered_qty =  flt(frappe.conn.sql("""select sum(transfer_qty) 
 					from `tabStock Entry Detail` where material_request = %s 
 					and material_request_item = %s and docstatus = 1""", 
 					(self.doc.name, d.name))[0][0])
-				webnotes.conn.set_value(d.doctype, d.name, "ordered_qty", d.ordered_qty)
+				frappe.conn.set_value(d.doctype, d.name, "ordered_qty", d.ordered_qty)
 				
 			# note: if qty is 0, its row is still counted in len(item_doclist)
 			# hence adding 1 to per_ordered
@@ -168,7 +168,7 @@
 				per_ordered += flt(d.ordered_qty / flt(d.qty))
 		
 		self.doc.per_ordered = flt((per_ordered / flt(len(item_doclist))) * 100.0, 2)
-		webnotes.conn.set_value(self.doc.doctype, self.doc.name, "per_ordered", self.doc.per_ordered)
+		frappe.conn.set_value(self.doc.doctype, self.doc.name, "per_ordered", self.doc.per_ordered)
 		
 def update_completed_qty(bean, method):
 	if bean.doc.doctype == "Stock Entry":
@@ -179,13 +179,13 @@
 				material_request_map.setdefault(d.material_request, []).append(d.material_request_item)
 			
 		for mr_name, mr_items in material_request_map.items():
-			mr_obj = webnotes.get_obj("Material Request", mr_name, with_children=1)
-			mr_doctype = webnotes.get_doctype("Material Request")
+			mr_obj = frappe.get_obj("Material Request", mr_name, with_children=1)
+			mr_doctype = frappe.get_doctype("Material Request")
 			
 			if mr_obj.doc.status in ["Stopped", "Cancelled"]:
-				webnotes.throw(_("Material Request") + ": %s, " % mr_obj.doc.name 
+				frappe.throw(_("Material Request") + ": %s, " % mr_obj.doc.name 
 					+ _(mr_doctype.get_label("status")) + " = %s. " % _(mr_obj.doc.status)
-					+ _("Cannot continue."), exc=webnotes.InvalidStatusError)
+					+ _("Cannot continue."), exc=frappe.InvalidStatusError)
 				
 			_update_requested_qty(bean, mr_obj, mr_items)
 			
@@ -221,16 +221,16 @@
 		})
 
 def set_missing_values(source, target_doclist):
-	po = webnotes.bean(target_doclist)
+	po = frappe.bean(target_doclist)
 	po.run_method("set_missing_values")
 	
 def update_item(obj, target, source_parent):
 	target.conversion_factor = 1
 	target.qty = flt(obj.qty) - flt(obj.ordered_qty)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_purchase_order(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 
 	doclist = get_mapped_doclist("Material Request", source_name, 	{
 		"Material Request": {
@@ -255,13 +255,13 @@
 
 	return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_purchase_order_based_on_supplier(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	if target_doclist:
 		if isinstance(target_doclist, basestring):
 			import json
-			target_doclist = webnotes.doclist(json.loads(target_doclist))
+			target_doclist = frappe.doclist(json.loads(target_doclist))
 		target_doclist = target_doclist.get({"parentfield": ["!=", "po_details"]})
 		
 	material_requests, supplier_items = get_material_requests_based_on_supplier(source_name)
@@ -298,9 +298,9 @@
 	return [d.fields for d in target_doclist]
 	
 def get_material_requests_based_on_supplier(supplier):
-	supplier_items = [d[0] for d in webnotes.conn.get_values("Item", 
+	supplier_items = [d[0] for d in frappe.conn.get_values("Item", 
 		{"default_supplier": supplier})]
-	material_requests = webnotes.conn.sql_list("""select distinct mr.name 
+	material_requests = frappe.conn.sql_list("""select distinct mr.name 
 		from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
 		where mr.name = mr_item.parent
 		and mr_item.item_code in (%s)
@@ -311,9 +311,9 @@
 		tuple(supplier_items))
 	return material_requests, supplier_items
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_supplier_quotation(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 
 	doclist = get_mapped_doclist("Material Request", source_name, {
 		"Material Request": {
@@ -335,9 +335,9 @@
 
 	return [d.fields for d in doclist]
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_stock_entry(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def update_item(obj, target, source_parent):
 		target.conversion_factor = 1
@@ -346,7 +346,7 @@
 	
 	def set_missing_values(source, target):
 		target[0].purpose = "Material Transfer"
-		se = webnotes.bean(target)
+		se = frappe.bean(target)
 		se.run_method("get_stock_and_rate")
 
 	doclist = get_mapped_doclist("Material Request", source_name, {
diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py
index 499fbb0..3a097b9 100644
--- a/erpnext/stock/doctype/material_request/test_material_request.py
+++ b/erpnext/stock/doctype/material_request/test_material_request.py
@@ -5,22 +5,22 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes, unittest
-from webnotes.utils import flt
+import frappe, unittest
+from frappe.utils import flt
 
 class TestMaterialRequest(unittest.TestCase):
 	def setUp(self):
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 0)
 
 	def test_make_purchase_order(self):
 		from erpnext.stock.doctype.material_request.material_request import make_purchase_order
 
-		mr = webnotes.bean(copy=test_records[0]).insert()
+		mr = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_purchase_order, 
+		self.assertRaises(frappe.ValidationError, make_purchase_order, 
 			mr.doc.name)
 
-		mr = webnotes.bean("Material Request", mr.doc.name)
+		mr = frappe.bean("Material Request", mr.doc.name)
 		mr.submit()
 		po = make_purchase_order(mr.doc.name)
 		
@@ -30,12 +30,12 @@
 	def test_make_supplier_quotation(self):
 		from erpnext.stock.doctype.material_request.material_request import make_supplier_quotation
 
-		mr = webnotes.bean(copy=test_records[0]).insert()
+		mr = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_supplier_quotation, 
+		self.assertRaises(frappe.ValidationError, make_supplier_quotation, 
 			mr.doc.name)
 
-		mr = webnotes.bean("Material Request", mr.doc.name)
+		mr = frappe.bean("Material Request", mr.doc.name)
 		mr.submit()
 		sq = make_supplier_quotation(mr.doc.name)
 		
@@ -46,12 +46,12 @@
 	def test_make_stock_entry(self):
 		from erpnext.stock.doctype.material_request.material_request import make_stock_entry
 
-		mr = webnotes.bean(copy=test_records[0]).insert()
+		mr = frappe.bean(copy=test_records[0]).insert()
 
-		self.assertRaises(webnotes.ValidationError, make_stock_entry, 
+		self.assertRaises(frappe.ValidationError, make_stock_entry, 
 			mr.doc.name)
 
-		mr = webnotes.bean("Material Request", mr.doc.name)
+		mr = frappe.bean("Material Request", mr.doc.name)
 		mr.doc.material_request_type = "Transfer"
 		mr.submit()
 		se = make_stock_entry(mr.doc.name)
@@ -65,13 +65,13 @@
 				self.assertEquals(val, doclist[i].fields.get(fieldname))
 				
 	def _test_requested_qty(self, qty1, qty2):
-		self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 100",
+		self.assertEqual(flt(frappe.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 100",
 			"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty1)
-		self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200",
+		self.assertEqual(flt(frappe.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200",
 			"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2)
 			
 	def _insert_stock_entry(self, qty1, qty2):
-		se = webnotes.bean([
+		se = frappe.bean([
 			{
 				"company": "_Test Company", 
 				"doctype": "Stock Entry", 
@@ -109,10 +109,10 @@
 		se.submit()
 				
 	def test_completed_qty_for_purchase(self):
-		webnotes.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("""delete from `tabBin`""")
 		
 		# submit material request of type Purchase
-		mr = webnotes.bean(copy=test_records[0])
+		mr = frappe.bean(copy=test_records[0])
 		mr.insert()
 		mr.submit()
 		
@@ -133,14 +133,14 @@
 
 		
 		# check for stopped status of Material Request
-		po = webnotes.bean(copy=po_doclist)
+		po = frappe.bean(copy=po_doclist)
 		po.insert()
 		mr.obj.update_status('Stopped')
-		self.assertRaises(webnotes.ValidationError, po.submit)
-		self.assertRaises(webnotes.ValidationError, po.cancel)
+		self.assertRaises(frappe.ValidationError, po.submit)
+		self.assertRaises(frappe.ValidationError, po.cancel)
 
 		mr.obj.update_status('Submitted')
-		po = webnotes.bean(copy=po_doclist)
+		po = frappe.bean(copy=po_doclist)
 		po.insert()
 		po.submit()
 		
@@ -156,11 +156,11 @@
 		self._test_requested_qty(54.0, 3.0)
 		
 	def test_completed_qty_for_transfer(self):
-		webnotes.conn.sql("""delete from `tabBin`""")
-		webnotes.conn.sql("""delete from `tabStock Ledger Entry`""")
+		frappe.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("""delete from `tabStock Ledger Entry`""")
 		
 		# submit material request of type Purchase
-		mr = webnotes.bean(copy=test_records[0])
+		mr = frappe.bean(copy=test_records[0])
 		mr.doc.material_request_type = "Transfer"
 		mr.insert()
 		mr.submit()
@@ -196,14 +196,14 @@
 		self._insert_stock_entry(27.0, 1.5)
 		
 		# check for stopped status of Material Request
-		se = webnotes.bean(copy=se_doclist)
+		se = frappe.bean(copy=se_doclist)
 		se.insert()
 		mr.obj.update_status('Stopped')
-		self.assertRaises(webnotes.ValidationError, se.submit)
-		self.assertRaises(webnotes.ValidationError, se.cancel)
+		self.assertRaises(frappe.ValidationError, se.submit)
+		self.assertRaises(frappe.ValidationError, se.cancel)
 		
 		mr.obj.update_status('Submitted')
-		se = webnotes.bean(copy=se_doclist)
+		se = frappe.bean(copy=se_doclist)
 		se.insert()
 		se.submit()
 		
@@ -219,11 +219,11 @@
 		self._test_requested_qty(54.0, 3.0)
 		
 	def test_completed_qty_for_over_transfer(self):
-		webnotes.conn.sql("""delete from `tabBin`""")
-		webnotes.conn.sql("""delete from `tabStock Ledger Entry`""")
+		frappe.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("""delete from `tabStock Ledger Entry`""")
 		
 		# submit material request of type Purchase
-		mr = webnotes.bean(copy=test_records[0])
+		mr = frappe.bean(copy=test_records[0])
 		mr.doc.material_request_type = "Transfer"
 		mr.insert()
 		mr.submit()
@@ -259,14 +259,14 @@
 		self._insert_stock_entry(60.0, 3.0)
 		
 		# check for stopped status of Material Request
-		se = webnotes.bean(copy=se_doclist)
+		se = frappe.bean(copy=se_doclist)
 		se.insert()
 		mr.obj.update_status('Stopped')
-		self.assertRaises(webnotes.ValidationError, se.submit)
-		self.assertRaises(webnotes.ValidationError, se.cancel)
+		self.assertRaises(frappe.ValidationError, se.submit)
+		self.assertRaises(frappe.ValidationError, se.cancel)
 		
 		mr.obj.update_status('Submitted')
-		se = webnotes.bean(copy=se_doclist)
+		se = frappe.bean(copy=se_doclist)
 		se.insert()
 		se.submit()
 		
@@ -283,7 +283,7 @@
 		
 	def test_incorrect_mapping_of_stock_entry(self):
 		# submit material request of type Purchase
-		mr = webnotes.bean(copy=test_records[0])
+		mr = frappe.bean(copy=test_records[0])
 		mr.doc.material_request_type = "Transfer"
 		mr.insert()
 		mr.submit()
@@ -312,12 +312,12 @@
 		})
 		
 		# check for stopped status of Material Request
-		se = webnotes.bean(copy=se_doclist)
-		self.assertRaises(webnotes.MappingMismatchError, se.insert)
+		se = frappe.bean(copy=se_doclist)
+		self.assertRaises(frappe.MappingMismatchError, se.insert)
 		
 	def test_warehouse_company_validation(self):
 		from erpnext.stock.utils import InvalidWarehouseCompany
-		mr = webnotes.bean(copy=test_records[0])
+		mr = frappe.bean(copy=test_records[0])
 		mr.doc.company = "_Test Company 1"
 		self.assertRaises(InvalidWarehouseCompany, mr.insert)
 
diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.py b/erpnext/stock/doctype/material_request_item/material_request_item.py
index e5468e5..968a25b 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.py
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index d92b503..4316b83 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -4,26 +4,26 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, flt
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
+import frappe
+from frappe.utils import cstr, flt
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
 
 class DocType:
 	def __init__(self, d, dl):
 		self.doc, self.doclist = d, dl
 		
 def get_sales_bom_items(item_code):
-	return webnotes.conn.sql("""select t1.item_code, t1.qty, t1.uom 
+	return frappe.conn.sql("""select t1.item_code, t1.qty, t1.uom 
 		from `tabSales BOM Item` t1, `tabSales BOM` t2 
 		where t2.new_item_code=%s and t1.parent = t2.name""", item_code, as_dict=1)
 
 def get_packing_item_details(item):
-	return webnotes.conn.sql("""select item_name, description, stock_uom from `tabItem` 
+	return frappe.conn.sql("""select item_name, description, stock_uom from `tabItem` 
 		where name = %s""", item, as_dict = 1)[0]
 
 def get_bin_qty(item, warehouse):
-	det = webnotes.conn.sql("""select actual_qty, projected_qty from `tabBin` 
+	det = frappe.conn.sql("""select actual_qty, projected_qty from `tabBin` 
 		where item_code = %s and warehouse = %s""", (item, warehouse), as_dict = 1)
 	return det and det[0] or ''
 
@@ -66,7 +66,7 @@
 	for d in obj.doclist.get({"parentfield": item_table_fieldname}):
 		warehouse = (item_table_fieldname == "sales_order_details") \
 			and d.warehouse or d.warehouse
-		if webnotes.conn.get_value("Sales BOM", {"new_item_code": d.item_code}):
+		if frappe.conn.get_value("Sales BOM", {"new_item_code": d.item_code}):
 			for i in get_sales_bom_items(d.item_code):
 				update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty), 
 					warehouse, d, packing_list_idx)
@@ -90,7 +90,7 @@
 		return obj.doclist
 	
 	# delete from doclist
-	obj.doclist = webnotes.doclist(filter(lambda d: [d.parent_item, d.parent_detail_docname] 
+	obj.doclist = frappe.doclist(filter(lambda d: [d.parent_item, d.parent_detail_docname] 
 		not in delete_list, obj.doclist))
 		
 	return obj.doclist
\ 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 992b00d..f00fa77 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.js
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.js
@@ -45,13 +45,13 @@
 cur_frm.cscript.validate_case_nos = function(doc) {
 	doc = locals[doc.doctype][doc.name];
 	if(cint(doc.from_case_no)==0) {
-		msgprint(wn._("Case No. cannot be 0"))
+		msgprint(frappe._("Case No. cannot be 0"))
 		validated = false;
 	} else if(!cint(doc.to_case_no)) {
 		doc.to_case_no = doc.from_case_no;
 		refresh_field('to_case_no');
 	} else if(cint(doc.to_case_no) < cint(doc.from_case_no)) {
-		msgprint(wn._("'To Case No.' cannot be less than 'From Case No.'"));
+		msgprint(frappe._("'To Case No.' cannot be less than 'From Case No.'"));
 		validated = false;
 	}	
 }
@@ -72,14 +72,14 @@
 	for(var i=0; i<ps_detail.length; i++) {
 		for(var j=0; j<ps_detail.length; j++) {
 			if(i!=j && ps_detail[i].item_code && ps_detail[i].item_code==ps_detail[j].item_code) {
-				msgprint(wn._("You have entered duplicate items. Please rectify and try again."));
+				msgprint(frappe._("You have entered duplicate items. Please rectify and try again."));
 				validated = false;
 				return;
 			}
 		}
 		if(flt(ps_detail[i].qty)<=0) {
-			msgprint(wn._("Invalid quantity specified for item ") + ps_detail[i].item_code +
-				"."+wn._(" Quantity should be greater than 0."));
+			msgprint(frappe._("Invalid quantity specified for item ") + ps_detail[i].item_code +
+				"."+frappe._(" Quantity should be greater than 0."));
 			validated = false;
 		}
 	}
@@ -95,9 +95,9 @@
 	for(var i=0; i<ps_detail.length; i++) {
 		var item = ps_detail[i];
 		if(item.weight_uom != doc.net_weight_uom) {
-			msgprint(wn._("Different UOM for items will lead to incorrect")+
-			wn._("(Total) Net Weight value. Make sure that Net Weight of each item is")+
-			wn._("in the same UOM."))
+			msgprint(frappe._("Different UOM for items will lead to incorrect")+
+			frappe._("(Total) Net Weight value. Make sure that Net Weight of each item is")+
+			frappe._("in the same UOM."))
 			validated = false;
 		}
 		net_weight_pkg += flt(item.net_weight) * flt(item.qty);
diff --git a/erpnext/stock/doctype/packing_slip/packing_slip.py b/erpnext/stock/doctype/packing_slip/packing_slip.py
index de97a7e..cc3fdc4 100644
--- a/erpnext/stock/doctype/packing_slip/packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/packing_slip.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt, cint
-from webnotes import msgprint, _
-from webnotes.model.doc import addchild
+import frappe
+from frappe.utils import flt, cint
+from frappe import msgprint, _
+from frappe.model.doc import addchild
 
 class DocType:
 	def __init__(self, d, dl):
@@ -32,28 +32,28 @@
 		"""
 			Validates if delivery note has status as draft
 		"""
-		if cint(webnotes.conn.get_value("Delivery Note", self.doc.delivery_note, "docstatus")) != 0:
+		if cint(frappe.conn.get_value("Delivery Note", self.doc.delivery_note, "docstatus")) != 0:
 			msgprint(_("""Invalid Delivery Note. Delivery Note should exist and should be in draft state. Please rectify and try again."""), raise_exception=1)
 	
 	def validate_items_mandatory(self):
 		rows = [d.item_code for d in self.doclist.get({"parentfield": "item_details"})]
 		if not rows:
-			webnotes.msgprint(_("No Items to Pack"), raise_exception=1)
+			frappe.msgprint(_("No Items to Pack"), raise_exception=1)
 
 	def validate_case_nos(self):
 		"""
 			Validate if case nos overlap. If they do, recommend next case no.
 		"""
 		if not cint(self.doc.from_case_no):
-			webnotes.msgprint(_("Please specify a valid 'From Case No.'"), raise_exception=1)
+			frappe.msgprint(_("Please specify a valid 'From Case No.'"), raise_exception=1)
 		elif not self.doc.to_case_no:
 			self.doc.to_case_no = self.doc.from_case_no
 		elif self.doc.from_case_no > self.doc.to_case_no:
-			webnotes.msgprint(_("'To Case No.' cannot be less than 'From Case No.'"),
+			frappe.msgprint(_("'To Case No.' cannot be less than 'From Case No.'"),
 				raise_exception=1)
 		
 		
-		res = webnotes.conn.sql("""SELECT name FROM `tabPacking Slip`
+		res = frappe.conn.sql("""SELECT name FROM `tabPacking Slip`
 			WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND
 			(from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s
 			OR to_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s
@@ -61,7 +61,7 @@
 			""", self.doc.fields)
 
 		if res:
-			webnotes.msgprint(_("""Case No(s) already in use. Please rectify and try again.
+			frappe.msgprint(_("""Case No(s) already in use. Please rectify and try again.
 				Recommended <b>From Case No. = %s</b>""") % self.get_recommended_case_no(),
 				raise_exception=1)
 
@@ -94,7 +94,7 @@
 			condition = " and item_code in (%s)" % (", ".join(["%s"]*len(rows)))
 		
 		# gets item code, qty per item code, latest packed qty per item code and stock uom
-		res = webnotes.conn.sql("""select item_code, ifnull(sum(qty), 0) as qty,
+		res = frappe.conn.sql("""select item_code, ifnull(sum(qty), 0) as qty,
 			(select sum(ifnull(psi.qty, 0) * (abs(ps.to_case_no - ps.from_case_no) + 1))
 				from `tabPacking Slip` ps, `tabPacking Slip Item` psi
 				where ps.name = psi.parent and ps.docstatus = 1
@@ -119,7 +119,7 @@
 		item['specified_qty'] = flt(ps_item_qty[item['item_code']])
 		if not item['packed_qty']: item['packed_qty'] = 0
 		
-		webnotes.msgprint("""
+		frappe.msgprint("""
 			Invalid Quantity specified (%(specified_qty)s %(stock_uom)s).
 			%(packed_qty)s out of %(qty)s %(stock_uom)s already packed for %(item_code)s.
 			<b>Recommended quantity for %(item_code)s = %(recommended_qty)s 
@@ -133,7 +133,7 @@
 			self.doc.from_case_no = self.get_recommended_case_no()
 
 		for d in self.doclist.get({"parentfield": "item_details"}):
-			res = webnotes.conn.get_value("Item", d.item_code, 
+			res = frappe.conn.get_value("Item", d.item_code, 
 				["net_weight", "weight_uom"], as_dict=True)
 			
 			if res and len(res)>0:
@@ -145,7 +145,7 @@
 			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`
+		recommended_case_no = frappe.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
@@ -165,7 +165,7 @@
 
 def item_details(doctype, txt, searchfield, start, page_len, filters):
 	from erpnext.controllers.queries import get_match_cond
-	return webnotes.conn.sql("""select name, item_name, description from `tabItem` 
+	return frappe.conn.sql("""select name, item_name, description from `tabItem` 
 				where name in ( select item_code FROM `tabDelivery Note Item` 
 	 						where parent= %s 
 	 							and ifnull(qty, 0) > ifnull(packed_qty, 0)) 
diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
index e5468e5..968a25b 100644
--- a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
+++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/price_list/price_list.js b/erpnext/stock/doctype/price_list/price_list.js
index 4615e13..ea7b6db 100644
--- a/erpnext/stock/doctype/price_list/price_list.js
+++ b/erpnext/stock/doctype/price_list/price_list.js
@@ -8,10 +8,10 @@
 
 	refresh: function() {
 		cur_frm.add_custom_button("Add / Edit Prices", function() {
-			wn.route_options = {
+			frappe.route_options = {
 				"price_list": cur_frm.doc.name
 			};
-			wn.set_route("Report", "Item Price");
+			frappe.set_route("Report", "Item Price");
 		}, "icon-money");
 	}
 });
\ No newline at end of file
diff --git a/erpnext/stock/doctype/price_list/price_list.py b/erpnext/stock/doctype/price_list/price_list.py
index bdcd1df..5c383f8 100644
--- a/erpnext/stock/doctype/price_list/price_list.py
+++ b/erpnext/stock/doctype/price_list/price_list.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _, throw
-from webnotes.utils import cint
-from webnotes.model.controller import DocListController
-import webnotes.defaults
+import frappe
+from frappe import msgprint, _, throw
+from frappe.utils import cint
+from frappe.model.controller import DocListController
+import frappe.defaults
 
 class DocType(DocListController):
 	def validate(self):
@@ -15,11 +15,11 @@
 				
 		if not self.doclist.get({"parentfield": "valid_for_territories"}):
 			# if no territory, set default territory
-			if webnotes.defaults.get_user_default("territory"):
+			if frappe.defaults.get_user_default("territory"):
 				self.doclist.append({
 					"doctype": "Applicable Territory",
 					"parentfield": "valid_for_territories",
-					"territory": webnotes.defaults.get_user_default("territory")
+					"territory": frappe.defaults.get_user_default("territory")
 				})
 			else:
 				# at least one territory
@@ -31,14 +31,14 @@
 
 	def set_default_if_missing(self):
 		if cint(self.doc.selling):
-			if not webnotes.conn.get_value("Selling Settings", None, "selling_price_list"):
-				webnotes.set_value("Selling Settings", "Selling Settings", "selling_price_list", self.doc.name)
+			if not frappe.conn.get_value("Selling Settings", None, "selling_price_list"):
+				frappe.set_value("Selling Settings", "Selling Settings", "selling_price_list", self.doc.name)
 
 		elif cint(self.doc.buying):
-			if not webnotes.conn.get_value("Buying Settings", None, "buying_price_list"):
-				webnotes.set_value("Buying Settings", "Buying Settings", "buying_price_list", self.doc.name)
+			if not frappe.conn.get_value("Buying Settings", None, "buying_price_list"):
+				frappe.set_value("Buying Settings", "Buying Settings", "buying_price_list", self.doc.name)
 
 	def update_item_price(self):
-		webnotes.conn.sql("""update `tabItem Price` set currency=%s, 
+		frappe.conn.sql("""update `tabItem Price` set currency=%s, 
 			buying=%s, selling=%s, modified=NOW() where price_list=%s""", 
 			(self.doc.currency, cint(self.doc.buying), cint(self.doc.selling), self.doc.name))
diff --git a/erpnext/stock/doctype/price_list/test_price_list.py b/erpnext/stock/doctype/price_list/test_price_list.py
index c4fb163..8ec53cb 100644
--- a/erpnext/stock/doctype/price_list/test_price_list.py
+++ b/erpnext/stock/doctype/price_list/test_price_list.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 # test_ignore = ["Item"]
 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 1a08cd2..f067d9c 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -10,14 +10,14 @@
 {% include 'utilities/doctype/sms_control/sms_control.js' %}
 {% include 'accounts/doctype/sales_invoice/pos.js' %}
 
-wn.provide("erpnext.stock");
+frappe.provide("erpnext.stock");
 erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
 	refresh: function() {
 		this._super();
 		
 		if(this.frm.doc.docstatus == 1) {
 			if(!this.frm.doc.__billing_complete) {
-				cur_frm.add_custom_button(wn._('Make Purchase Invoice'), 
+				cur_frm.add_custom_button(frappe._('Make Purchase Invoice'), 
 					this.make_purchase_invoice);
 			}
 			cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
@@ -25,9 +25,9 @@
 			this.show_stock_ledger();
 			this.show_general_ledger();
 		} else {
-			cur_frm.add_custom_button(wn._(wn._('From Purchase Order')), 
+			cur_frm.add_custom_button(frappe._(frappe._('From Purchase Order')), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
 						source_doctype: "Purchase Order",
 						get_query_filters: {
@@ -41,30 +41,30 @@
 				});
 		}
 
-		if(wn.boot.control_panel.country == 'India') {
+		if(frappe.boot.control_panel.country == 'India') {
 			unhide_field(['challan_no', 'challan_date']);
 		}
 	},
 	
 	received_qty: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["qty", "received_qty"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["qty", "received_qty"]);
 
 		item.qty = (item.qty < item.received_qty) ? item.qty : item.received_qty;
 		this.qty(doc, cdt, cdn);
 	},
 	
 	qty: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["qty", "received_qty"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["qty", "received_qty"]);
 		
 		if(!(item.received_qty || item.rejected_qty) && item.qty) {
 			item.received_qty = item.qty;
 		}
 		
 		if(item.qty > item.received_qty) {
-			msgprint(wn._("Error") + ": " + wn._(wn.meta.get_label(item.doctype, "qty", item.name))
-				+ " > " + wn._(wn.meta.get_label(item.doctype, "received_qty", item.name)));
+			msgprint(frappe._("Error") + ": " + frappe._(frappe.meta.get_label(item.doctype, "qty", item.name))
+				+ " > " + frappe._(frappe.meta.get_label(item.doctype, "received_qty", item.name)));
 			item.qty = item.rejected_qty = 0.0;
 		} else {
 			item.rejected_qty = flt(item.received_qty - item.qty, precision("rejected_qty", item));
@@ -74,13 +74,13 @@
 	},
 	
 	rejected_qty: function(doc, cdt, cdn) {
-		var item = wn.model.get_doc(cdt, cdn);
-		wn.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
+		var item = frappe.model.get_doc(cdt, cdn);
+		frappe.model.round_floats_in(item, ["received_qty", "rejected_qty"]);
 		
 		if(item.rejected_qty > item.received_qty) {
-			msgprint(wn._("Error") + ": " + 
-				wn._(wn.meta.get_label(item.doctype, "rejected_qty", item.name))
-				+ " > " + wn._(wn.meta.get_label(item.doctype, "received_qty", item.name)));
+			msgprint(frappe._("Error") + ": " + 
+				frappe._(frappe.meta.get_label(item.doctype, "rejected_qty", item.name))
+				+ " > " + frappe._(frappe.meta.get_label(item.doctype, "received_qty", item.name)));
 			item.qty = item.rejected_qty = 0.0;
 		} else {
 			item.qty = flt(item.received_qty - item.rejected_qty, precision("qty", item));
@@ -90,7 +90,7 @@
 	},
 	
 	make_purchase_invoice: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
 			source_name: cur_frm.doc.name
 		})
@@ -118,7 +118,7 @@
 }
 
 cur_frm.cscript.new_contact = function() {
-	tn = wn.model.make_new_doc_and_get_name('Contact');
+	tn = frappe.model.make_new_doc_and_get_name('Contact');
 	locals['Contact'][tn].is_supplier = 1;
 	if(doc.supplier)
 		locals['Contact'][tn].supplier = doc.supplier;
@@ -141,7 +141,7 @@
 		}
 	}
 	else
-		msgprint(wn._("Please enter Item Code."));
+		msgprint(frappe._("Please enter Item Code."));
 }
 
 cur_frm.cscript.select_print_heading = function(doc, cdt, cdn) {
@@ -168,6 +168,6 @@
 }
 
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(wn.boot.notification_settings.purchase_receipt))
-		cur_frm.email_doc(wn.boot.notification_settings.purchase_receipt_message);
+	if(cint(frappe.boot.notification_settings.purchase_receipt))
+		cur_frm.email_doc(frappe.boot.notification_settings.purchase_receipt_message);
 }
\ No newline at end of file
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 5025c87..8590113 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, cint
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
-import webnotes.defaults
+from frappe.utils import cstr, flt, cint
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
+import frappe.defaults
 from erpnext.stock.utils import update_bin
 
 from erpnext.controllers.buying_controller import BuyingController
@@ -32,7 +32,7 @@
 		}]
 		
 	def onload(self):
-		billed_qty = webnotes.conn.sql("""select sum(ifnull(qty, 0)) from `tabPurchase Invoice Item`
+		billed_qty = frappe.conn.sql("""select sum(ifnull(qty, 0)) from `tabPurchase Invoice Item`
 			where purchase_receipt=%s""", self.doc.name)
 		if billed_qty:
 			total_qty = sum((item.qty for item in self.doclist.get({"parentfield": "purchase_receipt_details"})))
@@ -72,7 +72,7 @@
 			if flt(d.rejected_qty) and not d.rejected_warehouse:
 				d.rejected_warehouse = self.doc.rejected_warehouse
 				if not d.rejected_warehouse:
-					webnotes.throw(_("Rejected Warehouse is mandatory against regected item"))		
+					frappe.throw(_("Rejected Warehouse is mandatory against regected item"))		
 
 	# validate accepted and rejected qty
 	def validate_accepted_rejected_qty(self):
@@ -96,12 +96,12 @@
 	def validate_challan_no(self):
 		"Validate if same challan no exists for same supplier in a submitted purchase receipt"
 		if self.doc.challan_no:
-			exists = webnotes.conn.sql("""
+			exists = frappe.conn.sql("""
 			SELECT name FROM `tabPurchase Receipt`
 			WHERE name!=%s AND supplier=%s AND challan_no=%s
 		AND docstatus=1""", (self.doc.name, self.doc.supplier, self.doc.challan_no))
 			if exists:
-				webnotes.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
+				frappe.msgprint("Another Purchase Receipt using the same Challan No. already exists.\
 			Please enter a valid Challan No.", raise_exception=1)
 			
 	def validate_with_previous_doc(self):
@@ -117,7 +117,7 @@
 			}
 		})
 		
-		if cint(webnotes.defaults.get_global_default('maintain_same_rate')):
+		if cint(frappe.defaults.get_global_default('maintain_same_rate')):
 			super(DocType, self).validate_with_previous_doc(self.tname, {
 				"Purchase Order Item": {
 					"ref_dn_field": "prevdoc_detail_docname",
@@ -128,7 +128,7 @@
 			
 
 	def po_required(self):
-		if webnotes.conn.get_value("Buying Settings", None, "po_required") == 'Yes':
+		if frappe.conn.get_value("Buying Settings", None, "po_required") == 'Yes':
 			 for d in getlist(self.doclist,'purchase_receipt_details'):
 				 if not d.prevdoc_docname:
 					 msgprint("Purchse Order No. required against item %s"%d.item_code)
@@ -171,7 +171,7 @@
 				po_qty, ordered_warehouse = self.get_po_qty_and_warehouse(d.prevdoc_detail_docname)
 				
 				if not ordered_warehouse:
-					webnotes.throw(_("Warehouse is missing in Purchase Order"))
+					frappe.throw(_("Warehouse is missing in Purchase Order"))
 				
 				if already_received_qty + d.qty > po_qty:
 					ordered_qty = - (po_qty - already_received_qty) * flt(d.conversion_factor)
@@ -186,14 +186,14 @@
 				})
 
 	def get_already_received_qty(self, po, po_detail):
-		qty = webnotes.conn.sql("""select sum(qty) from `tabPurchase Receipt Item` 
+		qty = frappe.conn.sql("""select sum(qty) from `tabPurchase Receipt Item` 
 			where prevdoc_detail_docname = %s and docstatus = 1 
 			and prevdoc_doctype='Purchase Order' and prevdoc_docname=%s 
 			and parent != %s""", (po_detail, po, self.doc.name))
 		return qty and flt(qty[0][0]) or 0.0
 		
 	def get_po_qty_and_warehouse(self, po_detail):
-		po_qty, po_warehouse = webnotes.conn.get_value("Purchase Order Item", po_detail, 
+		po_qty, po_warehouse = frappe.conn.get_value("Purchase Order Item", po_detail, 
 			["qty", "warehouse"])
 		return po_qty, po_warehouse
 	
@@ -210,7 +210,7 @@
 
 	def validate_inspection(self):
 		for d in getlist(self.doclist, 'purchase_receipt_details'):		 #Enter inspection date for all items that require inspection
-			ins_reqd = webnotes.conn.sql("select inspection_required from `tabItem` where name = %s",
+			ins_reqd = frappe.conn.sql("select inspection_required from `tabItem` where name = %s",
 				(d.item_code,), as_dict = 1)
 			ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No'
 			if ins_reqd == 'Yes' and not d.qa_no:
@@ -226,13 +226,13 @@
 
 	# on submit
 	def on_submit(self):
-		purchase_controller = webnotes.get_obj("Purchase Common")
+		purchase_controller = frappe.get_obj("Purchase Common")
 
 		# Check for Approving Authority
 		get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
 
 		# Set status as Submitted
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 
 		self.update_prevdoc_status()
 		
@@ -248,7 +248,7 @@
 		self.make_gl_entries()
 
 	def check_next_docstatus(self):
-		submit_rv = webnotes.conn.sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % (self.doc.name))
+		submit_rv = frappe.conn.sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % (self.doc.name))
 		if submit_rv:
 			msgprint("Purchase Invoice : " + cstr(self.submit_rv[0][0]) + " has already been submitted !")
 			raise Exception , "Validation Error."
@@ -261,13 +261,13 @@
 		# Check if Purchase Invoice has been submitted against current Purchase Order
 		# pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Invoice', docname = self.doc.name, detail_doctype = 'Purchase Invoice Item')
 
-		submitted = webnotes.conn.sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % self.doc.name)
+		submitted = frappe.conn.sql("select t1.name from `tabPurchase Invoice` t1,`tabPurchase Invoice Item` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % self.doc.name)
 		if submitted:
 			msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
 			raise Exception
 
 		
-		webnotes.conn.set(self.doc,'status','Cancelled')
+		frappe.conn.set(self.doc,'status','Cancelled')
 
 		self.update_ordered_qty()
 		
@@ -281,7 +281,7 @@
 	def get_current_stock(self):
 		for d in getlist(self.doclist, 'pr_raw_material_details'):
 			if self.doc.supplier_warehouse:
-				bin = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.rm_item_code, self.doc.supplier_warehouse), as_dict = 1)
+				bin = frappe.conn.sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.rm_item_code, self.doc.supplier_warehouse), as_dict = 1)
 				d.current_stock = bin and flt(bin[0]['actual_qty']) or 0
 
 	def get_rate(self,arg):
@@ -294,12 +294,12 @@
 		return gl_entries
 		
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_purchase_invoice(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def set_missing_values(source, target):
-		bean = webnotes.bean(target)
+		bean = frappe.bean(target)
 		bean.run_method("set_missing_values")
 
 	doclist = get_mapped_doclist("Purchase Receipt", source_name,	{
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index dbe2d27..3d97172 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -4,9 +4,9 @@
 
 from __future__ import unicode_literals
 import unittest
-import webnotes
-import webnotes.defaults
-from webnotes.utils import cint
+import frappe
+import frappe.defaults
+from frappe.utils import cint
 
 class TestPurchaseReceipt(unittest.TestCase):
 	def test_make_purchase_invoice(self):
@@ -14,12 +14,12 @@
 		set_perpetual_inventory(0)
 		from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
 
-		pr = webnotes.bean(copy=test_records[0]).insert()
+		pr = frappe.bean(copy=test_records[0]).insert()
 		
-		self.assertRaises(webnotes.ValidationError, make_purchase_invoice, 
+		self.assertRaises(frappe.ValidationError, make_purchase_invoice, 
 			pr.doc.name)
 
-		pr = webnotes.bean("Purchase Receipt", pr.doc.name)
+		pr = frappe.bean("Purchase Receipt", pr.doc.name)
 		pr.submit()
 		pi = make_purchase_invoice(pr.doc.name)
 		
@@ -28,23 +28,23 @@
 		
 		# modify rate
 		pi[1].rate = 200
-		self.assertRaises(webnotes.ValidationError, webnotes.bean(pi).submit)
+		self.assertRaises(frappe.ValidationError, frappe.bean(pi).submit)
 		
 	def test_purchase_receipt_no_gl_entry(self):
 		self._clear_stock_account_balance()
 		set_perpetual_inventory(0)
-		pr = webnotes.bean(copy=test_records[0])
+		pr = frappe.bean(copy=test_records[0])
 		pr.insert()
 		pr.submit()
 		
-		stock_value, stock_value_difference = webnotes.conn.get_value("Stock Ledger Entry", 
+		stock_value, stock_value_difference = frappe.conn.get_value("Stock Ledger Entry", 
 			{"voucher_type": "Purchase Receipt", "voucher_no": pr.doc.name, 
 				"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"}, 
 			["stock_value", "stock_value_difference"])
 		self.assertEqual(stock_value, 375)
 		self.assertEqual(stock_value_difference, 375)
 		
-		bin_stock_value = webnotes.conn.get_value("Bin", {"item_code": "_Test Item", 
+		bin_stock_value = frappe.conn.get_value("Bin", {"item_code": "_Test Item", 
 			"warehouse": "_Test Warehouse - _TC"}, "stock_value")
 		self.assertEqual(bin_stock_value, 375)
 		
@@ -54,9 +54,9 @@
 		self._clear_stock_account_balance()
 		
 		set_perpetual_inventory()
-		self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
+		self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
 		
-		pr = webnotes.bean(copy=test_records[0])
+		pr = frappe.bean(copy=test_records[0])
 		pr.insert()
 		pr.submit()
 		
@@ -64,9 +64,9 @@
 		
 		self.assertTrue(gl_entries)
 		
-		stock_in_hand_account = webnotes.conn.get_value("Account", 
+		stock_in_hand_account = frappe.conn.get_value("Account", 
 			{"master_name": pr.doclist[1].warehouse})		
-		fixed_asset_account = webnotes.conn.get_value("Account", 
+		fixed_asset_account = frappe.conn.get_value("Account", 
 			{"master_name": pr.doclist[2].warehouse})
 		
 		expected_values = {
@@ -85,12 +85,12 @@
 		set_perpetual_inventory(0)
 		
 	def _clear_stock_account_balance(self):
-		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
-		webnotes.conn.sql("""delete from `tabBin`""")
-		webnotes.conn.sql("""delete from `tabGL Entry`""")
+		frappe.conn.sql("delete from `tabStock Ledger Entry`")
+		frappe.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("""delete from `tabGL Entry`""")
 		
 	def test_subcontracting(self):
-		pr = webnotes.bean(copy=test_records[1])
+		pr = frappe.bean(copy=test_records[1])
 		pr.run_method("calculate_taxes_and_totals")
 		pr.insert()
 		
@@ -98,14 +98,14 @@
 		self.assertEquals(len(pr.doclist.get({"parentfield": "pr_raw_material_details"})), 2)
 		
 	def test_serial_no_supplier(self):
-		pr = webnotes.bean(copy=test_records[0])
+		pr = frappe.bean(copy=test_records[0])
 		pr.doclist[1].item_code = "_Test Serialized Item With Series"
 		pr.doclist[1].qty = 1
 		pr.doclist[1].received_qty = 1
 		pr.insert()
 		pr.submit()
 		
-		self.assertEquals(webnotes.conn.get_value("Serial No", pr.doclist[1].serial_no, 
+		self.assertEquals(frappe.conn.get_value("Serial No", pr.doclist[1].serial_no, 
 			"supplier"), pr.doc.supplier)
 			
 		return pr
@@ -114,16 +114,16 @@
 		pr = self.test_serial_no_supplier()
 		pr.cancel()
 		
-		self.assertFalse(webnotes.conn.get_value("Serial No", pr.doclist[1].serial_no, 
+		self.assertFalse(frappe.conn.get_value("Serial No", pr.doclist[1].serial_no, 
 			"warehouse"))
 			
 def get_gl_entries(voucher_type, voucher_no):
-	return webnotes.conn.sql("""select account, debit, credit
+	return frappe.conn.sql("""select account, debit, credit
 		from `tabGL Entry` where voucher_type=%s and voucher_no=%s
 		order by account desc""", (voucher_type, voucher_no), as_dict=1)
 		
 def set_perpetual_inventory(enable=1):
-	accounts_settings = webnotes.bean("Accounts Settings")
+	accounts_settings = frappe.bean("Accounts Settings")
 	accounts_settings.doc.auto_accounting_for_stock = enable
 	accounts_settings.save()
 	
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 0408cfe..e47b551 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cint, getdate, cstr, flt, add_days
+from frappe.utils import cint, getdate, cstr, flt, add_days
 import datetime
-from webnotes import _, ValidationError
+from frappe import _, ValidationError
 
 from erpnext.controllers.stock_controller import StockController
 
@@ -29,7 +29,7 @@
 
 	def validate(self):
 		if self.doc.fields.get("__islocal") and self.doc.warehouse:
-			webnotes.throw(_("New Serial No cannot have Warehouse. Warehouse must be \
+			frappe.throw(_("New Serial No cannot have Warehouse. Warehouse must be \
 				set by Stock Entry or Purchase Receipt"), SerialNoCannotCreateDirectError)
 			
 		self.validate_warranty_status()
@@ -40,33 +40,33 @@
 
 	def validate_amc_status(self):
 		if (self.doc.maintenance_status == 'Out of AMC' and self.doc.amc_expiry_date and getdate(self.doc.amc_expiry_date) >= datetime.date.today()) or (self.doc.maintenance_status == 'Under AMC' and (not self.doc.amc_expiry_date or getdate(self.doc.amc_expiry_date) < datetime.date.today())):
-			webnotes.throw(self.doc.name + ": " + 
+			frappe.throw(self.doc.name + ": " + 
 				_("AMC expiry date and maintenance status mismatched"))
 
 	def validate_warranty_status(self):
 		if (self.doc.maintenance_status == 'Out of Warranty' and self.doc.warranty_expiry_date and getdate(self.doc.warranty_expiry_date) >= datetime.date.today()) or (self.doc.maintenance_status == 'Under Warranty' and (not self.doc.warranty_expiry_date or getdate(self.doc.warranty_expiry_date) < datetime.date.today())):
-			webnotes.throw(self.doc.name + ": " + 
+			frappe.throw(self.doc.name + ": " + 
 				_("Warranty expiry date and maintenance status mismatched"))
 
 
 	def validate_warehouse(self):
 		if not self.doc.fields.get("__islocal"):
-			item_code, warehouse = webnotes.conn.get_value("Serial No", 
+			item_code, warehouse = frappe.conn.get_value("Serial No", 
 				self.doc.name, ["item_code", "warehouse"])
 			if item_code != self.doc.item_code:
-				webnotes.throw(_("Item Code cannot be changed for Serial No."), 
+				frappe.throw(_("Item Code cannot be changed for Serial No."), 
 					SerialNoCannotCannotChangeError)
 			if not self.via_stock_ledger and warehouse != self.doc.warehouse:
-				webnotes.throw(_("Warehouse cannot be changed for Serial No."), 
+				frappe.throw(_("Warehouse cannot be changed for Serial No."), 
 					SerialNoCannotCannotChangeError)
 
 	def validate_item(self):
 		"""
 			Validate whether serial no is required for this item
 		"""
-		item = webnotes.doc("Item", self.doc.item_code)
+		item = frappe.doc("Item", self.doc.item_code)
 		if item.has_serial_no!="Yes":
-			webnotes.throw(_("Item must have 'Has Serial No' as 'Yes'") + ": " + self.doc.item_code)
+			frappe.throw(_("Item must have 'Has Serial No' as 'Yes'") + ": " + self.doc.item_code)
 			
 		self.doc.item_group = item.item_group
 		self.doc.description = item.description
@@ -77,7 +77,7 @@
 	def set_status(self, last_sle):
 		if last_sle:
 			if last_sle.voucher_type == "Stock Entry":
-				document_type = webnotes.conn.get_value("Stock Entry", last_sle.voucher_no, 
+				document_type = frappe.conn.get_value("Stock Entry", last_sle.voucher_no, 
 					"purpose")
 			else:
 				document_type = last_sle.voucher_type
@@ -106,7 +106,7 @@
 			self.doc.purchase_rate = purchase_sle.incoming_rate
 			if purchase_sle.voucher_type == "Purchase Receipt":
 				self.doc.supplier, self.doc.supplier_name = \
-					webnotes.conn.get_value("Purchase Receipt", purchase_sle.voucher_no, 
+					frappe.conn.get_value("Purchase Receipt", purchase_sle.voucher_no, 
 						["supplier", "supplier_name"])
 		else:
 			for fieldname in ("purchase_document_type", "purchase_document_no", 
@@ -120,7 +120,7 @@
 			self.doc.delivery_date = delivery_sle.posting_date
 			self.doc.delivery_time = delivery_sle.posting_time
 			self.doc.customer, self.doc.customer_name = \
-				webnotes.conn.get_value(delivery_sle.voucher_type, delivery_sle.voucher_no, 
+				frappe.conn.get_value(delivery_sle.voucher_type, delivery_sle.voucher_no, 
 					["customer", "customer_name"])
 			if self.doc.warranty_period:
 				self.doc.warranty_expiry_date	= add_days(cstr(delivery_sle.posting_date), 
@@ -148,7 +148,7 @@
 		
 	def get_stock_ledger_entries(self):
 		sle_dict = {}
-		for sle in webnotes.conn.sql("""select * from `tabStock Ledger Entry` 
+		for sle in frappe.conn.sql("""select * from `tabStock Ledger Entry` 
 			where serial_no like %s and item_code=%s and ifnull(is_cancelled, 'No')='No' 
 			order by posting_date desc, posting_time desc, name desc""", 
 			("%%%s%%" % self.doc.name, self.doc.item_code), as_dict=1):
@@ -162,25 +162,25 @@
 					
 	def on_trash(self):
 		if self.doc.status == 'Delivered':
-			webnotes.throw(_("Delivered Serial No ") + self.doc.name + _(" can not be deleted"))
+			frappe.throw(_("Delivered Serial No ") + self.doc.name + _(" can not be deleted"))
 		if self.doc.warehouse:
-			webnotes.throw(_("Cannot delete Serial No in warehouse. \
+			frappe.throw(_("Cannot delete Serial No in warehouse. \
 				First remove from warehouse, then delete.") + ": " + self.doc.name)
 	
 	def before_rename(self, old, new, merge=False):
 		if merge:
-			webnotes.throw(_("Sorry, Serial Nos cannot be merged"))
+			frappe.throw(_("Sorry, Serial Nos cannot be merged"))
 			
 	def after_rename(self, old, new, merge=False):
 		"""rename serial_no text fields"""
-		for dt in webnotes.conn.sql("""select parent from tabDocField 
+		for dt in frappe.conn.sql("""select parent from tabDocField 
 			where fieldname='serial_no' and fieldtype='Text'"""):
 			
-			for item in webnotes.conn.sql("""select name, serial_no from `tab%s` 
+			for item in frappe.conn.sql("""select name, serial_no from `tab%s` 
 				where serial_no like '%%%s%%'""" % (dt[0], old)):
 				
 				serial_nos = map(lambda i: i==old and new or i, item[1].split('\n'))
-				webnotes.conn.sql("""update `tab%s` set serial_no = %s 
+				frappe.conn.sql("""update `tab%s` set serial_no = %s 
 					where name=%s""" % (dt[0], '%s', '%s'),
 					('\n'.join(serial_nos), item[0]))
 	
@@ -202,65 +202,65 @@
 def validate_serial_no(sle, item_det):
 	if item_det.has_serial_no=="No":
 		if sle.serial_no:
-			webnotes.throw(_("Serial Number should be blank for Non Serialized Item" + ": " 
+			frappe.throw(_("Serial Number should be blank for Non Serialized Item" + ": " 
 				+ sle.item_code), SerialNoNotRequiredError)
 	else:
 		if sle.serial_no:
 			serial_nos = get_serial_nos(sle.serial_no)
 			if cint(sle.actual_qty) != flt(sle.actual_qty):
-				webnotes.throw(_("Serial No qty cannot be a fraction") + \
+				frappe.throw(_("Serial No qty cannot be a fraction") + \
 					(": %s (%s)" % (sle.item_code, sle.actual_qty)))
 			if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)):
-				webnotes.throw(_("Serial Nos do not match with qty") + \
+				frappe.throw(_("Serial Nos do not match with qty") + \
 					(": %s (%s)" % (sle.item_code, sle.actual_qty)), SerialNoQtyError)
 					
 			if len(serial_nos) != len(set(serial_nos)):
-				webnotes.throw(_("Duplicate Serial No entered against item") + 
+				frappe.throw(_("Duplicate Serial No entered against item") + 
 					(": %s" % sle.item_code), SerialNoDuplicateError)
 			
 			for serial_no in serial_nos:
-				if webnotes.conn.exists("Serial No", serial_no):
-					sr = webnotes.bean("Serial No", serial_no)
+				if frappe.conn.exists("Serial No", serial_no):
+					sr = frappe.bean("Serial No", serial_no)
 					
 					if sr.doc.item_code!=sle.item_code:
-						webnotes.throw(_("Serial No does not belong to Item") + 
+						frappe.throw(_("Serial No does not belong to Item") + 
 							(": %s (%s)" % (sle.item_code, serial_no)), SerialNoItemError)
 							
 					if sr.doc.warehouse and sle.actual_qty > 0:
-						webnotes.throw(_("Same Serial No") + ": " + sr.doc.name + 
+						frappe.throw(_("Same Serial No") + ": " + sr.doc.name + 
 							_(" can not be received twice"), SerialNoDuplicateError)
 					
 					if sle.actual_qty < 0:
 						if sr.doc.warehouse!=sle.warehouse:
-							webnotes.throw(_("Serial No") + ": " + serial_no + 
+							frappe.throw(_("Serial No") + ": " + serial_no + 
 								_(" does not belong to Warehouse") + ": " + sle.warehouse, 
 								SerialNoWarehouseError)
 					
 						if sle.voucher_type in ("Delivery Note", "Sales Invoice") \
 							and sr.doc.status != "Available":
-							webnotes.throw(_("Serial No status must be 'Available' to Deliver") 
+							frappe.throw(_("Serial No status must be 'Available' to Deliver") 
 								+ ": " + serial_no, SerialNoStatusError)
 				elif sle.actual_qty < 0:
 					# transfer out
-					webnotes.throw(_("Serial No must exist to transfer out.") + \
+					frappe.throw(_("Serial No must exist to transfer out.") + \
 						": " + serial_no, SerialNoNotExistsError)
 		elif sle.actual_qty < 0 or not item_det.serial_no_series:
-			webnotes.throw(_("Serial Number Required for Serialized Item" + ": " 
+			frappe.throw(_("Serial Number Required for Serialized Item" + ": " 
 				+ sle.item_code), SerialNoRequiredError)
 				
 def update_serial_nos(sle, item_det):
 	if sle.is_cancelled == "No" and not sle.serial_no and sle.actual_qty > 0 and item_det.serial_no_series:
-		from webnotes.model.doc import make_autoname
+		from frappe.model.doc import make_autoname
 		serial_nos = []
 		for i in xrange(cint(sle.actual_qty)):
 			serial_nos.append(make_autoname(item_det.serial_no_series))
-		webnotes.conn.set(sle, "serial_no", "\n".join(serial_nos))
+		frappe.conn.set(sle, "serial_no", "\n".join(serial_nos))
 		
 	if sle.serial_no:
 		serial_nos = get_serial_nos(sle.serial_no)
 		for serial_no in serial_nos:
-			if webnotes.conn.exists("Serial No", serial_no):
-				sr = webnotes.bean("Serial No", serial_no)
+			if frappe.conn.exists("Serial No", serial_no):
+				sr = frappe.bean("Serial No", serial_no)
 				sr.make_controller().via_stock_ledger = True
 				sr.doc.warehouse = sle.warehouse if sle.actual_qty > 0 else None
 				sr.save()
@@ -268,7 +268,7 @@
 				make_serial_no(serial_no, sle)
 
 def get_item_details(item_code):
-	return webnotes.conn.sql("""select name, has_batch_no, docstatus, 
+	return frappe.conn.sql("""select name, has_batch_no, docstatus, 
 		is_stock_item, has_serial_no, serial_no_series 
 		from tabItem where name=%s""", item_code, as_dict=True)[0]
 		
@@ -277,7 +277,7 @@
 		if s.strip()]
 
 def make_serial_no(serial_no, sle):
-	sr = webnotes.new_bean("Serial No")
+	sr = frappe.new_bean("Serial No")
 	sr.doc.serial_no = serial_no
 	sr.doc.item_code = sle.item_code
 	sr.make_controller().via_stock_ledger = True
@@ -285,11 +285,11 @@
 	sr.doc.warehouse = sle.warehouse
 	sr.doc.status = "Available"
 	sr.save()
-	webnotes.msgprint(_("Serial No created") + ": " + sr.doc.name)
+	frappe.msgprint(_("Serial No created") + ": " + sr.doc.name)
 	return sr.doc.name
 	
 def update_serial_nos_after_submit(controller, parentfield):
-	stock_ledger_entries = webnotes.conn.sql("""select voucher_detail_no, serial_no
+	stock_ledger_entries = frappe.conn.sql("""select voucher_detail_no, serial_no
 		from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""", 
 		(controller.doc.doctype, controller.doc.name), as_dict=True)
 		
@@ -304,4 +304,4 @@
 
 		if d.serial_no != serial_no:
 			d.serial_no = serial_no
-			webnotes.conn.set_value(d.doctype, d.name, "serial_no", serial_no)
+			frappe.conn.set_value(d.doctype, d.name, "serial_no", serial_no)
diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py
index fb23361..8b295b4 100644
--- a/erpnext/stock/doctype/serial_no/test_serial_no.py
+++ b/erpnext/stock/doctype/serial_no/test_serial_no.py
@@ -5,7 +5,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes, unittest
+import frappe, unittest
 
 test_dependencies = ["Item"]
 test_records = []
@@ -14,7 +14,7 @@
 
 class TestSerialNo(unittest.TestCase):
 	def test_cannot_create_direct(self):
-		sr = webnotes.new_bean("Serial No")
+		sr = frappe.new_bean("Serial No")
 		sr.doc.item_code = "_Test Serialized Item"
 		sr.doc.warehouse = "_Test Warehouse - _TC"
 		sr.doc.serial_no = "_TCSER0001"
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 5df1af8..b78c104 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -4,8 +4,8 @@
 cur_frm.cscript.tname = "Stock Entry Detail";
 cur_frm.cscript.fname = "mtn_details";
 
-wn.require("assets/erpnext/js/controllers/stock_controller.js");
-wn.provide("erpnext.stock");
+frappe.require("assets/erpnext/js/controllers/stock_controller.js");
+frappe.provide("erpnext.stock");
 
 erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
 	setup: function() {
@@ -41,7 +41,7 @@
 			}
 		};
 		
-		if(cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
+		if(cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
 			this.frm.add_fetch("company", "stock_adjustment_account", "expense_account");
 			this.frm.fields_dict.mtn_details.grid.get_field('expense_account').get_query = 
 					function() {
@@ -68,12 +68,12 @@
 		this.show_general_ledger();
 		
 		if(this.frm.doc.docstatus === 1 && 
-				wn.boot.profile.can_create.indexOf("Journal Voucher")!==-1) {
+				frappe.boot.profile.can_create.indexOf("Journal Voucher")!==-1) {
 			if(this.frm.doc.purpose === "Sales Return") {
-				this.frm.add_custom_button(wn._("Make Credit Note"), function() { me.make_return_jv(); });
+				this.frm.add_custom_button(frappe._("Make Credit Note"), function() { me.make_return_jv(); });
 				this.add_excise_button();
 			} else if(this.frm.doc.purpose === "Purchase Return") {
-				this.frm.add_custom_button(wn._("Make Debit Note"), function() { me.make_return_jv(); });
+				this.frm.add_custom_button(frappe._("Make Debit Note"), function() { me.make_return_jv(); });
 				this.add_excise_button();
 			}
 		}
@@ -91,7 +91,7 @@
 	set_default_account: function() {
 		var me = this;
 		
-		if(cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
+		if(cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
 			var account_for = "stock_adjustment_account";
 
 			if (this.frm.doc.purpose == "Purchase Return") 
@@ -118,7 +118,7 @@
 		// Clear Production Order record from locals, because it is updated via Stock Entry
 		if(this.frm.doc.production_order && 
 				this.frm.doc.purpose == "Manufacture/Repack") {
-			wn.model.remove_from_locals("Production Order", 
+			frappe.model.remove_from_locals("Production Order", 
 				this.frm.doc.production_order);
 		}
 	},
@@ -166,11 +166,11 @@
 		if(this.frm.doc.purpose === "Sales Return") {
 			if(this.frm.doc.delivery_note_no && this.frm.doc.sales_invoice_no) {
 				// both specified
-				msgprint(wn._("You can not enter both Delivery Note No and Sales Invoice No. Please enter any one."));
+				msgprint(frappe._("You can not enter both Delivery Note No and Sales Invoice No. Please enter any one."));
 				
 			} else if(!(this.frm.doc.delivery_note_no || this.frm.doc.sales_invoice_no)) {
 				// none specified
-				msgprint(wn._("Please enter Delivery Note No or Sales Invoice No to proceed"));
+				msgprint(frappe._("Please enter Delivery Note No or Sales Invoice No to proceed"));
 				
 			} else if(this.frm.doc.delivery_note_no) {
 				return {doctype: "Delivery Note", docname: this.frm.doc.delivery_note_no};
@@ -185,16 +185,16 @@
 				
 			} else {
 				// not specified
-				msgprint(wn._("Please enter Purchase Receipt No to proceed"));
+				msgprint(frappe._("Please enter Purchase Receipt No to proceed"));
 				
 			}
 		}
 	},
 
 	add_excise_button: function() {
-		if(wn.boot.control_panel.country === "India")
-			this.frm.add_custom_button(wn._("Make Excise Invoice"), function() {
-				var excise = wn.model.make_new_doc_and_get_name('Journal Voucher');
+		if(frappe.boot.control_panel.country === "India")
+			this.frm.add_custom_button(frappe._("Make Excise Invoice"), function() {
+				var excise = frappe.model.make_new_doc_and_get_name('Journal Voucher');
 				excise = locals['Journal Voucher'][excise];
 				excise.voucher_type = 'Excise Voucher';
 				loaddoc('Journal Voucher', excise.name);
@@ -210,11 +210,11 @@
 				},
 				callback: function(r) {
 					if(!r.exc) {
-						var jv_name = wn.model.make_new_doc_and_get_name('Journal Voucher');
+						var jv_name = frappe.model.make_new_doc_and_get_name('Journal Voucher');
 						var jv = locals["Journal Voucher"][jv_name];
 						$.extend(jv, r.message[0]);
 						$.each(r.message.slice(1), function(i, jvd) {
-							var child = wn.model.add_child(jv, "Journal Voucher Detail", "entries");
+							var child = frappe.model.add_child(jv, "Journal Voucher Detail", "entries");
 							$.extend(child, jvd);
 						});
 						loaddoc("Journal Voucher", jv_name);
@@ -225,7 +225,7 @@
 	},
 
 	mtn_details_add: function(doc, cdt, cdn) {
-		var row = wn.model.get_doc(cdt, cdn);
+		var row = frappe.model.get_doc(cdt, cdn);
 		this.frm.script_manager.copy_from_first_row("mtn_details", row, 
 			["expense_account", "cost_center"]);
 		
@@ -333,7 +333,7 @@
 			}
 		}			
 	} else {
-		msgprint(wn._("Please enter Item Code to get batch no"));
+		msgprint(frappe._("Please enter Item Code to get batch no"));
 	}
 }
 
@@ -387,7 +387,7 @@
 cur_frm.cscript.validate_items = function(doc) {
 	cl = getchildren('Stock Entry Detail', doc.name, 'mtn_details');
 	if (!cl.length) {
-		msgprint(wn._("Item table can not be blank"));
+		msgprint(frappe._("Item table can not be blank"));
 		validated = false;
 	}
 }
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 608f1ba..8ef66e5 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -2,25 +2,25 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.defaults
+import frappe
+import frappe.defaults
 
-from webnotes.utils import cstr, cint, flt, comma_or, nowdate
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import cstr, cint, flt, comma_or, nowdate
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 from erpnext.stock.utils import get_incoming_rate
 from erpnext.stock.stock_ledger import get_previous_sle
 from erpnext.controllers.queries import get_match_cond
 import json
 
 
-class NotUpdateStockError(webnotes.ValidationError): pass
-class StockOverReturnError(webnotes.ValidationError): pass
-class IncorrectValuationRateError(webnotes.ValidationError): pass
-class DuplicateEntryForProductionOrderError(webnotes.ValidationError): pass
-class StockOverProductionError(webnotes.ValidationError): pass
+class NotUpdateStockError(frappe.ValidationError): pass
+class StockOverReturnError(frappe.ValidationError): pass
+class IncorrectValuationRateError(frappe.ValidationError): pass
+class DuplicateEntryForProductionOrderError(frappe.ValidationError): pass
+class StockOverProductionError(frappe.ValidationError): pass
 	
 from erpnext.controllers.stock_controller import StockController
 
@@ -154,7 +154,7 @@
 			self.doc.production_order = None
 	
 	def check_duplicate_entry_for_production_order(self):
-		other_ste = [t[0] for t in webnotes.conn.get_values("Stock Entry",  {
+		other_ste = [t[0] for t in frappe.conn.get_values("Stock Entry",  {
 			"production_order": self.doc.production_order,
 			"purpose": self.doc.purpose,
 			"docstatus": ["!=", 2],
@@ -162,17 +162,17 @@
 		}, "name")]
 		
 		if other_ste:
-			production_item, qty = webnotes.conn.get_value("Production Order", 
+			production_item, qty = frappe.conn.get_value("Production Order", 
 				self.doc.production_order, ["production_item", "qty"])
 			args = other_ste + [production_item]
-			fg_qty_already_entered = webnotes.conn.sql("""select sum(actual_qty)
+			fg_qty_already_entered = frappe.conn.sql("""select sum(actual_qty)
 				from `tabStock Entry Detail` 
 				where parent in (%s) 
 					and item_code = %s 
 					and ifnull(s_warehouse,'')='' """ % (", ".join(["%s" * len(other_ste)]), "%s"), args)[0][0]
 			
 			if fg_qty_already_entered >= qty:
-				webnotes.throw(_("Stock Entries already created for Production Order ") 
+				frappe.throw(_("Stock Entries already created for Production Order ") 
 					+ self.doc.production_order + ":" + ", ".join(other_ste), DuplicateEntryForProductionOrderError)
 
 	def set_total_amount(self):
@@ -181,7 +181,7 @@
 	def get_stock_and_rate(self):
 		"""get stock and incoming rate on posting date"""
 		for d in getlist(self.doclist, 'mtn_details'):
-			args = webnotes._dict({
+			args = frappe._dict({
 				"item_code": d.item_code,
 				"warehouse": d.s_warehouse or d.t_warehouse,
 				"posting_date": self.doc.posting_date,
@@ -203,7 +203,7 @@
 		incoming_rate = 0
 		if self.doc.purpose == "Sales Return" and \
 				(self.doc.delivery_note_no or self.doc.sales_invoice_no):
-			sle = webnotes.conn.sql("""select name, posting_date, posting_time, 
+			sle = frappe.conn.sql("""select name, posting_date, posting_time, 
 				actual_qty, stock_value, warehouse from `tabStock Ledger Entry` 
 				where voucher_type = %s and voucher_no = %s and 
 				item_code = %s limit 1""", 
@@ -231,7 +231,7 @@
 					
 	def validate_bom(self):
 		for d in getlist(self.doclist, 'mtn_details'):
-			if d.bom_no and not webnotes.conn.sql("""select name from `tabBOM`
+			if d.bom_no and not frappe.conn.sql("""select name from `tabBOM`
 					where item = %s and name = %s and docstatus = 1 and is_active = 1""",
 					(d.item_code, d.bom_no)):
 				msgprint(_("Item") + " %s: " % cstr(d.item_code)
@@ -252,12 +252,12 @@
 		if ref.doclist:
 			# validate docstatus
 			if ref.doclist[0].docstatus != 1:
-				webnotes.msgprint(_(ref.doclist[0].doctype) + ' "' + ref.doclist[0].name + '": ' 
-					+ _("Status should be Submitted"), raise_exception=webnotes.InvalidStatusError)
+				frappe.msgprint(_(ref.doclist[0].doctype) + ' "' + ref.doclist[0].name + '": ' 
+					+ _("Status should be Submitted"), raise_exception=frappe.InvalidStatusError)
 			
 			# update stock check
 			if ref.doclist[0].doctype == "Sales Invoice" and cint(ref.doclist[0].update_stock) != 1:
-				webnotes.msgprint(_(ref.doclist[0].doctype) + ' "' + ref.doclist[0].name + '": ' 
+				frappe.msgprint(_(ref.doclist[0].doctype) + ' "' + ref.doclist[0].name + '": ' 
 					+ _("Update Stock should be checked."), 
 					raise_exception=NotUpdateStockError)
 			
@@ -267,8 +267,8 @@
 			this_posting_datetime = "%s %s" % (cstr(self.doc.posting_date), 
 				cstr(self.doc.posting_time))
 			if this_posting_datetime < ref_posting_datetime:
-				from webnotes.utils.dateutils import datetime_in_user_format
-				webnotes.msgprint(_("Posting Date Time cannot be before")
+				from frappe.utils.dateutils import datetime_in_user_format
+				frappe.msgprint(_("Posting Date Time cannot be before")
 					+ ": " + datetime_in_user_format(ref_posting_datetime),
 					raise_exception=True)
 			
@@ -280,23 +280,23 @@
 				if item.item_code not in stock_items:
 					msgprint(_("Item") + ': "' + item.item_code + _("\" does not exist in ") +
 						ref.doclist[0].doctype + ": " + ref.doclist[0].name, 
-						raise_exception=webnotes.DoesNotExistError)
+						raise_exception=frappe.DoesNotExistError)
 				
 				# validate quantity <= ref item's qty - qty already returned
 				ref_item = ref.doclist.getone({"item_code": item.item_code})
 				returnable_qty = ref_item.qty - flt(already_returned_item_qty.get(item.item_code))
 				if not returnable_qty:
-					webnotes.throw("{item}: {item_code} {returned}".format(
+					frappe.throw("{item}: {item_code} {returned}".format(
 						item=_("Item"), item_code=item.item_code, 
 						returned=_("already returned though some other documents")), 
 						StockOverReturnError)
 				elif item.transfer_qty > returnable_qty:
-					webnotes.throw("{item}: {item_code}, {returned}: {qty}".format(
+					frappe.throw("{item}: {item_code}, {returned}: {qty}".format(
 						item=_("Item"), item_code=item.item_code,
 						returned=_("Max Returnable Qty"), qty=returnable_qty), StockOverReturnError)
 						
 	def get_already_returned_item_qty(self, ref_fieldname):
-		return dict(webnotes.conn.sql("""select item_code, sum(transfer_qty) as qty
+		return dict(frappe.conn.sql("""select item_code, sum(transfer_qty) as qty
 			from `tabStock Entry Detail` where parent in (
 				select name from `tabStock Entry` where `%s`=%s and docstatus=1)
 			group by item_code""" % (ref_fieldname, "%s"), (self.doc.fields.get(ref_fieldname),)))
@@ -333,7 +333,7 @@
 	def update_production_order(self):
 		def _validate_production_order(pro_bean):
 			if flt(pro_bean.doc.docstatus) != 1:
-				webnotes.throw(_("Production Order must be submitted") + ": " + 
+				frappe.throw(_("Production Order must be submitted") + ": " + 
 					self.doc.production_order)
 					
 			if pro_bean.doc.status == 'Stopped':
@@ -341,7 +341,7 @@
 					self.doc.production_order)
 		
 		if self.doc.production_order:
-			pro_bean = webnotes.bean("Production Order", self.doc.production_order)
+			pro_bean = frappe.bean("Production Order", self.doc.production_order)
 			_validate_production_order(pro_bean)
 			self.update_produced_qty(pro_bean)
 			if self.doc.purpose == "Manufacture/Repack":
@@ -353,12 +353,12 @@
 				(self.doc.docstatus==1 and 1 or -1 ) * flt(self.doc.fg_completed_qty)
 				
 			if produced_qty > flt(pro_bean.doc.qty):
-				webnotes.throw(_("Production Order") + ": " + self.doc.production_order + "\n" +
+				frappe.throw(_("Production Order") + ": " + self.doc.production_order + "\n" +
 					_("Total Manufactured Qty can not be greater than Planned qty to manufacture") 
 					+ "(%s/%s)" % (produced_qty, flt(pro_bean.doc.qty)), StockOverProductionError)
 					
 			status = 'Completed' if flt(produced_qty) >= flt(pro_bean.doc.qty) else 'In Process'
-			webnotes.conn.sql("""update `tabProduction Order` set status=%s, produced_qty=%s 
+			frappe.conn.sql("""update `tabProduction Order` set status=%s, produced_qty=%s 
 				where name=%s""", (status, produced_qty, self.doc.production_order))
 			
 	def update_planned_qty(self, pro_bean):
@@ -372,7 +372,7 @@
 					
 	def get_item_details(self, arg):
 		arg = json.loads(arg)
-		item = webnotes.conn.sql("""select stock_uom, description, item_name, 
+		item = frappe.conn.sql("""select stock_uom, description, item_name, 
 			expense_account, buying_cost_center from `tabItem` 
 			where name = %s and (ifnull(end_of_life,'')='' or end_of_life ='0000-00-00' 
 			or end_of_life > now())""", (arg.get('item_code')), as_dict = 1)
@@ -385,7 +385,7 @@
 			'description'		  	: item and item[0]['description'] or '',
 			'item_name' 		  	: item and item[0]['item_name'] or '',
 			'expense_account'		: item and item[0]['expense_account'] or arg.get("expense_account") \
-				or webnotes.conn.get_value("Company", arg.get("company"), "default_expense_account"),
+				or frappe.conn.get_value("Company", arg.get("company"), "default_expense_account"),
 			'cost_center'			: item and item[0]['buying_cost_center'] or arg.get("cost_center"),
 			'qty'					: 0,
 			'transfer_qty'			: 0,
@@ -400,7 +400,7 @@
 
 	def get_uom_details(self, arg = ''):
 		arg, ret = eval(arg), {}
-		uom = webnotes.conn.sql("""select conversion_factor from `tabUOM Conversion Detail` 
+		uom = frappe.conn.sql("""select conversion_factor from `tabUOM Conversion Detail` 
 			where parent = %s and uom = %s""", (arg['item_code'], arg['uom']), as_dict = 1)
 		if not uom or not flt(uom[0].conversion_factor):
 			msgprint("There is no Conversion Factor for UOM '%s' in Item '%s'" % (arg['uom'],
@@ -421,7 +421,7 @@
 				"posting_date": self.doc.posting_date,
 				"posting_time": self.doc.posting_time,
 			})
-			args = webnotes._dict(args)
+			args = frappe._dict(args)
 		
 			ret = {
 				"actual_qty" : get_previous_sle(args).get("qty_after_transaction") or 0,
@@ -451,7 +451,7 @@
 					item_dict = self.get_pending_raw_materials(pro_obj)
 				else:
 					if not self.doc.fg_completed_qty:
-						webnotes.throw(_("Manufacturing Quantity is mandatory"))
+						frappe.throw(_("Manufacturing Quantity is mandatory"))
 					item_dict = self.get_bom_raw_materials(self.doc.fg_completed_qty)
 					for item in item_dict.values():
 						if pro_obj:
@@ -463,7 +463,7 @@
 					
 			# add finished good item to Stock Entry Detail table -- along with bom_no
 			if self.doc.production_order and self.doc.purpose == "Manufacture/Repack":
-				item = webnotes.conn.get_value("Item", pro_obj.doc.production_item, ["item_name", 
+				item = frappe.conn.get_value("Item", pro_obj.doc.production_item, ["item_name", 
 					"description", "stock_uom", "expense_account", "buying_cost_center"], as_dict=1)
 				self.add_to_stock_entry_detail({
 					cstr(pro_obj.doc.production_item): {
@@ -482,7 +482,7 @@
 				if self.doc.purpose=="Material Receipt":
 					self.doc.from_warehouse = ""
 					
-				item = webnotes.conn.sql("""select name, item_name, description, 
+				item = frappe.conn.sql("""select name, item_name, description, 
 					stock_uom, expense_account, buying_cost_center from `tabItem` 
 					where name=(select item from tabBOM where name=%s)""", 
 					self.doc.bom_no, as_dict=1)
@@ -539,18 +539,18 @@
 		
 		# show some message
 		if not len(item_dict):
-			webnotes.msgprint(_("""All items have already been transferred \
+			frappe.msgprint(_("""All items have already been transferred \
 				for this Production Order."""))
 			
 		elif only_pending_fetched:
-			webnotes.msgprint(_("""Only quantities pending to be transferred \
+			frappe.msgprint(_("""Only quantities pending to be transferred \
 				were fetched for the following items:\n""" + "\n".join(only_pending_fetched)))
 
 		return item_dict
 
 	def get_issued_qty(self):
 		issued_item_qty = {}
-		result = webnotes.conn.sql("""select t1.item_code, sum(t1.qty)
+		result = frappe.conn.sql("""select t1.item_code, sum(t1.qty)
 			from `tabStock Entry Detail` t1, `tabStock Entry` t2
 			where t1.parent = t2.name and t2.production_order = %s and t2.docstatus = 1
 			and t2.purpose = 'Material Transfer'
@@ -562,7 +562,7 @@
 
 	def add_to_stock_entry_detail(self, item_dict, bom_no=None, idx=None):
 		if not idx:	idx = 1
-		expense_account, cost_center = webnotes.conn.get_values("Company", self.doc.company, \
+		expense_account, cost_center = frappe.conn.get_values("Company", self.doc.company, \
 			["default_expense_account", "cost_center"])[0]
 
 		for d in item_dict:
@@ -594,28 +594,28 @@
 	def validate_with_material_request(self):
 		for item in self.doclist.get({"parentfield": "mtn_details"}):
 			if item.material_request:
-				mreq_item = webnotes.conn.get_value("Material Request Item", 
+				mreq_item = frappe.conn.get_value("Material Request Item", 
 					{"name": item.material_request_item, "parent": item.material_request},
 					["item_code", "warehouse", "idx"], as_dict=True)
 				if mreq_item.item_code != item.item_code or mreq_item.warehouse != item.t_warehouse:
 					msgprint(_("Row #") + (" %d: " % item.idx) + _("does not match")
 						+ " " + _("Row #") + (" %d %s " % (mreq_item.idx, _("of")))
 						+ _("Material Request") + (" - %s" % item.material_request), 
-						raise_exception=webnotes.MappingMismatchError)
+						raise_exception=frappe.MappingMismatchError)
 	
-@webnotes.whitelist()					
+@frappe.whitelist()					
 def get_party_details(ref_dt, ref_dn):
 	if ref_dt in ["Delivery Note", "Sales Invoice"]:
-		res = webnotes.conn.get_value(ref_dt, ref_dn, 
+		res = frappe.conn.get_value(ref_dt, ref_dn, 
 			["customer", "customer_name", "address_display as customer_address"], as_dict=1)
 	else:
-		res = webnotes.conn.get_value(ref_dt, ref_dn, 
+		res = frappe.conn.get_value(ref_dt, ref_dn, 
 			["supplier", "supplier_name", "address_display as supplier_address"], as_dict=1)
 	return res or {}
 	
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_production_order_details(production_order):
-	result = webnotes.conn.sql("""select bom_no, 
+	result = frappe.conn.sql("""select bom_no, 
 		ifnull(qty, 0) - ifnull(produced_qty, 0) as fg_completed_qty, use_multi_level_bom, 
 		wip_warehouse from `tabProduction Order` where name = %s""", production_order, as_dict=1)
 	return result and result[0] or {}
@@ -625,7 +625,7 @@
 	if doctype == "Sales Invoice":
 		conditions = "and update_stock=1"
 	
-	return webnotes.conn.sql("""select name, customer, customer_name
+	return frappe.conn.sql("""select name, customer, customer_name
 		from `tab%s` where docstatus = 1
 			and (`%s` like %%(txt)s 
 				or `customer` like %%(txt)s) %s %s
@@ -636,7 +636,7 @@
 		as_list=True)
 	
 def query_purchase_return_doc(doctype, txt, searchfield, start, page_len, filters):
-	return webnotes.conn.sql("""select name, supplier, supplier_name
+	return frappe.conn.sql("""select name, supplier, supplier_name
 		from `tab%s` where docstatus = 1
 			and (`%s` like %%(txt)s 
 				or `supplier` like %%(txt)s) %s
@@ -685,7 +685,7 @@
 	}
 	
 	if filters.get("s_warehouse"):
-		batch_nos = webnotes.conn.sql("""select batch_no 
+		batch_nos = frappe.conn.sql("""select batch_no 
 			from `tabStock Ledger Entry` sle 
 			where item_code = '%(item_code)s' 
 				and warehouse = '%(s_warehouse)s'
@@ -704,7 +704,7 @@
 	if batch_nos:
 		return batch_nos
 	else:
-		return webnotes.conn.sql("""select name from `tabBatch` 
+		return frappe.conn.sql("""select name from `tabBatch` 
 			where item = '%(item_code)s'
 			and docstatus < 2
 			and (ifnull(expiry_date, '2099-12-31') >= %(posting_date)s 
@@ -721,21 +721,21 @@
 	
 	all_items = list(set([d.item_code for d in 
 		ref_doclist.get({"parentfield": ["in", parentfields]})]))
-	stock_items = webnotes.conn.sql_list("""select name from `tabItem`
+	stock_items = frappe.conn.sql_list("""select name from `tabItem`
 		where is_stock_item='Yes' and name in (%s)""" % (", ".join(["%s"] * len(all_items))),
 		tuple(all_items))
 
 	return stock_items
 	
 def get_return_doclist_and_details(args):
-	ref = webnotes._dict()
+	ref = frappe._dict()
 	
 	# get ref_doclist
 	if args["purpose"] in return_map:
 		for fieldname, val in return_map[args["purpose"]].items():
 			if args.get(fieldname):
 				ref.fieldname = fieldname
-				ref.doclist = webnotes.get_doclist(val[0], args[fieldname])
+				ref.doclist = frappe.get_doclist(val[0], args[fieldname])
 				ref.parentfields = val[1]
 				break
 				
@@ -752,9 +752,9 @@
 	}
 }
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_return_jv(stock_entry):
-	se = webnotes.bean("Stock Entry", stock_entry)
+	se = frappe.bean("Stock Entry", stock_entry)
 	if not se.doc.purpose in ["Sales Return", "Purchase Return"]:
 		return
 	
@@ -845,7 +845,7 @@
 	
 	for se_item in se.doclist.get({"parentfield": "mtn_details"}):
 		for sales_invoice in invoices_against_delivery:
-			si = webnotes.bean("Sales Invoice", sales_invoice)
+			si = frappe.bean("Sales Invoice", sales_invoice)
 			
 			if se_item.item_code in packing_item_parent_map:
 				ref_item = si.doclist.get({"item_code": packing_item_parent_map[se_item.item_code]})
@@ -878,7 +878,7 @@
 	if isinstance(value, basestring):
 		value = [value]
 	
-	return webnotes.conn.sql_list("""select distinct parent from `tab%s`
+	return frappe.conn.sql_list("""select distinct parent from `tab%s`
 		where docstatus = 1 and `%s` in (%s)""" % (doctype, link_field,
 			", ".join(["%s"]*len(value))), tuple(value))
 			
@@ -902,7 +902,7 @@
 	
 	for se_item in se.doclist.get({"parentfield": "mtn_details"}):
 		for purchase_invoice in invoice_against_receipt:
-			pi = webnotes.bean("Purchase Invoice", purchase_invoice)
+			pi = frappe.bean("Purchase Invoice", purchase_invoice)
 			ref_item = pi.doclist.get({"item_code": se_item.item_code})
 			
 			if not ref_item:
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 7239d7a..6a57056 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -2,31 +2,31 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes, unittest
-from webnotes.utils import flt
+import frappe, unittest
+from frappe.utils import flt
 from erpnext.stock.doctype.serial_no.serial_no import *
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
 from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
 
 class TestStockEntry(unittest.TestCase):
 	def tearDown(self):
-		webnotes.set_user("Administrator")
+		frappe.set_user("Administrator")
 		set_perpetual_inventory(0)
 		if hasattr(self, "old_default_company"):
-			webnotes.conn.set_default("company", self.old_default_company)
+			frappe.conn.set_default("company", self.old_default_company)
 
 	def test_auto_material_request(self):
-		webnotes.conn.sql("""delete from `tabMaterial Request Item`""")
-		webnotes.conn.sql("""delete from `tabMaterial Request`""")
+		frappe.conn.sql("""delete from `tabMaterial Request Item`""")
+		frappe.conn.sql("""delete from `tabMaterial Request`""")
 		self._clear_stock_account_balance()
 
-		webnotes.conn.set_value("Stock Settings", None, "auto_indent", True)
+		frappe.conn.set_value("Stock Settings", None, "auto_indent", True)
 
-		st1 = webnotes.bean(copy=test_records[0])
+		st1 = frappe.bean(copy=test_records[0])
 		st1.insert()
 		st1.submit()
 
-		st2 = webnotes.bean(copy=test_records[1])
+		st2 = frappe.bean(copy=test_records[1])
 		st2.insert()
 		st2.submit()
 				
@@ -34,22 +34,22 @@
 
 		reorder_item()
 
-		mr_name = webnotes.conn.sql("""select parent from `tabMaterial Request Item`
+		mr_name = frappe.conn.sql("""select parent from `tabMaterial Request Item`
 			where item_code='_Test Item'""")
 
 		self.assertTrue(mr_name)
 
-		webnotes.conn.set_default("company", self.old_default_company)
+		frappe.conn.set_default("company", self.old_default_company)
 
 	def test_material_receipt_gl_entry(self):
 		self._clear_stock_account_balance()
 		set_perpetual_inventory()
 
-		mr = webnotes.bean(copy=test_records[0])
+		mr = frappe.bean(copy=test_records[0])
 		mr.insert()
 		mr.submit()
 
-		stock_in_hand_account = webnotes.conn.get_value("Account", {"account_type": "Warehouse",
+		stock_in_hand_account = frappe.conn.get_value("Account", {"account_type": "Warehouse",
 			"master_name": mr.doclist[1].t_warehouse})
 
 		self.check_stock_ledger_entries("Stock Entry", mr.doc.name,
@@ -64,10 +64,10 @@
 
 		mr.cancel()
 
-		self.assertFalse(webnotes.conn.sql("""select * from `tabStock Ledger Entry`
+		self.assertFalse(frappe.conn.sql("""select * from `tabStock Ledger Entry`
 			where voucher_type='Stock Entry' and voucher_no=%s""", mr.doc.name))
 
-		self.assertFalse(webnotes.conn.sql("""select * from `tabGL Entry`
+		self.assertFalse(frappe.conn.sql("""select * from `tabGL Entry`
 			where voucher_type='Stock Entry' and voucher_no=%s""", mr.doc.name))
 
 
@@ -77,14 +77,14 @@
 
 		self._insert_material_receipt()
 
-		mi = webnotes.bean(copy=test_records[1])
+		mi = frappe.bean(copy=test_records[1])
 		mi.insert()
 		mi.submit()
 
 		self.check_stock_ledger_entries("Stock Entry", mi.doc.name,
 			[["_Test Item", "_Test Warehouse - _TC", -40.0]])
 
-		stock_in_hand_account = webnotes.conn.get_value("Account", {"account_type": "Warehouse",
+		stock_in_hand_account = frappe.conn.get_value("Account", {"account_type": "Warehouse",
 			"master_name": mi.doclist[1].s_warehouse})
 
 		self.check_gl_entries("Stock Entry", mi.doc.name,
@@ -95,16 +95,16 @@
 		)
 
 		mi.cancel()
-		self.assertFalse(webnotes.conn.sql("""select * from `tabStock Ledger Entry`
+		self.assertFalse(frappe.conn.sql("""select * from `tabStock Ledger Entry`
 			where voucher_type='Stock Entry' and voucher_no=%s""", mi.doc.name))
 
-		self.assertFalse(webnotes.conn.sql("""select * from `tabGL Entry`
+		self.assertFalse(frappe.conn.sql("""select * from `tabGL Entry`
 			where voucher_type='Stock Entry' and voucher_no=%s""", mi.doc.name))
 
-		self.assertEquals(webnotes.conn.get_value("Bin", {"warehouse": mi.doclist[1].s_warehouse,
+		self.assertEquals(frappe.conn.get_value("Bin", {"warehouse": mi.doclist[1].s_warehouse,
 			"item_code": mi.doclist[1].item_code}, "actual_qty"), 50)
 
-		self.assertEquals(webnotes.conn.get_value("Bin", {"warehouse": mi.doclist[1].s_warehouse,
+		self.assertEquals(frappe.conn.get_value("Bin", {"warehouse": mi.doclist[1].s_warehouse,
 			"item_code": mi.doclist[1].item_code}, "stock_value"), 5000)
 
 	def test_material_transfer_gl_entry(self):
@@ -113,17 +113,17 @@
 
 		self._insert_material_receipt()
 
-		mtn = webnotes.bean(copy=test_records[2])
+		mtn = frappe.bean(copy=test_records[2])
 		mtn.insert()
 		mtn.submit()
 
 		self.check_stock_ledger_entries("Stock Entry", mtn.doc.name,
 			[["_Test Item", "_Test Warehouse - _TC", -45.0], ["_Test Item", "_Test Warehouse 1 - _TC", 45.0]])
 
-		stock_in_hand_account = webnotes.conn.get_value("Account", {"account_type": "Warehouse",
+		stock_in_hand_account = frappe.conn.get_value("Account", {"account_type": "Warehouse",
 			"master_name": mtn.doclist[1].s_warehouse})
 
-		fixed_asset_account = webnotes.conn.get_value("Account", {"account_type": "Warehouse",
+		fixed_asset_account = frappe.conn.get_value("Account", {"account_type": "Warehouse",
 			"master_name": mtn.doclist[1].t_warehouse})
 
 
@@ -136,10 +136,10 @@
 
 
 		mtn.cancel()
-		self.assertFalse(webnotes.conn.sql("""select * from `tabStock Ledger Entry`
+		self.assertFalse(frappe.conn.sql("""select * from `tabStock Ledger Entry`
 			where voucher_type='Stock Entry' and voucher_no=%s""", mtn.doc.name))
 
-		self.assertFalse(webnotes.conn.sql("""select * from `tabGL Entry`
+		self.assertFalse(frappe.conn.sql("""select * from `tabGL Entry`
 			where voucher_type='Stock Entry' and voucher_no=%s""", mtn.doc.name))
 
 
@@ -149,7 +149,7 @@
 
 		self._insert_material_receipt()
 
-		repack = webnotes.bean(copy=test_records[3])
+		repack = frappe.bean(copy=test_records[3])
 		repack.insert()
 		repack.submit()
 
@@ -157,7 +157,7 @@
 			[["_Test Item", "_Test Warehouse - _TC", -50.0],
 				["_Test Item Home Desktop 100", "_Test Warehouse - _TC", 1]])
 
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type='Stock Entry' and voucher_no=%s
 			order by account desc""", repack.doc.name, as_dict=1)
 		self.assertFalse(gl_entries)
@@ -170,12 +170,12 @@
 
 		self._insert_material_receipt()
 
-		repack = webnotes.bean(copy=test_records[3])
+		repack = frappe.bean(copy=test_records[3])
 		repack.doclist[2].incoming_rate = 6000
 		repack.insert()
 		repack.submit()
 
-		stock_in_hand_account = webnotes.conn.get_value("Account", {"account_type": "Warehouse",
+		stock_in_hand_account = frappe.conn.get_value("Account", {"account_type": "Warehouse",
 			"master_name": repack.doclist[2].t_warehouse})
 
 		self.check_gl_entries("Stock Entry", repack.doc.name,
@@ -190,7 +190,7 @@
 		expected_sle.sort(key=lambda x: x[0])
 
 		# check stock ledger entries
-		sle = webnotes.conn.sql("""select item_code, warehouse, actual_qty
+		sle = frappe.conn.sql("""select item_code, warehouse, actual_qty
 			from `tabStock Ledger Entry` where voucher_type = %s
 			and voucher_no = %s order by item_code, warehouse, actual_qty""",
 			(voucher_type, voucher_no), as_list=1)
@@ -205,7 +205,7 @@
 	def check_gl_entries(self, voucher_type, voucher_no, expected_gl_entries):
 		expected_gl_entries.sort(key=lambda x: x[0])
 
-		gl_entries = webnotes.conn.sql("""select account, debit, credit
+		gl_entries = frappe.conn.sql("""select account, debit, credit
 			from `tabGL Entry` where voucher_type=%s and voucher_no=%s
 			order by account asc, debit asc""", (voucher_type, voucher_no), as_list=1)
 		self.assertTrue(gl_entries)
@@ -218,19 +218,19 @@
 
 	def _insert_material_receipt(self):
 		self._clear_stock_account_balance()
-		se1 = webnotes.bean(copy=test_records[0])
+		se1 = frappe.bean(copy=test_records[0])
 		se1.insert()
 		se1.submit()
 
-		se2 = webnotes.bean(copy=test_records[0])
+		se2 = frappe.bean(copy=test_records[0])
 		se2.doclist[1].item_code = "_Test Item Home Desktop 100"
 		se2.insert()
 		se2.submit()
 
-		webnotes.conn.set_default("company", self.old_default_company)
+		frappe.conn.set_default("company", self.old_default_company)
 
 	def _get_actual_qty(self):
-		return flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item",
+		return flt(frappe.conn.get_value("Bin", {"item_code": "_Test Item",
 			"warehouse": "_Test Warehouse - _TC"}, "actual_qty"))
 
 	def _test_sales_invoice_return(self, item_code, delivered_qty, returned_qty):
@@ -240,11 +240,11 @@
 			import test_records as sales_invoice_test_records
 
 		# invalid sales invoice as update stock not checked
-		si = webnotes.bean(copy=sales_invoice_test_records[1])
+		si = frappe.bean(copy=sales_invoice_test_records[1])
 		si.insert()
 		si.submit()
 
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Sales Return"
 		se.doc.sales_invoice_no = si.doc.name
 		se.doclist[1].qty = returned_qty
@@ -257,7 +257,7 @@
 		actual_qty_0 = self._get_actual_qty()
 
 		# insert a pos invoice with update stock
-		si = webnotes.bean(copy=sales_invoice_test_records[1])
+		si = frappe.bean(copy=sales_invoice_test_records[1])
 		si.doc.is_pos = si.doc.update_stock = 1
 		si.doclist[1].warehouse = "_Test Warehouse - _TC"
 		si.doclist[1].item_code = item_code
@@ -271,7 +271,7 @@
 		self.assertEquals(actual_qty_0 - delivered_qty, actual_qty_1)
 
 		# check if item is validated
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Sales Return"
 		se.doc.sales_invoice_no = si.doc.name
 		se.doc.posting_date = "2013-03-10"
@@ -281,10 +281,10 @@
 		se.doclist[1].transfer_qty = returned_qty
 
 		# check if stock entry gets submitted
-		self.assertRaises(webnotes.DoesNotExistError, se.insert)
+		self.assertRaises(frappe.DoesNotExistError, se.insert)
 
 		# try again
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Sales Return"
 		se.doc.posting_date = "2013-03-10"
 		se.doc.fiscal_year = "_Test Fiscal Year 2013"
@@ -321,7 +321,7 @@
 
 		actual_qty_0 = self._get_actual_qty()
 		# make a delivery note based on this invoice
-		dn = webnotes.bean(copy=delivery_note_test_records[0])
+		dn = frappe.bean(copy=delivery_note_test_records[0])
 		dn.doclist[1].item_code = item_code
 		dn.insert()
 		dn.submit()
@@ -332,7 +332,7 @@
 
 		si_doclist = make_sales_invoice(dn.doc.name)
 
-		si = webnotes.bean(si_doclist)
+		si = frappe.bean(si_doclist)
 		si.doc.posting_date = dn.doc.posting_date
 		si.doc.debit_to = "_Test Customer - _TC"
 		for d in si.doclist.get({"parentfield": "entries"}):
@@ -342,7 +342,7 @@
 		si.submit()
 
 		# insert and submit stock entry for sales return
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Sales Return"
 		se.doc.delivery_note_no = dn.doc.name
 		se.doc.posting_date = "2013-03-10"
@@ -410,7 +410,7 @@
 
 		actual_qty_0 = self._get_actual_qty()
 
-		so = webnotes.bean(copy=sales_order_test_records[0])
+		so = frappe.bean(copy=sales_order_test_records[0])
 		so.doclist[1].item_code = item_code
 		so.doclist[1].qty = 5.0
 		so.insert()
@@ -418,7 +418,7 @@
 
 		dn_doclist = make_delivery_note(so.doc.name)
 
-		dn = webnotes.bean(dn_doclist)
+		dn = frappe.bean(dn_doclist)
 		dn.doc.status = "Draft"
 		dn.doc.posting_date = so.doc.delivery_date
 		dn.insert()
@@ -430,7 +430,7 @@
 
 		si_doclist = make_sales_invoice(so.doc.name)
 
-		si = webnotes.bean(si_doclist)
+		si = frappe.bean(si_doclist)
 		si.doc.posting_date = dn.doc.posting_date
 		si.doc.debit_to = "_Test Customer - _TC"
 		for d in si.doclist.get({"parentfield": "entries"}):
@@ -440,7 +440,7 @@
 		si.submit()
 
 		# insert and submit stock entry for sales return
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Sales Return"
 		se.doc.delivery_note_no = dn.doc.name
 		se.doc.posting_date = "2013-03-10"
@@ -466,7 +466,7 @@
 		from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
 		
 		# submit purchase receipt
-		pr = webnotes.bean(copy=purchase_receipt_test_records[0])
+		pr = frappe.bean(copy=purchase_receipt_test_records[0])
 		pr.insert()
 		pr.submit()
 
@@ -476,7 +476,7 @@
 
 		pi_doclist = make_purchase_invoice(pr.doc.name)
 
-		pi = webnotes.bean(pi_doclist)
+		pi = frappe.bean(pi_doclist)
 		pi.doc.posting_date = pr.doc.posting_date
 		pi.doc.credit_to = "_Test Supplier - _TC"
 		for d in pi.doclist.get({"parentfield": "entries"}):
@@ -492,7 +492,7 @@
 		pi.submit()
 
 		# submit purchase return
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Purchase Return"
 		se.doc.purchase_receipt_no = pr.doc.name
 		se.doc.posting_date = "2013-03-01"
@@ -506,7 +506,7 @@
 
 		self.assertEquals(actual_qty_1 - 5, actual_qty_2)
 
-		webnotes.conn.set_default("company", self.old_default_company)
+		frappe.conn.set_default("company", self.old_default_company)
 
 		return se, pr.doc.name
 
@@ -518,7 +518,7 @@
 		prev_se, pr_docname = self.test_purchase_receipt_return()
 
 		# submit purchase return - return another 6 qtys so that exception is raised
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Purchase Return"
 		se.doc.purchase_receipt_no = pr_docname
 		se.doc.posting_date = "2013-03-01"
@@ -559,7 +559,7 @@
 			make_purchase_receipt, make_purchase_invoice
 
 		# submit purchase receipt
-		po = webnotes.bean(copy=purchase_order_test_records[0])
+		po = frappe.bean(copy=purchase_order_test_records[0])
 		po.doc.is_subcontracted = None
 		po.doclist[1].item_code = "_Test Item"
 		po.doclist[1].rate = 50
@@ -568,7 +568,7 @@
 
 		pr_doclist = make_purchase_receipt(po.doc.name)
 
-		pr = webnotes.bean(pr_doclist)
+		pr = frappe.bean(pr_doclist)
 		pr.doc.posting_date = po.doc.transaction_date
 		pr.insert()
 		pr.submit()
@@ -579,7 +579,7 @@
 
 		pi_doclist = make_purchase_invoice(po.doc.name)
 
-		pi = webnotes.bean(pi_doclist)
+		pi = frappe.bean(pi_doclist)
 		pi.doc.posting_date = pr.doc.posting_date
 		pi.doc.credit_to = "_Test Supplier - _TC"
 		for d in pi.doclist.get({"parentfield": "entries"}):
@@ -594,7 +594,7 @@
 		pi.submit()
 
 		# submit purchase return
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Purchase Return"
 		se.doc.purchase_receipt_no = pr.doc.name
 		se.doc.posting_date = "2013-03-01"
@@ -608,26 +608,26 @@
 
 		self.assertEquals(actual_qty_1 - 5, actual_qty_2)
 
-		webnotes.conn.set_default("company", self.old_default_company)
+		frappe.conn.set_default("company", self.old_default_company)
 
 		return se, pr.doc.name
 
 	def _clear_stock_account_balance(self):
-		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
-		webnotes.conn.sql("""delete from `tabBin`""")
-		webnotes.conn.sql("""delete from `tabGL Entry`""")
+		frappe.conn.sql("delete from `tabStock Ledger Entry`")
+		frappe.conn.sql("""delete from `tabBin`""")
+		frappe.conn.sql("""delete from `tabGL Entry`""")
 
-		self.old_default_company = webnotes.conn.get_default("company")
-		webnotes.conn.set_default("company", "_Test Company")
+		self.old_default_company = frappe.conn.get_default("company")
+		frappe.conn.set_default("company", "_Test Company")
 
 	def test_serial_no_not_reqd(self):
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doclist[1].serial_no = "ABCD"
 		se.insert()
 		self.assertRaises(SerialNoNotRequiredError, se.submit)
 
 	def test_serial_no_reqd(self):
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doclist[1].item_code = "_Test Serialized Item"
 		se.doclist[1].qty = 2
 		se.doclist[1].transfer_qty = 2
@@ -635,7 +635,7 @@
 		self.assertRaises(SerialNoRequiredError, se.submit)
 
 	def test_serial_no_qty_more(self):
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doclist[1].item_code = "_Test Serialized Item"
 		se.doclist[1].qty = 2
 		se.doclist[1].serial_no = "ABCD\nEFGH\nXYZ"
@@ -644,7 +644,7 @@
 		self.assertRaises(SerialNoQtyError, se.submit)
 
 	def test_serial_no_qty_less(self):
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doclist[1].item_code = "_Test Serialized Item"
 		se.doclist[1].qty = 2
 		se.doclist[1].serial_no = "ABCD"
@@ -654,7 +654,7 @@
 
 	def test_serial_no_transfer_in(self):
 		self._clear_stock_account_balance()
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doclist[1].item_code = "_Test Serialized Item"
 		se.doclist[1].qty = 2
 		se.doclist[1].serial_no = "ABCD\nEFGH"
@@ -662,15 +662,15 @@
 		se.insert()
 		se.submit()
 
-		self.assertTrue(webnotes.conn.exists("Serial No", "ABCD"))
-		self.assertTrue(webnotes.conn.exists("Serial No", "EFGH"))
+		self.assertTrue(frappe.conn.exists("Serial No", "ABCD"))
+		self.assertTrue(frappe.conn.exists("Serial No", "EFGH"))
 
 		se.cancel()
-		self.assertFalse(webnotes.conn.get_value("Serial No", "ABCD", "warehouse"))
+		self.assertFalse(frappe.conn.get_value("Serial No", "ABCD", "warehouse"))
 
 	def test_serial_no_not_exists(self):
 		self._clear_stock_account_balance()
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Material Issue"
 		se.doclist[1].item_code = "_Test Serialized Item"
 		se.doclist[1].qty = 2
@@ -685,7 +685,7 @@
 		self._clear_stock_account_balance()
 		self.test_serial_by_series()
 
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doclist[1].item_code = "_Test Serialized Item With Series"
 		se.doclist[1].qty = 1
 		se.doclist[1].serial_no = "ABCD00001"
@@ -699,8 +699,8 @@
 
 		serial_nos = get_serial_nos(se.doclist[1].serial_no)
 
-		self.assertTrue(webnotes.conn.exists("Serial No", serial_nos[0]))
-		self.assertTrue(webnotes.conn.exists("Serial No", serial_nos[1]))
+		self.assertTrue(frappe.conn.exists("Serial No", serial_nos[0]))
+		self.assertTrue(frappe.conn.exists("Serial No", serial_nos[1]))
 
 		return se
 
@@ -708,7 +708,7 @@
 		self._clear_stock_account_balance()
 		self.test_serial_by_series()
 
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Material Transfer"
 		se.doclist[1].item_code = "_Test Serialized Item"
 		se.doclist[1].qty = 1
@@ -724,7 +724,7 @@
 		se = make_serialized_item()
 		serial_no = get_serial_nos(se.doclist[1].serial_no)[0]
 
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Material Transfer"
 		se.doclist[1].item_code = "_Test Serialized Item With Series"
 		se.doclist[1].qty = 1
@@ -734,16 +734,16 @@
 		se.doclist[1].t_warehouse = "_Test Warehouse 1 - _TC"
 		se.insert()
 		se.submit()
-		self.assertTrue(webnotes.conn.get_value("Serial No", serial_no, "warehouse"), "_Test Warehouse 1 - _TC")
+		self.assertTrue(frappe.conn.get_value("Serial No", serial_no, "warehouse"), "_Test Warehouse 1 - _TC")
 
 		se.cancel()
-		self.assertTrue(webnotes.conn.get_value("Serial No", serial_no, "warehouse"), "_Test Warehouse - _TC")
+		self.assertTrue(frappe.conn.get_value("Serial No", serial_no, "warehouse"), "_Test Warehouse - _TC")
 
 	def test_serial_warehouse_error(self):
 		self._clear_stock_account_balance()
 		make_serialized_item()
 
-		se = webnotes.bean(copy=test_records[0])
+		se = frappe.bean(copy=test_records[0])
 		se.doc.purpose = "Material Transfer"
 		se.doclist[1].item_code = "_Test Serialized Item With Series"
 		se.doclist[1].qty = 1
@@ -760,69 +760,69 @@
 		se.cancel()
 
 		serial_no = get_serial_nos(se.doclist[1].serial_no)[0]
-		self.assertFalse(webnotes.conn.get_value("Serial No", serial_no, "warehouse"))
+		self.assertFalse(frappe.conn.get_value("Serial No", serial_no, "warehouse"))
 		
 	def test_warehouse_company_validation(self):
 		set_perpetual_inventory(0)
 		self._clear_stock_account_balance()
-		webnotes.bean("Profile", "test2@example.com").get_controller()\
+		frappe.bean("Profile", "test2@example.com").get_controller()\
 			.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
-		webnotes.set_user("test2@example.com")
+		frappe.set_user("test2@example.com")
 
 		from erpnext.stock.utils import InvalidWarehouseCompany
-		st1 = webnotes.bean(copy=test_records[0])
+		st1 = frappe.bean(copy=test_records[0])
 		st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
 		st1.insert()
 		self.assertRaises(InvalidWarehouseCompany, st1.submit)
 		
 	# permission tests
 	def test_warehouse_user(self):
-		import webnotes.defaults
-		from webnotes.model.bean import BeanPermissionError
+		import frappe.defaults
+		from frappe.model.bean import BeanPermissionError
 		set_perpetual_inventory(0)
 		
-		webnotes.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
-		webnotes.defaults.add_default("Warehouse", "_Test Warehouse 2 - _TC1", "test2@example.com", "Restriction")
-		webnotes.bean("Profile", "test@example.com").get_controller()\
+		frappe.defaults.add_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", "Restriction")
+		frappe.defaults.add_default("Warehouse", "_Test Warehouse 2 - _TC1", "test2@example.com", "Restriction")
+		frappe.bean("Profile", "test@example.com").get_controller()\
 			.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
-		webnotes.bean("Profile", "test2@example.com").get_controller()\
+		frappe.bean("Profile", "test2@example.com").get_controller()\
 			.add_roles("Sales User", "Sales Manager", "Material User", "Material Manager")
 
-		webnotes.set_user("test@example.com")
-		st1 = webnotes.bean(copy=test_records[0])
+		frappe.set_user("test@example.com")
+		st1 = frappe.bean(copy=test_records[0])
 		st1.doc.company = "_Test Company 1"
 		st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
 		self.assertRaises(BeanPermissionError, st1.insert)
 
-		webnotes.set_user("test2@example.com")
-		st1 = webnotes.bean(copy=test_records[0])
+		frappe.set_user("test2@example.com")
+		st1 = frappe.bean(copy=test_records[0])
 		st1.doc.company = "_Test Company 1"
 		st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
 		st1.insert()
 		st1.submit()
 		
-		webnotes.defaults.clear_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", parenttype="Restriction")
-		webnotes.defaults.clear_default("Warehouse", "_Test Warehouse 2 - _TC1", "test2@example.com", parenttype="Restriction")
+		frappe.defaults.clear_default("Warehouse", "_Test Warehouse 1 - _TC1", "test@example.com", parenttype="Restriction")
+		frappe.defaults.clear_default("Warehouse", "_Test Warehouse 2 - _TC1", "test2@example.com", parenttype="Restriction")
 		
 	def test_freeze_stocks (self):
 		self._clear_stock_account_balance()
-		webnotes.conn.set_value('Stock Settings', None,'stock_auth_role', '')
+		frappe.conn.set_value('Stock Settings', None,'stock_auth_role', '')
 
 		# test freeze_stocks_upto
 		date_newer_than_test_records = add_days(getdate(test_records[0][0]['posting_date']), 5)
-		webnotes.conn.set_value("Stock Settings", None, "stock_frozen_upto", date_newer_than_test_records)
-		se = webnotes.bean(copy=test_records[0]).insert()
+		frappe.conn.set_value("Stock Settings", None, "stock_frozen_upto", date_newer_than_test_records)
+		se = frappe.bean(copy=test_records[0]).insert()
 		self.assertRaises (StockFreezeError, se.submit)
-		webnotes.conn.set_value("Stock Settings", None, "stock_frozen_upto", '')
+		frappe.conn.set_value("Stock Settings", None, "stock_frozen_upto", '')
 
 		# test freeze_stocks_upto_days
-		webnotes.conn.set_value("Stock Settings", None, "stock_frozen_upto_days", 7)
-		se = webnotes.bean(copy=test_records[0]).insert()
+		frappe.conn.set_value("Stock Settings", None, "stock_frozen_upto_days", 7)
+		se = frappe.bean(copy=test_records[0]).insert()
 		self.assertRaises (StockFreezeError, se.submit)
-		webnotes.conn.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
+		frappe.conn.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
 
 def make_serialized_item():
-	se = webnotes.bean(copy=test_records[0])
+	se = frappe.bean(copy=test_records[0])
 	se.doclist[1].item_code = "_Test Serialized Item With Series"
 	se.doclist[1].qty = 2
 	se.doclist[1].transfer_qty = 2
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
index f44e5e3..eedf716 100644
--- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import add_days, cstr, flt, nowdate, cint, now
-from webnotes.model.doc import Document
-from webnotes.model.bean import getlist
-from webnotes.model.code import get_obj
-from webnotes import session, msgprint
+from frappe.utils import add_days, cstr, flt, nowdate, cint, now
+from frappe.model.doc import Document
+from frappe.model.bean import getlist
+from frappe.model.code import get_obj
+from frappe import session, msgprint
 from erpnext.stock.utils import get_valid_serial_nos
 
 
@@ -25,10 +25,10 @@
 			if v.get('is_cancelled') == 'Yes':
 				v['actual_qty'] = -flt(v['actual_qty'])
 				# cancel matching entry
-				webnotes.conn.sql("""update `tabStock Ledger Entry` set is_cancelled='Yes',
+				frappe.conn.sql("""update `tabStock Ledger Entry` set is_cancelled='Yes',
 					modified=%s, modified_by=%s
 					where voucher_no=%s and voucher_type=%s""", 
-					(now(), webnotes.session.user, v['voucher_no'], v['voucher_type']))
+					(now(), frappe.session.user, v['voucher_no'], v['voucher_type']))
 
 			if v.get("actual_qty"):
 				sle_id = self.make_entry(v)
@@ -44,7 +44,7 @@
 
 	def make_entry(self, args):
 		args.update({"doctype": "Stock Ledger Entry"})
-		sle = webnotes.bean([args])
+		sle = frappe.bean([args])
 		sle.ignore_permissions = 1
 		sle.insert()
 		return sle.doc.name
@@ -53,5 +53,5 @@
 		"""
 		Repost everything!
 		"""
-		for wh in webnotes.conn.sql("select name from tabWarehouse"):
+		for wh in frappe.conn.sql("select name from tabWarehouse"):
 			get_obj('Warehouse', wh[0]).repost_stock()
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index d6217dc..bc677ac 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -3,13 +3,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint
-from webnotes.utils import flt, getdate, add_days
-from webnotes.model.controller import DocListController
+import frappe
+from frappe import msgprint
+from frappe.utils import flt, getdate, add_days
+from frappe.model.controller import DocListController
 from datetime import date
 
-class StockFreezeError(webnotes.ValidationError): pass
+class StockFreezeError(frappe.ValidationError): pass
 
 class DocType(DocListController):
 	def __init__(self, doc, doclist=[]):
@@ -37,7 +37,7 @@
 	#check for item quantity available in stock
 	def actual_amt_check(self):
 		if self.doc.batch_no:
-			batch_bal_after_transaction = flt(webnotes.conn.sql("""select sum(actual_qty)
+			batch_bal_after_transaction = flt(frappe.conn.sql("""select sum(actual_qty)
 				from `tabStock Ledger Entry`
 				where warehouse=%s and item_code=%s and batch_no=%s""",
 				(self.doc.warehouse, self.doc.item_code, self.doc.batch_no))[0][0])
@@ -47,7 +47,7 @@
 					'batch_bal': batch_bal_after_transaction - self.doc.actual_qty
 				})
 
-				webnotes.throw("""Not enough quantity (requested: %(actual_qty)s, \
+				frappe.throw("""Not enough quantity (requested: %(actual_qty)s, \
 					current: %(batch_bal)s in Batch <b>%(batch_no)s</b> for Item \
 					<b>%(item_code)s</b> at Warehouse <b>%(warehouse)s</b> \
 					as on %(posting_date)s %(posting_time)s""" % self.doc.fields)
@@ -60,43 +60,43 @@
 			if not self.doc.fields.get(k):
 				msgprint("Stock Ledger Entry: '%s' is mandatory" % k, raise_exception = 1)
 			elif k == 'warehouse':
-				if not webnotes.conn.sql("select name from tabWarehouse where name = '%s'" % self.doc.fields.get(k)):
+				if not frappe.conn.sql("select name from tabWarehouse where name = '%s'" % self.doc.fields.get(k)):
 					msgprint("Warehouse: '%s' does not exist in the system. Please check." % self.doc.fields.get(k), raise_exception = 1)
 
 	def validate_item(self):
-		item_det = webnotes.conn.sql("""select name, has_batch_no, docstatus,
+		item_det = frappe.conn.sql("""select name, has_batch_no, docstatus,
 			is_stock_item, has_serial_no, serial_no_series
 			from tabItem where name=%s""",
 			self.doc.item_code, as_dict=True)[0]
 
 		if item_det.is_stock_item != 'Yes':
-			webnotes.throw("""Item: "%s" is not a Stock Item.""" % self.doc.item_code)
+			frappe.throw("""Item: "%s" is not a Stock Item.""" % self.doc.item_code)
 
 		# check if batch number is required
 		if item_det.has_batch_no =='Yes' and self.doc.voucher_type != 'Stock Reconciliation':
 			if not self.doc.batch_no:
-				webnotes.throw("Batch number is mandatory for Item '%s'" % self.doc.item_code)
+				frappe.throw("Batch number is mandatory for Item '%s'" % self.doc.item_code)
 
 			# check if batch belongs to item
-			if not webnotes.conn.sql("""select name from `tabBatch`
+			if not frappe.conn.sql("""select name from `tabBatch`
 				where item='%s' and name ='%s' and docstatus != 2""" % (self.doc.item_code, self.doc.batch_no)):
-				webnotes.throw("'%s' is not a valid Batch Number for Item '%s'" % (self.doc.batch_no, self.doc.item_code))
+				frappe.throw("'%s' is not a valid Batch Number for Item '%s'" % (self.doc.batch_no, self.doc.item_code))
 
 		if not self.doc.stock_uom:
 			self.doc.stock_uom = item_det.stock_uom
 
 	def check_stock_frozen_date(self):
-		stock_frozen_upto = webnotes.conn.get_value('Stock Settings', None, 'stock_frozen_upto') or ''
+		stock_frozen_upto = frappe.conn.get_value('Stock Settings', None, 'stock_frozen_upto') or ''
 		if stock_frozen_upto:
-			stock_auth_role = webnotes.conn.get_value('Stock Settings', None,'stock_auth_role')
-			if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in webnotes.user.get_roles():
+			stock_auth_role = frappe.conn.get_value('Stock Settings', None,'stock_auth_role')
+			if getdate(self.doc.posting_date) <= getdate(stock_frozen_upto) and not stock_auth_role in frappe.user.get_roles():
 				msgprint("You are not authorized to do / modify back dated stock entries before %s" % getdate(stock_frozen_upto).strftime('%d-%m-%Y'), raise_exception=StockFreezeError)
 
-		stock_frozen_upto_days = int(webnotes.conn.get_value('Stock Settings', None, 'stock_frozen_upto_days') or 0)
+		stock_frozen_upto_days = int(frappe.conn.get_value('Stock Settings', None, 'stock_frozen_upto_days') or 0)
 		if stock_frozen_upto_days:
-			stock_auth_role = webnotes.conn.get_value('Stock Settings', None,'stock_auth_role')
+			stock_auth_role = frappe.conn.get_value('Stock Settings', None,'stock_auth_role')
 			older_than_x_days_ago = (add_days(getdate(self.doc.posting_date), stock_frozen_upto_days) <= date.today())
-			if older_than_x_days_ago and not stock_auth_role in webnotes.user.get_roles():
+			if older_than_x_days_ago and not stock_auth_role in frappe.user.get_roles():
 				msgprint("You are not authorized to do / modify back dated stock entries older than %d days ago" %stock_frozen_upto_days, raise_exception=StockFreezeError)
 
 
@@ -105,8 +105,8 @@
 			self.doc.posting_time = '00:00'
 
 def on_doctype_update():
-	if not webnotes.conn.sql("""show index from `tabStock Ledger Entry`
+	if not frappe.conn.sql("""show index from `tabStock Ledger Entry`
 		where Key_name="posting_sort_index" """):
-		webnotes.conn.commit()
-		webnotes.conn.sql("""alter table `tabStock Ledger Entry`
+		frappe.conn.commit()
+		frappe.conn.sql("""alter table `tabStock Ledger Entry`
 			add index posting_sort_index(posting_date, posting_time, name)""")
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index b12b38a..bf62c75 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/controllers/stock_controller.js");
-wn.provide("erpnext.stock");
+frappe.require("assets/erpnext/js/controllers/stock_controller.js");
+frappe.provide("erpnext.stock");
 
 erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
 	onload: function() {
@@ -56,12 +56,12 @@
 			this.show_download_template();
 			this.show_upload();
 			if(this.frm.doc.reconciliation_json) {
-				this.frm.set_intro(wn._("You can submit this Stock Reconciliation."));
+				this.frm.set_intro(frappe._("You can submit this Stock Reconciliation."));
 			} else {
-				this.frm.set_intro(wn._("Download the Template, fill appropriate data and attach the modified file."));
+				this.frm.set_intro(frappe._("Download the Template, fill appropriate data and attach the modified file."));
 			}
 		} else if(this.frm.doc.docstatus == 1) {
-			this.frm.set_intro(wn._("Cancelling this Stock Reconciliation will nullify its effect."));
+			this.frm.set_intro(frappe._("Cancelling this Stock Reconciliation will nullify its effect."));
 			this.show_stock_ledger();
 			this.show_general_ledger();
 		} else {
@@ -73,20 +73,20 @@
 	
 	show_download_template: function() {
 		var me = this;
-		this.frm.add_custom_button(wn._("Download Template"), function() {
-			this.title = wn._("Stock Reconcilation Template");
-			wn.tools.downloadify([[wn._("Stock Reconciliation")],
+		this.frm.add_custom_button(frappe._("Download Template"), function() {
+			this.title = frappe._("Stock Reconcilation Template");
+			frappe.tools.downloadify([[frappe._("Stock Reconciliation")],
 				["----"],
-				[wn._("Stock Reconciliation can be used to update the stock on a particular date, ")
-					+ wn._("usually as per physical inventory.")],
-				[wn._("When submitted, the system creates difference entries ")
-					+ wn._("to set the given stock and valuation on this date.")],
-				[wn._("It can also be used to create opening stock entries and to fix stock value.")],
+				[frappe._("Stock Reconciliation can be used to update the stock on a particular date, ")
+					+ frappe._("usually as per physical inventory.")],
+				[frappe._("When submitted, the system creates difference entries ")
+					+ frappe._("to set the given stock and valuation on this date.")],
+				[frappe._("It can also be used to create opening stock entries and to fix stock value.")],
 				["----"],
-				[wn._("Notes:")],
-				[wn._("Item Code and Warehouse should already exist.")],
-				[wn._("You can update either Quantity or Valuation Rate or both.")],
-				[wn._("If no change in either Quantity or Valuation Rate, leave the cell blank.")],
+				[frappe._("Notes:")],
+				[frappe._("Item Code and Warehouse should already exist.")],
+				[frappe._("You can update either Quantity or Valuation Rate or both.")],
+				[frappe._("If no change in either Quantity or Valuation Rate, leave the cell blank.")],
 				["----"],
 				["Item Code", "Warehouse", "Quantity", "Valuation Rate"]], null, this);
 			return false;
@@ -98,7 +98,7 @@
 		var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty();
 		
 		// upload
-		wn.upload.make({
+		frappe.upload.make({
 			parent: $wrapper,
 			args: {
 				method: 'erpnext.stock.doctype.stock_reconciliation.stock_reconciliation.upload'
@@ -120,9 +120,9 @@
 	show_download_reconciliation_data: function() {
 		var me = this;
 		if(this.frm.doc.reconciliation_json) {
-			this.frm.add_custom_button(wn._("Download Reconcilation Data"), function() {
-				this.title = wn._("Stock Reconcilation Data");
-				wn.tools.downloadify(JSON.parse(me.frm.doc.reconciliation_json), null, this);
+			this.frm.add_custom_button(frappe._("Download Reconcilation Data"), function() {
+				this.title = frappe._("Stock Reconcilation Data");
+				frappe.tools.downloadify(JSON.parse(me.frm.doc.reconciliation_json), null, this);
 				return false;
 			}, "icon-download");
 		}
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index f61bd40..91c8151 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-import webnotes.defaults
+import frappe
+import frappe.defaults
 import json
-from webnotes import msgprint, _
-from webnotes.utils import cstr, flt, cint
+from frappe import msgprint, _
+from frappe.utils import cstr, flt, cint
 from erpnext.stock.stock_ledger import update_entries_after
 from erpnext.controllers.stock_controller import StockController
 from erpnext.stock.utils import update_bin
@@ -87,7 +87,7 @@
 			for msg in self.validation_messages:
 				msgprint(msg)
 			
-			raise webnotes.ValidationError
+			raise frappe.ValidationError
 						
 	def validate_item(self, item_code, row_num):
 		from erpnext.stock.doctype.item.item import validate_end_of_life, \
@@ -96,7 +96,7 @@
 		# using try except to catch all validation msgs and display together
 		
 		try:
-			item = webnotes.doc("Item", item_code)
+			item = frappe.doc("Item", item_code)
 			
 			# end of life and stock item
 			validate_end_of_life(item_code, item.end_of_life, verbose=0)
@@ -104,7 +104,7 @@
 		
 			# item should not be serialized
 			if item.has_serial_no == "Yes":
-				raise webnotes.ValidationError, (_("Serialized Item: '") + item_code +
+				raise frappe.ValidationError, (_("Serialized Item: '") + item_code +
 					_("""' can not be managed using Stock Reconciliation.\
 					You can add/delete Serial No directly, \
 					to modify stock of this item."""))
@@ -128,7 +128,7 @@
 		
 		data = json.loads(self.doc.reconciliation_json)
 		for row_num, row in enumerate(data[data.index(self.head_row)+1:]):
-			row = webnotes._dict(zip(row_template, row))
+			row = frappe._dict(zip(row_template, row))
 			row["row_num"] = row_num
 			previous_sle = get_previous_sle({
 				"item_code": row.item_code,
@@ -140,7 +140,7 @@
 			# check valuation rate mandatory
 			if row.qty != "" and not row.valuation_rate and \
 					flt(previous_sle.get("qty_after_transaction")) <= 0:
-				webnotes.throw(_("As existing qty for item: ") + row.item_code + 
+				frappe.throw(_("As existing qty for item: ") + row.item_code + 
 					_(" at warehouse: ") + row.warehouse +
 					_(" is less than equals to zero in the system, valuation rate is mandatory for this item"))
 			
@@ -233,7 +233,7 @@
 					
 	def insert_entries(self, opts, row):
 		"""Insert Stock Ledger Entries"""		
-		args = webnotes._dict({
+		args = frappe._dict({
 			"doctype": "Stock Ledger Entry",
 			"item_code": row.item_code,
 			"warehouse": row.warehouse,
@@ -242,7 +242,7 @@
 			"voucher_type": self.doc.doctype,
 			"voucher_no": self.doc.name,
 			"company": self.doc.company,
-			"stock_uom": webnotes.conn.get_value("Item", row.item_code, "stock_uom"),
+			"stock_uom": frappe.conn.get_value("Item", row.item_code, "stock_uom"),
 			"voucher_detail_no": row.voucher_detail_no,
 			"fiscal_year": self.doc.fiscal_year,
 			"is_cancelled": "No"
@@ -257,12 +257,12 @@
 		"""	Delete Stock Ledger Entries related to this voucher
 			and repost future Stock Ledger Entries"""
 				
-		existing_entries = webnotes.conn.sql("""select distinct item_code, warehouse 
+		existing_entries = frappe.conn.sql("""select distinct item_code, warehouse 
 			from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s""", 
 			(self.doc.doctype, self.doc.name), as_dict=1)
 				
 		# delete entries
-		webnotes.conn.sql("""delete from `tabStock Ledger Entry` 
+		frappe.conn.sql("""delete from `tabStock Ledger Entry` 
 			where voucher_type=%s and voucher_no=%s""", (self.doc.doctype, self.doc.name))
 		
 		# repost future entries for selected item_code, warehouse
@@ -283,20 +283,20 @@
 		
 			
 	def validate_expense_account(self):
-		if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
+		if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
 			return
 			
 		if not self.doc.expense_account:
 			msgprint(_("Please enter Expense Account"), raise_exception=1)
-		elif not webnotes.conn.sql("""select * from `tabStock Ledger Entry`"""):
-			if webnotes.conn.get_value("Account", self.doc.expense_account, 
+		elif not frappe.conn.sql("""select * from `tabStock Ledger Entry`"""):
+			if frappe.conn.get_value("Account", self.doc.expense_account, 
 					"is_pl_account") == "Yes":
 				msgprint(_("""Expense Account can not be a PL Account, as this stock \
 					reconciliation is an opening entry. \
 					Please select 'Temporary Account (Liabilities)' or relevant account"""), 
 					raise_exception=1)
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def upload():
-	from webnotes.utils.datautils import read_csv_content_from_uploaded_file
+	from frappe.utils.datautils import read_csv_content_from_uploaded_file
 	return read_csv_content_from_uploaded_file()
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index 287395f..cdb8c3e 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -5,15 +5,15 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes, unittest
-from webnotes.utils import flt
+import frappe, unittest
+from frappe.utils import flt
 import json
 from erpnext.accounts.utils import get_fiscal_year, get_stock_and_account_difference, get_balance_on
 
 
 class TestStockReconciliation(unittest.TestCase):
 	def test_reco_for_fifo(self):
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 0)
 		# [[qty, valuation_rate, posting_date, 
 		#		posting_time, expected_stock_value, bin_qty, bin_valuation]]
 		input_data = [
@@ -37,27 +37,27 @@
 			stock_reco = self.submit_stock_reconciliation(d[0], d[1], d[2], d[3])
 		
 			# check stock value
-			res = webnotes.conn.sql("""select stock_value from `tabStock Ledger Entry`
+			res = frappe.conn.sql("""select stock_value from `tabStock Ledger Entry`
 				where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'
 				and posting_date = %s and posting_time = %s order by name desc limit 1""", 
 				(d[2], d[3]))
 			self.assertEqual(res and flt(res[0][0]) or 0, d[4])
 			
 			# check bin qty and stock value
-			bin = webnotes.conn.sql("""select actual_qty, stock_value from `tabBin`
+			bin = frappe.conn.sql("""select actual_qty, stock_value from `tabBin`
 				where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'""")
 			
 			self.assertEqual(bin and [flt(bin[0][0]), flt(bin[0][1])] or [], [d[5], d[6]])
 			
 			# no gl entries
-			gl_entries = webnotes.conn.sql("""select name from `tabGL Entry` 
+			gl_entries = frappe.conn.sql("""select name from `tabGL Entry` 
 				where voucher_type = 'Stock Reconciliation' and voucher_no = %s""",
 				 stock_reco.doc.name)
 			self.assertFalse(gl_entries)
 			
 		
 	def test_reco_for_moving_average(self):
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 0)
 		# [[qty, valuation_rate, posting_date, 
 		#		posting_time, expected_stock_value, bin_qty, bin_valuation]]
 		input_data = [
@@ -82,7 +82,7 @@
 			stock_reco = self.submit_stock_reconciliation(d[0], d[1], d[2], d[3])
 			
 			# check stock value in sle
-			res = webnotes.conn.sql("""select stock_value from `tabStock Ledger Entry`
+			res = frappe.conn.sql("""select stock_value from `tabStock Ledger Entry`
 				where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'
 				and posting_date = %s and posting_time = %s order by name desc limit 1""", 
 				(d[2], d[3]))
@@ -90,20 +90,20 @@
 			self.assertEqual(res and flt(res[0][0], 4) or 0, d[4])
 			
 			# bin qty and stock value
-			bin = webnotes.conn.sql("""select actual_qty, stock_value from `tabBin`
+			bin = frappe.conn.sql("""select actual_qty, stock_value from `tabBin`
 				where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'""")
 			
 			self.assertEqual(bin and [flt(bin[0][0]), flt(bin[0][1], 4)] or [], 
 				[flt(d[5]), flt(d[6])])
 				
 			# no gl entries
-			gl_entries = webnotes.conn.sql("""select name from `tabGL Entry` 
+			gl_entries = frappe.conn.sql("""select name from `tabGL Entry` 
 				where voucher_type = 'Stock Reconciliation' and voucher_no = %s""", 
 				stock_reco.doc.name)
 			self.assertFalse(gl_entries)
 			
 	def test_reco_fifo_gl_entries(self):
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 1)
 		
 		# [[qty, valuation_rate, posting_date, posting_time, stock_in_hand_debit]]
 		input_data = [
@@ -133,10 +133,10 @@
 			stock_reco.cancel()
 			self.assertFalse(get_stock_and_account_difference(["_Test Account Stock In Hand - _TC"]))
 		
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 0)
 			
 	def test_reco_moving_average_gl_entries(self):
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 1)
 		
 		# [[qty, valuation_rate, posting_date, 
 		#		posting_time, stock_in_hand_debit]]
@@ -166,16 +166,16 @@
 			stock_reco.cancel()
 			self.assertFalse(get_stock_and_account_difference(["_Test Warehouse - _TC"]))
 		
-		webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
+		frappe.defaults.set_global_default("auto_accounting_for_stock", 0)
 
 
 	def cleanup_data(self):
-		webnotes.conn.sql("delete from `tabStock Ledger Entry`")
-		webnotes.conn.sql("delete from tabBin")
-		webnotes.conn.sql("delete from `tabGL Entry`")
+		frappe.conn.sql("delete from `tabStock Ledger Entry`")
+		frappe.conn.sql("delete from tabBin")
+		frappe.conn.sql("delete from `tabGL Entry`")
 						
 	def submit_stock_reconciliation(self, qty, rate, posting_date, posting_time):
-		stock_reco = webnotes.bean([{
+		stock_reco = frappe.bean([{
 			"doctype": "Stock Reconciliation",
 			"posting_date": posting_date,
 			"posting_time": posting_time,
@@ -193,8 +193,8 @@
 		return stock_reco
 		
 	def insert_existing_sle(self, valuation_method):
-		webnotes.conn.set_value("Item", "_Test Item", "valuation_method", valuation_method)
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.set_value("Item", "_Test Item", "valuation_method", valuation_method)
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
 		stock_entry = [
 			{
@@ -221,11 +221,11 @@
 			}, 
 		]
 			
-		pr = webnotes.bean(copy=stock_entry)
+		pr = frappe.bean(copy=stock_entry)
 		pr.insert()
 		pr.submit()
 		
-		pr1 = webnotes.bean(copy=stock_entry)
+		pr1 = frappe.bean(copy=stock_entry)
 		pr1.doc.posting_date = "2012-12-15"
 		pr1.doc.posting_time = "02:00"
 		pr1.doclist[1].qty = 10
@@ -234,7 +234,7 @@
 		pr1.insert()
 		pr1.submit()
 		
-		pr2 = webnotes.bean(copy=stock_entry)
+		pr2 = frappe.bean(copy=stock_entry)
 		pr2.doc.posting_date = "2012-12-25"
 		pr2.doc.posting_time = "03:00"
 		pr2.doc.purpose = "Material Issue"
@@ -246,7 +246,7 @@
 		pr2.insert()
 		pr2.submit()
 		
-		pr3 = webnotes.bean(copy=stock_entry)
+		pr3 = frappe.bean(copy=stock_entry)
 		pr3.doc.posting_date = "2012-12-31"
 		pr3.doc.posting_time = "08:00"
 		pr3.doc.purpose = "Material Issue"
@@ -259,7 +259,7 @@
 		pr3.submit()
 		
 		
-		pr4 = webnotes.bean(copy=stock_entry)
+		pr4 = frappe.bean(copy=stock_entry)
 		pr4.doc.posting_date = "2013-01-05"
 		pr4.doc.fiscal_year = "_Test Fiscal Year 2013"
 		pr4.doc.posting_time = "07:00"
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py
index 30a9490..470ae1b 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.py
@@ -4,8 +4,8 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
 class DocType:
 	def __init__(self, d, dl):
@@ -14,7 +14,7 @@
 	def validate(self):
 		for key in ["item_naming_by", "item_group", "stock_uom",
 			"allow_negative_stock"]:
-			webnotes.conn.set_default(key, self.doc.fields.get(key, ""))
+			frappe.conn.set_default(key, self.doc.fields.get(key, ""))
 			
 		from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
 		set_by_naming_series("Item", "item_code", 
@@ -24,4 +24,4 @@
 		submitted_stock_frozen = self.doc.stock_frozen_upto_days
 		if submitted_stock_frozen > stock_frozen_limit:
 			self.doc.stock_frozen_upto_days = stock_frozen_limit
-			webnotes.msgprint (_("`Freeze Stocks Older Than` should be smaller than %d days.") %stock_frozen_limit)
+			frappe.msgprint (_("`Freeze Stocks Older Than` should be smaller than %d days.") %stock_frozen_limit)
diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
index 2644995..f226efd 100644
--- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
+++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr, flt, now, cint
-from webnotes.model import db_exists
-from webnotes.model.bean import copy_doclist
-from webnotes.model.code import get_obj
-from webnotes import msgprint, _
+from frappe.utils import cstr, flt, now, cint
+from frappe.model import db_exists
+from frappe.model.bean import copy_doclist
+from frappe.model.code import get_obj
+from frappe import msgprint, _
 
 
 class DocType:
@@ -33,14 +33,14 @@
 			msgprint("Please Enter Conversion Factor.")
 			raise Exception
 		
-		stock_uom = webnotes.conn.sql("select stock_uom from `tabItem` where name = '%s'" % self.doc.item_code)
+		stock_uom = frappe.conn.sql("select stock_uom from `tabItem` where name = '%s'" % self.doc.item_code)
 		stock_uom = stock_uom and stock_uom[0][0]
 		if cstr(self.doc.new_stock_uom) == cstr(stock_uom):
 			msgprint("Item Master is already updated with New Stock UOM " + cstr(self.doc.new_stock_uom))
 			raise Exception
 			
 	def update_item_master(self):
-		item_bean = webnotes.bean("Item", self.doc.item_code)
+		item_bean = frappe.bean("Item", self.doc.item_code)
 		item_bean.doc.stock_uom = self.doc.new_stock_uom
 		item_bean.save()
 		
@@ -49,9 +49,9 @@
 	def update_bin(self):
 		# update bin
 		if flt(self.doc.conversion_factor) != flt(1):
-			webnotes.conn.sql("update `tabBin` set stock_uom = '%s' , indented_qty = ifnull(indented_qty,0) * %s, ordered_qty = ifnull(ordered_qty,0) * %s, reserved_qty = ifnull(reserved_qty,0) * %s, planned_qty = ifnull(planned_qty,0) * %s, projected_qty = actual_qty + ordered_qty + indented_qty + planned_qty - reserved_qty	where item_code = '%s'" % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.item_code) )
+			frappe.conn.sql("update `tabBin` set stock_uom = '%s' , indented_qty = ifnull(indented_qty,0) * %s, ordered_qty = ifnull(ordered_qty,0) * %s, reserved_qty = ifnull(reserved_qty,0) * %s, planned_qty = ifnull(planned_qty,0) * %s, projected_qty = actual_qty + ordered_qty + indented_qty + planned_qty - reserved_qty	where item_code = '%s'" % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.conversion_factor, self.doc.item_code) )
 		else:
-			webnotes.conn.sql("update `tabBin` set stock_uom = '%s' where item_code = '%s'" % (self.doc.new_stock_uom, self.doc.item_code) )
+			frappe.conn.sql("update `tabBin` set stock_uom = '%s' where item_code = '%s'" % (self.doc.new_stock_uom, self.doc.item_code) )
 
 		# acknowledge user
 		msgprint(" All Bins Updated Successfully.")
@@ -61,16 +61,16 @@
 		from erpnext.stock.stock_ledger import update_entries_after
 		
 		if flt(self.doc.conversion_factor) != flt(1):
-			webnotes.conn.sql("update `tabStock Ledger Entry` set stock_uom = '%s', actual_qty = ifnull(actual_qty,0) * '%s' where item_code = '%s' " % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.item_code))
+			frappe.conn.sql("update `tabStock Ledger Entry` set stock_uom = '%s', actual_qty = ifnull(actual_qty,0) * '%s' where item_code = '%s' " % (self.doc.new_stock_uom, self.doc.conversion_factor, self.doc.item_code))
 		else:
-			webnotes.conn.sql("update `tabStock Ledger Entry` set stock_uom = '%s' where item_code = '%s' " % (self.doc.new_stock_uom, self.doc.item_code))
+			frappe.conn.sql("update `tabStock Ledger Entry` set stock_uom = '%s' where item_code = '%s' " % (self.doc.new_stock_uom, self.doc.item_code))
 		
 		# acknowledge user
 		msgprint("Stock Ledger Entries Updated Successfully.")
 		
 		# update item valuation
 		if flt(self.doc.conversion_factor) != flt(1):
-			wh = webnotes.conn.sql("select name from `tabWarehouse`")
+			wh = frappe.conn.sql("select name from `tabWarehouse`")
 			for w in wh:
 				update_entries_after({"item_code": self.doc.item_code, "warehouse": w[0]})
 
@@ -90,19 +90,19 @@
 
 		
 	def validate_uom_integer_type(self):
-		current_is_integer = webnotes.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number")
-		new_is_integer = webnotes.conn.get_value("UOM", self.doc.new_stock_uom, "must_be_whole_number")
+		current_is_integer = frappe.conn.get_value("UOM", self.doc.current_stock_uom, "must_be_whole_number")
+		new_is_integer = frappe.conn.get_value("UOM", self.doc.new_stock_uom, "must_be_whole_number")
 		
 		if current_is_integer and not new_is_integer:
-			webnotes.msgprint("New UOM must be of type Whole Number", raise_exception=True)
+			frappe.msgprint("New UOM must be of type Whole Number", raise_exception=True)
 
 		if not current_is_integer and new_is_integer:
-			webnotes.msgprint("New UOM must NOT be of type Whole Number", raise_exception=True)
+			frappe.msgprint("New UOM must NOT be of type Whole Number", raise_exception=True)
 
 		if current_is_integer and new_is_integer and cint(self.doc.conversion_factor)!=self.doc.conversion_factor:
-			webnotes.msgprint("Conversion Factor cannot be fraction", raise_exception=True)
+			frappe.msgprint("Conversion Factor cannot be fraction", raise_exception=True)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_stock_uom(item_code):
-	return { 'current_stock_uom': cstr(webnotes.conn.get_value('Item', item_code, 'stock_uom')) }
+	return { 'current_stock_uom': cstr(frappe.conn.get_value('Item', item_code, 'stock_uom')) }
 	
diff --git a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
+++ b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 68dea05..8d9268a 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cint, validate_email_add
-from webnotes import throw, msgprint, _
+import frappe
+from frappe.utils import cint, validate_email_add
+from frappe import throw, msgprint, _
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -12,7 +12,7 @@
 		self.doclist = doclist
 	
 	def autoname(self):
-		suffix = " - " + webnotes.conn.get_value("Company", self.doc.company, "abbr")
+		suffix = " - " + frappe.conn.get_value("Company", self.doc.company, "abbr")
 		if not self.doc.warehouse_name.endswith(suffix):
 			self.doc.name = self.doc.warehouse_name + suffix
 
@@ -24,12 +24,12 @@
 				
 	def update_parent_account(self):
 		if not self.doc.__islocal and (self.doc.create_account_under != 
-			webnotes.conn.get_value("Warehouse", self.doc.name, "create_account_under")):
-				warehouse_account = webnotes.conn.get_value("Account", 
+			frappe.conn.get_value("Warehouse", self.doc.name, "create_account_under")):
+				warehouse_account = frappe.conn.get_value("Account", 
 					{"account_type": "Warehouse", "company": self.doc.company, 
 					"master_name": self.doc.name}, ["name", "parent_account"])
 				if warehouse_account and warehouse_account[1] != self.doc.create_account_under:
-					acc_bean = webnotes.bean("Account", warehouse_account[0])
+					acc_bean = frappe.bean("Account", warehouse_account[0])
 					acc_bean.doc.parent_account = self.doc.create_account_under
 					acc_bean.save()
 				
@@ -37,14 +37,14 @@
 		self.create_account_head()
 						
 	def create_account_head(self):
-		if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
-			if not webnotes.conn.get_value("Account", {"account_type": "Warehouse", 
-					"master_name": self.doc.name}) and not webnotes.conn.get_value("Account", 
+		if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
+			if not frappe.conn.get_value("Account", {"account_type": "Warehouse", 
+					"master_name": self.doc.name}) and not frappe.conn.get_value("Account", 
 					{"account_name": self.doc.warehouse_name}):
-				if self.doc.fields.get("__islocal") or not webnotes.conn.get_value(
+				if self.doc.fields.get("__islocal") or not frappe.conn.get_value(
 						"Stock Ledger Entry", {"warehouse": self.doc.name}):
 					self.validate_parent_account()
-					ac_bean = webnotes.bean({
+					ac_bean = frappe.bean({
 						"doctype": "Account",
 						'account_name': self.doc.warehouse_name, 
 						'parent_account': self.doc.create_account_under, 
@@ -61,17 +61,17 @@
 	
 	def validate_parent_account(self):
 		if not self.doc.create_account_under:
-			parent_account = webnotes.conn.get_value("Account", 
+			parent_account = frappe.conn.get_value("Account", 
 				{"account_name": "Stock Assets", "company": self.doc.company})
 			if parent_account:
 				self.doc.create_account_under = parent_account
 			else:
-				webnotes.throw(_("Please enter account group under which account \
+				frappe.throw(_("Please enter account group under which account \
 					for warehouse ") + self.doc.name +_(" will be created"))
 		
 	def on_trash(self):
 		# delete bin
-		bins = webnotes.conn.sql("select * from `tabBin` where warehouse = %s", 
+		bins = frappe.conn.sql("select * from `tabBin` where warehouse = %s", 
 			self.doc.name, as_dict=1)
 		for d in bins:
 			if d['actual_qty'] or d['reserved_qty'] or d['ordered_qty'] or \
@@ -79,14 +79,14 @@
 				throw("""Warehouse: %s can not be deleted as qty exists for item: %s""" 
 					% (self.doc.name, d['item_code']))
 			else:
-				webnotes.conn.sql("delete from `tabBin` where name = %s", d['name'])
+				frappe.conn.sql("delete from `tabBin` where name = %s", d['name'])
 				
-		warehouse_account = webnotes.conn.get_value("Account", 
+		warehouse_account = frappe.conn.get_value("Account", 
 			{"account_type": "Warehouse", "master_name": self.doc.name})
 		if warehouse_account:
-			webnotes.delete_doc("Account", warehouse_account)
+			frappe.delete_doc("Account", warehouse_account)
 				
-		if webnotes.conn.sql("""select name from `tabStock Ledger Entry` 
+		if frappe.conn.sql("""select name from `tabStock Ledger Entry` 
 				where warehouse = %s""", self.doc.name):
 			throw(_("""Warehouse can not be deleted as stock ledger entry 
 				exists for this warehouse."""))
@@ -97,13 +97,13 @@
 		new_warehouse = get_name_with_abbr(newdn, self.doc.company)
 
 		if merge:
-			if not webnotes.conn.exists("Warehouse", new_warehouse):
-				webnotes.throw(_("Warehouse ") + new_warehouse +_(" does not exists"))
+			if not frappe.conn.exists("Warehouse", new_warehouse):
+				frappe.throw(_("Warehouse ") + new_warehouse +_(" does not exists"))
 				
-			if self.doc.company != webnotes.conn.get_value("Warehouse", new_warehouse, "company"):
-				webnotes.throw(_("Both Warehouse must belong to same Company"))
+			if self.doc.company != frappe.conn.get_value("Warehouse", new_warehouse, "company"):
+				frappe.throw(_("Both Warehouse must belong to same Company"))
 				
-			webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
+			frappe.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
 			
 		from erpnext.accounts.utils import rename_account_for
 		rename_account_for("Warehouse", olddn, newdn, merge, self.doc.company)
@@ -116,15 +116,15 @@
 			
 	def recalculate_bin_qty(self, newdn):
 		from erpnext.utilities.repost_stock import repost_stock
-		webnotes.conn.auto_commit_on_many_writes = 1
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.auto_commit_on_many_writes = 1
+		frappe.conn.set_default("allow_negative_stock", 1)
 		
-		for item in webnotes.conn.sql("""select distinct item_code from (
+		for item in frappe.conn.sql("""select distinct item_code from (
 			select name as item_code from `tabItem` where ifnull(is_stock_item, 'Yes')='Yes'
 			union 
 			select distinct item_code from tabBin) a"""):
 				repost_stock(item[0], newdn)
 			
-		webnotes.conn.set_default("allow_negative_stock", 
-			webnotes.conn.get_value("Stock Settings", None, "allow_negative_stock"))
-		webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
+		frappe.conn.set_default("allow_negative_stock", 
+			frappe.conn.get_value("Stock Settings", None, "allow_negative_stock"))
+		frappe.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse_user/warehouse_user.py b/erpnext/stock/doctype/warehouse_user/warehouse_user.py
index e5468e5..968a25b 100644
--- a/erpnext/stock/doctype/warehouse_user/warehouse_user.py
+++ b/erpnext/stock/doctype/warehouse_user/warehouse_user.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 8bd00b6..df67c9c 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, throw
-from webnotes.utils import flt, cint, add_days
+import frappe
+from frappe import _, throw
+from frappe.utils import flt, cint, add_days
 import json
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_item_details(args):
 	"""
 		args = {
@@ -31,7 +31,7 @@
 
 	if isinstance(args, basestring):
 		args = json.loads(args)
-	args = webnotes._dict(args)
+	args = frappe._dict(args)
 	
 	if not args.get("transaction_type"):
 		args.transaction_type = "selling" if args.get("customer") else "buying"
@@ -44,7 +44,7 @@
 	elif not args.item_code and args.serial_no:
 		args.item_code = get_item_code(serial_no=args.serial_no)
 	
-	item_bean = webnotes.bean("Item", args.item_code)
+	item_bean = frappe.bean("Item", args.item_code)
 	item = item_bean.doc
 
 	validate_item_details(args, item)
@@ -76,9 +76,9 @@
 
 def get_item_code(barcode=None, serial_no=None):
 	if barcode:
-		item_code = webnotes.conn.get_value("Item", {"barcode": barcode})
+		item_code = frappe.conn.get_value("Item", {"barcode": barcode})
 	elif serial_no:
-		item_code = webnotes.conn.get_value("Serial No", serial_no, "item_code")
+		item_code = frappe.conn.get_value("Serial No", serial_no, "item_code")
 
 	if not item_code:
 		throw(_("No Item found with ") + _("Barcode") if barcode else _("Serial No") + 
@@ -117,20 +117,20 @@
 def get_basic_details(args, item_bean):
 	item = item_bean.doc
 	
-	from webnotes.defaults import get_user_default_as_list
+	from frappe.defaults import get_user_default_as_list
 	user_default_warehouse_list = get_user_default_as_list('warehouse')
 	user_default_warehouse = user_default_warehouse_list[0] \
 		if len(user_default_warehouse_list)==1 else ""
 
-	out = webnotes._dict({
+	out = frappe._dict({
 		"item_code": item.name,
 		"item_name": item.item_name,
 		"description": item.description_html or item.description,
 		"warehouse": user_default_warehouse or args.warehouse or item.default_warehouse,
 		"income_account": item.income_account or args.income_account \
-			or webnotes.conn.get_value("Company", args.company, "default_income_account"),
+			or frappe.conn.get_value("Company", args.company, "default_income_account"),
 		"expense_account": item.expense_account or args.expense_account \
-			or webnotes.conn.get_value("Company", args.company, "default_expense_account"),
+			or frappe.conn.get_value("Company", args.company, "default_expense_account"),
 		"cost_center": item.selling_cost_center \
 			if args.transaction_type == "selling" else item.buying_cost_center,
 		"batch_no": None,
@@ -155,13 +155,13 @@
 	return out
 	
 def get_price_list_rate(args, item_bean, out):
-	meta = webnotes.get_doctype(args.doctype)
+	meta = frappe.get_doctype(args.doctype)
 
 	if meta.get_field("currency"):
 		validate_price_list(args)
 		validate_conversion_rate(args, meta)
 
-		price_list_rate = webnotes.conn.get_value("Item Price", 
+		price_list_rate = frappe.conn.get_value("Item Price", 
 			{"price_list": args.price_list, "item_code": args.item_code}, "price_list_rate")
 			
 		if not price_list_rate: return {}
@@ -176,7 +176,7 @@
 			
 def validate_price_list(args):
 	if args.get("price_list"):
-		if not webnotes.conn.get_value("Price List", 
+		if not frappe.conn.get_value("Price List", 
 			{"name": args.price_list, args.transaction_type: 1, "enabled": 1}):
 				throw(_("Price List is either disabled or for not ") + _(args.transaction_type))
 	else:
@@ -184,7 +184,7 @@
 		
 def validate_conversion_rate(args, meta):
 	from erpnext.setup.doctype.currency.currency import validate_conversion_rate
-	from webnotes.model.meta import get_field_precision
+	from frappe.model.meta import get_field_precision
 	
 	# validate currency conversion rate
 	validate_conversion_rate(args.currency, args.conversion_rate, 
@@ -192,7 +192,7 @@
 	
 	args.conversion_rate = flt(args.conversion_rate, 
 		get_field_precision(meta.get_field("conversion_rate"), 
-			webnotes._dict({"fields": args})))
+			frappe._dict({"fields": args})))
 	
 	# validate price list currency conversion rate
 	if not args.get("price_list_currency"):
@@ -203,10 +203,10 @@
 		
 		args.plc_conversion_rate = flt(args.plc_conversion_rate, 
 			get_field_precision(meta.get_field("plc_conversion_rate"), 
-			webnotes._dict({"fields": args})))
+			frappe._dict({"fields": args})))
 
 def get_item_discount(item_group, customer):
-	parent_item_groups = [x[0] for x in webnotes.conn.sql("""SELECT parent.name 
+	parent_item_groups = [x[0] for x in frappe.conn.sql("""SELECT parent.name 
 		FROM `tabItem Group` AS node, `tabItem Group` AS parent 
 		WHERE parent.lft <= node.lft and parent.rgt >= node.rgt and node.name = %s
 		GROUP BY parent.name 
@@ -214,7 +214,7 @@
 		
 	discount = 0
 	for d in parent_item_groups:
-		res = webnotes.conn.sql("""select discount, name from `tabCustomer Discount` 
+		res = frappe.conn.sql("""select discount, name from `tabCustomer Discount` 
 			where parent = %s and item_group = %s""", (customer, d))
 		if res:
 			discount = flt(res[0][0])
@@ -234,7 +234,7 @@
 		
 
 def get_pos_settings_item_details(company, args, pos_settings=None):
-	res = webnotes._dict()
+	res = frappe._dict()
 	
 	if not pos_settings:
 		pos_settings = get_pos_settings(company)
@@ -251,17 +251,17 @@
 	return res
 
 def get_pos_settings(company):
-	pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` where user = %s 
-		and company = %s""", (webnotes.session['user'], company), as_dict=1)
+	pos_settings = frappe.conn.sql("""select * from `tabPOS Setting` where user = %s 
+		and company = %s""", (frappe.session['user'], company), as_dict=1)
 	
 	if not pos_settings:
-		pos_settings = webnotes.conn.sql("""select * from `tabPOS Setting` 
+		pos_settings = frappe.conn.sql("""select * from `tabPOS Setting` 
 			where ifnull(user,'') = '' and company = %s""", company, as_dict=1)
 			
 	return pos_settings and pos_settings[0] or None
 	
 def get_serial_nos_by_fifo(args, item_bean):
-	return "\n".join(webnotes.conn.sql_list("""select name from `tabSerial No` 
+	return "\n".join(frappe.conn.sql_list("""select name from `tabSerial No` 
 		where item_code=%(item_code)s and warehouse=%(warehouse)s and status='Available' 
 		order by timestamp(purchase_date, purchase_time) asc limit %(qty)s""", {
 			"item_code": args.item_code,
@@ -269,17 +269,17 @@
 			"qty": cint(args.qty)
 		}))
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_conversion_factor(item_code, uom):
-	return {"conversion_factor": webnotes.conn.get_value("UOM Conversion Detail",
+	return {"conversion_factor": frappe.conn.get_value("UOM Conversion Detail",
 		{"parent": item_code, "uom": uom}, "conversion_factor")}
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_projected_qty(item_code, warehouse):
-	return {"projected_qty": webnotes.conn.get_value("Bin", 
+	return {"projected_qty": frappe.conn.get_value("Bin", 
 		{"item_code": item_code, "warehouse": warehouse}, "projected_qty")}
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_available_qty(item_code, warehouse):
-	return webnotes.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, 
+	return frappe.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse}, 
 		["projected_qty", "actual_qty"], as_dict=True) or {}
\ No newline at end of file
diff --git a/erpnext/stock/page/stock_ageing/stock_ageing.js b/erpnext/stock/page/stock_ageing/stock_ageing.js
index 33dbf54..d7a2b3e 100644
--- a/erpnext/stock/page/stock_ageing/stock_ageing.js
+++ b/erpnext/stock/page/stock_ageing/stock_ageing.js
@@ -2,10 +2,10 @@
 // License: GNU General Public License v3. See license.txt
 
 
-wn.pages['stock-ageing'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['stock-ageing'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Stock Ageing'),
+		title: frappe._('Stock Ageing'),
 		single_column: true
 	});
 
@@ -16,12 +16,12 @@
 	
 }
 
-wn.require("assets/erpnext/js/stock_grid_report.js");
+frappe.require("assets/erpnext/js/stock_grid_report.js");
 
 erpnext.StockAgeing = erpnext.StockGridReport.extend({
 	init: function(wrapper) {
 		this._super({
-			title: wn._("Stock Ageing"),
+			title: frappe._("Stock Ageing"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -30,37 +30,37 @@
 	},
 	setup_columns: function() {
 		this.columns = [
-			{id: "name", name: wn._("Item"), field: "name", width: 300,
+			{id: "name", name: frappe._("Item"), field: "name", width: 300,
 				link_formatter: {
 					open_btn: true,
 					doctype: '"Item"'
 				}},
-			{id: "item_name", name: wn._("Item Name"), field: "item_name", 
+			{id: "item_name", name: frappe._("Item Name"), field: "item_name", 
 				width: 100, formatter: this.text_formatter},
-			{id: "description", name: wn._("Description"), field: "description", 
+			{id: "description", name: frappe._("Description"), field: "description", 
 				width: 200, formatter: this.text_formatter},
-			{id: "brand", name: wn._("Brand"), field: "brand", width: 100},
-			{id: "average_age", name: wn._("Average Age"), field: "average_age",
+			{id: "brand", name: frappe._("Brand"), field: "brand", width: 100},
+			{id: "average_age", name: frappe._("Average Age"), field: "average_age",
 				formatter: this.currency_formatter},
-			{id: "earliest", name: wn._("Earliest"), field: "earliest",
+			{id: "earliest", name: frappe._("Earliest"), field: "earliest",
 				formatter: this.currency_formatter},
-			{id: "latest", name: wn._("Latest"), field: "latest",
+			{id: "latest", name: frappe._("Latest"), field: "latest",
 				formatter: this.currency_formatter},
 			{id: "stock_uom", name: "UOM", field: "stock_uom", width: 100},
 		];
 	},
 	filters: [
-		{fieldtype:"Select", label: wn._("Warehouse"), link:"Warehouse", 
+		{fieldtype:"Select", label: frappe._("Warehouse"), link:"Warehouse", 
 			default_value: "Select Warehouse..."},
-		{fieldtype:"Select", label: wn._("Brand"), link:"Brand", 
+		{fieldtype:"Select", label: frappe._("Brand"), link:"Brand", 
 			default_value: "Select Brand...", filter: function(val, item, opts) {
 				return val == opts.default_value || item.brand == val;
 			}, link_formatter: {filter_input: "brand"}},
-		{fieldtype:"Select", label: wn._("Plot By"), 
+		{fieldtype:"Select", label: frappe._("Plot By"), 
 			options: ["Average Age", "Earliest", "Latest"]},
-		{fieldtype:"Date", label: wn._("To Date")},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Date", label: frappe._("To Date")},
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	setup_filters: function() {
 		var me = this;
@@ -76,7 +76,7 @@
 		var me = this;
 				
 		if(!this.data) {
-			me._data = wn.report_dump.data["Item"];
+			me._data = frappe.report_dump.data["Item"];
 			me.item_by_name = me.make_name_map(me._data);
 		}
 		
@@ -103,7 +103,7 @@
 	prepare_balances: function() {
 		var me = this;
 		var to_date = dateutil.str_to_obj(this.to_date);
-		var data = wn.report_dump.data["Stock Ledger Entry"];
+		var data = frappe.report_dump.data["Stock Ledger Entry"];
 
 		this.item_warehouse = {};
 
diff --git a/erpnext/stock/page/stock_analytics/stock_analytics.js b/erpnext/stock/page/stock_analytics/stock_analytics.js
index ba2c55a..f6f8043 100644
--- a/erpnext/stock/page/stock_analytics/stock_analytics.js
+++ b/erpnext/stock/page/stock_analytics/stock_analytics.js
@@ -2,10 +2,10 @@
 // License: GNU General Public License v3. See license.txt
 
 
-wn.pages['stock-analytics'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['stock-analytics'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Stock Analytics'),
+		title: frappe._('Stock Analytics'),
 		single_column: true
 	});
 
@@ -16,4 +16,4 @@
 	
 }
 
-wn.require("assets/erpnext/js/stock_analytics.js");
\ No newline at end of file
+frappe.require("assets/erpnext/js/stock_analytics.js");
\ No newline at end of file
diff --git a/erpnext/stock/page/stock_balance/stock_balance.js b/erpnext/stock/page/stock_balance/stock_balance.js
index cc293a4..c3204a4 100644
--- a/erpnext/stock/page/stock_balance/stock_balance.js
+++ b/erpnext/stock/page/stock_balance/stock_balance.js
@@ -1,12 +1,12 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/stock_analytics.js");
+frappe.require("assets/erpnext/js/stock_analytics.js");
 
-wn.pages['stock-balance'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['stock-balance'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Stock Balance'),
+		title: frappe._('Stock Balance'),
 		single_column: true
 	});
 	
@@ -20,58 +20,58 @@
 erpnext.StockBalance = erpnext.StockAnalytics.extend({
 	init: function(wrapper) {
 		this._super(wrapper, {
-			title: wn._("Stock Balance"),
+			title: frappe._("Stock Balance"),
 			doctypes: ["Item", "Item Group", "Warehouse", "Stock Ledger Entry", "Brand",
 				"Stock Entry", "Project", "Serial No"],
 		});
 	},
 	setup_columns: function() {
 		this.columns = [
-			{id: "name", name: wn._("Item"), field: "name", width: 300,
+			{id: "name", name: frappe._("Item"), field: "name", width: 300,
 				formatter: this.tree_formatter},
-			{id: "item_name", name: wn._("Item Name"), field: "item_name", width: 100},
-			{id: "description", name: wn._("Description"), field: "description", width: 200, 
+			{id: "item_name", name: frappe._("Item Name"), field: "item_name", width: 100},
+			{id: "description", name: frappe._("Description"), field: "description", width: 200, 
 				formatter: this.text_formatter},
-			{id: "brand", name: wn._("Brand"), field: "brand", width: 100},
-			{id: "stock_uom", name: wn._("UOM"), field: "stock_uom", width: 100},
-			{id: "opening_qty", name: wn._("Opening Qty"), field: "opening_qty", width: 100, 
+			{id: "brand", name: frappe._("Brand"), field: "brand", width: 100},
+			{id: "stock_uom", name: frappe._("UOM"), field: "stock_uom", width: 100},
+			{id: "opening_qty", name: frappe._("Opening Qty"), field: "opening_qty", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "inflow_qty", name: wn._("In Qty"), field: "inflow_qty", width: 100, 
+			{id: "inflow_qty", name: frappe._("In Qty"), field: "inflow_qty", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "outflow_qty", name: wn._("Out Qty"), field: "outflow_qty", width: 100, 
+			{id: "outflow_qty", name: frappe._("Out Qty"), field: "outflow_qty", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "closing_qty", name: wn._("Closing Qty"), field: "closing_qty", width: 100, 
+			{id: "closing_qty", name: frappe._("Closing Qty"), field: "closing_qty", width: 100, 
 				formatter: this.currency_formatter},
 				
-			{id: "opening_value", name: wn._("Opening Value"), field: "opening_value", width: 100, 
+			{id: "opening_value", name: frappe._("Opening Value"), field: "opening_value", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "inflow_value", name: wn._("In Value"), field: "inflow_value", width: 100, 
+			{id: "inflow_value", name: frappe._("In Value"), field: "inflow_value", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "outflow_value", name: wn._("Out Value"), field: "outflow_value", width: 100, 
+			{id: "outflow_value", name: frappe._("Out Value"), field: "outflow_value", width: 100, 
 				formatter: this.currency_formatter},
-			{id: "closing_value", name: wn._("Closing Value"), field: "closing_value", width: 100, 
+			{id: "closing_value", name: frappe._("Closing Value"), field: "closing_value", width: 100, 
 				formatter: this.currency_formatter},
 		];
 	},
 	
 	filters: [
-		{fieldtype:"Select", label: wn._("Brand"), link:"Brand", 
+		{fieldtype:"Select", label: frappe._("Brand"), link:"Brand", 
 			default_value: "Select Brand...", filter: function(val, item, opts) {
 				return val == opts.default_value || item.brand == val || item._show;
 			}, link_formatter: {filter_input: "brand"}},
-		{fieldtype:"Select", label: wn._("Warehouse"), link:"Warehouse", 
+		{fieldtype:"Select", label: frappe._("Warehouse"), link:"Warehouse", 
 			default_value: "Select Warehouse...", filter: function(val, item, opts, me) {
 				return me.apply_zero_filter(val, item, opts, me);
 			}},
-		{fieldtype:"Select", label: wn._("Project"), link:"Project", 
+		{fieldtype:"Select", label: frappe._("Project"), link:"Project", 
 			default_value: "Select Project...", filter: function(val, item, opts, me) {
 				return me.apply_zero_filter(val, item, opts, me);
 			}, link_formatter: {filter_input: "project"}},
-		{fieldtype:"Date", label: wn._("From Date")},
-		{fieldtype:"Label", label: wn._("To")},
-		{fieldtype:"Date", label: wn._("To Date")},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Date", label: frappe._("From Date")},
+		{fieldtype:"Label", label: frappe._("To")},
+		{fieldtype:"Date", label: frappe._("To Date")},
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	
 	setup_plot_check: function() {
@@ -79,7 +79,7 @@
 	},
 	
 	prepare_data: function() {
-		this.stock_entry_map = this.make_name_map(wn.report_dump.data["Stock Entry"], "name");
+		this.stock_entry_map = this.make_name_map(frappe.report_dump.data["Stock Entry"], "name");
 		this._super();
 	},
 	
@@ -87,7 +87,7 @@
 		var me = this;
 		var from_date = dateutil.str_to_obj(this.from_date);
 		var to_date = dateutil.str_to_obj(this.to_date);
-		var data = wn.report_dump.data["Stock Ledger Entry"];
+		var data = frappe.report_dump.data["Stock Ledger Entry"];
 
 		this.item_warehouse = {};
 		this.serialized_buying_rates = this.get_serialized_buying_rates();
diff --git a/erpnext/stock/page/stock_home/stock_home.js b/erpnext/stock/page/stock_home/stock_home.js
index fbb21e4..93b7110 100644
--- a/erpnext/stock/page/stock_home/stock_home.js
+++ b/erpnext/stock/page/stock_home/stock_home.js
@@ -1,250 +1,250 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Stock"] = [
+frappe.module_page["Stock"] = [
 	{
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		top: true,
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Item"),
-				description: wn._("All Products or Services."),
+				label: frappe._("Item"),
+				description: frappe._("All Products or Services."),
 				doctype: "Item"
 			},
 			{
-				label: wn._("Material Request"),
-				description: wn._("Requests for items."),
+				label: frappe._("Material Request"),
+				description: frappe._("Requests for items."),
 				doctype: "Material Request"
 			},
 			{
-				label: wn._("Stock Entry"),
-				description: wn._("Record item movement."),
+				label: frappe._("Stock Entry"),
+				description: frappe._("Record item movement."),
 				doctype: "Stock Entry"
 			},
 			{
-				label: wn._("Delivery Note"),
-				description: wn._("Shipments to customers."),
+				label: frappe._("Delivery Note"),
+				description: frappe._("Shipments to customers."),
 				doctype: "Delivery Note"
 			},
 			{
-				label: wn._("Purchase Receipt"),
-				description: wn._("Goods received from Suppliers."),
+				label: frappe._("Purchase Receipt"),
+				description: frappe._("Goods received from Suppliers."),
 				doctype: "Purchase Receipt"
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Serial No"),
-				description: wn._("Single unit of an Item."),
+				label: frappe._("Serial No"),
+				description: frappe._("Single unit of an Item."),
 				doctype: "Serial No"
 			},
 			{
-				label: wn._("Batch"),
-				description: wn._("Batch (lot) of an Item."),
+				label: frappe._("Batch"),
+				description: frappe._("Batch (lot) of an Item."),
 				doctype: "Batch"
 			},
 			{
-				label: wn._("Warehouse"),
-				description: wn._("Where items are stored."),
+				label: frappe._("Warehouse"),
+				description: frappe._("Where items are stored."),
 				doctype: "Warehouse"
 			},
 		]
 	},
 	{
-		title: wn._("Tools"),
+		title: frappe._("Tools"),
 		icon: "icon-wrench",
 		items: [
 			{
 				doctype: "Stock Reconciliation",
-				label: wn._("Stock Reconciliation"),
-				description: wn._("Upload stock balance via csv.")
+				label: frappe._("Stock Reconciliation"),
+				description: frappe._("Upload stock balance via csv.")
 			},
 			{
 				doctype: "Installation Note",
-				label: wn._("Installation Note"),
-				description: wn._("Installation record for a Serial No.")
+				label: frappe._("Installation Note"),
+				description: frappe._("Installation record for a Serial No.")
 			},
 			{
-				label: wn._("Packing Slip"),
+				label: frappe._("Packing Slip"),
 				doctype: "Packing Slip",
-				description: wn._("Split Delivery Note into packages.")
+				description: frappe._("Split Delivery Note into packages.")
 			},
 			{
 				doctype: "Price List",
-				label: wn._("Price List"),
-				description: wn._("Multiple Price list.")
+				label: frappe._("Price List"),
+				description: frappe._("Multiple Price list.")
 			},
 			{
 				doctype: "Item Price",
-				label: wn._("Item Price"),
-				description: wn._("Multiple Item prices.")
+				label: frappe._("Item Price"),
+				description: frappe._("Multiple Item prices.")
 			},
 			{
 				doctype: "Quality Inspection",
-				label: wn._("Quality Inspection"),
-				description: wn._("Incoming quality inspection.")
+				label: frappe._("Quality Inspection"),
+				description: frappe._("Incoming quality inspection.")
 			},
 			{
 				route: "Form/Landed Cost Wizard/Landed Cost Wizard",
-				label: wn._("Landed Cost Wizard"),
-				description: wn._("Distribute transport overhead across items."),
+				label: frappe._("Landed Cost Wizard"),
+				description: frappe._("Distribute transport overhead across items."),
 				doctype: "Landed Cost Wizard"
 			},
 			{
 				route: "Form/Stock UOM Replace Utility/Stock UOM Replace Utility",
-				label: wn._("UOM Replace Utility"),
-				description: wn._("Change UOM for an Item."),
+				label: frappe._("UOM Replace Utility"),
+				description: frappe._("Change UOM for an Item."),
 				doctype: "Stock UOM Replace Utility"
 			},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-cog",
 		items: [
 			{
-				label: wn._("Stock Settings"),
+				label: frappe._("Stock Settings"),
 				route: "Form/Stock Settings",
 				doctype: "Stock Settings",
-				description: wn._("Settings for Stock Module")
+				description: frappe._("Settings for Stock Module")
 			},
 			{
 				route: "Sales Browser/Item Group",
-				label: wn._("Item Group"),
+				label: frappe._("Item Group"),
 				doctype: "Item Group",
-				description: wn._("Item classification.")
+				description: frappe._("Item classification.")
 			},
 			{
 				doctype: "UOM",
-				label: wn._("Unit of Measure") + " (UOM)",
-				description: wn._("e.g. Kg, Unit, Nos, m")
+				label: frappe._("Unit of Measure") + " (UOM)",
+				description: frappe._("e.g. Kg, Unit, Nos, m")
 			},
 			{
 				doctype: "Brand",
-				label: wn._("Brand"),
-				description: wn._("Brand master.")
+				label: frappe._("Brand"),
+				description: frappe._("Brand master.")
 			}
 		]
 	},
 	{
-		title: wn._("Main Reports"),
+		title: frappe._("Main Reports"),
 		right: true,
 		icon: "icon-table",
 		items: [
 			{
-				label: wn._("Stock Ledger"),
+				label: frappe._("Stock Ledger"),
 				doctype: "Item",
 				route: "query-report/Stock Ledger"
 			},
 			{
-				label: wn._("Stock Balance"),
+				label: frappe._("Stock Balance"),
 				page: "stock-balance"
 			},
 			{
-				label: wn._("Stock Projected Qty"),
+				label: frappe._("Stock Projected Qty"),
 				doctype: "Item",
 				route: "query-report/Stock Projected Qty"
 			},
 			{
-				label: wn._("Stock Ageing"),
+				label: frappe._("Stock Ageing"),
 				doctype: "Item",
 				route: "query-report/Stock Ageing"
 			},
 			{
-				label: wn._("Item-wise Price List Rate"),
+				label: frappe._("Item-wise Price List Rate"),
 				route: "Report/Item Price/Item-wise Price List Rate",
 				doctype: "Item Price"
 			},
 		]
 	},
 	{
-		title: wn._("Analytics"),
+		title: frappe._("Analytics"),
 		right: true,
 		icon: "icon-bar-chart",
 		items: [
 			{
-				label: wn._("Stock Analytics"),
+				label: frappe._("Stock Analytics"),
 				page: "stock-analytics"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				label: wn._("Ordered Items To Be Delivered"),
+				label: frappe._("Ordered Items To Be Delivered"),
 				route: "query-report/Ordered Items To Be Delivered",
 				doctype: "Delivery Note"
 			},
 			{
-				label: wn._("Purchase Order Items To Be Received"),
+				label: frappe._("Purchase Order Items To Be Received"),
 				route: "query-report/Purchase Order Items To Be Received",
 				doctype: "Purchase Receipt"
 			},
 			{
-				label: wn._("Item Shortage Report"),
+				label: frappe._("Item Shortage Report"),
 				route: "Report/Bin/Item Shortage Report",
 				doctype: "Purchase Receipt"
 			},
 			{
-				label: wn._("Serial No Service Contract Expiry"),
+				label: frappe._("Serial No Service Contract Expiry"),
 				route: "Report/Serial No/Serial No Service Contract Expiry",
 				doctype: "Serial No"
 			},
 			{
-				label: wn._("Serial No Status"),
+				label: frappe._("Serial No Status"),
 				route: "Report/Serial No/Serial No Status",
 				doctype: "Serial No"
 			},
 			{
-				label: wn._("Serial No Warranty Expiry"),
+				label: frappe._("Serial No Warranty Expiry"),
 				route: "Report/Serial No/Serial No Warranty Expiry",
 				doctype: "Serial No"
 			},
 			{
-				label: wn._("Purchase In Transit"),
+				label: frappe._("Purchase In Transit"),
 				route: "query-report/Purchase In Transit",
 				doctype: "Purchase Order"
 			},
 			{
-				label: wn._("Requested Items To Be Transferred"),
+				label: frappe._("Requested Items To Be Transferred"),
 				route: "query-report/Requested Items To Be Transferred",
 				doctype: "Material Request"
 			},
 			{
-				label: wn._("Batch-Wise Balance History"),
+				label: frappe._("Batch-Wise Balance History"),
 				route: "query-report/Batch-Wise Balance History",
 				doctype: "Batch"
 			},
 			{
-				label: wn._("Warehouse-Wise Stock Balance"),
+				label: frappe._("Warehouse-Wise Stock Balance"),
 				route: "query-report/Warehouse-Wise Stock Balance",
 				doctype: "Warehouse"
 			},
 			{
-				label: wn._("Item Prices"),
+				label: frappe._("Item Prices"),
 				route: "query-report/Item Prices",
 				doctype: "Price List"
 			},
 			{
-				label: wn._("Itemwise Recommended Reorder Level"),
+				label: frappe._("Itemwise Recommended Reorder Level"),
 				route: "query-report/Itemwise Recommended Reorder Level",
 				doctype: "Item"
 			},
 			{
-				label: wn._("Delivery Note Trends"),
+				label: frappe._("Delivery Note Trends"),
 				route: "query-report/Delivery Note Trends",
 				doctype: "Delivery Note"
 			},
 			{
-				label: wn._("Purchase Receipt Trends"),
+				label: frappe._("Purchase Receipt Trends"),
 				route: "query-report/Purchase Receipt Trends",
 				doctype: "Purchase Receipt"
 			},
@@ -253,5 +253,5 @@
 ]
 
 pscript['onload_stock-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Stock");
+	frappe.views.moduleview.make(wrapper, "Stock");
 }
\ No newline at end of file
diff --git a/erpnext/stock/page/stock_ledger/stock_ledger.js b/erpnext/stock/page/stock_ledger/stock_ledger.js
index a8a966f..107304a 100644
--- a/erpnext/stock/page/stock_ledger/stock_ledger.js
+++ b/erpnext/stock/page/stock_ledger/stock_ledger.js
@@ -1,10 +1,10 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['stock-ledger'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['stock-ledger'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Stock Ledger'),
+		title: frappe._('Stock Ledger'),
 		single_column: true
 	});
 	
@@ -12,12 +12,12 @@
 	wrapper.appframe.add_module_icon("Stock")
 }
 
-wn.require("assets/erpnext/js/stock_grid_report.js");
+frappe.require("assets/erpnext/js/stock_grid_report.js");
 
 erpnext.StockLedger = erpnext.StockGridReport.extend({
 	init: function(wrapper) {
 		this._super({
-			title: wn._("Stock Ledger"),
+			title: frappe._("Stock Ledger"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -28,29 +28,29 @@
 	setup_columns: function() {
 		this.hide_balance = (this.is_default("item_code") || this.voucher_no) ? true : false;
 		this.columns = [
-			{id: "posting_datetime", name: wn._("Posting Date"), field: "posting_datetime", width: 120,
+			{id: "posting_datetime", name: frappe._("Posting Date"), field: "posting_datetime", width: 120,
 				formatter: this.date_formatter},
-			{id: "item_code", name: wn._("Item Code"), field: "item_code", width: 160, 	
+			{id: "item_code", name: frappe._("Item Code"), field: "item_code", width: 160, 	
 				link_formatter: {
 					filter_input: "item_code",
 					open_btn: true,
 					doctype: '"Item"',
 				}},
-			{id: "description", name: wn._("Description"), field: "description", width: 200,
+			{id: "description", name: frappe._("Description"), field: "description", width: 200,
 				formatter: this.text_formatter},
-			{id: "warehouse", name: wn._("Warehouse"), field: "warehouse", width: 100,
+			{id: "warehouse", name: frappe._("Warehouse"), field: "warehouse", width: 100,
 				link_formatter: {filter_input: "warehouse"}},
-			{id: "brand", name: wn._("Brand"), field: "brand", width: 100},
-			{id: "stock_uom", name: wn._("UOM"), field: "stock_uom", width: 100},
-			{id: "qty", name: wn._("Qty"), field: "qty", width: 100,
+			{id: "brand", name: frappe._("Brand"), field: "brand", width: 100},
+			{id: "stock_uom", name: frappe._("UOM"), field: "stock_uom", width: 100},
+			{id: "qty", name: frappe._("Qty"), field: "qty", width: 100,
 				formatter: this.currency_formatter},
-			{id: "balance", name: wn._("Balance Qty"), field: "balance", width: 100,
+			{id: "balance", name: frappe._("Balance Qty"), field: "balance", width: 100,
 				formatter: this.currency_formatter,
 				hidden: this.hide_balance},
-			{id: "balance_value", name: wn._("Balance Value"), field: "balance_value", width: 100,
+			{id: "balance_value", name: frappe._("Balance Value"), field: "balance_value", width: 100,
 				formatter: this.currency_formatter, hidden: this.hide_balance},
-			{id: "voucher_type", name: wn._("Voucher Type"), field: "voucher_type", width: 120},
-			{id: "voucher_no", name: wn._("Voucher No"), field: "voucher_no", width: 160,
+			{id: "voucher_type", name: frappe._("Voucher Type"), field: "voucher_type", width: 120},
+			{id: "voucher_no", name: frappe._("Voucher No"), field: "voucher_no", width: 160,
 				link_formatter: {
 					filter_input: "voucher_no",
 					open_btn: true,
@@ -60,11 +60,11 @@
 		
 	},
 	filters: [
-		{fieldtype:"Select", label: wn._("Warehouse"), link:"Warehouse", 
+		{fieldtype:"Select", label: frappe._("Warehouse"), link:"Warehouse", 
 			default_value: "Select Warehouse...", filter: function(val, item, opts) {
 				return item.warehouse == val || val == opts.default_value;
 			}},
-		{fieldtype:"Link", label: wn._("Item Code"), link:"Item", default_value: "Select Item...",
+		{fieldtype:"Link", label: frappe._("Item Code"), link:"Item", default_value: "Select Item...",
 			filter: function(val, item, opts) {
 				return item.item_code == val || !val;
 			}},
@@ -72,20 +72,20 @@
 			default_value: "Select Brand...", filter: function(val, item, opts) {
 				return val == opts.default_value || item.brand == val || item._show;
 			}, link_formatter: {filter_input: "brand"}},
-		{fieldtype:"Data", label: wn._("Voucher No"),
+		{fieldtype:"Data", label: frappe._("Voucher No"),
 			filter: function(val, item, opts) {
 				if(!val) return true;
 				return (item.voucher_no && item.voucher_no.indexOf(val)!=-1);
 			}},
-		{fieldtype:"Date", label: wn._("From Date"), filter: function(val, item) {
+		{fieldtype:"Date", label: frappe._("From Date"), filter: function(val, item) {
 			return dateutil.str_to_obj(val) <= dateutil.str_to_obj(item.posting_date);
 		}},
-		{fieldtype:"Label", label: wn._("To")},
-		{fieldtype:"Date", label: wn._("To Date"), filter: function(val, item) {
+		{fieldtype:"Label", label: frappe._("To")},
+		{fieldtype:"Date", label: frappe._("To Date"), filter: function(val, item) {
 			return dateutil.str_to_obj(val) >= dateutil.str_to_obj(item.posting_date);
 		}},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	
 	setup_filters: function() {
@@ -115,8 +115,8 @@
 	prepare_data: function() {
 		var me = this;
 		if(!this.item_by_name)
-			this.item_by_name = this.make_name_map(wn.report_dump.data["Item"]);
-		var data = wn.report_dump.data["Stock Ledger Entry"];
+			this.item_by_name = this.make_name_map(frappe.report_dump.data["Item"]);
+		var data = frappe.report_dump.data["Stock Ledger Entry"];
 		var out = [];
 
 		var opening = {
@@ -133,7 +133,7 @@
 		}
 		
 		// clear balance
-		$.each(wn.report_dump.data["Item"], function(i, item) {
+		$.each(frappe.report_dump.data["Item"], function(i, item) {
 			item.balance = item.balance_value = 0.0; 
 		});
 		
diff --git a/erpnext/stock/page/stock_level/stock_level.js b/erpnext/stock/page/stock_level/stock_level.js
index 8cef636..1b84b73 100644
--- a/erpnext/stock/page/stock_level/stock_level.js
+++ b/erpnext/stock/page/stock_level/stock_level.js
@@ -1,10 +1,10 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['stock-level'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['stock-level'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Stock Level'),
+		title: frappe._('Stock Level'),
 		single_column: true
 	});
 	
@@ -15,14 +15,14 @@
 	;
 }
 
-wn.require("assets/erpnext/js/stock_grid_report.js");
+frappe.require("assets/erpnext/js/stock_grid_report.js");
 
 erpnext.StockLevel = erpnext.StockGridReport.extend({
 	init: function(wrapper) {
 		var me = this;
 		
 		this._super({
-			title: wn._("Stock Level"),
+			title: frappe._("Stock Level"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -31,18 +31,18 @@
 		});
 		
 		this.wrapper.bind("make", function() {
-			wn.utils.set_footnote(me, me.wrapper.get(0),
+			frappe.utils.set_footnote(me, me.wrapper.get(0),
 				"<ul> \
 					<li style='font-weight: bold;'> \
 						Projected Qty = Actual Qty + Planned Qty + Requested Qty \
 						+ Ordered Qty - Reserved Qty </li> \
 					<ul> \
-						<li>"+wn._("Actual Qty: Quantity available in the warehouse.") +"</li>"+
-						"<li>"+wn._("Planned Qty: Quantity, for which, Production Order has been raised,")+
-							wn._("but is pending to be manufactured.")+ "</li> " +
-						"<li>"+wn._("Requested Qty: Quantity requested for purchase, but not ordered.") + "</li>" +
-						"<li>" + wn._("Ordered Qty: Quantity ordered for purchase, but not received.")+ "</li>" +
-						"<li>" + wn._("Reserved Qty: Quantity ordered for sale, but not delivered.") +  "</li>" +
+						<li>"+frappe._("Actual Qty: Quantity available in the warehouse.") +"</li>"+
+						"<li>"+frappe._("Planned Qty: Quantity, for which, Production Order has been raised,")+
+							frappe._("but is pending to be manufactured.")+ "</li> " +
+						"<li>"+frappe._("Requested Qty: Quantity requested for purchase, but not ordered.") + "</li>" +
+						"<li>" + frappe._("Ordered Qty: Quantity ordered for purchase, but not received.")+ "</li>" +
+						"<li>" + frappe._("Reserved Qty: Quantity ordered for sale, but not delivered.") +  "</li>" +
 					"</ul> \
 				</ul>");
 		});
@@ -50,57 +50,57 @@
 	
 	setup_columns: function() {
 		this.columns = [
-			{id: "item_code", name: wn._("Item Code"), field: "item_code", width: 160, 	
+			{id: "item_code", name: frappe._("Item Code"), field: "item_code", width: 160, 	
 				link_formatter: {
 					filter_input: "item_code",
 					open_btn: true,
 					doctype: '"Item"',
 				}},
-			{id: "item_name", name: wn._("Item Name"), field: "item_name", width: 100,
+			{id: "item_name", name: frappe._("Item Name"), field: "item_name", width: 100,
 				formatter: this.text_formatter},
-			{id: "description", name: wn._("Description"), field: "description", width: 200, 
+			{id: "description", name: frappe._("Description"), field: "description", width: 200, 
 				formatter: this.text_formatter},
-			{id: "brand", name: wn._("Brand"), field: "brand", width: 100,
+			{id: "brand", name: frappe._("Brand"), field: "brand", width: 100,
 				link_formatter: {filter_input: "brand"}},
-			{id: "warehouse", name: wn._("Warehouse"), field: "warehouse", width: 100,
+			{id: "warehouse", name: frappe._("Warehouse"), field: "warehouse", width: 100,
 				link_formatter: {filter_input: "warehouse"}},
-			{id: "uom", name: wn._("UOM"), field: "uom", width: 60},
-			{id: "actual_qty", name: wn._("Actual Qty"), 
+			{id: "uom", name: frappe._("UOM"), field: "uom", width: 60},
+			{id: "actual_qty", name: frappe._("Actual Qty"), 
 				field: "actual_qty", width: 80, formatter: this.currency_formatter},
-			{id: "planned_qty", name: wn._("Planned Qty"), 
+			{id: "planned_qty", name: frappe._("Planned Qty"), 
 				field: "planned_qty", width: 80, formatter: this.currency_formatter},
-			{id: "requested_qty", name: wn._("Requested Qty"), 
+			{id: "requested_qty", name: frappe._("Requested Qty"), 
 				field: "requested_qty", width: 80, formatter: this.currency_formatter},
-			{id: "ordered_qty", name: wn._("Ordered Qty"), 
+			{id: "ordered_qty", name: frappe._("Ordered Qty"), 
 				field: "ordered_qty", width: 80, formatter: this.currency_formatter},
-			{id: "reserved_qty", name: wn._("Reserved Qty"), 
+			{id: "reserved_qty", name: frappe._("Reserved Qty"), 
 				field: "reserved_qty", width: 80, formatter: this.currency_formatter},
-			{id: "projected_qty", name: wn._("Projected Qty"), 
+			{id: "projected_qty", name: frappe._("Projected Qty"), 
 				field: "projected_qty", width: 80, formatter: this.currency_formatter},
-			{id: "re_order_level", name: wn._("Re-Order Level"), 
+			{id: "re_order_level", name: frappe._("Re-Order Level"), 
 				field: "re_order_level", width: 80, formatter: this.currency_formatter},
-			{id: "re_order_qty", name: wn._("Re-Order Qty"), 
+			{id: "re_order_qty", name: frappe._("Re-Order Qty"), 
 				field: "re_order_qty", width: 80, formatter: this.currency_formatter},
 		];
 	},
 	
 	filters: [
-		{fieldtype:"Link", label: wn._("Item Code"), link:"Item", default_value: "Select Item...",
+		{fieldtype:"Link", label: frappe._("Item Code"), link:"Item", default_value: "Select Item...",
 			filter: function(val, item, opts) {
 				return item.item_code == val || !val;
 			}},
 			
-		{fieldtype:"Select", label: wn._("Warehouse"), link:"Warehouse", 
+		{fieldtype:"Select", label: frappe._("Warehouse"), link:"Warehouse", 
 			default_value: "Select Warehouse...", filter: function(val, item, opts) {
 				return item.warehouse == val || val == opts.default_value;
 			}},
 		
-		{fieldtype:"Select", label: wn._("Brand"), link:"Brand", 
+		{fieldtype:"Select", label: frappe._("Brand"), link:"Brand", 
 			default_value: "Select Brand...", filter: function(val, item, opts) {
 				return val == opts.default_value || item.brand == val;
 			}},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 	
 	setup_filters: function() {
@@ -134,7 +134,7 @@
 		if(!this._data) {
 			this._data = [];
 			this.item_warehouse_map = {};
-			this.item_by_name = this.make_name_map(wn.report_dump.data["Item"]);
+			this.item_by_name = this.make_name_map(frappe.report_dump.data["Item"]);
 			this.calculate_quantities();
 		}
 		
@@ -155,7 +155,7 @@
 			["Purchase Order Item", "ordered_qty"],
 			["Sales Order Item", "reserved_qty"]], 
 			function(i, v) {
-				$.each(wn.report_dump.data[v[0]], function(i, item) {
+				$.each(frappe.report_dump.data[v[0]], function(i, item) {
 					var row = me.get_row(item.item_code, item.warehouse);
 					row[v[1]] += flt(item.qty);
 				});
diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.js b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.js
index cf47aa2..517ca4a 100644
--- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.js
+++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.js
@@ -1,21 +1,21 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Batch-Wise Balance History"] = {
+frappe.query_reports["Batch-Wise Balance History"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
 			"width": "80",
 			"default": sys_defaults.year_start_date,
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"width": "80",
-			"default": wn.datetime.get_today()
+			"default": frappe.datetime.get_today()
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py
index 9500fa9..2b3ec2c 100644
--- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py
+++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -37,19 +37,19 @@
 def get_conditions(filters):
 	conditions = ""
 	if not filters.get("from_date"):
-		webnotes.msgprint("Please enter From Date", raise_exception=1)
+		frappe.msgprint("Please enter From Date", raise_exception=1)
 
 	if filters.get("to_date"):
 		conditions += " and posting_date <= '%s'" % filters["to_date"]
 	else:
-		webnotes.msgprint("Please enter To Date", raise_exception=1)
+		frappe.msgprint("Please enter To Date", raise_exception=1)
 		
 	return conditions
 
 #get all details
 def get_stock_ledger_entries(filters):
 	conditions = get_conditions(filters)
-	return webnotes.conn.sql("""select item_code, batch_no, warehouse, 
+	return frappe.conn.sql("""select item_code, batch_no, warehouse, 
 		posting_date, actual_qty 
 		from `tabStock Ledger Entry` 
 		where docstatus < 2 %s order by item_code, warehouse""" %
@@ -61,7 +61,7 @@
 
 	for d in sle:
 		iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, {})\
-			.setdefault(d.batch_no, webnotes._dict({
+			.setdefault(d.batch_no, frappe._dict({
 				"opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
 			}))
 		qty_dict = iwb_map[d.item_code][d.warehouse][d.batch_no]
@@ -79,7 +79,7 @@
 
 def get_item_details(filters):
 	item_map = {}
-	for d in webnotes.conn.sql("select name, item_name, description from tabItem", as_dict=1):
+	for d in frappe.conn.sql("select name, item_name, description from tabItem", as_dict=1):
 		item_map.setdefault(d.name, d)
 
 	return item_map
\ No newline at end of file
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
index 568d982..b107473 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/sales_trends_filters.js");
+frappe.require("assets/erpnext/js/sales_trends_filters.js");
 
-wn.query_reports["Delivery Note Trends"] = {
+frappe.query_reports["Delivery Note Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
index a3f4218..6e3bd31 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns,get_data
 
 def execute(filters=None):
diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py
index 5a0234d..8f7a481 100644
--- a/erpnext/stock/report/item_prices/item_prices.py
+++ b/erpnext/stock/report/item_prices/item_prices.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -45,7 +45,7 @@
 	
 	item_map = {}
 	
-	for i in webnotes.conn.sql("select name, item_name, description, \
+	for i in frappe.conn.sql("select name, item_name, description, \
 		stock_uom, standard_rate from tabItem \
 		order by item_code", as_dict=1):
 			item_map.setdefault(i.name, i)
@@ -57,7 +57,7 @@
 
 	rate = {}
 
-	price_list = webnotes.conn.sql("""select ip.item_code, ip.buying, ip.selling, 
+	price_list = frappe.conn.sql("""select ip.item_code, ip.buying, ip.selling, 
 		concat(ip.price_list, " - ", ip.currency, " ", ip.price_list_rate) as price 
 		from `tabItem Price` ip, `tabPrice List` pl 
 		where ip.price_list=pl.name and pl.enabled=1""", as_dict=1)
@@ -105,7 +105,7 @@
 				order by result.item_code asc, result.posting_date desc) result_wrapper
 				group by item_code"""
 
-	for d in webnotes.conn.sql(query, as_dict=1):
+	for d in frappe.conn.sql(query, as_dict=1):
 		item_last_purchase_rate_map.setdefault(d.item_code, d.base_rate)
 
 	return item_last_purchase_rate_map
@@ -115,7 +115,7 @@
 
 	item_bom_map = {}
 	
-	for b in webnotes.conn.sql("""select item, (total_cost/quantity) as bom_rate 
+	for b in frappe.conn.sql("""select item, (total_cost/quantity) as bom_rate 
 		from `tabBOM` where is_active=1 and is_default=1""", as_dict=1):
 			item_bom_map.setdefault(b.item, flt(b.bom_rate))
 
@@ -126,7 +126,7 @@
 
 	item_val_rate_map = {}
 	
-	for d in webnotes.conn.sql("""select item_code, 
+	for d in frappe.conn.sql("""select item_code, 
 		sum(actual_qty*valuation_rate)/sum(actual_qty) as val_rate
 		from tabBin where actual_qty > 0 group by item_code""", as_dict=1):
 			item_val_rate_map.setdefault(d.item_code, d.val_rate)
diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
index 0fd37a5..55083e8 100644
--- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
+++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
@@ -1,17 +1,17 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Itemwise Recommended Reorder Level"] = {
+frappe.query_reports["Itemwise Recommended Reorder Level"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
 			"default": sys_defaults.year_start_date
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"default": get_today()
 		}
diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
index f7ed3b4..5266180 100644
--- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
+++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
@@ -1,19 +1,19 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
-from webnotes.utils import getdate, flt
+import frappe
+from frappe.utils import getdate, flt
 
 def execute(filters=None):
 	if not filters: filters = {}
-	float_preceision = webnotes.conn.get_default("float_preceision")
+	float_preceision = frappe.conn.get_default("float_preceision")
 
 	condition =get_condition(filters)
 
 	avg_daily_outgoing = 0
 	diff = ((getdate(filters.get("to_date")) - getdate(filters.get("from_date"))).days)+1
 	if diff <= 0:
-		webnotes.msgprint("To Date should not be less than eual to From Date",raise_exception=1)
+		frappe.msgprint("To Date should not be less than eual to From Date",raise_exception=1)
 
 	columns = get_columns()
 	items = get_item_info()
@@ -42,12 +42,12 @@
 	]
 
 def get_item_info():
-	return webnotes.conn.sql("""select name, item_name, description, min_order_qty,
+	return frappe.conn.sql("""select name, item_name, description, min_order_qty,
 		lead_time_days	from tabItem""", as_dict=1)
 
 def get_consumed_items(condition):
 
-	cn_items = webnotes.conn.sql("""select se_item.item_code, 
+	cn_items = frappe.conn.sql("""select se_item.item_code, 
 				sum(se_item.actual_qty) as 'consume_qty'
 		from `tabStock Entry` se, `tabStock Entry Detail` se_item
 		where se.name = se_item.parent and se.docstatus = 1 
@@ -62,12 +62,12 @@
 
 def get_delivered_items(condition):
 
-	dn_items = webnotes.conn.sql("""select dn_item.item_code, sum(dn_item.qty) as dn_qty
+	dn_items = frappe.conn.sql("""select dn_item.item_code, sum(dn_item.qty) as dn_qty
 		from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
 		where dn.name = dn_item.parent and dn.docstatus = 1 %s 
 		group by dn_item.item_code""" % (condition), as_dict=1)
 
-	si_items = webnotes.conn.sql("""select si_item.item_name, sum(si_item.qty) as si_qty
+	si_items = frappe.conn.sql("""select si_item.item_name, sum(si_item.qty) as si_qty
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
 		where si.name = si_item.parent and si.docstatus = 1 and 
 		ifnull(si.update_stock, 0) = 1 and ifnull(si.is_pos, 0) = 1 %s 
@@ -87,5 +87,5 @@
 	if filters.get("from_date") and filters.get("to_date"):
 		conditions += " and posting_date between '%s' and '%s'" % (filters["from_date"],filters["to_date"])
 	else:
-		webnotes.msgprint("Please set date in from date field",raise_exception=1)
+		frappe.msgprint("Please set date in from date field",raise_exception=1)
 	return conditions
\ No newline at end of file
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
index f66fcfc..d440b71 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
@@ -1,8 +1,8 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.require("assets/erpnext/js/purchase_trends_filters.js");
+frappe.require("assets/erpnext/js/purchase_trends_filters.js");
 
-wn.query_reports["Purchase Receipt Trends"] = {
+frappe.query_reports["Purchase Receipt Trends"] = {
 	filters: get_filters()
  }
\ No newline at end of file
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
index 6be1179..31539a7 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 from erpnext.controllers.trends	import get_columns,get_data
 
 def execute(filters=None):
diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.js b/erpnext/stock/report/stock_ageing/stock_ageing.js
index f9e84b8..2a47f0e 100644
--- a/erpnext/stock/report/stock_ageing/stock_ageing.js
+++ b/erpnext/stock/report/stock_ageing/stock_ageing.js
@@ -1,38 +1,38 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Stock Ageing"] = {
+frappe.query_reports["Stock Ageing"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company"),
+			"default": frappe.defaults.get_user_default("company"),
 			"reqd": 1
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.get_today(),
+			"default": frappe.datetime.get_today(),
 			"reqd": 1
 		},
 		{
 			"fieldname":"warehouse",
-			"label": wn._("Warehouse"),
+			"label": frappe._("Warehouse"),
 			"fieldtype": "Link",
 			"options": "Warehouse"
 		},
 		{
 			"fieldname":"item_code",
-			"label": wn._("Item"),
+			"label": frappe._("Item"),
 			"fieldtype": "Link",
 			"options": "Item"
 		},
 		{
 			"fieldname":"brand",
-			"label": wn._("Brand"),
+			"label": frappe._("Brand"),
 			"fieldtype": "Link",
 			"options": "Brand"
 		}
diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py
index 1a84f93..1d782c5 100644
--- a/erpnext/stock/report/stock_ageing/stock_ageing.py
+++ b/erpnext/stock/report/stock_ageing/stock_ageing.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import date_diff
+import frappe
+from frappe.utils import date_diff
 
 def execute(filters=None):
 	
@@ -63,7 +63,7 @@
 	return item_details
 	
 def get_stock_ledger_entries(filters):
-	return webnotes.conn.sql("""select 
+	return frappe.conn.sql("""select 
 			item.name, item.item_name, item_group, brand, description, item.stock_uom, 
 			actual_qty, posting_date
 		from `tabStock Ledger Entry` sle,
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.js b/erpnext/stock/report/stock_ledger/stock_ledger.js
index 752d6d2..32e868a 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.js
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.js
@@ -1,51 +1,51 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Stock Ledger"] = {
+frappe.query_reports["Stock Ledger"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company",
-			"default": wn.defaults.get_user_default("company"),
+			"default": frappe.defaults.get_user_default("company"),
 			"reqd": 1
 		},
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.add_months(wn.datetime.get_today(), -1),
+			"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
 			"reqd": 1
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
-			"default": wn.datetime.get_today(),
+			"default": frappe.datetime.get_today(),
 			"reqd": 1
 		},
 		{
 			"fieldname":"warehouse",
-			"label": wn._("Warehouse"),
+			"label": frappe._("Warehouse"),
 			"fieldtype": "Link",
 			"options": "Warehouse"
 		},
 		{
 			"fieldname":"item_code",
-			"label": wn._("Item"),
+			"label": frappe._("Item"),
 			"fieldtype": "Link",
 			"options": "Item"
 		},
 		{
 			"fieldname":"brand",
-			"label": wn._("Brand"),
+			"label": frappe._("Brand"),
 			"fieldtype": "Link",
 			"options": "Brand"
 		},
 		{
 			"fieldname":"voucher_no",
-			"label": wn._("Voucher #"),
+			"label": frappe._("Voucher #"),
 			"fieldtype": "Data"
 		}
 	]
@@ -53,6 +53,6 @@
 
 // $(function() {
 // 	$(wrapper).bind("show", function() {
-// 		wn.query_report.load();
+// 		frappe.query_report.load();
 // 	});
 // });
\ No newline at end of file
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index 38308c2..31554ec 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute(filters=None):
 	columns = get_columns()
@@ -32,7 +32,7 @@
 		"Batch:Link/Batch:100", "Serial #:Link/Serial No:100", "Company:Link/Company:100"]
 	
 def get_stock_ledger_entries(filters):
-	return webnotes.conn.sql("""select concat_ws(" ", posting_date, posting_time) as date,
+	return frappe.conn.sql("""select concat_ws(" ", posting_date, posting_time) as date,
 			item_code, warehouse, actual_qty, qty_after_transaction, 
 			stock_value, voucher_type, voucher_no, batch_no, serial_no, company
 		from `tabStock Ledger Entry`
@@ -44,7 +44,7 @@
 
 def get_item_details(filters):
 	item_details = {}
-	for item in webnotes.conn.sql("""select name, item_name, description, item_group, 
+	for item in frappe.conn.sql("""select name, item_name, description, item_group, 
 			brand, stock_uom from `tabItem` {item_conditions}"""\
 			.format(item_conditions=get_item_conditions(filters)), filters, as_dict=1):
 		item_details.setdefault(item.name, item)
diff --git a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.js b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.js
index 8c25e5d..3cb9ee1 100644
--- a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.js
+++ b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.js
@@ -1,29 +1,29 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Stock Projected Qty"] = {
+frappe.query_reports["Stock Projected Qty"] = {
 	"filters": [
 		{
 			"fieldname":"company",
-			"label": wn._("Company"),
+			"label": frappe._("Company"),
 			"fieldtype": "Link",
 			"options": "Company"
 		},
 		{
 			"fieldname":"warehouse",
-			"label": wn._("Warehouse"),
+			"label": frappe._("Warehouse"),
 			"fieldtype": "Link",
 			"options": "Warehouse"
 		},
 		{
 			"fieldname":"item_code",
-			"label": wn._("Item"),
+			"label": frappe._("Item"),
 			"fieldtype": "Link",
 			"options": "Item"
 		},
 		{
 			"fieldname":"brand",
-			"label": wn._("Brand"),
+			"label": frappe._("Brand"),
 			"fieldtype": "Link",
 			"options": "Brand"
 		}
diff --git a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
index d335ebf..2bfd0c8 100644
--- a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
+++ b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 def execute(filters=None):
 	columns = get_columns()
 		
-	data = webnotes.conn.sql("""select 
+	data = frappe.conn.sql("""select 
 			item.name, item.item_name, description, item_group, brand, warehouse, item.stock_uom, 
 			actual_qty, planned_qty, indented_qty, ordered_qty, reserved_qty, 
 			projected_qty, item.re_order_level, item.re_order_qty
diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
index 4384b70..8af47b1 100644
--- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
+++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
@@ -1,28 +1,28 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Supplier-Wise Sales Analytics"] = {
+frappe.query_reports["Supplier-Wise Sales Analytics"] = {
 	"filters": [
 		{
 			"fieldname":"supplier",
-			"label": wn._("Supplier"),
+			"label": frappe._("Supplier"),
 			"fieldtype": "Link",
 			"options": "Supplier",
 			"width": "80"
 		},
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
 			"width": "80",
-			"default": wn.datetime.month_start()
+			"default": frappe.datetime.month_start()
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"width": "80",
-			"default": wn.datetime.month_end()
+			"default": frappe.datetime.month_end()
 		},
 	]
 }
\ No newline at end of file
diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
index 254bd90..ec3eaca 100644
--- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
+++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	columns = get_columns(filters)
@@ -63,7 +63,7 @@
 	conditions, values = get_conditions(filters)
 	consumed_details = {}
 
-	for d in webnotes.conn.sql("""select sle.item_code, i.item_name, i.description, 
+	for d in frappe.conn.sql("""select sle.item_code, i.item_name, i.description, 
 		i.stock_uom, sle.actual_qty, sle.stock_value_difference, 
 		sle.voucher_no, sle.voucher_type
 		from `tabStock Ledger Entry` sle, `tabItem` i 
@@ -76,7 +76,7 @@
 	item_supplier_map = {}
 	supplier = filters.get('supplier')
 
-	for d in webnotes.conn.sql("""select pr.supplier, pri.item_code from 
+	for d in frappe.conn.sql("""select pr.supplier, pri.item_code from 
 		`tabPurchase Receipt` pr, `tabPurchase Receipt Item` pri 
 		where pr.name=pri.parent and pr.docstatus=1 and 
 		pri.item_code=(select name from `tabItem` where 
@@ -91,5 +91,5 @@
 	return item_supplier_map
 
 def get_material_transfer_vouchers():
-	return webnotes.conn.sql_list("""select name from `tabStock Entry` where 
+	return frappe.conn.sql_list("""select name from `tabStock Entry` where 
 		purpose='Material Transfer' and docstatus=1""")
\ No newline at end of file
diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js
index 9b93a31..1fa85a2 100644
--- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js
+++ b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js
@@ -1,21 +1,21 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Warehouse-Wise Stock Balance"] = {
+frappe.query_reports["Warehouse-Wise Stock Balance"] = {
 	"filters": [
 		{
 			"fieldname":"from_date",
-			"label": wn._("From Date"),
+			"label": frappe._("From Date"),
 			"fieldtype": "Date",
 			"width": "80",
 			"default": sys_defaults.year_start_date,
 		},
 		{
 			"fieldname":"to_date",
-			"label": wn._("To Date"),
+			"label": frappe._("To Date"),
 			"fieldtype": "Date",
 			"width": "80",
-			"default": wn.datetime.get_today()
+			"default": frappe.datetime.get_today()
 		}
 	]
 }
\ No newline at end of file
diff --git a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
index 342c25c..76ab7e8 100644
--- a/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
+++ b/erpnext/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import flt
+import frappe
+from frappe.utils import flt
 
 def execute(filters=None):
 	if not filters: filters = {}
@@ -37,19 +37,19 @@
 def get_conditions(filters):
 	conditions = ""
 	if not filters.get("from_date"):
-		webnotes.msgprint("Please enter From Date", raise_exception=1)
+		frappe.msgprint("Please enter From Date", raise_exception=1)
 
 	if filters.get("to_date"):
 		conditions += " and posting_date <= '%s'" % filters["to_date"]
 	else:
-		webnotes.msgprint("Please enter To Date", raise_exception=1)
+		frappe.msgprint("Please enter To Date", raise_exception=1)
 		
 	return conditions
 
 #get all details
 def get_stock_ledger_entries(filters):
 	conditions = get_conditions(filters)
-	return webnotes.conn.sql("""select item_code, warehouse, 
+	return frappe.conn.sql("""select item_code, warehouse, 
 		posting_date, actual_qty, company 
 		from `tabStock Ledger Entry` 
 		where docstatus < 2 %s order by item_code, warehouse""" %
@@ -61,7 +61,7 @@
 
 	for d in sle:
 		iwb_map.setdefault(d.company, {}).setdefault(d.item_code, {}).\
-		setdefault(d.warehouse, webnotes._dict({\
+		setdefault(d.warehouse, frappe._dict({\
 				"opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
 			}))
 		qty_dict = iwb_map[d.company][d.item_code][d.warehouse]
@@ -79,7 +79,7 @@
 
 def get_item_details(filters):
 	item_map = {}
-	for d in webnotes.conn.sql("select name, item_name, description from tabItem", as_dict=1):
+	for d in frappe.conn.sql("select name, item_name, description from tabItem", as_dict=1):
 		item_map.setdefault(d.name, d)
 
 	return item_map
\ No newline at end of file
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 860bb76..53446af 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -2,16 +2,16 @@
 # License: GNU General Public License v3. See license.txt
 from __future__ import unicode_literals
 
-import webnotes
-from webnotes import msgprint
-from webnotes.utils import cint, flt, cstr, now
+import frappe
+from frappe import msgprint
+from frappe.utils import cint, flt, cstr, now
 from erpnext.stock.utils import get_valuation_method
 import json
 
 # future reposting
-class NegativeStockError(webnotes.ValidationError): pass
+class NegativeStockError(frappe.ValidationError): pass
 
-_exceptions = webnotes.local('stockledger_exceptions')
+_exceptions = frappe.local('stockledger_exceptions')
 # _exceptions = []
 
 def make_sl_entries(sl_entries, is_amended=None):
@@ -42,21 +42,21 @@
 				sl_entries[0].get('voucher_no'))
 			
 def set_as_cancel(voucher_type, voucher_no):
-	webnotes.conn.sql("""update `tabStock Ledger Entry` set is_cancelled='Yes',
+	frappe.conn.sql("""update `tabStock Ledger Entry` set is_cancelled='Yes',
 		modified=%s, modified_by=%s
 		where voucher_no=%s and voucher_type=%s""", 
-		(now(), webnotes.session.user, voucher_type, voucher_no))
+		(now(), frappe.session.user, voucher_type, voucher_no))
 		
 def make_entry(args):
 	args.update({"doctype": "Stock Ledger Entry"})
-	sle = webnotes.bean([args])
+	sle = frappe.bean([args])
 	sle.ignore_permissions = 1
 	sle.insert()
 	sle.submit()
 	return sle.doc.name
 	
 def delete_cancelled_entry(voucher_type, voucher_no):
-	webnotes.conn.sql("""delete from `tabStock Ledger Entry` 
+	frappe.conn.sql("""delete from `tabStock Ledger Entry` 
 		where voucher_type=%s and voucher_no=%s""", (voucher_type, voucher_no))
 
 def update_entries_after(args, verbose=1):
@@ -72,7 +72,7 @@
 		}
 	"""
 	if not _exceptions:
-		webnotes.local.stockledger_exceptions = []
+		frappe.local.stockledger_exceptions = []
 	
 	previous_sle = get_sle_before_datetime(args)
 	
@@ -89,7 +89,7 @@
 	stock_value_difference = 0.0
 
 	for sle in entries_to_fix:
-		if sle.serial_no or not cint(webnotes.conn.get_default("allow_negative_stock")):
+		if sle.serial_no or not cint(frappe.conn.get_default("allow_negative_stock")):
 			# validate negative stock for serialized items, fifo valuation 
 			# or when negative stock is not allowed for moving average
 			if not validate_negative_stock(qty_after_transaction, sle):
@@ -115,17 +115,17 @@
 			stock_value = sum((flt(batch[0]) * flt(batch[1]) for batch in stock_queue))
 		
 		# rounding as per precision
-		from webnotes.model.meta import get_field_precision
-		meta = webnotes.get_doctype("Stock Ledger Entry")
+		from frappe.model.meta import get_field_precision
+		meta = frappe.get_doctype("Stock Ledger Entry")
 		
 		stock_value = flt(stock_value, get_field_precision(meta.get_field("stock_value"), 
-			webnotes._dict({"fields": sle})))
+			frappe._dict({"fields": sle})))
 		
 		stock_value_difference = stock_value - prev_stock_value
 		prev_stock_value = stock_value
 			
 		# update current sle
-		webnotes.conn.sql("""update `tabStock Ledger Entry`
+		frappe.conn.sql("""update `tabStock Ledger Entry`
 			set qty_after_transaction=%s, valuation_rate=%s, stock_queue=%s,
 			stock_value=%s, stock_value_difference=%s where name=%s""", 
 			(qty_after_transaction, valuation_rate,
@@ -135,9 +135,9 @@
 		_raise_exceptions(args, verbose)
 	
 	# update bin
-	if not webnotes.conn.exists({"doctype": "Bin", "item_code": args["item_code"], 
+	if not frappe.conn.exists({"doctype": "Bin", "item_code": args["item_code"], 
 			"warehouse": args["warehouse"]}):
-		bin_wrapper = webnotes.bean([{
+		bin_wrapper = frappe.bean([{
 			"doctype": "Bin",
 			"item_code": args["item_code"],
 			"warehouse": args["warehouse"],
@@ -145,7 +145,7 @@
 		bin_wrapper.ignore_permissions = 1
 		bin_wrapper.insert()
 	
-	webnotes.conn.sql("""update `tabBin` set valuation_rate=%s, actual_qty=%s,
+	frappe.conn.sql("""update `tabBin` set valuation_rate=%s, actual_qty=%s,
 		stock_value=%s, 
 		projected_qty = (actual_qty + indented_qty + ordered_qty + planned_qty - reserved_qty)
 		where item_code=%s and warehouse=%s""", (valuation_rate, qty_after_transaction,
@@ -165,7 +165,7 @@
 		["timestamp(posting_date, posting_time) < timestamp(%(posting_date)s, %(posting_time)s)"],
 		"desc", "limit 1", for_update=for_update)
 	
-	return sle and sle[0] or webnotes._dict()
+	return sle and sle[0] or frappe._dict()
 	
 def get_sle_after_datetime(args, for_update=False):
 	"""get Stock Ledger Entries after a particular datetime, for reposting"""
@@ -181,7 +181,7 @@
 	if not args.get("posting_time"):
 		args["posting_time"] = "00:00"
 	
-	return webnotes.conn.sql("""select * from `tabStock Ledger Entry`
+	return frappe.conn.sql("""select * from `tabStock Ledger Entry`
 		where item_code = %%(item_code)s
 		and warehouse = %%(warehouse)s
 		and ifnull(is_cancelled, 'No')='No'
@@ -202,7 +202,7 @@
 	diff = qty_after_transaction + flt(sle.actual_qty)
 
 	if not _exceptions:
-		webnotes.local.stockledger_exceptions = []
+		frappe.local.stockledger_exceptions = []
 	
 	if diff < 0 and abs(diff) > 0.0001:
 		# negative stock!
@@ -223,7 +223,7 @@
 	elif incoming_rate == 0 or flt(sle.actual_qty) < 0:
 		# In case of delivery/stock issue, get average purchase rate
 		# of serial nos of current entry
-		incoming_rate = flt(webnotes.conn.sql("""select avg(ifnull(purchase_rate, 0))
+		incoming_rate = flt(frappe.conn.sql("""select avg(ifnull(purchase_rate, 0))
 			from `tabSerial No` where name in (%s)""" % (", ".join(["%s"]*len(serial_no))),
 			tuple(serial_no))[0][0])
 	
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index f203023..7a1246a 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -1,19 +1,19 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes
-from webnotes import msgprint, _
+import frappe
+from frappe import msgprint, _
 import json
-from webnotes.utils import flt, cstr, nowdate, add_days, cint
-from webnotes.defaults import get_global_default
-from webnotes.utils.email_lib import sendmail
+from frappe.utils import flt, cstr, nowdate, add_days, cint
+from frappe.defaults import get_global_default
+from frappe.utils.email_lib import sendmail
 
-class InvalidWarehouseCompany(webnotes.ValidationError): pass
+class InvalidWarehouseCompany(frappe.ValidationError): pass
 	
 def get_stock_balance_on(warehouse, posting_date=None):
 	if not posting_date: posting_date = nowdate()
 	
-	stock_ledger_entries = webnotes.conn.sql("""
+	stock_ledger_entries = frappe.conn.sql("""
 		SELECT 
 			item_code, stock_value
 		FROM 
@@ -31,16 +31,16 @@
 	
 def get_latest_stock_balance():
 	bin_map = {}
-	for d in webnotes.conn.sql("""SELECT item_code, warehouse, stock_value as stock_value 
+	for d in frappe.conn.sql("""SELECT item_code, warehouse, stock_value as stock_value 
 		FROM tabBin""", as_dict=1):
 			bin_map.setdefault(d.warehouse, {}).setdefault(d.item_code, flt(d.stock_value))
 			
 	return bin_map
 	
 def get_bin(item_code, warehouse):
-	bin = webnotes.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
+	bin = frappe.conn.get_value("Bin", {"item_code": item_code, "warehouse": warehouse})
 	if not bin:
-		bin_wrapper = webnotes.bean([{
+		bin_wrapper = frappe.bean([{
 			"doctype": "Bin",
 			"item_code": item_code,
 			"warehouse": warehouse,
@@ -49,12 +49,12 @@
 		bin_wrapper.insert()
 		bin_obj = bin_wrapper.make_controller()
 	else:
-		from webnotes.model.code import get_obj
+		from frappe.model.code import get_obj
 		bin_obj = get_obj('Bin', bin)
 	return bin_obj
 
 def update_bin(args):
-	is_stock_item = webnotes.conn.get_value('Item', args.get("item_code"), 'is_stock_item')
+	is_stock_item = frappe.conn.get_value('Item', args.get("item_code"), 'is_stock_item')
 	if is_stock_item == 'Yes':
 		bin = get_bin(args.get("item_code"), args.get("warehouse"))
 		bin.update_stock(args)
@@ -71,7 +71,7 @@
 	if args.get("serial_no"):
 		in_rate = get_avg_purchase_rate(args.get("serial_no"))
 	elif args.get("bom_no"):
-		result = webnotes.conn.sql("""select ifnull(total_cost, 0) / ifnull(quantity, 1) 
+		result = frappe.conn.sql("""select ifnull(total_cost, 0) / ifnull(quantity, 1) 
 			from `tabBOM` where name = %s and docstatus=1 and is_active=1""", args.get("bom_no"))
 		in_rate = result and flt(result[0][0]) or 0
 	else:
@@ -91,13 +91,13 @@
 	"""get average value of serial numbers"""
 	
 	serial_nos = get_valid_serial_nos(serial_nos)
-	return flt(webnotes.conn.sql("""select avg(ifnull(purchase_rate, 0)) from `tabSerial No` 
+	return flt(frappe.conn.sql("""select avg(ifnull(purchase_rate, 0)) from `tabSerial No` 
 		where name in (%s)""" % ", ".join(["%s"] * len(serial_nos)),
 		tuple(serial_nos))[0][0])
 
 def get_valuation_method(item_code):
 	"""get valuation method from item or default"""
-	val_method = webnotes.conn.get_value('Item', item_code, 'valuation_method')
+	val_method = frappe.conn.get_value('Item', item_code, 'valuation_method')
 	if not val_method:
 		val_method = get_global_default('valuation_method') or "FIFO"
 	return val_method
@@ -148,9 +148,9 @@
 	return valid_serial_nos
 
 def validate_warehouse_company(warehouse, company):
-	warehouse_company = webnotes.conn.get_value("Warehouse", warehouse, "company")
+	warehouse_company = frappe.conn.get_value("Warehouse", warehouse, "company")
 	if warehouse_company and warehouse_company != company:
-		webnotes.msgprint(_("Warehouse does not belong to company.") + " (" + \
+		frappe.msgprint(_("Warehouse does not belong to company.") + " (" + \
 			warehouse + ", " + company +")", raise_exception=InvalidWarehouseCompany)
 
 def get_sales_bom_buying_amount(item_code, warehouse, voucher_type, voucher_no, voucher_detail_no, 
@@ -181,12 +181,12 @@
 
 def reorder_item():
 	""" Reorder item if stock reaches reorder level"""
-	if getattr(webnotes.local, "auto_indent", None) is None:
-		webnotes.local.auto_indent = cint(webnotes.conn.get_value('Stock Settings', None, 'auto_indent'))
+	if getattr(frappe.local, "auto_indent", None) is None:
+		frappe.local.auto_indent = cint(frappe.conn.get_value('Stock Settings', None, 'auto_indent'))
 	
-	if webnotes.local.auto_indent:
+	if frappe.local.auto_indent:
 		material_requests = {}
-		bin_list = webnotes.conn.sql("""select item_code, warehouse, projected_qty
+		bin_list = frappe.conn.sql("""select item_code, warehouse, projected_qty
 			from tabBin where ifnull(item_code, '') != '' and ifnull(warehouse, '') != ''
 			and exists (select name from `tabItem` 
 				where `tabItem`.name = `tabBin`.item_code and 
@@ -194,14 +194,14 @@
 				(ifnull(end_of_life, '')='' or end_of_life > now()))""", as_dict=True)
 		for bin in bin_list:
 			#check if re-order is required
-			item_reorder = webnotes.conn.get("Item Reorder", 
+			item_reorder = frappe.conn.get("Item Reorder", 
 				{"parent": bin.item_code, "warehouse": bin.warehouse})
 			if item_reorder:
 				reorder_level = item_reorder.warehouse_reorder_level
 				reorder_qty = item_reorder.warehouse_reorder_qty
 				material_request_type = item_reorder.material_request_type or "Purchase"
 			else:
-				reorder_level, reorder_qty = webnotes.conn.get_value("Item", bin.item_code,
+				reorder_level, reorder_qty = frappe.conn.get_value("Item", bin.item_code,
 					["re_order_level", "re_order_qty"])
 				material_request_type = "Purchase"
 		
@@ -209,12 +209,12 @@
 				if flt(reorder_level) - flt(bin.projected_qty) > flt(reorder_qty):
 					reorder_qty = flt(reorder_level) - flt(bin.projected_qty)
 					
-				company = webnotes.conn.get_value("Warehouse", bin.warehouse, "company") or \
-					webnotes.defaults.get_defaults()["company"] or \
-					webnotes.conn.sql("""select name from tabCompany limit 1""")[0][0]
+				company = frappe.conn.get_value("Warehouse", bin.warehouse, "company") or \
+					frappe.defaults.get_defaults()["company"] or \
+					frappe.conn.sql("""select name from tabCompany limit 1""")[0][0]
 					
-				material_requests.setdefault(material_request_type, webnotes._dict()).setdefault(
-					company, []).append(webnotes._dict({
+				material_requests.setdefault(material_request_type, frappe._dict()).setdefault(
+					company, []).append(frappe._dict({
 						"item_code": bin.item_code,
 						"warehouse": bin.warehouse,
 						"reorder_qty": reorder_qty
@@ -226,7 +226,7 @@
 def create_material_request(material_requests):
 	"""	Create indent on reaching reorder level	"""
 	mr_list = []
-	defaults = webnotes.defaults.get_defaults()
+	defaults = frappe.defaults.get_defaults()
 	exceptions_list = []
 	from erpnext.accounts.utils import get_fiscal_year
 	current_fiscal_year = get_fiscal_year(nowdate())[0] or defaults.fiscal_year
@@ -246,7 +246,7 @@
 				}]
 			
 				for d in items:
-					item = webnotes.doc("Item", d.item_code)
+					item = frappe.doc("Item", d.item_code)
 					mr.append({
 						"doctype": "Material Request Item",
 						"parenttype": "Material Request",
@@ -262,24 +262,24 @@
 						"brand": item.brand,
 					})
 			
-				mr_bean = webnotes.bean(mr)
+				mr_bean = frappe.bean(mr)
 				mr_bean.insert()
 				mr_bean.submit()
 				mr_list.append(mr_bean)
 
 			except:
-				if webnotes.local.message_log:
-					exceptions_list.append([] + webnotes.local.message_log)
-					webnotes.local.message_log = []
+				if frappe.local.message_log:
+					exceptions_list.append([] + frappe.local.message_log)
+					frappe.local.message_log = []
 				else:
-					exceptions_list.append(webnotes.get_traceback())
+					exceptions_list.append(frappe.get_traceback())
 
 	if mr_list:
-		if getattr(webnotes.local, "reorder_email_notify", None) is None:
-			webnotes.local.reorder_email_notify = cint(webnotes.conn.get_value('Stock Settings', None, 
+		if getattr(frappe.local, "reorder_email_notify", None) is None:
+			frappe.local.reorder_email_notify = cint(frappe.conn.get_value('Stock Settings', None, 
 				'reorder_email_notify'))
 			
-		if(webnotes.local.reorder_email_notify):
+		if(frappe.local.reorder_email_notify):
 			send_email_notification(mr_list)
 
 	if exceptions_list:
@@ -288,7 +288,7 @@
 def send_email_notification(mr_list):
 	""" Notify user about auto creation of indent"""
 	
-	email_list = webnotes.conn.sql_list("""select distinct r.parent 
+	email_list = frappe.conn.sql_list("""select distinct r.parent 
 		from tabUserRole r, tabProfile p
 		where p.name = r.parent and p.enabled = 1 and p.docstatus < 2
 		and r.role in ('Purchase Manager','Material Manager') 
@@ -320,5 +320,5 @@
 		Regards,
 		Administrator""" % ("\n\n".join(["\n".join(msg) for msg in exceptions_list]),)
 
-	from webnotes.profile import get_system_managers
+	from frappe.profile import get_system_managers
 	sendmail(get_system_managers(), subject=subject, msg=msg)
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.js b/erpnext/support/doctype/customer_issue/customer_issue.js
index 36bfe97..e3552c0 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.js
+++ b/erpnext/support/doctype/customer_issue/customer_issue.js
@@ -1,24 +1,24 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.support");
+frappe.provide("erpnext.support");
 
-wn.ui.form.on_change("Customer Issue", "customer", function(frm) { 
+frappe.ui.form.on_change("Customer Issue", "customer", function(frm) { 
 	erpnext.utils.get_party_details(frm) });
-wn.ui.form.on_change("Customer Issue", "customer_address", 
+frappe.ui.form.on_change("Customer Issue", "customer_address", 
 	erpnext.utils.get_address_display);
-wn.ui.form.on_change("Customer Issue", "contact_person", 
+frappe.ui.form.on_change("Customer Issue", "contact_person", 
 	erpnext.utils.get_contact_details);	
 
-erpnext.support.CustomerIssue = wn.ui.form.Controller.extend({
+erpnext.support.CustomerIssue = frappe.ui.form.Controller.extend({
 	refresh: function() {
 		if((cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) {
-			cur_frm.add_custom_button(wn._('Make Maintenance Visit'), this.make_maintenance_visit)
+			cur_frm.add_custom_button(frappe._('Make Maintenance Visit'), this.make_maintenance_visit)
 		}
 	}, 
 		
 	make_maintenance_visit: function() {
-		wn.model.open_mapped_doc({
+		frappe.model.open_mapped_doc({
 			method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
 			source_name: cur_frm.doc.name
 		})
diff --git a/erpnext/support/doctype/customer_issue/customer_issue.py b/erpnext/support/doctype/customer_issue/customer_issue.py
index f6e6b6d..1709673 100644
--- a/erpnext/support/doctype/customer_issue/customer_issue.py
+++ b/erpnext/support/doctype/customer_issue/customer_issue.py
@@ -3,9 +3,9 @@
 
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import session, msgprint
-from webnotes.utils import today
+import frappe
+from frappe import session, msgprint
+from frappe.utils import today
 
 	
 
@@ -22,27 +22,27 @@
 				raise_exception=True)
 				
 		if self.doc.status=="Closed" and \
-			webnotes.conn.get_value("Customer Issue", self.doc.name, "status")!="Closed":
+			frappe.conn.get_value("Customer Issue", self.doc.name, "status")!="Closed":
 			self.doc.resolution_date = today()
-			self.doc.resolved_by = webnotes.session.user
+			self.doc.resolved_by = frappe.session.user
 	
 	def on_cancel(self):
-		lst = webnotes.conn.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t2.prevdoc_docname = '%s' and	t1.docstatus!=2"%(self.doc.name))
+		lst = frappe.conn.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t2.prevdoc_docname = '%s' and	t1.docstatus!=2"%(self.doc.name))
 		if lst:
 			lst1 = ','.join([x[0] for x in lst])
 			msgprint("Maintenance Visit No. "+lst1+" already created against this customer issue. So can not be Cancelled")
 			raise Exception
 		else:
-			webnotes.conn.set(self.doc, 'status', 'Cancelled')
+			frappe.conn.set(self.doc, 'status', 'Cancelled')
 
 	def on_update(self):
 		pass
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_maintenance_visit(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
-	visit = webnotes.conn.sql("""select t1.name 
+	visit = frappe.conn.sql("""select t1.name 
 		from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 
 		where t2.parent=t1.name and t2.prevdoc_docname=%s 
 		and t1.docstatus=1 and t1.completion_status='Fully Completed'""", source_name)
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
index c8af280..328ca1d 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -1,24 +1,24 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.support");
+frappe.provide("erpnext.support");
 
-wn.ui.form.on_change("Maintenance Schedule", "customer", function(frm) { 
+frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) { 
 	erpnext.utils.get_party_details(frm) });
-wn.ui.form.on_change("Maintenance Schedule", "customer_address", 
+frappe.ui.form.on_change("Maintenance Schedule", "customer_address", 
 	erpnext.utils.get_address_display);
-wn.ui.form.on_change("Maintenance Schedule", "contact_person", 
+frappe.ui.form.on_change("Maintenance Schedule", "contact_person", 
 	erpnext.utils.get_contact_details);	
 
 // TODO commonify this code
-erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
+erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({
 	refresh: function() {
 		var me = this;
 
 		if (this.frm.doc.docstatus === 0) {
-			this.frm.add_custom_button(wn._('From Sales Order'), 
+			this.frm.add_custom_button(frappe._('From Sales Order'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
 						source_doctype: "Sales Order",
 						get_query_filters: {
@@ -30,8 +30,8 @@
 					});
 				});
 		} else if (this.frm.doc.docstatus === 1) {
-			this.frm.add_custom_button(wn._("Make Maintenance Visit"), function() {
-				wn.model.open_mapped_doc({
+			this.frm.add_custom_button(frappe._("Make Maintenance Visit"), function() {
+				frappe.model.open_mapped_doc({
 					method: "erpnext.support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
 					source_name: me.frm.doc.name
 				})
@@ -88,19 +88,19 @@
 		return get_server_fields('get_no_of_visits', docstring(arg), 
 			'item_maintenance_detail', doc, cdt, cdn, 1);
 	} else {
-		msgprint(wn._("Please enter Start Date and End Date"));
+		msgprint(frappe._("Please enter Start Date and End Date"));
 	}
 }
 
 cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
 	if (!doc.__islocal) {
 		return $c('runserverobj', args={'method':'generate_schedule', 
-			'docs':wn.model.compress(make_doclist(cdt,cdn))},
+			'docs':frappe.model.compress(make_doclist(cdt,cdn))},
 			function(r, rt) {
 				refresh_field('maintenance_schedule_detail');
 			});
 	} else {
-		msgprint(wn._("Please save the document before generating maintenance schedule"));
+		msgprint(frappe._("Please save the document before generating maintenance schedule"));
 	}
 }
 
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
index 8f75247..bed4199 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -2,12 +2,12 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import add_days, cstr, getdate, cint
-from webnotes.model.doc import addchild
-from webnotes.model.bean import getlist
-from webnotes import msgprint, throw, _
+from frappe.utils import add_days, cstr, getdate, cint
+from frappe.model.doc import addchild
+from frappe.model.bean import getlist
+from frappe import msgprint, throw, _
 from erpnext.utilities.transaction_base import TransactionBase, delete_events
 
 class DocType(TransactionBase):
@@ -16,7 +16,7 @@
 		self.doclist = doclist
 	
 	def get_item_details(self, item_code):
-		item = webnotes.conn.sql("""select item_name, description from `tabItem` 
+		item = frappe.conn.sql("""select item_name, description from `tabItem` 
 			where name=%s""", (item_code), as_dict=1)
 		ret = {
 			'item_name': item and item[0]['item_name'] or '',
@@ -26,7 +26,7 @@
 		
 	def generate_schedule(self):
 		self.doclist = self.doc.clear_table(self.doclist, 'maintenance_schedule_detail')
-		webnotes.conn.sql("""delete from `tabMaintenance Schedule Detail` 
+		frappe.conn.sql("""delete from `tabMaintenance Schedule Detail` 
 			where parent=%s""", (self.doc.name))
 		count = 1
 		for d in getlist(self.doclist, 'item_maintenance_detail'):
@@ -61,10 +61,10 @@
 				self.update_amc_date(d.serial_no, d.end_date)
 
 			if d.sales_person not in email_map:
-				sp = webnotes.bean("Sales Person", d.sales_person).make_controller()
+				sp = frappe.bean("Sales Person", d.sales_person).make_controller()
 				email_map[d.sales_person] = sp.get_email_id()
 
-			scheduled_date = webnotes.conn.sql("""select scheduled_date from 
+			scheduled_date = frappe.conn.sql("""select scheduled_date from 
 				`tabMaintenance Schedule Detail` where sales_person=%s and item_code=%s and 
 				parent=%s""", (d.sales_person, d.item_code, self.doc.name), as_dict=1)
 
@@ -72,7 +72,7 @@
 				if email_map[d.sales_person]:
 					description = "Reference: %s, Item Code: %s and Customer: %s" % \
 						(self.doc.name, d.item_code, self.doc.customer)
-					webnotes.bean({
+					frappe.bean({
 						"doctype": "Event",
 						"owner": email_map[d.sales_person] or self.doc.owner,
 						"subject": description,
@@ -83,7 +83,7 @@
 						"ref_name": self.doc.name
 					}).insert()
 
-		webnotes.conn.set(self.doc, 'status', 'Submitted')		
+		frappe.conn.set(self.doc, 'status', 'Submitted')		
 		
 	#get schedule dates
 	#----------------------
@@ -117,7 +117,7 @@
 
 		if fy_details and fy_details[0]:
 			# check holiday list in employee master
-			holiday_list = webnotes.conn.sql_list("""select h.holiday_date from `tabEmployee` emp, 
+			holiday_list = frappe.conn.sql_list("""select h.holiday_date from `tabEmployee` emp, 
 				`tabSales Person` sp, `tabHoliday` h, `tabHoliday List` hl 
 				where sp.name=%s and emp.name=sp.employee 
 				and hl.name=emp.holiday_list and 
@@ -125,7 +125,7 @@
 				hl.fiscal_year=%s""", (sales_person, fy_details[0]))
 			if not holiday_list:
 				# check global holiday list
-				holiday_list = webnotes.conn.sql("""select h.holiday_date from 
+				holiday_list = frappe.conn.sql("""select h.holiday_date from 
 					`tabHoliday` h, `tabHoliday List` hl 
 					where h.parent=hl.name and ifnull(hl.is_default, 0) = 1 
 					and hl.fiscal_year=%s""", fy_details[0])
@@ -197,7 +197,7 @@
 	def validate_sales_order(self):
 		for d in getlist(self.doclist, 'item_maintenance_detail'):
 			if d.prevdoc_docname:
-				chk = webnotes.conn.sql("""select ms.name from `tabMaintenance Schedule` ms, 
+				chk = frappe.conn.sql("""select ms.name from `tabMaintenance Schedule` ms, 
 					`tabMaintenance Schedule Item` msi where msi.parent=ms.name and 
 					msi.prevdoc_docname=%s and ms.docstatus=1""", d.prevdoc_docname)
 				if chk:
@@ -212,7 +212,7 @@
 				cur_s_no = cur_serial_no.split(',')
 				
 				for x in cur_s_no:
-					chk = webnotes.conn.sql("""select name, status from `tabSerial No` 
+					chk = frappe.conn.sql("""select name, status from `tabSerial No` 
 						where docstatus!=2 and name=%s""", (x))
 					chk1 = chk and chk[0][0] or ''
 					status = chk and chk[0][1] or ''
@@ -235,7 +235,7 @@
 				cur_s_no = cur_serial_no.split(',')
 				
 				for x in cur_s_no:
-					dt = webnotes.conn.sql("""select delivery_date from `tabSerial No` 
+					dt = frappe.conn.sql("""select delivery_date from `tabSerial No` 
 						where name=%s""", x)
 					dt = dt and dt[0][0] or ''
 					
@@ -251,16 +251,16 @@
 		cur_s_no = cur_serial_no.split(',')
 		
 		for x in cur_s_no:
-			webnotes.conn.sql("""update `tabSerial No` set amc_expiry_date=%s, 
+			frappe.conn.sql("""update `tabSerial No` set amc_expiry_date=%s, 
 				maintenance_status='Under AMC' where name=%s""", (amc_end_date, x))
 	
 	def on_update(self):
-		webnotes.conn.set(self.doc, 'status', 'Draft')
+		frappe.conn.set(self.doc, 'status', 'Draft')
 	
 	def validate_serial_no_warranty(self):
 		for d in getlist(self.doclist, 'item_maintenance_detail'):
 			if cstr(d.serial_no).strip():
-				dt = webnotes.conn.sql("""select warranty_expiry_date, amc_expiry_date 
+				dt = frappe.conn.sql("""select warranty_expiry_date, amc_expiry_date 
 					from `tabSerial No` where name=%s""", d.serial_no, as_dict=1)
 				if dt[0]['warranty_expiry_date'] and dt[0]['warranty_expiry_date'] >= d.start_date:
 					throw("""Serial No: %s is already under warranty upto %s. 
@@ -307,15 +307,15 @@
 		for d in getlist(self.doclist, 'item_maintenance_detail'):
 			if d.serial_no:
 				self.update_amc_date(d.serial_no, '')
-		webnotes.conn.set(self.doc, 'status', 'Cancelled')
+		frappe.conn.set(self.doc, 'status', 'Cancelled')
 		delete_events(self.doc.doctype, self.doc.name)
 
 	def on_trash(self):
 		delete_events(self.doc.doctype, self.doc.name)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def make_maintenance_visit(source_name, target_doclist=None):
-	from webnotes.model.mapper import get_mapped_doclist
+	from frappe.model.mapper import get_mapped_doclist
 	
 	def update_status(source, target, parent):
 		target.maintenance_type = "Scheduled"
diff --git a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py
index cb6190f..26c87f1 100644
--- a/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py
+++ b/erpnext/support/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.py b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.py
index cb6190f..26c87f1 100644
--- a/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.py
+++ b/erpnext/support/doctype/maintenance_schedule_item/maintenance_schedule_item.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
index 186e07c..d469082 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
@@ -1,22 +1,22 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.provide("erpnext.support");
+frappe.provide("erpnext.support");
 
-wn.ui.form.on_change("Maintenance Visit", "customer", function(frm) { 
+frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) { 
 	erpnext.utils.get_party_details(frm) });
-wn.ui.form.on_change("Maintenance Visit", "customer_address", 
+frappe.ui.form.on_change("Maintenance Visit", "customer_address", 
 	erpnext.utils.get_address_display);
-wn.ui.form.on_change("Maintenance Visit", "contact_person", 
+frappe.ui.form.on_change("Maintenance Visit", "contact_person", 
 	erpnext.utils.get_contact_details);	
 
 // TODO commonify this code
-erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
+erpnext.support.MaintenanceVisit = frappe.ui.form.Controller.extend({
 	refresh: function() {
 		if (this.frm.doc.docstatus===0) {
-			cur_frm.add_custom_button(wn._('From Maintenance Schedule'), 
+			cur_frm.add_custom_button(frappe._('From Maintenance Schedule'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
 						source_doctype: "Maintenance Schedule",
 						get_query_filters: {
@@ -26,9 +26,9 @@
 						}
 					})
 				});
-			cur_frm.add_custom_button(wn._('From Customer Issue'), 
+			cur_frm.add_custom_button(frappe._('From Customer Issue'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.support.doctype.customer_issue.customer_issue.make_maintenance_visit",
 						source_doctype: "Customer Issue",
 						get_query_filters: {
@@ -38,9 +38,9 @@
 						}
 					})
 				});
-			cur_frm.add_custom_button(wn._('From Sales Order'), 
+			cur_frm.add_custom_button(frappe._('From Sales Order'), 
 				function() {
-					wn.model.map_current_doc({
+					frappe.model.map_current_doc({
 						method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit",
 						source_doctype: "Sales Order",
 						get_query_filters: {
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
index e56389e..a79b2a9 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import cstr
-from webnotes.model.bean import getlist
-from webnotes import msgprint
+from frappe.utils import cstr
+from frappe.model.bean import getlist
+from frappe import msgprint
 
 	
 
@@ -18,7 +18,7 @@
 		self.doclist = doclist
 	
 	def get_item_details(self, item_code):
-		item = webnotes.conn.sql("select item_name,description from `tabItem` where name = '%s'" %(item_code), as_dict=1)
+		item = frappe.conn.sql("select item_name,description from `tabItem` where name = '%s'" %(item_code), as_dict=1)
 		ret = {
 			'item_name' : item and item[0]['item_name'] or '',
 			'description' : item and item[0]['description'] or ''
@@ -27,7 +27,7 @@
 			
 	def validate_serial_no(self):
 		for d in getlist(self.doclist, 'maintenance_visit_details'):
-			if d.serial_no and not webnotes.conn.sql("select name from `tabSerial No` where name = '%s' and docstatus != 2" % d.serial_no):
+			if d.serial_no and not frappe.conn.sql("select name from `tabSerial No` where name = '%s' and docstatus != 2" % d.serial_no):
 				msgprint("Serial No: "+ d.serial_no + " not exists in the system")
 				raise Exception
 
@@ -51,7 +51,7 @@
 					elif self.doc.completion_status == 'Partially Completed':
 						status = 'Work In Progress'
 				else:
-					nm = webnotes.conn.sql("select t1.name, t1.mntc_date, t2.service_person, t2.work_done from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.completion_status = 'Partially Completed' and t2.prevdoc_docname = %s and t1.name!=%s and t1.docstatus = 1 order by t1.name desc limit 1", (d.prevdoc_docname, self.doc.name))
+					nm = frappe.conn.sql("select t1.name, t1.mntc_date, t2.service_person, t2.work_done from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.completion_status = 'Partially Completed' and t2.prevdoc_docname = %s and t1.name!=%s and t1.docstatus = 1 order by t1.name desc limit 1", (d.prevdoc_docname, self.doc.name))
 					
 					if nm:
 						status = 'Work In Progress'
@@ -64,7 +64,7 @@
 						service_person = ''
 						work_done = ''
 				
-				webnotes.conn.sql("update `tabCustomer Issue` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname))
+				frappe.conn.sql("update `tabCustomer Issue` set resolution_date=%s, resolved_by=%s, resolution_details=%s, status=%s where name =%s",(mntc_date,service_person,work_done,status,d.prevdoc_docname))
 	
 
 	def check_if_last_visit(self):
@@ -76,7 +76,7 @@
 				check_for_doctype = d.prevdoc_doctype
 		
 		if check_for_docname:
-			check = webnotes.conn.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.doc.name, check_for_docname, self.doc.mntc_date, self.doc.mntc_date, self.doc.mntc_time))
+			check = frappe.conn.sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent = t1.name and t1.name!=%s and t2.prevdoc_docname=%s and t1.docstatus = 1 and (t1.mntc_date > %s or (t1.mntc_date = %s and t1.mntc_time > %s))", (self.doc.name, check_for_docname, self.doc.mntc_date, self.doc.mntc_date, self.doc.mntc_time))
 			
 			if check:
 				check_lst = [x[0] for x in check]
@@ -88,11 +88,11 @@
 	
 	def on_submit(self):
 		self.update_customer_issue(1)		
-		webnotes.conn.set(self.doc, 'status', 'Submitted')
+		frappe.conn.set(self.doc, 'status', 'Submitted')
 	
 	def on_cancel(self):
 		self.check_if_last_visit()		
-		webnotes.conn.set(self.doc, 'status', 'Cancelled')
+		frappe.conn.set(self.doc, 'status', 'Cancelled')
 
 	def on_update(self):
 		pass
\ No newline at end of file
diff --git a/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py b/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py
index cb6190f..26c87f1 100644
--- a/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py
+++ b/erpnext/support/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/support/doctype/newsletter/newsletter.js b/erpnext/support/doctype/newsletter/newsletter.js
index 41967e3..aaf9e19 100644
--- a/erpnext/support/doctype/newsletter/newsletter.js
+++ b/erpnext/support/doctype/newsletter/newsletter.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 cur_frm.cscript.onload = function(doc) {
-	return wn.call({
+	return frappe.call({
 		method: "erpnext.support.doctype.newsletter.newsletter.get_lead_options",
 		type: "GET",
 		callback: function(r) {
@@ -15,8 +15,8 @@
 cur_frm.cscript.refresh = function(doc) {
 	erpnext.hide_naming_series();
 	if(!doc.__islocal && !cint(doc.email_sent) && !doc.__unsaved
-			&& inList(wn.boot.profile.can_write, doc.doctype)) {
-		cur_frm.add_custom_button(wn._('Send'), function() {
+			&& inList(frappe.boot.profile.can_write, doc.doctype)) {
+		cur_frm.add_custom_button(frappe._('Send'), function() {
 			return $c_obj(make_doclist(doc.doctype, doc.name), 'send_emails', '', function(r) {
 				cur_frm.refresh();
 			});
@@ -27,7 +27,7 @@
 
 	if(doc.__islocal && !doc.send_from) {
 		cur_frm.set_value("send_from", 
-			repl("%(fullname)s <%(email)s>", wn.user_info(doc.owner)));
+			repl("%(fullname)s <%(email)s>", frappe.user_info(doc.owner)));
 	}
 }
 
@@ -35,7 +35,7 @@
 	cur_frm.dashboard.reset();
 	if(!cur_frm.doc.__islocal && cint(cur_frm.doc.email_sent) && cur_frm.doc.__status_count) {
 		var stat = cur_frm.doc.__status_count;
-		var total = wn.utils.sum($.map(stat, function(v) { return v; }));
+		var total = frappe.utils.sum($.map(stat, function(v) { return v; }));
 		if(total) {
 			$.each(stat, function(k, v) {
 				stat[k] = flt(v * 100 / total, 2);
diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py
index 9fbb5c4..43dff93 100644
--- a/erpnext/support/doctype/newsletter/newsletter.py
+++ b/erpnext/support/doctype/newsletter/newsletter.py
@@ -3,10 +3,10 @@
 
 from __future__ import unicode_literals
 
-import webnotes
-import webnotes.utils
-from webnotes.utils import cstr
-from webnotes import msgprint, throw, _
+import frappe
+import frappe.utils
+from frappe.utils import cstr
+from frappe import msgprint, throw, _
 
 class DocType():
 	def __init__(self, d, dl):
@@ -14,7 +14,7 @@
 		
 	def onload(self):
 		if self.doc.email_sent:
-			self.doc.fields["__status_count"] = dict(webnotes.conn.sql("""select status, count(*)
+			self.doc.fields["__status_count"] = dict(frappe.conn.sql("""select status, count(*)
 				from `tabBulk Email` where ref_doctype=%s and ref_docname=%s
 				group by status""", (self.doc.doctype, self.doc.name))) or None
 
@@ -41,18 +41,18 @@
 			"doctype": self.send_to_doctype
 		}))
 
-		webnotes.conn.set(self.doc, "email_sent", 1)
+		frappe.conn.set(self.doc, "email_sent", 1)
 	
 	def get_recipients(self):
 		self.email_field = None
 		if self.doc.send_to_type=="Contact":
 			self.send_to_doctype = "Contact"
 			if self.doc.contact_type == "Customer":		
-				return webnotes.conn.sql_list("""select email_id from tabContact 
+				return frappe.conn.sql_list("""select email_id from tabContact 
 					where ifnull(email_id, '') != '' and ifnull(customer, '') != ''""")
 
 			elif self.doc.contact_type == "Supplier":		
-				return webnotes.conn.sql_list("""select email_id from tabContact 
+				return frappe.conn.sql_list("""select email_id from tabContact 
 					where ifnull(email_id, '') != '' and ifnull(supplier, '') != ''""")
 	
 		elif self.doc.send_to_type=="Lead":
@@ -66,14 +66,14 @@
 			if conditions:
 				conditions = "".join(conditions)
 				
-			return webnotes.conn.sql_list("""select email_id from tabLead 
+			return frappe.conn.sql_list("""select email_id from tabLead 
 				where ifnull(email_id, '') != '' %s""" % (conditions or ""))
 
 		elif self.doc.send_to_type=="Employee":
 			self.send_to_doctype = "Employee"
 			self.email_field = "company_email"
 
-			return webnotes.conn.sql_list("""select 
+			return frappe.conn.sql_list("""select 
 				if(ifnull(company_email, '')!='', company_email, personal_email) as email_id 
 				from `tabEmployee` where status='Active'""")
 
@@ -88,56 +88,56 @@
 	def send_bulk(self):
 		self.validate_send()
 
-		sender = self.doc.send_from or webnotes.utils.get_formatted_email(self.doc.owner)
+		sender = self.doc.send_from or frappe.utils.get_formatted_email(self.doc.owner)
 		
-		from webnotes.utils.email_lib.bulk import send
+		from frappe.utils.email_lib.bulk import send
 		
-		if not webnotes.flags.in_test:
-			webnotes.conn.auto_commit_on_many_writes = True
+		if not frappe.flags.in_test:
+			frappe.conn.auto_commit_on_many_writes = True
 
 		send(recipients = self.recipients, sender = sender, 
 			subject = self.doc.subject, message = self.doc.message,
 			doctype = self.send_to_doctype, email_field = self.email_field or "email_id",
 			ref_doctype = self.doc.doctype, ref_docname = self.doc.name)
 
-		if not webnotes.flags.in_test:
-			webnotes.conn.auto_commit_on_many_writes = False
+		if not frappe.flags.in_test:
+			frappe.conn.auto_commit_on_many_writes = False
 
 	def validate_send(self):
 		if self.doc.fields.get("__islocal"):
 			throw(_("Please save the Newsletter before sending."))
 
-		from webnotes import conf
+		from frappe import conf
 		if (conf.get("status") or None) == "Trial":
 			throw(_("Sending newsletters is not allowed for Trial users, \
 				to prevent abuse of this feature."))
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_lead_options():
 	return {
 		"sources": ["All"] + filter(None, 
-			webnotes.conn.sql_list("""select distinct source from tabLead""")),
+			frappe.conn.sql_list("""select distinct source from tabLead""")),
 		"statuses": ["All"] + filter(None, 
-			webnotes.conn.sql_list("""select distinct status from tabLead"""))
+			frappe.conn.sql_list("""select distinct status from tabLead"""))
 	}
 
 
 def create_lead(email_id):
 	"""create a lead if it does not exist"""
 	from email.utils import parseaddr
-	from webnotes.model.doc import get_default_naming_series
+	from frappe.model.doc import get_default_naming_series
 	real_name, email_id = parseaddr(email_id)
 	
-	if webnotes.conn.get_value("Lead", {"email_id": email_id}):
+	if frappe.conn.get_value("Lead", {"email_id": email_id}):
 		return
 	
-	lead = webnotes.bean({
+	lead = frappe.bean({
 		"doctype": "Lead",
 		"email_id": email_id,
 		"lead_name": real_name or email_id,
 		"status": "Contacted",
 		"naming_series": get_default_naming_series("Lead"),
-		"company": webnotes.conn.get_default("company"),
+		"company": frappe.conn.get_default("company"),
 		"source": "Email"
 	})
 	lead.insert()
\ No newline at end of file
diff --git a/erpnext/support/doctype/newsletter/test_newsletter.py b/erpnext/support/doctype/newsletter/test_newsletter.py
index 697161d..6e30c65 100644
--- a/erpnext/support/doctype/newsletter/test_newsletter.py
+++ b/erpnext/support/doctype/newsletter/test_newsletter.py
@@ -1,39 +1,39 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
 
-import webnotes, unittest
+import frappe, unittest
 
 class TestNewsletter(unittest.TestCase):
 	def test_get_recipients_lead(self):
-		w = webnotes.bean(test_records[0])
+		w = frappe.bean(test_records[0])
 		w.insert()
 		self.assertTrue("test_lead@example.com" in w.controller.get_recipients())
-		webnotes.conn.sql("""delete from `tabBulk Email`""")
+		frappe.conn.sql("""delete from `tabBulk Email`""")
 		w.controller.send_emails()
-		self.assertTrue(webnotes.conn.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
+		self.assertTrue(frappe.conn.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
 
 	def test_get_recipients_lead_by_status(self):
-		w = webnotes.bean(test_records[0])
+		w = frappe.bean(test_records[0])
 		w.doc.lead_status="Converted"
 		w.insert()
 		self.assertTrue("test_lead3@example.com" in w.controller.get_recipients())
 
 	def test_get_recipients_contact_customer(self):
-		w = webnotes.bean(test_records[1])
+		w = frappe.bean(test_records[1])
 		w.insert()
 		self.assertTrue("test_contact_customer@example.com" in w.controller.get_recipients())
 
 	def test_get_recipients_contact_supplier(self):
-		w = webnotes.bean(test_records[1])
+		w = frappe.bean(test_records[1])
 		w.doc.contact_type="Supplier"
 		w.insert()
 		self.assertTrue("test_contact_supplier@example.com" in w.controller.get_recipients())
 
 	def test_get_recipients_custom(self):
-		w = webnotes.bean(test_records[2])
+		w = frappe.bean(test_records[2])
 		w.insert()
 		self.assertTrue("test_custom2@example.com" in w.controller.get_recipients())
-		self.assertTrue(webnotes.conn.get("Lead", 
+		self.assertTrue(frappe.conn.get("Lead", 
 			{"email_id": "test_custom2@example.com"}))
 
 
diff --git a/erpnext/support/doctype/support_ticket/get_support_mails.py b/erpnext/support/doctype/support_ticket/get_support_mails.py
index 1f2c9d2..735a159 100644
--- a/erpnext/support/doctype/support_ticket/get_support_mails.py
+++ b/erpnext/support/doctype/support_ticket/get_support_mails.py
@@ -2,16 +2,16 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, cint, decode_dict, today
-from webnotes.utils.email_lib import sendmail		
-from webnotes.utils.email_lib.receive import POP3Mailbox
-from webnotes.core.doctype.communication.communication import _make
+import frappe
+from frappe.utils import cstr, cint, decode_dict, today
+from frappe.utils.email_lib import sendmail		
+from frappe.utils.email_lib.receive import POP3Mailbox
+from frappe.core.doctype.communication.communication import _make
 
 class SupportMailbox(POP3Mailbox):	
 	def setup(self, args=None):
-		self.email_settings = webnotes.doc("Email Settings", "Email Settings")
-		self.settings = args or webnotes._dict({
+		self.email_settings = frappe.doc("Email Settings", "Email Settings")
+		self.settings = args or frappe._dict({
 			"use_ssl": self.email_settings.support_use_ssl,
 			"host": self.email_settings.support_host,
 			"username": self.email_settings.support_username,
@@ -24,7 +24,7 @@
 		thread_id = mail.get_thread_id()
 		new_ticket = False
 
-		if not (thread_id and webnotes.conn.exists("Support Ticket", thread_id)):
+		if not (thread_id and frappe.conn.exists("Support Ticket", thread_id)):
 			new_ticket = True
 		
 		ticket = add_support_communication(mail.subject, mail.content, mail.from_email,
@@ -53,17 +53,17 @@
 			msg = cstr(response))
 		
 def get_support_mails():
-	if cint(webnotes.conn.get_value('Email Settings', None, 'sync_support_mails')):
+	if cint(frappe.conn.get_value('Email Settings', None, 'sync_support_mails')):
 		SupportMailbox()
 		
 def add_support_communication(subject, content, sender, docname=None, mail=None):
 	if docname:
-		ticket = webnotes.bean("Support Ticket", docname)
+		ticket = frappe.bean("Support Ticket", docname)
 		ticket.doc.status = 'Open'
 		ticket.ignore_permissions = True
 		ticket.doc.save()
 	else:
-		ticket = webnotes.bean([decode_dict({
+		ticket = frappe.bean([decode_dict({
 			"doctype":"Support Ticket",
 			"description": content,
 			"subject": subject,
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.js b/erpnext/support/doctype/support_ticket/support_ticket.js
index a276e36..1807846 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.js
+++ b/erpnext/support/doctype/support_ticket/support_ticket.js
@@ -4,15 +4,15 @@
 cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
 	return{	query: "erpnext.controllers.queries.customer_query" } }
 
-wn.provide("erpnext.support");
+frappe.provide("erpnext.support");
 
 cur_frm.add_fetch("customer", "customer_name", "customer_name")
 
 $.extend(cur_frm.cscript, {
 	onload: function(doc, dt, dn) {
 		if(in_list(user_roles,'System Manager')) {
-			cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Email Settings/Email Settings">'+wn._("Email Settings")+'</a><br>\
-				<span class="help">'+wn._("Integrate incoming support emails to Support Ticket")+'</span></p>';
+			cur_frm.footer.help_area.innerHTML = '<p><a href="#Form/Email Settings/Email Settings">'+frappe._("Email Settings")+'</a><br>\
+				<span class="help">'+frappe._("Integrate incoming support emails to Support Ticket")+'</span></p>';
 		}
 	},
 	
@@ -34,7 +34,7 @@
 	make_listing: function(doc) {
 		var wrapper = cur_frm.fields_dict['thread_html'].wrapper;
 		
-		var comm_list = wn.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
+		var comm_list = frappe.model.get("Communication", {"parent": doc.name, "parenttype":"Support Ticket"})
 		
 		if(!comm_list.length) {
 			comm_list.push({
@@ -44,7 +44,7 @@
 				"content": doc.description});
 		}
 					
-		cur_frm.communication_view = new wn.views.CommunicationList({
+		cur_frm.communication_view = new frappe.views.CommunicationList({
 			list: comm_list,
 			parent: wrapper,
 			doc: doc,
@@ -62,7 +62,7 @@
 	},
 
 	set_status: function(status) {
-		return wn.call({
+		return frappe.call({
 			method: "erpnext.support.doctype.support_ticket.support_ticket.set_status",
 			args: {
 				name: cur_frm.doc.name,
diff --git a/erpnext/support/doctype/support_ticket/support_ticket.py b/erpnext/support/doctype/support_ticket/support_ticket.py
index 7af0e50..c2aa345 100644
--- a/erpnext/support/doctype/support_ticket/support_ticket.py
+++ b/erpnext/support/doctype/support_ticket/support_ticket.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 from erpnext.utilities.transaction_base import TransactionBase
-from webnotes.utils import now, extract_email_id
+from frappe.utils import now, extract_email_id
 
 class DocType(TransactionBase):
 	def __init__(self, doc, doclist=[]):
@@ -13,13 +13,13 @@
 		self.doclist = doclist
 	
 	def get_sender(self, comm):
-		return webnotes.conn.get_value('Email Settings',None,'support_email')
+		return frappe.conn.get_value('Email Settings',None,'support_email')
 
 	def get_subject(self, comm):
 		return '[' + self.doc.name + '] ' + (comm.subject or 'No Subject Specified')
 	
 	def get_content(self, comm):
-		signature = webnotes.conn.get_value('Email Settings',None,'support_signature')
+		signature = frappe.conn.get_value('Email Settings',None,'support_signature')
 		content = comm.content
 		if signature:
 			content += '<p>' + signature + '</p>'
@@ -33,7 +33,7 @@
 		self.set_lead_contact(self.doc.raised_by)
 		
 		if self.doc.status == "Closed":
-			from webnotes.widgets.form.assign_to import clear
+			from frappe.widgets.form.assign_to import clear
 			clear(self.doc.doctype, self.doc.name)
 				
 	def set_lead_contact(self, email_id):
@@ -41,16 +41,16 @@
 		email_id = email.utils.parseaddr(email_id)
 		if email_id:
 			if not self.doc.lead:
-				self.doc.lead = webnotes.conn.get_value("Lead", {"email_id": email_id})
+				self.doc.lead = frappe.conn.get_value("Lead", {"email_id": email_id})
 			if not self.doc.contact:
-				self.doc.contact = webnotes.conn.get_value("Contact", {"email_id": email_id})
+				self.doc.contact = frappe.conn.get_value("Contact", {"email_id": email_id})
 				
 			if not self.doc.company:		
-				self.doc.company = webnotes.conn.get_value("Lead", self.doc.lead, "company") or \
-					webnotes.conn.get_default("company")
+				self.doc.company = frappe.conn.get_value("Lead", self.doc.lead, "company") or \
+					frappe.conn.get_default("company")
 
 	def update_status(self):
-		status = webnotes.conn.get_value("Support Ticket", self.doc.name, "status")
+		status = frappe.conn.get_value("Support Ticket", self.doc.name, "status")
 		if self.doc.status!="Open" and status =="Open" and not self.doc.first_responded_on:
 			self.doc.first_responded_on = now()
 		if self.doc.status=="Closed" and status !="Closed":
@@ -58,13 +58,13 @@
 		if self.doc.status=="Open" and status !="Open":
 			self.doc.resolution_date = ""
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def set_status(name, status):
-	st = webnotes.bean("Support Ticket", name)
+	st = frappe.bean("Support Ticket", name)
 	st.doc.status = status
 	st.save()
 		
 def auto_close_tickets():
-	webnotes.conn.sql("""update `tabSupport Ticket` set status = 'Closed' 
+	frappe.conn.sql("""update `tabSupport Ticket` set status = 'Closed' 
 		where status = 'Replied' 
 		and date_sub(curdate(),interval 15 Day) > modified""")
diff --git a/erpnext/support/page/support_analytics/support_analytics.js b/erpnext/support/page/support_analytics/support_analytics.js
index 0cb8850..d8e8214 100644
--- a/erpnext/support/page/support_analytics/support_analytics.js
+++ b/erpnext/support/page/support_analytics/support_analytics.js
@@ -1,10 +1,10 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.pages['support-analytics'].onload = function(wrapper) { 
-	wn.ui.make_app_page({
+frappe.pages['support-analytics'].onload = function(wrapper) { 
+	frappe.ui.make_app_page({
 		parent: wrapper,
-		title: wn._('Support Analytics'),
+		title: frappe._('Support Analytics'),
 		single_column: true
 	});					
 
@@ -15,10 +15,10 @@
 	
 }
 
-erpnext.SupportAnalytics = wn.views.GridReportWithPlot.extend({
+erpnext.SupportAnalytics = frappe.views.GridReportWithPlot.extend({
 	init: function(wrapper) {
 		this._super({
-			title: wn._("Support Analtyics"),
+			title: frappe._("Support Analtyics"),
 			page: wrapper,
 			parent: $(wrapper).find('.layout-main'),
 			appframe: wrapper.appframe,
@@ -27,22 +27,22 @@
 	},
 	
 	filters: [
-		{fieldtype:"Select", label: wn._("Fiscal Year"), link:"Fiscal Year", 
+		{fieldtype:"Select", label: frappe._("Fiscal Year"), link:"Fiscal Year", 
 			default_value: "Select Fiscal Year..."},
-		{fieldtype:"Date", label: wn._("From Date")},
-		{fieldtype:"Label", label: wn._("To")},
-		{fieldtype:"Date", label: wn._("To Date")},
-		{fieldtype:"Select", label: wn._("Range"), 
+		{fieldtype:"Date", label: frappe._("From Date")},
+		{fieldtype:"Label", label: frappe._("To")},
+		{fieldtype:"Date", label: frappe._("To Date")},
+		{fieldtype:"Select", label: frappe._("Range"), 
 			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
-		{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
-		{fieldtype:"Button", label: wn._("Reset Filters")}
+		{fieldtype:"Button", label: frappe._("Refresh"), icon:"icon-refresh icon-white"},
+		{fieldtype:"Button", label: frappe._("Reset Filters")}
 	],
 
 	setup_columns: function() {
 		var std_columns = [
-			{id: "check", name: wn._("Plot"), field: "check", width: 30,
+			{id: "check", name: frappe._("Plot"), field: "check", width: 30,
 				formatter: this.check_formatter},
-			{id: "status", name: wn._("Status"), field: "status", width: 100},
+			{id: "status", name: frappe._("Status"), field: "status", width: 100},
 		];
 		this.make_date_range_columns();		
 		this.columns = std_columns.concat(this.columns);
@@ -64,7 +64,7 @@
 		var total_responded = {};
 
 		
-		$.each(wn.report_dump.data["Support Ticket"], function(i, d) {
+		$.each(frappe.report_dump.data["Support Ticket"], function(i, d) {
 			var dateobj = dateutil.str_to_obj(d.creation);
 			var date = d.creation.split(" ")[0];
 			var col = me.column_map[date];
diff --git a/erpnext/support/page/support_home/support_home.js b/erpnext/support/page/support_home/support_home.js
index 940f800..38d35d9 100644
--- a/erpnext/support/page/support_home/support_home.js
+++ b/erpnext/support/page/support_home/support_home.js
@@ -1,92 +1,92 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt"
 
-wn.module_page["Support"] = [
+frappe.module_page["Support"] = [
 	{
-		title: wn._("Top"),
+		title: frappe._("Top"),
 		top: true,
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Support Ticket"),
-				description: wn._("Support queries from customers."),
+				label: frappe._("Support Ticket"),
+				description: frappe._("Support queries from customers."),
 				doctype:"Support Ticket"
 			},
 			{
-				label: wn._("Customer Issue"),
-				description: wn._("Customer Issue against Serial No."),
+				label: frappe._("Customer Issue"),
+				description: frappe._("Customer Issue against Serial No."),
 				doctype:"Customer Issue"
 			},
 		]
 	},
 
 	{
-		title: wn._("Documents"),
+		title: frappe._("Documents"),
 		icon: "icon-copy",
 		items: [
 			{
-				label: wn._("Maintenance Schedule"),
-				description: wn._("Plan for maintenance visits."),
+				label: frappe._("Maintenance Schedule"),
+				description: frappe._("Plan for maintenance visits."),
 				doctype:"Maintenance Schedule"
 			},
 			{
-				label: wn._("Maintenance Visit"),
-				description: wn._("Visit report for maintenance call."),
+				label: frappe._("Maintenance Visit"),
+				description: frappe._("Visit report for maintenance call."),
 				doctype:"Maintenance Visit"
 			},
 			{
-				label: wn._("Newsletter"),
-				description: wn._("Newsletters to contacts, leads."),
+				label: frappe._("Newsletter"),
+				description: frappe._("Newsletters to contacts, leads."),
 				doctype:"Newsletter"
 			},
 			{
-				label: wn._("Communication"),
-				description: wn._("Communication log."),
+				label: frappe._("Communication"),
+				description: frappe._("Communication log."),
 				doctype:"Communication"
 			},
 		]
 	},
 	{
-		title: wn._("Masters"),
+		title: frappe._("Masters"),
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Serial No"),
-				description: wn._("Single unit of an Item."),
+				label: frappe._("Serial No"),
+				description: frappe._("Single unit of an Item."),
 				doctype:"Serial No"
 			},
 		]
 	},
 	{
-		title: wn._("Setup"),
+		title: frappe._("Setup"),
 		icon: "icon-cog",
 		items: [
 			{
 				"route":"Form/Email Settings/Email Settings",
-				"label":wn._("Email Settings"),
-				"description":wn._("Setup to pull emails from support email account"),
+				"label":frappe._("Email Settings"),
+				"description":frappe._("Setup to pull emails from support email account"),
 				doctype: "Email Settings"
 			},
 		]
 	},
 	{
-		title: wn._("Analytics"),
+		title: frappe._("Analytics"),
 		right: true,
 		icon: "icon-bar-chart",
 		items: [
 			{
-				"label":wn._("Support Analytics"),
+				"label":frappe._("Support Analytics"),
 				page: "support-analytics"
 			},
 		]
 	},
 	{
-		title: wn._("Reports"),
+		title: frappe._("Reports"),
 		right: true,
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Maintenance Schedules"),
+				"label":frappe._("Maintenance Schedules"),
 				route: "query-report/Maintenance Schedules",
 				doctype: "Maintenance Schedule"
 			}
@@ -95,5 +95,5 @@
 ]
 
 pscript['onload_support-home'] = function(wrapper) {
-	wn.views.moduleview.make(wrapper, "Support");
+	frappe.views.moduleview.make(wrapper, "Support");
 }
diff --git a/erpnext/templates/includes/footer_extension.html b/erpnext/templates/includes/footer_extension.html
index 315be06..ba26592 100644
--- a/erpnext/templates/includes/footer_extension.html
+++ b/erpnext/templates/includes/footer_extension.html
@@ -32,6 +32,6 @@
 			});
 		}
 		else
-			wn.msgprint(wn._("Please enter email address"))
+			frappe.msgprint(frappe._("Please enter email address"))
 	});
 </script>
diff --git a/erpnext/templates/utils.py b/erpnext/templates/utils.py
index bcd23ab..e98a5c0 100644
--- a/erpnext/templates/utils.py
+++ b/erpnext/templates/utils.py
@@ -2,11 +2,11 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-@webnotes.whitelist(allow_guest=True)
+@frappe.whitelist(allow_guest=True)
 def send_message(subject="Website Query", message="", sender="", status="Open"):
-	from webnotes.templates.pages.contact import send_message as website_send_message
+	from frappe.templates.pages.contact import send_message as website_send_message
 	
 	if not website_send_message(subject, message, sender):
 		return
diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py
index b047537..e3a1e7f 100644
--- a/erpnext/utilities/__init__.py
+++ b/erpnext/utilities/__init__.py
@@ -15,9 +15,9 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _, msgprint
-from webnotes.utils import cint, comma_or
+import frappe
+from frappe import _, msgprint
+from frappe.utils import cint, comma_or
 
 def validate_status(status, options):
 	if status not in options:
diff --git a/erpnext/utilities/cleanup_data.py b/erpnext/utilities/cleanup_data.py
index 630a54e..9b1988e 100644
--- a/erpnext/utilities/cleanup_data.py
+++ b/erpnext/utilities/cleanup_data.py
@@ -16,7 +16,7 @@
 sys.path.append(".")
 sys.path.append("erpnext")
 
-import webnotes
+import frappe
 
 #--------------------------------
 
@@ -34,9 +34,9 @@
 		"Job Applicant", "Web Page", "Website Slideshow", "Blog Post", "Blog Category", "Blogger", 
 		"Time Log", "Time Log Batch", "Workflow"]
 	for d in trans:
-		for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
-			webnotes.conn.sql("delete from `tab%s`" % (t))
-		webnotes.conn.sql("delete from `tab%s`" % (d))
+		for t in frappe.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
+			frappe.conn.sql("delete from `tab%s`" % (t))
+		frappe.conn.sql("delete from `tab%s`" % (d))
 		print "Deleted " + d
 	
 	
@@ -95,18 +95,18 @@
 		'BOM': ''
 	}
 	for d in masters.keys():
-		for t in webnotes.conn.sql("select options from tabDocField where parent='%s' \
+		for t in frappe.conn.sql("select options from tabDocField where parent='%s' \
 			and fieldtype='Table'" % d):
-			webnotes.conn.sql("delete from `tab%s`" % (t))
+			frappe.conn.sql("delete from `tab%s`" % (t))
 		lst = '"'+'","'.join(masters[d])+ '"'
-		webnotes.conn.sql("delete from `tab%s` where name not in (%s)" % (d, lst))
+		frappe.conn.sql("delete from `tab%s` where name not in (%s)" % (d, lst))
 		print "Deleted " + d
 
 
 
 def reset_all_series():
 	# Reset master series
-	webnotes.conn.sql("""update tabSeries set current = 0 where name not in 
+	frappe.conn.sql("""update tabSeries set current = 0 where name not in 
 		('Ann/', 'BSD', 'DEF', 'DF', 'EV', 'Event Updates/', 'FileData-', 
 		'FL', 'FMD/', 'GLM Detail', 'Login Page/', 'MDI', 'MDR', 'MI', 'MIR', 
 		'PERM', 'PR', 'SRCH/C/', 'TD', 'TIC/', 'TMD/', 'TW', 'UR', '_FEED', 
@@ -115,7 +115,7 @@
 	print "Series updated"
 		
 def reset_transaction_series():
-	webnotes.conn.sql("""update tabSeries set current = 0 where name in 
+	frappe.conn.sql("""update tabSeries set current = 0 where name in 
 		('JV', 'INV', 'BILL', 'SO', 'DN', 'PO', 'LEAD', 'ENQUIRY', 'ENQ', 'CI',
 		 'IN', 'PS', 'IDT', 'QAI', 'QTN', 'STE', 'SQTN', 'SUP', 'SR', 
 		'POS', 'LAP', 'LAL', 'EXP')""")
@@ -125,9 +125,9 @@
 def delete_main_masters():
 	main_masters = ['Fiscal Year', 'Company', 'DefaultValue']
 	for d in main_masters:
-		for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
-			webnotes.conn.sql("delete from `tab%s`" % (t))
-		webnotes.conn.sql("delete from `tab%s`" % (d))
+		for t in frappe.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
+			frappe.conn.sql("delete from `tab%s`" % (t))
+		frappe.conn.sql("delete from `tab%s`" % (d))
 		print "Deleted " + d
 
 def reset_global_defaults():
@@ -152,18 +152,18 @@
 		'default_price_list_currency': None,
 	}
 
-	from webnotes.model.code import get_obj
+	from frappe.model.code import get_obj
 	gd = get_obj('Global Defaults', 'Global Defaults')
 	for d in flds:
 		gd.doc.fields[d] = flds[d]
 	gd.doc.save()
 	
-	webnotes.clear_cache()
+	frappe.clear_cache()
 
 
 def run():
-	webnotes.connect()
-	webnotes.conn.begin()
+	frappe.connect()
+	frappe.conn.begin()
 	
 	# Confirmation from user
 	confirm = ''
@@ -195,8 +195,8 @@
 		reset_global_defaults()
 
 	print "System cleaned up succesfully"
-	webnotes.conn.commit()
-	webnotes.conn.close()
+	frappe.conn.commit()
+	frappe.conn.close()
 
 
 if __name__ == '__main__':
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index e450d84..988cbd2 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -2,10 +2,10 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes import msgprint, throw, _
-from webnotes.utils import cstr, cint
+from frappe import msgprint, throw, _
+from frappe.utils import cstr, cint
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -34,7 +34,7 @@
 		elif self.doc.is_shipping_address != 1:
 			for fieldname in ["customer", "supplier", "sales_partner", "lead"]:
 				if self.doc.fields.get(fieldname):
-					if not webnotes.conn.sql("""select name from `tabAddress` where is_primary_address=1
+					if not frappe.conn.sql("""select name from `tabAddress` where is_primary_address=1
 						and `%s`=%s and name!=%s""" % (fieldname, "%s", "%s"), 
 						(self.doc.fields[fieldname], self.doc.name)):
 							self.doc.is_primary_address = 1
@@ -48,16 +48,16 @@
 	def _unset_other(self, is_address_type):
 		for fieldname in ["customer", "supplier", "sales_partner", "lead"]:
 			if self.doc.fields.get(fieldname):
-				webnotes.conn.sql("""update `tabAddress` set `%s`=0 where `%s`=%s and name!=%s""" %
+				frappe.conn.sql("""update `tabAddress` set `%s`=0 where `%s`=%s and name!=%s""" %
 					(is_address_type, fieldname, "%s", "%s"), (self.doc.fields[fieldname], self.doc.name))
 				break
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_address_display(address_dict):
 	if not isinstance(address_dict, dict):
-		address_dict = webnotes.conn.get_value("Address", address_dict, "*", as_dict=True) or {}
+		address_dict = frappe.conn.get_value("Address", address_dict, "*", as_dict=True) or {}
 	
-	meta = webnotes.get_doctype("Address")
+	meta = frappe.get_doctype("Address")
 	sequence = (("", "address_line1"), 
 		("\n", "address_line2"), 
 		("\n", "city"),
diff --git a/erpnext/utilities/doctype/contact/contact.js b/erpnext/utilities/doctype/contact/contact.js
index 3d3e556..eb7681f 100644
--- a/erpnext/utilities/doctype/contact/contact.js
+++ b/erpnext/utilities/doctype/contact/contact.js
@@ -4,8 +4,8 @@
 {% include 'controllers/js/contact_address_common.js' %};
 
 cur_frm.cscript.refresh = function(doc) {
-	cur_frm.communication_view = new wn.views.CommunicationList({
-		list: wn.model.get("Communication", {"parent": doc.name, "parenttype": "Contact"}),
+	cur_frm.communication_view = new frappe.views.CommunicationList({
+		list: frappe.model.get("Communication", {"parent": doc.name, "parenttype": "Contact"}),
 		parent: cur_frm.fields_dict.communication_html.wrapper,
 		doc: doc,
 		recipients: doc.email_id
diff --git a/erpnext/utilities/doctype/contact/contact.py b/erpnext/utilities/doctype/contact/contact.py
index 2abd0dc..2b9c8ca 100644
--- a/erpnext/utilities/doctype/contact/contact.py
+++ b/erpnext/utilities/doctype/contact/contact.py
@@ -2,8 +2,8 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes.utils import cstr, extract_email_id
+import frappe
+from frappe.utils import cstr, extract_email_id
 
 from erpnext.controllers.status_updater import StatusUpdater
 
@@ -30,29 +30,29 @@
 	def validate_primary_contact(self):
 		if self.doc.is_primary_contact == 1:
 			if self.doc.customer:
-				webnotes.conn.sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
+				frappe.conn.sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
 			elif self.doc.supplier:
-				webnotes.conn.sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))	
+				frappe.conn.sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))	
 			elif self.doc.sales_partner:
-				webnotes.conn.sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
+				frappe.conn.sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
 		else:
 			if self.doc.customer:
-				if not webnotes.conn.sql("select name from tabContact where is_primary_contact=1 and customer = '%s'" % (self.doc.customer)):
+				if not frappe.conn.sql("select name from tabContact where is_primary_contact=1 and customer = '%s'" % (self.doc.customer)):
 					self.doc.is_primary_contact = 1
 			elif self.doc.supplier:
-				if not webnotes.conn.sql("select name from tabContact where is_primary_contact=1 and supplier = '%s'" % (self.doc.supplier)):
+				if not frappe.conn.sql("select name from tabContact where is_primary_contact=1 and supplier = '%s'" % (self.doc.supplier)):
 					self.doc.is_primary_contact = 1
 			elif self.doc.sales_partner:
-				if not webnotes.conn.sql("select name from tabContact where is_primary_contact=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
+				if not frappe.conn.sql("select name from tabContact where is_primary_contact=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
 					self.doc.is_primary_contact = 1
 
 	def on_trash(self):
-		webnotes.conn.sql("""update `tabSupport Ticket` set contact='' where contact=%s""",
+		frappe.conn.sql("""update `tabSupport Ticket` set contact='' where contact=%s""",
 			self.doc.name)
 
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_contact_details(contact):
-	contact = webnotes.doc("Contact", contact)
+	contact = frappe.doc("Contact", contact)
 	out = {
 		"contact_person": contact.get("name"),
 		"contact_display": " ".join(filter(None, 
diff --git a/erpnext/utilities/doctype/note/note.py b/erpnext/utilities/doctype/note/note.py
index 0ae23a2..50afa7e 100644
--- a/erpnext/utilities/doctype/note/note.py
+++ b/erpnext/utilities/doctype/note/note.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
@@ -16,13 +16,13 @@
 		self.doc.name = re.sub("[%'\"#*?`]", "", self.doc.title.strip())
 		
 	def onload(self):
-		if not self.doc.public and webnotes.session.user != self.doc.owner:
-			if webnotes.session.user not in [d.user for d in self.doclist if d.doctype=="Note User"]:
-				webnotes.msgprint("You are not authorized to read this record.", raise_exception=True)
+		if not self.doc.public and frappe.session.user != self.doc.owner:
+			if frappe.session.user not in [d.user for d in self.doclist if d.doctype=="Note User"]:
+				frappe.msgprint("You are not authorized to read this record.", raise_exception=True)
 	
 	def validate(self):
 		if not self.doc.fields.get("__islocal"):
-			if webnotes.session.user != self.doc.owner:
-				if webnotes.session.user not in webnotes.conn.sql_list("""select user from `tabNote User` 
+			if frappe.session.user != self.doc.owner:
+				if frappe.session.user not in frappe.conn.sql_list("""select user from `tabNote User` 
 					where parent=%s and permission='Edit'""", self.doc.name):
-					webnotes.msgprint("You are not authorized to edit this record.", raise_exception=True)
+					frappe.msgprint("You are not authorized to edit this record.", raise_exception=True)
diff --git a/erpnext/utilities/doctype/note_user/note_user.py b/erpnext/utilities/doctype/note_user/note_user.py
index e5468e5..968a25b 100644
--- a/erpnext/utilities/doctype/note_user/note_user.py
+++ b/erpnext/utilities/doctype/note_user/note_user.py
@@ -4,7 +4,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.js b/erpnext/utilities/doctype/rename_tool/rename_tool.js
index 90cd1e1..1338c0e 100644
--- a/erpnext/utilities/doctype/rename_tool/rename_tool.js
+++ b/erpnext/utilities/doctype/rename_tool/rename_tool.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 cur_frm.cscript.refresh = function(doc) {
-	return wn.call({
+	return frappe.call({
 		method: "erpnext.utilities.doctype.rename_tool.rename_tool.get_doctypes",
 		callback: function(r) {
 			cur_frm.set_df_property("select_doctype", "options", r.message);
@@ -19,12 +19,12 @@
 	var me = this;
 	var $wrapper = $(cur_frm.fields_dict.upload_html.wrapper).empty()
 		.html("<hr><div class='alert alert-warning'>" +
-			wn._("Upload a .csv file with two columns: the old name and the new name. Max 500 rows.")
+			frappe._("Upload a .csv file with two columns: the old name and the new name. Max 500 rows.")
 			+ "</div>");
 	var $log = $(cur_frm.fields_dict.rename_log.wrapper).empty();
 
 	// upload
-	wn.upload.make({
+	frappe.upload.make({
 		parent: $wrapper,
 		args: {
 			method: 'utilities.doctype.rename_tool.rename_tool.upload',
diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.py b/erpnext/utilities/doctype/rename_tool/rename_tool.py
index f38b8d1..b642282 100644
--- a/erpnext/utilities/doctype/rename_tool/rename_tool.py
+++ b/erpnext/utilities/doctype/rename_tool/rename_tool.py
@@ -4,38 +4,38 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import _
+import frappe
+from frappe import _
 
 class DocType:
 	def __init__(self, d, dl):
 		self.doc, self.doclist = d, dl
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def get_doctypes():
-	return webnotes.conn.sql_list("""select name from tabDocType
+	return frappe.conn.sql_list("""select name from tabDocType
 		where ifnull(allow_rename,0)=1 and module!='Core' order by name""")
 		
-@webnotes.whitelist()
+@frappe.whitelist()
 def upload(select_doctype=None, rows=None):
-	from webnotes.utils.datautils import read_csv_content_from_uploaded_file
-	from webnotes.modules import scrub
-	from webnotes.model.rename_doc import rename_doc
+	from frappe.utils.datautils import read_csv_content_from_uploaded_file
+	from frappe.modules import scrub
+	from frappe.model.rename_doc import rename_doc
 
 	if not select_doctype:
-		select_doctype = webnotes.form_dict.select_doctype
+		select_doctype = frappe.form_dict.select_doctype
 		
-	if not webnotes.has_permission(select_doctype, "write"):
-		raise webnotes.PermissionError
+	if not frappe.has_permission(select_doctype, "write"):
+		raise frappe.PermissionError
 
 	if not rows:
 		rows = read_csv_content_from_uploaded_file()
 	if not rows:
-		webnotes.msgprint(_("Please select a valid csv file with data."))
+		frappe.msgprint(_("Please select a valid csv file with data."))
 		raise Exception
 		
 	if len(rows) > 500:
-		webnotes.msgprint(_("Max 500 rows only."))
+		frappe.msgprint(_("Max 500 rows only."))
 		raise Exception
 	
 	rename_log = []
@@ -45,7 +45,7 @@
 			try:
 				if rename_doc(select_doctype, row[0], row[1]):
 					rename_log.append(_("Successful: ") + row[0] + " -> " + row[1])
-					webnotes.conn.commit()
+					frappe.conn.commit()
 				else:
 					rename_log.append(_("Ignored: ") + row[0] + " -> " + row[1])
 			except Exception, e:
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.js b/erpnext/utilities/doctype/sms_control/sms_control.js
index 42025bf..24d314e 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.js
+++ b/erpnext/utilities/doctype/sms_control/sms_control.js
@@ -36,7 +36,7 @@
 		me.dialog.show();
 	}
 	this.make_dialog = function() {
-		var d = new wn.ui.Dialog({
+		var d = new frappe.ui.Dialog({
 			title: 'Send SMS',
 			width: 400,
 			fields: [
diff --git a/erpnext/utilities/doctype/sms_control/sms_control.py b/erpnext/utilities/doctype/sms_control/sms_control.py
index 5c08a41..14ae989 100644
--- a/erpnext/utilities/doctype/sms_control/sms_control.py
+++ b/erpnext/utilities/doctype/sms_control/sms_control.py
@@ -2,13 +2,13 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes, json
+import frappe, json
 
-from webnotes.utils import nowdate, cstr
-from webnotes.model.code import get_obj
-from webnotes.model.doc import Document
-from webnotes import msgprint, throw, _
-from webnotes.model.bean import getlist
+from frappe.utils import nowdate, cstr
+from frappe.model.code import get_obj
+from frappe.model.doc import Document
+from frappe import msgprint, throw, _
+from frappe.model.bean import getlist
 
 class DocType:
 	def __init__(self, doc, doclist=[]):
@@ -33,10 +33,10 @@
 
 	def get_sender_name(self):
 		"returns name as SMS sender"
-		sender_name = webnotes.conn.get_value('Global Defaults', None, 'sms_sender_name') or \
+		sender_name = frappe.conn.get_value('Global Defaults', None, 'sms_sender_name') or \
 			'ERPNXT'
 		if len(sender_name) > 6 and \
-				webnotes.conn.get_value("Control Panel", None, "country") == "India":
+				frappe.conn.get_value("Control Panel", None, "country") == "India":
 			throw(_("""
 				As per TRAI rule, sender name must be exactly 6 characters.
 				Kindly change sender name in Setup --> Global Defaults.
@@ -48,7 +48,7 @@
 	def get_contact_number(self, arg):
 		"returns mobile number of the contact"
 		args = json.loads(arg)
-		number = webnotes.conn.sql("""select mobile_no, phone from tabContact where name=%s and %s=%s""" % 
+		number = frappe.conn.sql("""select mobile_no, phone from tabContact where name=%s and %s=%s""" % 
 			('%s', args['key'], '%s'), (args['contact_name'], args['value']))
 		return number and (number[0][0] or number[0][1]) or ''
 	
@@ -66,7 +66,7 @@
 			'sender_name'	: sender_name or self.get_sender_name()
 		}
 
-		if webnotes.conn.get_value('SMS Settings', None, 'sms_gateway_url'):
+		if frappe.conn.get_value('SMS Settings', None, 'sms_gateway_url'):
 			ret = self.send_via_gateway(arg)
 			msgprint(ret)
 
diff --git a/erpnext/utilities/doctype/sms_log/sms_log.py b/erpnext/utilities/doctype/sms_log/sms_log.py
index cb6190f..26c87f1 100644
--- a/erpnext/utilities/doctype/sms_log/sms_log.py
+++ b/erpnext/utilities/doctype/sms_log/sms_log.py
@@ -2,7 +2,7 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
 class DocType:
 	def __init__(self, d, dl):
diff --git a/erpnext/utilities/repost_stock.py b/erpnext/utilities/repost_stock.py
index caf8c8b..c31eb53 100644
--- a/erpnext/utilities/repost_stock.py
+++ b/erpnext/utilities/repost_stock.py
@@ -2,30 +2,30 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
+import frappe
 
-from webnotes.utils import flt
+from frappe.utils import flt
 
 
 def repost(allow_negative_stock=False):
 	"""
 	Repost everything!
 	"""
-	webnotes.conn.auto_commit_on_many_writes = 1
+	frappe.conn.auto_commit_on_many_writes = 1
 	
 	if allow_negative_stock:
-		webnotes.conn.set_default("allow_negative_stock", 1)
+		frappe.conn.set_default("allow_negative_stock", 1)
 	
-	for d in webnotes.conn.sql("""select distinct item_code, warehouse from 
+	for d in frappe.conn.sql("""select distinct item_code, warehouse from 
 		(select item_code, warehouse from tabBin
 		union
 		select item_code, warehouse from `tabStock Ledger Entry`) a"""):
 			repost_stock(d[0], d[1], allow_negative_stock)
 			
 	if allow_negative_stock:
-		webnotes.conn.set_default("allow_negative_stock", 
-			webnotes.conn.get_value("Stock Settings", None, "allow_negative_stock"))
-	webnotes.conn.auto_commit_on_many_writes = 0
+		frappe.conn.set_default("allow_negative_stock", 
+			frappe.conn.get_value("Stock Settings", None, "allow_negative_stock"))
+	frappe.conn.auto_commit_on_many_writes = 0
 
 def repost_stock(item_code, warehouse):
 	repost_actual_qty(item_code, warehouse)
@@ -46,7 +46,7 @@
 		pass
 	
 def get_reserved_qty(item_code, warehouse):
-	reserved_qty = webnotes.conn.sql("""
+	reserved_qty = frappe.conn.sql("""
 		select 
 			sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty))
 		from 
@@ -88,7 +88,7 @@
 	return flt(reserved_qty[0][0]) if reserved_qty else 0
 	
 def get_indented_qty(item_code, warehouse):
-	indented_qty = webnotes.conn.sql("""select sum(pr_item.qty - ifnull(pr_item.ordered_qty, 0))
+	indented_qty = frappe.conn.sql("""select sum(pr_item.qty - ifnull(pr_item.ordered_qty, 0))
 		from `tabMaterial Request Item` pr_item, `tabMaterial Request` pr
 		where pr_item.item_code=%s and pr_item.warehouse=%s 
 		and pr_item.qty > ifnull(pr_item.ordered_qty, 0) and pr_item.parent=pr.name 
@@ -97,7 +97,7 @@
 	return flt(indented_qty[0][0]) if indented_qty else 0
 
 def get_ordered_qty(item_code, warehouse):
-	ordered_qty = webnotes.conn.sql("""
+	ordered_qty = frappe.conn.sql("""
 		select sum((po_item.qty - ifnull(po_item.received_qty, 0))*po_item.conversion_factor)
 		from `tabPurchase Order Item` po_item, `tabPurchase Order` po
 		where po_item.item_code=%s and po_item.warehouse=%s 
@@ -107,7 +107,7 @@
 	return flt(ordered_qty[0][0]) if ordered_qty else 0
 			
 def get_planned_qty(item_code, warehouse):
-	planned_qty = webnotes.conn.sql("""
+	planned_qty = frappe.conn.sql("""
 		select sum(ifnull(qty, 0) - ifnull(produced_qty, 0)) from `tabProduction Order` 
 		where production_item = %s and fg_warehouse = %s and status != "Stopped"
 		and docstatus=1 and ifnull(qty, 0) > ifnull(produced_qty, 0)""", (item_code, warehouse))
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index b239fdc..079b9d1 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -2,9 +2,9 @@
 # License: GNU General Public License v3. See license.txt
 
 from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
-from webnotes.utils import cstr, flt, now_datetime, cint
+import frappe
+from frappe import msgprint, _
+from frappe.utils import cstr, flt, now_datetime, cint
 
 from erpnext.controllers.status_updater import StatusUpdater
 
@@ -35,7 +35,7 @@
 	def get_lead_defaults(self):
 		out = self.get_default_address_and_contact("lead")
 		
-		lead = webnotes.conn.get_value("Lead", self.doc.lead, 
+		lead = frappe.conn.get_value("Lead", self.doc.lead, 
 			["territory", "company_name", "lead_name"], as_dict=True) or {}
 
 		out["territory"] = lead.get("territory")
@@ -48,9 +48,9 @@
 
 	def load_notification_message(self):
 		dt = self.doc.doctype.lower().replace(" ", "_")
-		if int(webnotes.conn.get_value("Notification Control", None, dt) or 0):
+		if int(frappe.conn.get_value("Notification Control", None, dt) or 0):
 			self.doc.fields["__notification_message"] = \
-				webnotes.conn.get_value("Notification Control", None, dt + "_message")
+				frappe.conn.get_value("Notification Control", None, dt + "_message")
 							
 	def validate_posting_time(self):
 		if not self.doc.posting_time:
@@ -64,12 +64,12 @@
 			self._add_calendar_event(opts)
 			
 	def delete_events(self):
-		webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent` 
+		frappe.delete_doc("Event", frappe.conn.sql_list("""select name from `tabEvent` 
 			where ref_type=%s and ref_name=%s""", (self.doc.doctype, self.doc.name)), 
 			ignore_permissions=True)
 			
 	def _add_calendar_event(self, opts):
-		opts = webnotes._dict(opts)
+		opts = frappe._dict(opts)
 		
 		if self.doc.contact_date:
 			event_doclist = [{
@@ -83,14 +83,14 @@
 				"ref_name": self.doc.name
 			}]
 			
-			if webnotes.conn.exists("Profile", self.doc.contact_by):
+			if frappe.conn.exists("Profile", self.doc.contact_by):
 				event_doclist.append({
 					"doctype": "Event User",
 					"parentfield": "event_individuals",
 					"person": self.doc.contact_by
 				})
 			
-			webnotes.bean(event_doclist).insert()
+			frappe.bean(event_doclist).insert()
 			
 	def validate_uom_is_integer(self, uom_field, qty_fields):
 		validate_uom_is_integer(self.doclist, uom_field, qty_fields)
@@ -108,7 +108,7 @@
 						if ref_dn not in item_ref_dn:
 							item_ref_dn.append(ref_dn)
 						elif not val.get("allow_duplicate_prev_row_id"):
-							webnotes.msgprint(_("Row ") + cstr(d.idx + 1) + 
+							frappe.msgprint(_("Row ") + cstr(d.idx + 1) + 
 								_(": Duplicate row from same ") + key, raise_exception=1)
 					elif ref_dn:
 						ref_doc.setdefault(key, [])
@@ -120,7 +120,7 @@
 	def compare_values(self, ref_doc, fields, doc=None):
 		for ref_doctype, ref_dn_list in ref_doc.items():
 			for ref_docname in ref_dn_list:
-				prevdoc_values = webnotes.conn.get_value(ref_doctype, ref_docname, 
+				prevdoc_values = frappe.conn.get_value(ref_doctype, ref_docname, 
 					[d[0] for d in fields], as_dict=1)
 
 				for field, condition in fields:
@@ -128,7 +128,7 @@
 						self.validate_value(field, condition, prevdoc_values[field], doc)
 
 def get_default_contact(party_field, party_name):
-	contact = webnotes.conn.sql("""select name from `tabContact` where `%s`=%s
+	contact = frappe.conn.sql("""select name from `tabContact` where `%s`=%s
 		order by is_primary_contact desc, name asc limit 1""" % (party_field, "%s"), 
 		(party_name,))
 		
@@ -139,7 +139,7 @@
 	for fieldname in ["contact_display", "contact_email", "contact_mobile", "contact_phone"]:
 		out[fieldname] = None
 	
-	lead = webnotes.conn.sql("""select * from `tabLead` where name=%s""", party_name, as_dict=True)
+	lead = frappe.conn.sql("""select * from `tabLead` where name=%s""", party_name, as_dict=True)
 	if lead:
 		lead = lead[0]
 		out.update({
@@ -161,7 +161,7 @@
 		contact_name = get_default_contact(party_field, party_name)
 	
 	if contact_name:
-		contact = webnotes.conn.sql("""select * from `tabContact` where name=%s""", 
+		contact = frappe.conn.sql("""select * from `tabContact` where name=%s""", 
 			contact_name, as_dict=True)
 
 		if contact:
@@ -184,23 +184,23 @@
 	for fieldname in ("city", "state", "country"):
 		value = address_doc.fields.get(fieldname)
 		if value:
-			territory = webnotes.conn.get_value("Territory", value.strip())
+			territory = frappe.conn.get_value("Territory", value.strip())
 			if territory:
 				break
 	
 	return territory
 	
 def delete_events(ref_type, ref_name):
-	webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent` 
+	frappe.delete_doc("Event", frappe.conn.sql_list("""select name from `tabEvent` 
 		where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
 
-class UOMMustBeIntegerError(webnotes.ValidationError): pass
+class UOMMustBeIntegerError(frappe.ValidationError): pass
 
 def validate_uom_is_integer(doclist, uom_field, qty_fields):
 	if isinstance(qty_fields, basestring):
 		qty_fields = [qty_fields]
 	
-	integer_uoms = filter(lambda uom: webnotes.conn.get_value("UOM", uom, 
+	integer_uoms = filter(lambda uom: frappe.conn.get_value("UOM", uom, 
 		"must_be_whole_number") or None, doclist.get_distinct_values(uom_field))
 		
 	if not integer_uoms:
@@ -211,7 +211,7 @@
 			for f in qty_fields:
 				if d.fields.get(f):
 					if cint(d.fields[f])!=d.fields[f]:
-						webnotes.msgprint(_("For UOM") + " '" + d.fields[uom_field] \
+						frappe.msgprint(_("For UOM") + " '" + d.fields[uom_field] \
 							+ "': " + _("Quantity cannot be a fraction.") \
 							+ " " + _("In Row") + ": " + str(d.idx),
 							raise_exception=UOMMustBeIntegerError)