Removed tname and fname from code
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index f31c766..015d223 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -1,10 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.tname = "Purchase Invoice Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-
 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' %}
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 441605c..6b9de1e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -16,9 +16,6 @@
 }
 
 class PurchaseInvoice(BuyingController):
-	tname = 'Purchase Invoice Item'
-	fname = 'items'
-
 	def __init__(self, arg1, arg2=None):
 		super(PurchaseInvoice, self).__init__(arg1, arg2)
 		self.status_updater = [{
@@ -107,7 +104,7 @@
 					throw(_("Purchase Order {0} is 'Stopped'").format(d.purchase_order))
 
 	def validate_with_previous_doc(self):
-		super(PurchaseInvoice, self).validate_with_previous_doc(self.tname, {
+		super(PurchaseInvoice, self).validate_with_previous_doc({
 			"Purchase Order": {
 				"ref_dn_field": "purchase_order",
 				"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
@@ -130,7 +127,7 @@
 		})
 
 		if cint(frappe.defaults.get_global_default('maintain_same_rate')):
-			super(PurchaseInvoice, self).validate_with_previous_doc(self.tname, {
+			super(PurchaseInvoice, self).validate_with_previous_doc({
 				"Purchase Order Item": {
 					"ref_dn_field": "po_detail",
 					"compare_fields": [["rate", "="]],
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.js b/erpnext/accounts/doctype/sales_invoice/pos.js
index 8c6e3cd..cf6a8dd 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.js
+++ b/erpnext/accounts/doctype/sales_invoice/pos.js
@@ -293,7 +293,7 @@
 
 		// check whether the item is already added
 		if (no_of_items != 0) {
-			$.each(this.frm.doc[this.frm.cscript.fname] || [], function(i, d) {
+			$.each(this.frm.doc["items"] || [], function(i, d) {
 				if (d.item_code == item_code) {
 					caught = true;
 					if (serial_no)
@@ -314,8 +314,7 @@
 	add_new_item_to_grid: function(item_code, serial_no) {
 		var me = this;
 
-		var child = frappe.model.add_child(me.frm.doc, this.frm.doctype + " Item",
-			this.frm.cscript.fname);
+		var child = frappe.model.add_child(me.frm.doc, this.frm.doctype + " Item", "items");
 		child.item_code = item_code;
 
 		if (serial_no)
@@ -334,7 +333,7 @@
 	},
 	update_qty: function(item_code, qty) {
 		var me = this;
-		$.each(this.frm.doc[this.frm.cscript.fname] || [], function(i, d) {
+		$.each(this.frm.doc["items"] || [], function(i, d) {
 			if (d.item_code == item_code) {
 				if (qty == 0) {
 					frappe.model.clear_doc(d.doctype, d.name);
@@ -383,7 +382,7 @@
 		var me = this;
 		var $items = this.wrapper.find("#cart tbody").empty();
 
-		$.each(this.frm.doc[this.frm.cscript.fname] || [], function(i, d) {
+		$.each(this.frm.doc["items"] || [], function(i, d) {
 
 			$(repl('<tr id="%(item_code)s" data-selected="false">\
 					<td>%(item_code)s%(item_name)s</td>\
@@ -425,7 +424,7 @@
 	},
 	show_taxes: function() {
 		var me = this;
-		var taxes = this.frm.doc[this.frm.cscript.other_fname] || [];
+		var taxes = this.frm.doc["taxes"] || [];
 		$(this.wrapper).find(".tax-table")
 			.toggle((taxes && taxes.length) ? true : false)
 			.find("tbody").empty();
@@ -550,7 +549,7 @@
 			}
 		}
 
-		var child = this.frm.doc[this.frm.cscript.fname] || [];
+		var child = this.frm.doc["items"] || [];
 
 		$.each(child, function(i, d) {
 			for (var i in selected_items) {
@@ -564,7 +563,7 @@
 	},
 	refresh_grid: function() {
 		this.frm.dirty();
-		this.frm.fields_dict[this.frm.cscript.fname].grid.refresh();
+		this.frm.fields_dict["items"].grid.refresh();
 		this.frm.script_manager.trigger("calculate_taxes_and_totals");
 		this.refresh();
 	},
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index b2889e7..e3fb994 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -1,11 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.tname = "Sales Invoice Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-cur_frm.cscript.sales_team_fname = "sales_team";
-
 // print heading
 cur_frm.pformat.print_heading = 'Invoice';
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 54f0563..585e0a4 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -17,9 +17,6 @@
 }
 
 class SalesInvoice(SellingController):
-	tname = 'Sales Invoice Item'
-	fname = 'items'
-
 	def __init__(self, arg1, arg2=None):
 		super(SalesInvoice, self).__init__(arg1, arg2)
 		self.status_updater = [{
@@ -151,7 +148,7 @@
 		super(SalesInvoice, self).set_missing_values(for_validate)
 
 	def update_time_log_batch(self, sales_invoice):
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			if d.time_log_batch:
 				tlb = frappe.get_doc("Time Log Batch", d.time_log_batch)
 				tlb.sales_invoice = sales_invoice
@@ -159,7 +156,7 @@
 				tlb.save()
 
 	def validate_time_logs_are_submitted(self):
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			if d.time_log_batch:
 				status = frappe.db.get_value("Time Log Batch", d.time_log_batch, "status")
 				if status!="Submitted":
@@ -258,7 +255,7 @@
 				msgprint(_("Account {0} must be of type 'Fixed Asset' as Item {1} is an Asset Item").format(acc[0][0], d.item_code), raise_exception=True)
 
 	def validate_with_previous_doc(self):
-		super(SalesInvoice, self).validate_with_previous_doc(self.tname, {
+		super(SalesInvoice, self).validate_with_previous_doc({
 			"Sales Order": {
 				"ref_dn_field": "sales_order",
 				"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
@@ -272,7 +269,7 @@
 		})
 
 		if cint(frappe.defaults.get_global_default('maintain_same_sales_rate')):
-			super(SalesInvoice, self).validate_with_previous_doc(self.tname, {
+			super(SalesInvoice, self).validate_with_previous_doc({
 				"Sales Order Item": {
 					"ref_dn_field": "so_detail",
 					"compare_fields": [["rate", "="]],
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 1b8c635..abe2f39 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -1,11 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-// Preset
-// ------
-// cur_frm.cscript.tname - Details table name
-// cur_frm.cscript.fname - Details fieldname
-
 frappe.provide("erpnext.buying");
 frappe.require("assets/erpnext/js/transaction.js");
 {% include "public/js/controllers/accounts.js" %}
@@ -42,7 +37,7 @@
 				return{	query: "erpnext.controllers.queries.supplier_query" }});
 		}
 
-		this.frm.set_query("item_code", this.frm.cscript.fname, function() {
+		this.frm.set_query("item_code", "items", function() {
 			if(me.frm.doc.is_subcontracted == "Yes") {
 				 return{
 					query: "erpnext.controllers.queries.item_query",
@@ -159,7 +154,7 @@
 	project_name: function(doc, cdt, cdn) {
 		var item = frappe.get_doc(cdt, cdn);
 		if(item.project_name) {
-			$.each(this.frm.doc[this.fname],
+			$.each(this.frm.doc["items"],
 				function(i, other_item) {
 					if(!other_item.project_name) {
 						other_item.project_name = item.project_name;
@@ -359,13 +354,12 @@
 		};
 
 		setup_field_label_map(["base_rate", "base_price_list_rate", "base_amount", "base_rate"],
-			company_currency, this.fname);
+			company_currency, "items");
 
-		setup_field_label_map(["rate", "price_list_rate", "amount"],
-			this.frm.doc.currency, this.fname);
+			setup_field_label_map(["rate", "price_list_rate", "amount"], this.frm.doc.currency, "items");
 
-		if(this.frm.fields_dict[this.other_fname]) {
-			setup_field_label_map(["tax_amount", "total"], company_currency, this.other_fname);
+		if(this.frm.fields_dict["taxes"]) {
+			setup_field_label_map(["tax_amount", "total"], company_currency, "taxes");
 		}
 
 		if(this.frm.fields_dict["advances"]) {
@@ -374,7 +368,7 @@
 		}
 
 		// toggle columns
-		var item_grid = this.frm.fields_dict[this.fname].grid;
+		var item_grid = this.frm.fields_dict["items"].grid;
 		var fieldnames = $.map(["base_rate", "base_price_list_rate", "base_amount", "base_rate"], function(fname) {
 			return frappe.meta.get_docfield(item_grid.doctype, fname, me.frm.docname) ? fname : null;
 		});
@@ -391,7 +385,7 @@
 cur_frm.add_fetch('project_name', 'cost_center', 'cost_center');
 
 erpnext.buying.get_default_bom = function(frm) {
-	$.each(frm.doc[frm.cscript.fname] || [], function(i, d) {
+	$.each(frm.doc["items"] || [], function(i, d) {
 		if (d.item_code && d.bom === "") {
 			return frappe.call({
 				type: "GET",
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 2cf8673..38fff6a 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -16,7 +16,7 @@
 		import frappe.utils
 		this_purchase_date = frappe.utils.getdate(obj.get('posting_date') or obj.get('transaction_date'))
 
-		for d in obj.get(obj.fname):
+		for d in obj.get("items"):
 			# get last purchase details
 			last_purchase_details = get_last_purchase_details(d.item_code, obj.name)
 
@@ -38,34 +38,9 @@
 				frappe.db.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):
-		"""get last purchase rates for all items"""
-		doc_name = obj.name
-		conversion_rate = flt(obj.get('conversion_rate')) or 1.0
-
-		for d in obj.get(obj.fname):
-			if d.item_code:
-				last_purchase_details = get_last_purchase_details(d.item_code, doc_name)
-
-				if last_purchase_details:
-					d.base_price_list_rate = last_purchase_details['base_price_list_rate'] * (flt(d.conversion_factor) or 1.0)
-					d.discount_percentage = last_purchase_details['discount_percentage']
-					d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
-					d.price_list_rate = d.base_price_list_rate / conversion_rate
-					d.rate = d.base_rate / conversion_rate
-				else:
-					# 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 = frappe.db.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 \
-							= d.rate = item_last_purchase_rate
-
 	def validate_for_items(self, obj):
 		check_list, chk_dupl_itm=[],[]
-		for d in obj.get(obj.fname):
+		for d in obj.get("items"):
 			# validation for valid qty
 			if flt(d.qty) < 0 or (d.parenttype != 'Purchase Receipt' and not flt(d.qty)):
 				frappe.throw(_("Please enter quantity for Item {0}").format(d.item_code))
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index a8d327a..0df35e8 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -3,10 +3,6 @@
 
 frappe.provide("erpnext.buying");
 
-cur_frm.cscript.tname = "Purchase Order Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-
 {% 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' %}
@@ -147,7 +143,7 @@
 
 cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
 	return $c_obj(doc, 'get_last_purchase_rate', '', function(r, rt) {
-		refresh_field(cur_frm.cscript.fname);
+		refresh_field("items");
 		var doc = locals[cdt][cdn];
 		cur_frm.cscript.calc_amount( doc, 2);
 	});
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 725147f..cf4d006 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -7,15 +7,14 @@
 from frappe import msgprint, _, throw
 from frappe.model.mapper import get_mapped_doc
 from erpnext.controllers.buying_controller import BuyingController
+from erpnext.stock.doctype.item.item import get_last_purchase_details
+
 
 form_grid_templates = {
 	"items": "templates/form_grid/item_grid.html"
 }
 
 class PurchaseOrder(BuyingController):
-	tname = 'Purchase Order Item'
-	fname = 'items'
-
 	def __init__(self, arg1, arg2=None):
 		super(PurchaseOrder, self).__init__(arg1, arg2)
 		self.status_updater = [{
@@ -54,7 +53,7 @@
 		self.create_raw_materials_supplied("supplied_items")
 
 	def validate_with_previous_doc(self):
-		super(PurchaseOrder, self).validate_with_previous_doc(self.tname, {
+		super(PurchaseOrder, self).validate_with_previous_doc({
 			"Supplier Quotation": {
 				"ref_dn_field": "supplier_quotation",
 				"compare_fields": [["supplier", "="], ["company", "="], ["currency", "="]],
@@ -86,7 +85,27 @@
 						d.prevdoc_detail_docname, "schedule_date")
 
 	def get_last_purchase_rate(self):
-		frappe.get_doc('Purchase Common').get_last_purchase_rate(self)
+		"""get last purchase rates for all items"""
+		conversion_rate = flt(self.get('conversion_rate')) or 1.0
+
+		for d in self.get("items"):
+			if d.item_code:
+				last_purchase_details = get_last_purchase_details(d.item_code, self.name)
+
+				if last_purchase_details:
+					d.base_price_list_rate = last_purchase_details['base_price_list_rate'] * (flt(d.conversion_factor) or 1.0)
+					d.discount_percentage = last_purchase_details['discount_percentage']
+					d.base_rate = last_purchase_details['base_rate'] * (flt(d.conversion_factor) or 1.0)
+					d.price_list_rate = d.base_price_list_rate / conversion_rate
+					d.rate = d.base_rate / conversion_rate
+				else:
+					# 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 = frappe.db.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 \
+							= d.rate = item_last_purchase_rate
 
 	# Check for Stopped status
 	def check_for_stopped_status(self, pc_obj):
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index a2ff788..ac6cb08 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -1,11 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-// define defaults for purchase common
-cur_frm.cscript.tname = "Supplier Quotation Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-
 // attach required files
 {% include 'buying/doctype/purchase_common/purchase_common.js' %};
 {% include 'accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js' %}
@@ -71,4 +66,4 @@
 	return {
 		filters:{'supplier': doc.supplier}
 	}
-}
\ No newline at end of file
+}
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index 9eb8649..0dde536 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -12,9 +12,6 @@
 }
 
 class SupplierQuotation(BuyingController):
-	tname = "Supplier Quotation Item"
-	fname = "items"
-
 	def validate(self):
 		super(SupplierQuotation, self).validate()
 
@@ -39,7 +36,7 @@
 		pass
 
 	def validate_with_previous_doc(self):
-		super(SupplierQuotation, self).validate_with_previous_doc(self.tname, {
+		super(SupplierQuotation, self).validate_with_previous_doc({
 			"Material Request": {
 				"ref_dn_field": "prevdoc_docname",
 				"compare_fields": [["company", "="]],
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index c5af29e..862fb84 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -102,12 +102,12 @@
 	def set_missing_item_details(self):
 		"""set missing item values"""
 		from erpnext.stock.get_item_details import get_item_details
-		if hasattr(self, "fname"):
+		if hasattr(self, "items"):
 			parent_dict = {}
 			for fieldname in self.meta.get_valid_columns():
 				parent_dict[fieldname] = self.get(fieldname)
 
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				if item.get("item_code"):
 					args = parent_dict.copy()
 					args.update(item.as_dict())
@@ -166,8 +166,6 @@
 				self.meta.get_label("conversion_rate"), self.company)
 
 		self.conversion_rate = flt(self.conversion_rate)
-		self.item_doclist = self.get(self.fname)
-		self.tax_doclist = self.get(self.other_fname)
 
 		self.calculate_item_values()
 		self.initialize_taxes()
@@ -181,7 +179,7 @@
 		self._cleanup()
 
 	def initialize_taxes(self):
-		for tax in self.tax_doclist:
+		for tax in self.get("taxes"):
 			tax.item_wise_tax_detail = {}
 			tax_fields = ["total", "tax_amount_after_discount_amount",
 				"tax_amount_for_current_item", "grand_total_for_current_item",
@@ -216,30 +214,30 @@
 				# inclusive tax cannot be of type Actual
 				throw(_("Charge of type 'Actual' in row {0} cannot be included in Item Rate").format(tax.idx))
 			elif tax.charge_type == "On Previous Row Amount" and \
-					not cint(self.tax_doclist[cint(tax.row_id) - 1].included_in_print_rate):
+					not cint(self.get("taxes")[cint(tax.row_id) - 1].included_in_print_rate):
 				# referred row should also be inclusive
 				_on_previous_row_error(tax.row_id)
 			elif tax.charge_type == "On Previous Row Total" and \
-					not all([cint(t.included_in_print_rate) for t in self.tax_doclist[:cint(tax.row_id) - 1]]):
+					not all([cint(t.included_in_print_rate) for t in self.get("taxes")[:cint(tax.row_id) - 1]]):
 				# all rows about the reffered tax should be inclusive
 				_on_previous_row_error("1 - %d" % (tax.row_id,))
 
 	def calculate_taxes(self):
 		# maintain actual tax rate based on idx
-		actual_tax_dict = dict([[tax.idx, flt(tax.rate, self.precision("tax_amount", tax))] for tax in self.tax_doclist
+		actual_tax_dict = dict([[tax.idx, flt(tax.rate, self.precision("tax_amount", tax))] for tax in self.get("taxes")
 			if tax.charge_type == "Actual"])
 
-		for n, item in enumerate(self.item_doclist):
+		for n, item in enumerate(self.get("items")):
 			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
 
-			for i, tax in enumerate(self.tax_doclist):
+			for i, tax in enumerate(self.get("taxes")):
 				# tax_amount represents the amount of tax for the current step
 				current_tax_amount = self.get_current_tax_amount(item, tax, item_tax_map)
 
 				# Adjust divisional loss to the last item
 				if tax.charge_type == "Actual":
 					actual_tax_dict[tax.idx] -= current_tax_amount
-					if n == len(self.item_doclist) - 1:
+					if n == len(self.get("items")) - 1:
 						current_tax_amount += actual_tax_dict[tax.idx]
 
 				# store tax_amount for current item as it will be used for
@@ -268,18 +266,18 @@
 						self.precision("total", tax))
 				else:
 					tax.grand_total_for_current_item = \
-						flt(self.tax_doclist[i-1].grand_total_for_current_item +
+						flt(self.get("taxes")[i-1].grand_total_for_current_item +
 							current_tax_amount, self.precision("total", tax))
 
 				# in tax.total, accumulate grand total of each item
 				tax.total += tax.grand_total_for_current_item
 
 				# set precision in the last item iteration
-				if n == len(self.item_doclist) - 1:
+				if n == len(self.get("items")) - 1:
 					self.round_off_totals(tax)
 
 					# adjust Discount Amount loss in last tax iteration
-					if i == (len(self.tax_doclist) - 1) and self.discount_amount_applied:
+					if i == (len(self.get("taxes")) - 1) and self.discount_amount_applied:
 						self.adjust_discount_amount_loss(tax)
 
 	def round_off_totals(self, tax):
@@ -308,10 +306,10 @@
 			current_tax_amount = (tax_rate / 100.0) * item.base_amount
 		elif tax.charge_type == "On Previous Row Amount":
 			current_tax_amount = (tax_rate / 100.0) * \
-				self.tax_doclist[cint(tax.row_id) - 1].tax_amount_for_current_item
+				self.get("taxes")[cint(tax.row_id) - 1].tax_amount_for_current_item
 		elif tax.charge_type == "On Previous Row Total":
 			current_tax_amount = (tax_rate / 100.0) * \
-				self.tax_doclist[cint(tax.row_id) - 1].grand_total_for_current_item
+				self.get("taxes")[cint(tax.row_id) - 1].grand_total_for_current_item
 
 		current_tax_amount = flt(current_tax_amount, self.precision("tax_amount", tax))
 
@@ -335,7 +333,7 @@
 			return tax.rate
 
 	def _cleanup(self):
-		for tax in self.tax_doclist:
+		for tax in self.get("taxes"):
 			tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
 
 	def _set_in_company_currency(self, item, print_field, base_field):
@@ -461,7 +459,7 @@
 				else:
 					already_billed = frappe.db.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'),
+						(based_on, self.doctype + " Item", item_ref_dn, '%s', '%s'),
 						(item.get(item_ref_dn), self.name))[0][0]
 
 					total_billed_amt = flt(flt(already_billed) + flt(item.get(based_on)),
@@ -481,7 +479,7 @@
 
 	def get_stock_items(self):
 		stock_items = []
-		item_codes = list(set(item.item_code for item in self.get(self.fname)))
+		item_codes = list(set(item.item_code for item in self.get("items")))
 		if item_codes:
 			stock_items = [r[0] for r in frappe.db.sql("""select name
 				from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index af6f728..c3f449c 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -14,9 +14,9 @@
 
 class BuyingController(StockController):
 	def __setup__(self):
-		if hasattr(self, "fname"):
+		if hasattr(self, "items"):
 			self.table_print_templates = {
-				self.fname: "templates/print_formats/includes/item_grid.html",
+				"items": "templates/print_formats/includes/item_grid.html",
 				"taxes": "templates/print_formats/includes/taxes.html",
 			}
 
@@ -50,7 +50,7 @@
 
 	def set_supplier_from_item_default(self):
 		if self.meta.get_field("supplier") and not self.supplier:
-			for d in self.get(self.fname):
+			for d in self.get("items"):
 				supplier = frappe.db.get_value("Item", d.item_code, "default_supplier")
 				if supplier:
 					self.supplier = supplier
@@ -60,7 +60,7 @@
 		from erpnext.stock.utils import validate_warehouse_company
 
 		warehouses = list(set([d.warehouse for d in
-			self.get(self.fname) if getattr(d, "warehouse", None)]))
+			self.get("items") if getattr(d, "warehouse", None)]))
 
 		for w in warehouses:
 			validate_warehouse_company(w, self.company)
@@ -82,12 +82,11 @@
 		 		self.currency)
 
 	def calculate_taxes_and_totals(self):
-		self.other_fname = "taxes"
 		super(BuyingController, self).calculate_taxes_and_totals()
 		self.calculate_total_advance("Purchase Invoice", "advances")
 
 	def calculate_item_values(self):
-		for item in self.item_doclist:
+		for item in self.get("items"):
 			self.round_floats_in(item)
 
 			if item.discount_percentage == 100.0:
@@ -108,14 +107,14 @@
 	def calculate_net_total(self):
 		self.net_total = self.net_total_import = 0.0
 
-		for item in self.item_doclist:
+		for item in self.get("items"):
 			self.net_total += item.base_amount
 			self.net_total_import += item.amount
 
 		self.round_floats_in(self, ["net_total", "net_total_import"])
 
 	def calculate_totals(self):
-		self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
+		self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
 		self.grand_total_import = flt(self.grand_total / self.conversion_rate)
 
 		self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
@@ -130,12 +129,12 @@
 			self.rounded_total_import = rounded(self.grand_total_import)
 
 		if self.meta.get_field("other_charges_added"):
-			self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
+			self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
 				if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
 				self.precision("other_charges_added"))
 
 		if self.meta.get_field("other_charges_deducted"):
-			self.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
+			self.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.get("taxes")
 				if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
 				self.precision("other_charges_deducted"))
 
@@ -216,12 +215,12 @@
 			if self.doctype == "Purchase Receipt" and not self.supplier_warehouse:
 				frappe.throw(_("Supplier Warehouse mandatory for sub-contracted Purchase Receipt"))
 
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				if item in self.sub_contracted_items and not item.bom:
 					frappe.throw(_("Please select BOM in BOM field for Item {0}").format(item.item_code))
 
 		else:
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				if item.bom:
 					item.bom = None
 
@@ -229,7 +228,7 @@
 		if self.is_subcontracted=="Yes":
 			parent_items = []
 			rm_supplied_idx = 0
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				if self.doctype == "Purchase Receipt":
 					item.rm_supp_cost = 0.0
 				if item.item_code in self.sub_contracted_items:
@@ -241,7 +240,7 @@
 			self.cleanup_raw_materials_supplied(parent_items, raw_material_table)
 
 		elif self.doctype == "Purchase Receipt":
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				item.rm_supp_cost = 0.0
 
 	def update_raw_materials_supplied(self, item, raw_material_table, rm_supplied_idx):
@@ -336,7 +335,7 @@
 		if not hasattr(self, "_sub_contracted_items"):
 			self._sub_contracted_items = []
 			item_codes = list(set(item.item_code for item in
-				self.get(self.fname)))
+				self.get("items")))
 			if item_codes:
 				self._sub_contracted_items = [r[0] for r in frappe.db.sql("""select name
 					from `tabItem` where name in (%s) and is_sub_contracted_item='Yes'""" % \
@@ -349,7 +348,7 @@
 		if not hasattr(self, "_purchase_items"):
 			self._purchase_items = []
 			item_codes = list(set(item.item_code for item in
-				self.get(self.fname)))
+				self.get("items")))
 			if item_codes:
 				self._purchase_items = [r[0] for r in frappe.db.sql("""select name
 					from `tabItem` where name in (%s) and is_purchase_item='Yes'""" % \
@@ -359,11 +358,11 @@
 
 
 	def is_item_table_empty(self):
-		if not len(self.get(self.fname)):
+		if not len(self.get("items")):
 			frappe.throw(_("Item table can not be blank"))
 
 	def set_qty_as_per_stock_uom(self):
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			if d.meta.get_field("stock_qty") and not d.stock_qty:
 				if not d.conversion_factor:
 					frappe.throw(_("Row {0}: Conversion Factor is mandatory"))
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 513507d..937e026 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -12,9 +12,9 @@
 
 class SellingController(StockController):
 	def __setup__(self):
-		if hasattr(self, "fname"):
+		if hasattr(self, "items"):
 			self.table_print_templates = {
-				self.fname: "templates/print_formats/includes/item_grid.html",
+				"items": "templates/print_formats/includes/item_grid.html",
 				"taxes": "templates/print_formats/includes/taxes.html",
 			}
 
@@ -24,7 +24,7 @@
 
 	def onload(self):
 		if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				item.update(get_available_qty(item.item_code,
 					item.warehouse))
 
@@ -124,8 +124,6 @@
 				self.grand_total_export or self.rounded_total_export, self.currency)
 
 	def calculate_taxes_and_totals(self):
-		self.other_fname = "taxes"
-
 		super(SellingController, self).calculate_taxes_and_totals()
 
 		self.calculate_total_advance("Sales Invoice", "advances")
@@ -133,21 +131,21 @@
 		self.calculate_contribution()
 
 	def determine_exclusive_rate(self):
-		if not any((cint(tax.included_in_print_rate) for tax in self.tax_doclist)):
+		if not any((cint(tax.included_in_print_rate) for tax in self.get("taxes"))):
 			# no inclusive tax
 			return
 
-		for item in self.item_doclist:
+		for item in self.get("items"):
 			item_tax_map = self._load_item_tax_rate(item.item_tax_rate)
 			cumulated_tax_fraction = 0
-			for i, tax in enumerate(self.tax_doclist):
+			for i, tax in enumerate(self.get("taxes")):
 				tax.tax_fraction_for_current_item = self.get_current_tax_fraction(tax, item_tax_map)
 
 				if i==0:
 					tax.grand_total_fraction_for_current_item = 1 + tax.tax_fraction_for_current_item
 				else:
 					tax.grand_total_fraction_for_current_item = \
-						self.tax_doclist[i-1].grand_total_fraction_for_current_item \
+						self.get("taxes")[i-1].grand_total_fraction_for_current_item \
 						+ tax.tax_fraction_for_current_item
 
 				cumulated_tax_fraction += tax.tax_fraction_for_current_item
@@ -181,17 +179,17 @@
 
 			elif tax.charge_type == "On Previous Row Amount":
 				current_tax_fraction = (tax_rate / 100.0) * \
-					self.tax_doclist[cint(tax.row_id) - 1].tax_fraction_for_current_item
+					self.get("taxes")[cint(tax.row_id) - 1].tax_fraction_for_current_item
 
 			elif tax.charge_type == "On Previous Row Total":
 				current_tax_fraction = (tax_rate / 100.0) * \
-					self.tax_doclist[cint(tax.row_id) - 1].grand_total_fraction_for_current_item
+					self.get("taxes")[cint(tax.row_id) - 1].grand_total_fraction_for_current_item
 
 		return current_tax_fraction
 
 	def calculate_item_values(self):
 		if not self.discount_amount_applied:
-			for item in self.item_doclist:
+			for item in self.get("items"):
 				self.round_floats_in(item)
 
 				if item.discount_percentage == 100:
@@ -210,14 +208,14 @@
 	def calculate_net_total(self):
 		self.net_total = self.net_total_export = 0.0
 
-		for item in self.item_doclist:
+		for item in self.get("items"):
 			self.net_total += item.base_amount
 			self.net_total_export += item.amount
 
 		self.round_floats_in(self, ["net_total", "net_total_export"])
 
 	def calculate_totals(self):
-		self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
+		self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
 
 		self.grand_total_export = flt(self.grand_total / self.conversion_rate)
 
@@ -238,7 +236,7 @@
 
 			if grand_total_for_discount_amount:
 				# calculate item amount after Discount Amount
-				for item in self.item_doclist:
+				for item in self.get("items"):
 					distributed_amount = flt(self.discount_amount) * item.base_amount / grand_total_for_discount_amount
 					item.base_amount = flt(item.base_amount - distributed_amount, self.precision("base_amount", item))
 
@@ -248,7 +246,7 @@
 	def get_grand_total_for_discount_amount(self):
 		actual_taxes_dict = {}
 
-		for tax in self.tax_doclist:
+		for tax in self.get("taxes"):
 			if tax.charge_type == "Actual":
 				actual_taxes_dict.setdefault(tax.idx, tax.tax_amount)
 			elif tax.row_id in actual_taxes_dict:
@@ -306,7 +304,7 @@
 			throw(_("Order Type must be one of {0}").format(comma_or(valid_types)))
 
 	def validate_max_discount(self):
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			discount = flt(frappe.db.get_value("Item", d.item_code, "max_discount"))
 
 			if discount and flt(d.discount_percentage) > discount:
@@ -314,7 +312,7 @@
 
 	def get_item_list(self):
 		il = []
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			reserved_warehouse = ""
 			reserved_qty_for_main_item = 0
 
@@ -390,14 +388,14 @@
 		return so_qty, so_warehouse
 
 	def check_stop_sales_order(self, ref_fieldname):
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			if d.get(ref_fieldname):
 				status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status")
 				if status == "Stopped":
 					frappe.throw(_("Sales Order {0} is stopped").format(d.get(ref_fieldname)))
 
 def check_active_sales_items(obj):
-	for d in obj.get(obj.fname):
+	for d in obj.get("items"):
 		if d.item_code:
 			item = frappe.db.sql("""select docstatus, is_sales_item,
 				is_service_item, income_account from tabItem where name = %s""",
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index f719c5d..4b4be79 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -77,7 +77,7 @@
 			return [frappe._dict({ "name": voucher_detail_no, "expense_account": default_expense_account,
 				"cost_center": default_cost_center }) for voucher_detail_no, sle in sle_map.items()]
 		else:
-			details = self.get(self.fname)
+			details = self.get("items")
 
 			if default_expense_account or default_cost_center:
 				for d in details:
@@ -91,8 +91,8 @@
 	def get_items_and_warehouses(self):
 		items, warehouses = [], []
 
-		if hasattr(self, "fname"):
-			item_doclist = self.get(self.fname)
+		if hasattr(self, "items"):
+			item_doclist = self.get("items")
 		elif self.doctype == "Stock Reconciliation":
 			import json
 			item_doclist = []
@@ -208,7 +208,7 @@
 
 	def get_serialized_items(self):
 		serialized_items = []
-		item_codes = list(set([d.item_code for d in self.get(self.fname)]))
+		item_codes = list(set([d.item_code for d in self.get("items")]))
 		if item_codes:
 			serialized_items = frappe.db.sql_list("""select name from `tabItem`
 				where has_serial_no='Yes' and name in ({})""".format(", ".join(["%s"]*len(item_codes))),
diff --git a/erpnext/public/js/controllers/stock_controller.js b/erpnext/public/js/controllers/stock_controller.js
index 1b472f1..9595e23 100644
--- a/erpnext/public/js/controllers/stock_controller.js
+++ b/erpnext/public/js/controllers/stock_controller.js
@@ -75,11 +75,11 @@
 	copy_account_in_all_row: function(doc, dt, dn, fieldname) {
 		var d = locals[dt][dn];
 		if(d[fieldname]){
-			var cl = doc[this.frm.cscript.fname] || [];
+			var cl = doc["items"] || [];
 			for(var i = 0; i < cl.length; i++) {
 				if(!cl[i][fieldname]) cl[i][fieldname] = d[fieldname];
 			}
 		}
-		refresh_field(this.frm.cscript.fname);
+		refresh_field("items");
 	}
 });
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index a261649..f0f4b5d 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -33,22 +33,22 @@
 			}
 		}
 
-		if(this.other_fname) {
-			this[this.other_fname + "_remove"] = this.calculate_taxes_and_totals;
+		if(this.frm.fields_dict["taxes"]) {
+			this["taxes_remove"] = this.calculate_taxes_and_totals;
 		}
 
-		if(this.fname) {
-			this[this.fname + "_remove"] = this.calculate_taxes_and_totals;
+		if(this.frm.fields_dict["items"]) {
+			this["items_remove"] = this.calculate_taxes_and_totals;
 		}
 	},
 
 	onload_post_render: function() {
 		var me = this;
-		if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc[this.fname] && !this.frm.doc.is_pos) {
+		if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"] && !this.frm.doc.is_pos) {
 			this.calculate_taxes_and_totals();
 		}
-		if(frappe.meta.get_docfield(this.tname, "item_code")) {
-			cur_frm.get_field(this.fname).grid.set_multiple_add("item_code", "qty");
+		if(frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "item_code")) {
+			cur_frm.get_field("items").grid.set_multiple_add("item_code", "qty");
 		}
 	},
 
@@ -125,7 +125,7 @@
 		var item = frappe.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();
+				cur_frm.fields_dict["items"].grid.grid_rows[item.idx - 1].remove();
 			} else {
 				return this.frm.call({
 					method: "erpnext.stock.get_item_details.get_item_details",
@@ -224,13 +224,13 @@
 
 				me.frm.script_manager.trigger("currency");
 				me.apply_pricing_rule();
-			}	
+			}
 		}
-		
+
 		if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
 		else var date = this.frm.doc.transaction_date;
 		erpnext.get_fiscal_year(this.frm.doc.company, date, fn);
-		
+
 		erpnext.get_letter_head(this.frm.doc.company);
 	},
 
@@ -593,11 +593,11 @@
 	},
 
 	get_item_doclist: function() {
-		return this.frm.doc[this.fname] || [];
+		return this.frm.doc["items"] || [];
 	},
 
 	get_tax_doclist: function() {
-		return this.frm.doc[this.other_fname] || [];
+		return this.frm.doc["taxes"] || [];
 	},
 
 	validate_conversion_rate: function() {
@@ -828,11 +828,11 @@
 					"master_doctype": frappe.meta.get_docfield(this.frm.doc.doctype, "taxes_and_charges",
 						this.frm.doc.name).options,
 					"master_name": this.frm.doc.taxes_and_charges,
-					"tax_parentfield": this.other_fname
+					"tax_parentfield": "taxes"
 				},
 				callback: function(r) {
 					if(!r.exc) {
-						me.frm.set_value(me.other_fname, r.message);
+						me.frm.set_value("taxes", r.message);
 						me.calculate_taxes_and_totals();
 					}
 				}
diff --git a/erpnext/selling/doctype/installation_note/installation_note.js b/erpnext/selling/doctype/installation_note/installation_note.js
index d2b606d..477647e 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.js
+++ b/erpnext/selling/doctype/installation_note/installation_note.js
@@ -1,9 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.tname = "Installation Note Item";
-cur_frm.cscript.fname = "items";
-
 frappe.require("assets/erpnext/js/utils.js");
 
 frappe.ui.form.on_change("Installation Note", "customer",
@@ -77,4 +74,4 @@
 
 cur_frm.cscript.inst_date = function(doc, cdt, cdn){
 	erpnext.get_fiscal_year(doc.company, doc.inst_date);
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index 08feeb4..4aba9ab 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -12,9 +12,6 @@
 from erpnext.utilities.transaction_base import TransactionBase
 
 class InstallationNote(TransactionBase):
-	tname = 'Installation Note Item'
-	fname = 'items'
-
 	def __init__(self, arg1, arg2=None):
 		super(InstallationNote, self).__init__(arg1, arg2)
 		self.status_updater = [{
diff --git a/erpnext/selling/doctype/opportunity/opportunity.py b/erpnext/selling/doctype/opportunity/opportunity.py
index 338d35d..693e978 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.py
+++ b/erpnext/selling/doctype/opportunity/opportunity.py
@@ -10,9 +10,6 @@
 from erpnext.utilities.transaction_base import TransactionBase
 
 class Opportunity(TransactionBase):
-	fname = 'enq_details'
-	tname = 'Opportunity Item'
-
 	def get_item_details(self, item_code):
 		item = frappe.db.sql("""select item_name, stock_uom, description_html, description, item_group, brand
 			from `tabItem` where name = %s""", item_code, as_dict=1)
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index c9e7614..b14e0f7 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -1,12 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-// Module CRM
-// =====================================================================================
-cur_frm.cscript.tname = "Quotation Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-cur_frm.cscript.sales_team_fname = "sales_team";
 
 {% include 'selling/sales_common.js' %}
 {% include 'accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js' %}
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 43c31c6..e4d7cc8 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -14,9 +14,6 @@
 }
 
 class Quotation(SellingController):
-	tname = 'Quotation Item'
-	fname = 'items'
-
 	def validate(self):
 		super(Quotation, self).validate()
 		self.set_status()
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index eff37ca..02f2eb6 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -1,13 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-// Module CRM
-
-cur_frm.cscript.tname = "Sales Order Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-cur_frm.cscript.sales_team_fname = "sales_team";
-
 {% include 'selling/sales_common.js' %}
 {% include 'accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js' %}
 {% include 'accounts/doctype/sales_invoice/pos.js' %}
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 0035f91..da53521 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -15,12 +15,6 @@
 }
 
 class SalesOrder(SellingController):
-	tname = 'Sales Order Item'
-	fname = 'items'
-	person_tname = 'Target Detail'
-	partner_tname = 'Partner Target Detail'
-	territory_tname = 'Territory Target Detail'
-
 	def validate_mandatory(self):
 		# validate transaction date v/s delivery date
 		if self.delivery_date:
@@ -122,13 +116,13 @@
 		from erpnext.stock.utils import validate_warehouse_company
 
 		warehouses = list(set([d.warehouse for d in
-			self.get(self.fname) if d.warehouse]))
+			self.get("items") if d.warehouse]))
 
 		for w in warehouses:
 			validate_warehouse_company(w, self.company)
 
 	def validate_with_previous_doc(self):
-		super(SalesOrder, self).validate_with_previous_doc(self.tname, {
+		super(SalesOrder, self).validate_with_previous_doc({
 			"Quotation": {
 				"ref_dn_field": "prevdoc_docname",
 				"compare_fields": [["company", "="], ["currency", "="]]
@@ -142,7 +136,7 @@
 			frappe.db.sql("update `tabOpportunity` set status = %s where name=%s",(flag,enq[0][0]))
 
 	def update_prevdoc_status(self, flag):
-		for quotation in list(set([d.prevdoc_docname for d in self.get(self.fname)])):
+		for quotation in list(set([d.prevdoc_docname for d in self.get("items")])):
 			if quotation:
 				doc = frappe.get_doc("Quotation", quotation)
 				if doc.docstatus==2:
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 6df14ea..490eec0 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -1,12 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-// Preset
-// ------
-// cur_frm.cscript.tname - Details table name
-// cur_frm.cscript.fname - Details fieldname
-// cur_frm.cscript.other_fname - fieldname
-// cur_frm.cscript.sales_team_fname - Sales Team fieldname
 
 frappe.provide("erpnext.selling");
 frappe.require("assets/erpnext/js/transaction.js");
@@ -23,7 +17,7 @@
 	},
 
 	onload_post_render: function() {
-		cur_frm.get_field(this.fname).grid.set_multiple_add("item_code", "qty");
+		cur_frm.get_field("items").grid.set_multiple_add("item_code", "qty");
 	},
 
 	setup_queries: function() {
@@ -58,12 +52,12 @@
 			});
 		}
 
-		if(!this.fname) {
+		if(!this.frm.fields_dict["items"]) {
 			return;
 		}
 
-		if(this.frm.fields_dict[this.fname].grid.get_field('item_code')) {
-			this.frm.set_query("item_code", this.fname, function() {
+		if(this.frm.fields_dict["items"].grid.get_field('item_code')) {
+			this.frm.set_query("item_code", "items", function() {
 				return {
 					query: "erpnext.controllers.queries.item_query",
 					filters: (me.frm.doc.order_type === "Maintenance" ?
@@ -73,8 +67,8 @@
 			});
 		}
 
-		if(this.frm.fields_dict[this.fname].grid.get_field('batch_no')) {
-			this.frm.set_query("batch_no", this.fname, function(doc, cdt, cdn) {
+		if(this.frm.fields_dict["items"].grid.get_field('batch_no')) {
+			this.frm.set_query("batch_no", "items", function(doc, cdt, cdn) {
 				var item = frappe.get_doc(cdt, cdn);
 				if(!item.item_code) {
 					frappe.throw(__("Please enter Item Code to get batch no"));
@@ -231,7 +225,7 @@
 	},
 
 	toggle_editable_price_list_rate: function() {
-		var df = frappe.meta.get_docfield(this.tname, "price_list_rate", this.frm.doc.name);
+		var df = frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "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) {
@@ -555,10 +549,10 @@
 		}
 
 		setup_field_label_map(["base_rate", "base_price_list_rate", "base_amount"],
-			company_currency, this.fname);
+			company_currency, "items");
 
 		setup_field_label_map(["rate", "price_list_rate", "amount"],
-			this.frm.doc.currency, this.fname);
+			this.frm.doc.currency, "items");
 
 		setup_field_label_map(["tax_amount", "total"], company_currency, "taxes");
 
@@ -568,7 +562,7 @@
 		}
 
 		// toggle columns
-		var item_grid = this.frm.fields_dict[this.fname].grid;
+		var item_grid = this.frm.fields_dict["items"].grid;
 		var show = (this.frm.doc.currency != company_currency) ||
 			((cur_frm.doc.taxes || []).filter(
 					function(d) { return d.included_in_print_rate===1}).length);
@@ -595,7 +589,7 @@
 			args: {	project_name: frm.doc.project_name	},
 			callback: function(r, rt) {
 				if(!r.exc) {
-					$.each(frm.doc[cur_frm.cscript.fname] || [], function(i, row) {
+					$.each(frm.doc["items"] || [], function(i, row) {
 						frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
 						msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
 					})
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index 8e7b0ce..591a6fc 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -88,7 +88,7 @@
 				add_cond = " and master_name = '"+cstr(customer).replace("'", "\\'")+"'"
 		if based_on == 'Itemwise Discount':
 			if doc_obj:
-				for t in doc_obj.get(doc_obj.fname):
+				for t in doc_obj.get("items"):
 					self.validate_auth_rule(doctype_name, t.discount_percentage, based_on, add_cond, company,t.item_code )
 		else:
 			self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company)
@@ -97,7 +97,7 @@
 		av_dis = 0
 		if doc_obj:
 			price_list_rate, base_rate = 0, 0
-			for d in doc_obj.get(doc_obj.fname):
+			for d in doc_obj.get("items"):
 				if d.base_price_list_rate and d.base_rate:
 					price_list_rate += flt(d.base_price_list_rate)
 					base_rate += flt(d.base_rate)
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index bc34bb0..078aa7c 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -1,12 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-// Module Material Management
-cur_frm.cscript.tname = "Delivery Note Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-cur_frm.cscript.sales_team_fname = "sales_team";
-
 {% include 'selling/sales_common.js' %};
 {% include 'accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js' %}
 {% include 'accounts/doctype/sales_invoice/pos.js' %}
@@ -46,7 +40,7 @@
 
 		// unhide expense_account and cost_center is auto_accounting_for_stock enabled
 		var aii_enabled = cint(sys_defaults.auto_accounting_for_stock)
-		cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(["expense_account", "cost_center"], aii_enabled);
+		cur_frm.fields_dict["items"].grid.set_column_disp(["expense_account", "cost_center"], aii_enabled);
 
 		if (this.frm.doc.docstatus===0) {
 			cur_frm.add_custom_button(__('From Sales Order'),
@@ -205,12 +199,12 @@
 	cur_frm.cscript.expense_account = function(doc, cdt, cdn){
 		var d = locals[cdt][cdn];
 		if(d.expense_account) {
-			var cl = doc[cur_frm.cscript.fname] || [];
+			var cl = doc["items"] || [];
 			for(var i = 0; i < cl.length; i++){
 				if(!cl[i].expense_account) cl[i].expense_account = d.expense_account;
 			}
 		}
-		refresh_field(cur_frm.cscript.fname);
+		refresh_field("items");
 	}
 
 	// expense account
@@ -228,12 +222,12 @@
 	cur_frm.cscript.cost_center = function(doc, cdt, cdn){
 		var d = locals[cdt][cdn];
 		if(d.cost_center) {
-			var cl = doc[cur_frm.cscript.fname] || [];
+			var cl = doc["items"] || [];
 			for(var i = 0; i < cl.length; i++){
 				if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
 			}
 		}
-		refresh_field(cur_frm.cscript.fname);
+		refresh_field("items");
 	}
 
 	cur_frm.fields_dict.items.grid.get_field("cost_center").get_query = function(doc) {
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 53469e0..4c73b3b 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -17,9 +17,6 @@
 }
 
 class DeliveryNote(SellingController):
-	tname = 'Delivery Note Item'
-	fname = 'items'
-
 	def __init__(self, arg1, arg2=None):
 		super(DeliveryNote, self).__init__(arg1, arg2)
 		self.status_updater = [{
@@ -38,7 +35,7 @@
 			'second_source_field': 'qty',
 			'second_join_field': 'so_detail',
 			'overflow_type': 'delivery',
-			'second_source_extra_cond': """ and exists(select name from `tabSales Invoice` 
+			'second_source_extra_cond': """ and exists(select name from `tabSales Invoice`
 				where name=`tabSales Invoice Item`.parent and ifnull(update_stock, 0) = 1)"""
 		},
 		{
@@ -122,7 +119,7 @@
 
 		for fn in (("Sales Order", "against_sales_order"), ("Sales Invoice", "against_sales_invoice")):
 			if filter(None, [getattr(d, fn[1], None) for d in items]):
-				super(DeliveryNote, self).validate_with_previous_doc(self.tname, {
+				super(DeliveryNote, self).validate_with_previous_doc({
 					fn[0]: {
 						"ref_dn_field": fn[1],
 						"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
@@ -131,7 +128,7 @@
 				})
 
 				if cint(frappe.defaults.get_global_default('maintain_same_sales_rate')):
-					super(DeliveryNote, self).validate_with_previous_doc(self.tname, {
+					super(DeliveryNote, self).validate_with_previous_doc({
 						fn[0] + " Item": {
 							"ref_dn_field": "so_detail",
 							"compare_fields": [["rate", "="]],
@@ -222,10 +219,10 @@
 		"""
 			Validate that if packed qty exists, it should be equal to qty
 		"""
-		if not any([flt(d.get('packed_qty')) for d in self.get(self.fname)]):
+		if not any([flt(d.get('packed_qty')) for d in self.get("items")]):
 			return
 		has_error = False
-		for d in self.get(self.fname):
+		for d in self.get("items"):
 			if flt(d.get('qty')) != flt(d.get('packed_qty')):
 				frappe.msgprint(_("Packed quantity must equal quantity for Item {0} in row {1}").format(d.item_code, d.idx))
 				has_error = True
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 13df2e4..f83c50f 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -1,9 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.tname = "Material Request Item";
-cur_frm.cscript.fname = "items";
-
 {% include 'buying/doctype/purchase_common/purchase_common.js' %};
 
 frappe.require("assets/erpnext/js/utils.js");
@@ -11,7 +8,7 @@
 erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.extend({
 	onload: function(doc) {
 		this._super();
-		this.frm.set_query("item_code", this.frm.cscript.fname, function() {
+		this.frm.set_query("item_code", "items", function() {
 			return {
 				query: "erpnext.controllers.queries.item_query"
 			}
@@ -45,7 +42,7 @@
 			if(doc.material_request_type === "Material Transfer" && doc.status === "Submitted")
 				cur_frm.add_custom_button(__("Transfer Material"), this.make_stock_entry,
 					frappe.boot.doctype_icons["Stock Entry"]);
-		
+
 			if(doc.material_request_type === "Material Issue" && doc.status === "Submitted")
 				cur_frm.add_custom_button(__("Issue Material"), this.make_stock_entry,
 					frappe.boot.doctype_icons["Stock Entry"]);
@@ -200,4 +197,4 @@
 cur_frm.cscript.send_sms = function() {
 	frappe.require("assets/erpnext/js/sms_manager.js");
 	var sms_man = new SMSManager(cur_frm.doc);
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index d5e6c8f..32f6e8c 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -18,9 +18,6 @@
 }
 
 class MaterialRequest(BuyingController):
-	tname = 'Material Request Item'
-	fname = 'items'
-
 	def get_feed(self):
 		return _("{0}: {1}").format(self.status, self.material_request_type)
 
@@ -115,13 +112,13 @@
 		if self.material_request_type == "Purchase":
 			return
 
-		item_doclist = self.get("items")
+		self.get("items") = self.get("items")
 
 		if not mr_items:
-			mr_items = [d.name for d in item_doclist]
+			mr_items = [d.name for d in self.get("items")]
 
 		per_ordered = 0.0
-		for d in item_doclist:
+		for d in self.get("items"):
 			if d.name in mr_items:
 				d.ordered_qty =  flt(frappe.db.sql("""select sum(transfer_qty)
 					from `tabStock Entry Detail` where material_request = %s
@@ -129,14 +126,14 @@
 					(self.name, d.name))[0][0])
 				frappe.db.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)
+			# note: if qty is 0, its row is still counted in len(self.get("items"))
 			# hence adding 1 to per_ordered
 			if (d.ordered_qty > d.qty) or not d.qty:
 				per_ordered += 1.0
 			elif d.qty > 0:
 				per_ordered += flt(d.ordered_qty / flt(d.qty))
 
-		self.per_ordered = flt((per_ordered / flt(len(item_doclist))) * 100.0, 2)
+		self.per_ordered = flt((per_ordered / flt(len(self.get("items")))) * 100.0, 2)
 		frappe.db.set_value(self.doctype, self.name, "per_ordered", self.per_ordered)
 
 	def update_requested_qty(self, mr_item_rows=None):
@@ -301,7 +298,7 @@
 		target.qty = qty
 		target.transfer_qty = qty
 		target.conversion_factor = 1
-		
+
 		if source_parent.material_request_type == "Material Transfer":
 			target.t_warehouse = obj.warehouse
 		else:
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 616f66a..31033e0 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -1,10 +1,6 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.tname = "Purchase Receipt Item";
-cur_frm.cscript.fname = "items";
-cur_frm.cscript.other_fname = "taxes";
-
 {% 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' %}
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 1a8f413..bfb2eaf 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -16,9 +16,6 @@
 }
 
 class PurchaseReceipt(BuyingController):
-	tname = 'Purchase Receipt Item'
-	fname = 'items'
-
 	def __init__(self, arg1, arg2=None):
 		super(PurchaseReceipt, self).__init__(arg1, arg2)
 		self.status_updater = [{
@@ -101,7 +98,7 @@
 
 
 	def validate_with_previous_doc(self):
-		super(PurchaseReceipt, self).validate_with_previous_doc(self.tname, {
+		super(PurchaseReceipt, self).validate_with_previous_doc({
 			"Purchase Order": {
 				"ref_dn_field": "prevdoc_docname",
 				"compare_fields": [["supplier", "="], ["company", "="],	["currency", "="]],
@@ -114,7 +111,7 @@
 		})
 
 		if cint(frappe.defaults.get_global_default('maintain_same_rate')):
-			super(PurchaseReceipt, self).validate_with_previous_doc(self.tname, {
+			super(PurchaseReceipt, self).validate_with_previous_doc({
 				"Purchase Order Item": {
 					"ref_dn_field": "prevdoc_detail_docname",
 					"compare_fields": [["rate", "="]],
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 8d7b474..66256da 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -1,8 +1,5 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt
 
-cur_frm.cscript.tname = "Stock Entry Detail";
-cur_frm.cscript.fname = "items";
-
 frappe.require("assets/erpnext/js/controllers/stock_controller.js");
 frappe.require("assets/erpnext/js/utils.js");
 frappe.provide("erpnext.stock");
@@ -56,7 +53,7 @@
 	},
 
 	onload_post_render: function() {
-		cur_frm.get_field(this.fname).grid.set_multiple_add("item_code", "qty");
+		cur_frm.get_field("items").grid.set_multiple_add("item_code", "qty");
 		this.set_default_account();
 	},
 
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index eb006cc..2f7ca42 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -26,14 +26,12 @@
 }
 
 class StockEntry(StockController):
-	fname = 'items'
-
 	def get_feed(self):
 		return _("From {0} to {1}").format(self.from_warehouse, self.to_warehouse)
 
 	def onload(self):
 		if self.docstatus==1:
-			for item in self.get(self.fname):
+			for item in self.get("items"):
 				item.update(get_available_qty(item.item_code,
 					item.s_warehouse))
 
@@ -869,7 +867,7 @@
 	account = None
 	if not getattr(ref_item, "income_account", None):
 		if ref_item.parent_item:
-			parent_item = doc.get(doc.fname, {"item_code": ref_item.parent_item})[0]
+			parent_item = doc.get("items", {"item_code": ref_item.parent_item})[0]
 			account = parent_item.income_account
 	else:
 		account = ref_item.income_account
@@ -944,7 +942,7 @@
 
 	if not invoice_against_receipt:
 		purchase_orders_against_receipt = [d.prevdoc_docname for d in
-			ref.doc.get(ref.doc.fname, {"prevdoc_doctype": "Purchase Order"})
+			ref.doc.get("items", {"prevdoc_doctype": "Purchase Order"})
 			if getattr(d, "prevdoc_docname", None)]
 
 		if purchase_orders_against_receipt:
diff --git a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
index cf5d171..cbcc796 100644
--- a/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -107,7 +107,6 @@
 }
 
 cur_frm.cscript.item_code = function(doc, cdt, cdn) {
-	var fname = cur_frm.cscript.fname;
 	var d = locals[cdt][cdn];
 	if (d.item_code) {
 		return get_server_fields('get_item_details', d.item_code, 'items',
diff --git a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
index 675ecd3..c58b2ee 100644
--- a/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
+++ b/erpnext/support/doctype/maintenance_visit/maintenance_visit.js
@@ -82,7 +82,6 @@
 }
 
 cur_frm.cscript.item_code = function(doc, cdt, cdn) {
-	var fname = cur_frm.cscript.fname;
 	var d = locals[cdt][cdn];
 	if (d.item_code) {
 		return get_server_fields('get_item_details',d.item_code, 'purposes',doc,cdt,cdn,1);
@@ -100,4 +99,4 @@
 
 cur_frm.cscript.mntc_date = function(doc, cdt, cdn){
 	erpnext.get_fiscal_year(doc.company, doc.mntc_date);
-}
\ No newline at end of file
+}
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 8306eac..2c99b00 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -58,12 +58,12 @@
 	def validate_uom_is_integer(self, uom_field, qty_fields):
 		validate_uom_is_integer(self, uom_field, qty_fields)
 
-	def validate_with_previous_doc(self, source_dt, ref):
+	def validate_with_previous_doc(self, ref):
 		for key, val in ref.items():
 			is_child = val.get("is_child_table")
 			ref_doc = {}
 			item_ref_dn = []
-			for d in self.get_all_children(source_dt):
+			for d in self.get_all_children(self.doctype + " Item"):
 				ref_dn = d.get(val["ref_dn_field"])
 				if ref_dn:
 					if is_child: