model_wrapper is now bean, refactoring defaults
diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index 05c0432..980af58 100644
--- a/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr, flt, getdate, now, nowdate
 from webnotes.model import db_exists
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/accounts/doctype/budget_distribution/budget_distribution.py b/accounts/doctype/budget_distribution/budget_distribution.py
index 976fa84..f2fff5a 100644
--- a/accounts/doctype/budget_distribution/budget_distribution.py
+++ b/accounts/doctype/budget_distribution/budget_distribution.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import flt
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import msgprint
 
 class DocType:
diff --git a/accounts/doctype/c_form/c_form.py b/accounts/doctype/c_form/c_form.py
index 2636b0c..e574708 100644
--- a/accounts/doctype/c_form/c_form.py
+++ b/accounts/doctype/c_form/c_form.py
@@ -18,7 +18,7 @@
 import webnotes
 from webnotes.utils import flt, getdate
 from webnotes.model.doc import make_autoname
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 
 class DocType:
 	def __init__(self,d,dl):
diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py
index d23b086..8340a8b 100644
--- a/accounts/doctype/cost_center/cost_center.py
+++ b/accounts/doctype/cost_center/cost_center.py
@@ -16,7 +16,7 @@
 
 from __future__ import unicode_literals
 import webnotes
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import msgprint
 
 from webnotes.utils.nestedset import DocTypeNestedSet
diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py
index 4408068..2acf08e 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/accounts/doctype/journal_voucher/journal_voucher.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
 from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 from setup.utils import get_company_currency
diff --git a/accounts/doctype/mis_control/mis_control.py b/accounts/doctype/mis_control/mis_control.py
index 953fed0..6d4a852 100644
--- a/accounts/doctype/mis_control/mis_control.py
+++ b/accounts/doctype/mis_control/mis_control.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cint, cstr, flt, get_defaults, get_first_day, get_last_day, has_common
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import session, msgprint
 
 sql = webnotes.conn.sql
diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
index b75142b..ba4dec3 100644
--- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
+++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import flt
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import msgprint
 
 class DocType:
diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 80e993a..9269661 100644
--- a/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr, flt, getdate
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/accounts/doctype/pos_setting/pos_setting.py b/accounts/doctype/pos_setting/pos_setting.py
index 7f820fe..0e68e2a 100755
--- a/accounts/doctype/pos_setting/pos_setting.py
+++ b/accounts/doctype/pos_setting/pos_setting.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py
index f1c5758..3043ed3 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import add_days, cint, cstr, flt, formatdate, get_defaults
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint, _
 from setup.utils import get_company_currency
diff --git a/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 825c7d0..62296bf 100644
--- a/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -25,7 +25,7 @@
 
 class TestPurchaseInvoice(unittest.TestCase):
 	def test_gl_entries(self):
-		wrapper = webnotes.model_wrapper(self.get_test_doclist())
+		wrapper = webnotes.bean(self.get_test_doclist())
 		
 		# circumvent the disabled calculation call
 		obj = webnotes.get_obj(doc=wrapper.doc, doclist=wrapper.doclist)
@@ -54,7 +54,7 @@
 			self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
 			
 	def test_purchase_invoice_calculation(self):
-		wrapper = webnotes.model_wrapper(self.get_test_doclist())
+		wrapper = webnotes.bean(self.get_test_doclist())
 		
 		# circumvent the disabled calculation call
 		obj = webnotes.get_obj(doc=wrapper.doc, doclist=wrapper.doclist)
diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
index faf06fd..1250db5 100644
--- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
+++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 
 sql = webnotes.conn.sql
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index 8ffe17d..9973398 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -20,7 +20,7 @@
 from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdate, sendmail
 from webnotes.utils import comma_and
 from webnotes.model.doc import make_autoname
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import _, msgprint
 
@@ -858,7 +858,7 @@
 				where posting_date=%s and recurring_id=%s and docstatus=1""",
 				(next_date, recurring_id)):
 			try:
-				ref_wrapper = webnotes.model_wrapper('Sales Invoice', ref_invoice)
+				ref_wrapper = webnotes.bean('Sales Invoice', ref_invoice)
 				new_invoice_wrapper = make_new_invoice(ref_wrapper, next_date)
 				send_notification(new_invoice_wrapper)
 				webnotes.conn.commit()
@@ -880,7 +880,7 @@
 		raise Exception, exception_message
 
 def make_new_invoice(ref_wrapper, posting_date):
-	from webnotes.model.wrapper import clone
+	from webnotes.model.bean import clone
 	from accounts.utils import get_fiscal_year
 	new_invoice = clone(ref_wrapper)
 	
diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py
index c222c1a..6dcb713 100644
--- a/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -3,7 +3,7 @@
 
 class TestSalesInvoice(unittest.TestCase):
 	def make(self):
-		w = webnotes.model_wrapper(webnotes.copy_doclist(test_records[0]))
+		w = webnotes.bean(webnotes.copy_doclist(test_records[0]))
 		w.insert()
 		w.submit()
 		return w
@@ -17,7 +17,7 @@
 		from accounts.doctype.journal_voucher.test_journal_voucher \
 			import test_records as jv_test_records
 			
-		jv = webnotes.model_wrapper(webnotes.copy_doclist(jv_test_records[0]))
+		jv = webnotes.bean(webnotes.copy_doclist(jv_test_records[0]))
 		jv.doclist[1].against_invoice = w.doc.name
 		jv.insert()
 		jv.submit()
diff --git a/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py b/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py
index b8461bd..8c9f227 100755
--- a/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py
+++ b/accounts/doctype/trend_analyzer_control/trend_analyzer_control.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import add_days, add_months, cint, cstr
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py
index f99a078..b94864c 100644
--- a/accounts/page/voucher_import_tool/voucher_import_tool.py
+++ b/accounts/page/voucher_import_tool/voucher_import_tool.py
@@ -65,7 +65,7 @@
 
 def import_vouchers(common_values, data, start_idx, import_type):
 	from webnotes.model.doc import Document
-	from webnotes.model.wrapper import ModelWrapper
+	from webnotes.model.bean import Bean
 	from accounts.utils import get_fiscal_year
 	from webnotes.utils.dateutils import parse_date
 
@@ -159,7 +159,7 @@
 						If you entered accounts correctly, please check template once"""]
 					raise Exception
 					
-				doclist = ModelWrapper([jv]+details)
+				doclist = Bean([jv]+details)
 				doclist.submit()
 			
 				messages.append("""<p style='color: green'>[row #%s] 
diff --git a/accounts/utils.py b/accounts/utils.py
index 4c904ad..14ceb4e 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -121,7 +121,7 @@
 		args = webnotes.form_dict
 		args.pop("cmd")
 		
-	ac = webnotes.model_wrapper(args)
+	ac = webnotes.bean(args)
 	ac.doc.doctype = "Account"
 	ac.doc.old_parent = ""
 	ac.doc.freeze_account = "No"
@@ -135,7 +135,7 @@
 		args = webnotes.form_dict
 		args.pop("cmd")
 		
-	cc = webnotes.model_wrapper(args)
+	cc = webnotes.bean(args)
 	cc.doc.doctype = "Cost Center"
 	cc.doc.old_parent = ""
 	cc.ignore_permissions = 1
diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py
index a0133d6..6af08c6 100644
--- a/buying/doctype/purchase_common/purchase_common.py
+++ b/buying/doctype/purchase_common/purchase_common.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import add_days, cint, cstr, flt
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint, _
 
diff --git a/buying/doctype/purchase_order/purchase_order.py b/buying/doctype/purchase_order/purchase_order.py
index 053c70f..7581a68 100644
--- a/buying/doctype/purchase_order/purchase_order.py
+++ b/buying/doctype/purchase_order/purchase_order.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr, flt, get_defaults
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 from buying.utils import get_last_purchase_details
diff --git a/buying/doctype/quality_inspection/quality_inspection.py b/buying/doctype/quality_inspection/quality_inspection.py
index 415524f..336aabe 100644
--- a/buying/doctype/quality_inspection/quality_inspection.py
+++ b/buying/doctype/quality_inspection/quality_inspection.py
@@ -19,7 +19,7 @@
 
 from webnotes.model import db_exists
 from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/buying/doctype/supplier_quotation/supplier_quotation.py b/buying/doctype/supplier_quotation/supplier_quotation.py
index 28b8e14..0982fd6 100644
--- a/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -57,7 +57,7 @@
 				self.doc, self.doclist, """[['Material Request', 'Supplier Quotation'],
 				['Material Request Item', 'Supplier Quotation Item']]""")
 			
-			from webnotes.model.wrapper import getlist
+			from webnotes.model.bean import getlist
 			for d in getlist(self.doclist, self.fname):
 				if d.item_code and not d.purchase_rate:
 					d.purchase_ref_rate = d.discount_rate = d.purchase_rate = 0.0
diff --git a/buying/utils.py b/buying/utils.py
index 97efbc7..9d125de 100644
--- a/buying/utils.py
+++ b/buying/utils.py
@@ -37,7 +37,7 @@
 		
 	args = webnotes._dict(args)
 	
-	item_wrapper = webnotes.model_wrapper("Item", args.item_code)
+	item_wrapper = webnotes.bean("Item", args.item_code)
 	item = item_wrapper.doc
 	
 	from stock.utils import validate_end_of_life
@@ -98,7 +98,7 @@
 
 def get_rates_as_per_price_list(args, item_doclist=None):
 	if not item_doclist:
-		item_doclist = webnotes.model_wrapper("Item", args.item_code).doclist
+		item_doclist = webnotes.bean("Item", args.item_code).doclist
 	
 	result = item_doclist.get({"parentfield": "ref_rate_details", 
 		"price_list_name": args.price_list_name, "ref_currency": args.price_list_currency,
diff --git a/home/doctype/feed/feed.py b/home/doctype/feed/feed.py
index 6e4199b..36e09ca 100644
--- a/home/doctype/feed/feed.py
+++ b/home/doctype/feed/feed.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/hr/doctype/appraisal/appraisal.py b/hr/doctype/appraisal/appraisal.py
index 3d49c31..eaa609c 100644
--- a/hr/doctype/appraisal/appraisal.py
+++ b/hr/doctype/appraisal/appraisal.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import cstr, flt, getdate
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/hr/doctype/attendance/attendance.py b/hr/doctype/attendance/attendance.py
index d1ebc97..b0f3131 100644
--- a/hr/doctype/attendance/attendance.py
+++ b/hr/doctype/attendance/attendance.py
@@ -20,7 +20,7 @@
 from webnotes.utils import add_days, getdate, now
 from webnotes.model import db_exists
 from webnotes.model.doc import make_autoname
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/hr/doctype/attendance_control_panel/attendance_control_panel.py b/hr/doctype/attendance_control_panel/attendance_control_panel.py
index bc21f13..fdcc43d 100644
--- a/hr/doctype/attendance_control_panel/attendance_control_panel.py
+++ b/hr/doctype/attendance_control_panel/attendance_control_panel.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cint, cstr, date_diff, formatdate, get_defaults, getdate, now
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import form, msgprint
 
 sql = webnotes.conn.sql
diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py
index cef6fdc..2bd7998 100644
--- a/hr/doctype/employee/employee.py
+++ b/hr/doctype/employee/employee.py
@@ -79,7 +79,7 @@
 			from webnotes.profile import add_role
 			add_role(self.doc.user_id, "HR User")
 			
-		profile_wrapper = webnotes.model_wrapper("Profile", self.doc.user_id)
+		profile_wrapper = webnotes.bean("Profile", self.doc.user_id)
 		
 		# copy details like Fullname, DOB and Image to Profile
 		if self.doc.employee_name:
diff --git a/hr/doctype/expense_claim/expense_claim.py b/hr/doctype/expense_claim/expense_claim.py
index 9e476e5..0aa9ed8 100644
--- a/hr/doctype/expense_claim/expense_claim.py
+++ b/hr/doctype/expense_claim/expense_claim.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import add_days
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import form, msgprint
 from webnotes.model.code import get_obj
 
diff --git a/hr/doctype/holiday_list/holiday_list.py b/hr/doctype/holiday_list/holiday_list.py
index 5a4c062..0218114 100644
--- a/hr/doctype/holiday_list/holiday_list.py
+++ b/hr/doctype/holiday_list/holiday_list.py
@@ -20,7 +20,7 @@
 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.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/hr/doctype/job_applicant/get_job_applications.py b/hr/doctype/job_applicant/get_job_applications.py
index 4737a6a..0b994c5 100644
--- a/hr/doctype/job_applicant/get_job_applications.py
+++ b/hr/doctype/job_applicant/get_job_applications.py
@@ -31,14 +31,14 @@
 		name = webnotes.conn.get_value("Job Applicant", {"email_id": mail.from_email}, 
 			"name")
 		if name:
-			applicant = webnotes.model_wrapper("Job Applicant", name)
+			applicant = webnotes.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.model_wrapper({
+			applicant = webnotes.bean({
 				"creation": mail.date,
 				"doctype":"Job Applicant",
 				"applicant_name": name,
diff --git a/hr/doctype/leave_application/test_leave_application.py b/hr/doctype/leave_application/test_leave_application.py
index 584549a..dc1b463 100644
--- a/hr/doctype/leave_application/test_leave_application.py
+++ b/hr/doctype/leave_application/test_leave_application.py
@@ -5,18 +5,18 @@
 
 class TestLeaveApplication(unittest.TestCase):
 	def get_application(self, doclist):
-		application = webnotes.model_wrapper(doclist)
+		application = webnotes.bean(copy=doclist)
 		application.doc.from_date = "2013-01-01"
 		application.doc.to_date = "2013-01-05"
 		return application
 
 	def test_block_list(self):
 		import webnotes
-		webnotes.conn.set_value("Employee", "_T-Employee-0001", "department", 
-			"_Test Department with Block List")
+		webnotes.conn.set_value("Department", "_Test Department", "leave_block_list", "_Test Leave Block List")
 		
 		application = self.get_application(test_records[1])
 		application.insert()
+		application.doc.status = "Approved"
 		self.assertRaises(LeaveDayBlockedError, application.submit)
 		
 		webnotes.session.user = "test1@example.com"
@@ -45,6 +45,7 @@
 		from webnotes.profile import add_role
 		add_role("test@example.com", "Leave Approver")
 		
+		application.doc.status = "Approved"
 		self.assertRaises(LeaveDayBlockedError, application.submit)
 		
 
diff --git a/hr/doctype/leave_control_panel/leave_control_panel.py b/hr/doctype/leave_control_panel/leave_control_panel.py
index c81575c..d26efd4 100644
--- a/hr/doctype/leave_control_panel/leave_control_panel.py
+++ b/hr/doctype/leave_control_panel/leave_control_panel.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cint, cstr, flt, now, nowdate
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/hr/doctype/salary_manager/salary_manager.py b/hr/doctype/salary_manager/salary_manager.py
index 45b78a6..e9b3dd7 100644
--- a/hr/doctype/salary_manager/salary_manager.py
+++ b/hr/doctype/salary_manager/salary_manager.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cint, flt
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py
index 0f8e1ce..3edf410 100644
--- a/hr/doctype/salary_slip/salary_slip.py
+++ b/hr/doctype/salary_slip/salary_slip.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import add_days, cint, cstr, flt, getdate
 from webnotes.model.doc import make_autoname
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 from setup.utils import get_company_currency
diff --git a/hr/doctype/salary_structure/salary_structure.py b/hr/doctype/salary_structure/salary_structure.py
index 9c5ad24..22789e3 100644
--- a/hr/doctype/salary_structure/salary_structure.py
+++ b/hr/doctype/salary_structure/salary_structure.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr, flt
 from webnotes.model import db_exists
 from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py
index 809f36a..ef07e5e 100644
--- a/manufacturing/doctype/bom/bom.py
+++ b/manufacturing/doctype/bom/bom.py
@@ -18,7 +18,7 @@
 import webnotes
 from webnotes.utils import cint, cstr, flt, now, nowdate
 from webnotes.model.doc import Document, addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint, _
 
diff --git a/manufacturing/doctype/production_order/production_order.py b/manufacturing/doctype/production_order/production_order.py
index 9a09494..a0498e0 100644
--- a/manufacturing/doctype/production_order/production_order.py
+++ b/manufacturing/doctype/production_order/production_order.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr, flt, now, nowdate
 from webnotes.model import db_exists
 from webnotes.model.doc import make_autoname
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index b83441b..9626da1 100644
--- a/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -18,7 +18,7 @@
 import webnotes
 from webnotes.utils import cstr, flt, cint, nowdate, add_days
 from webnotes.model.doc import addchild, Document
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
@@ -339,7 +339,7 @@
 		purchase_request_list = []
 		if items_to_be_requested:
 			for item in items_to_be_requested:
-				item_wrapper = webnotes.model_wrapper("Item", item)
+				item_wrapper = webnotes.bean("Item", item)
 				pr_doclist = [
 					{
 						"doctype": "Material Request",
@@ -367,7 +367,7 @@
 						"warehouse": self.doc.purchase_request_for_warehouse
 					}
 				]
-				pr_wrapper = webnotes.model_wrapper(pr_doclist)
+				pr_wrapper = webnotes.bean(pr_doclist)
 				pr_wrapper.ignore_permissions = 1
 				pr_wrapper.submit()
 				purchase_request_list.append(pr_wrapper.doc.name)
diff --git a/manufacturing/doctype/workstation/workstation.py b/manufacturing/doctype/workstation/workstation.py
index 1609f6d..96f694b 100644
--- a/manufacturing/doctype/workstation/workstation.py
+++ b/manufacturing/doctype/workstation/workstation.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import flt
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/patches/august_2012/changed_blog_date_format.py b/patches/august_2012/changed_blog_date_format.py
index f44dc38..df51977 100644
--- a/patches/august_2012/changed_blog_date_format.py
+++ b/patches/august_2012/changed_blog_date_format.py
@@ -1,5 +1,5 @@
 from __future__ import unicode_literals
 def execute():
 	import webnotes
-	from webnotes.model.wrapper import ModelWrapper
-	ModelWrapper("Website Settings", "Website Settings").save()
\ No newline at end of file
+	from webnotes.model.bean import Bean
+	Bean("Website Settings", "Website Settings").save()
\ No newline at end of file
diff --git a/patches/december_2012/expense_leave_reload.py b/patches/december_2012/expense_leave_reload.py
index 06c67e6..867a795 100644
--- a/patches/december_2012/expense_leave_reload.py
+++ b/patches/december_2012/expense_leave_reload.py
@@ -4,10 +4,10 @@
 	# new roles
 	roles = [r[0] for r in webnotes.conn.sql("""select name from tabRole""")]
 	if not "Leave Approver" in roles:
-		webnotes.model_wrapper([{"doctype":"Role", "role_name":"Leave Approver", 
+		webnotes.bean([{"doctype":"Role", "role_name":"Leave Approver", 
 			"__islocal":1, "module":"HR"}]).save()
 	if not "Expense Approver" in roles:
-		webnotes.model_wrapper([{"doctype":"Role", "role_name":"Expense Approver", 
+		webnotes.bean([{"doctype":"Role", "role_name":"Expense Approver", 
 			"__islocal":1, "module":"HR"}]).save()
 
 	# reload
diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py
index b8a4181..e56cfde 100644
--- a/patches/february_2013/p03_material_request.py
+++ b/patches/february_2013/p03_material_request.py
@@ -6,6 +6,8 @@
 	webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
 	webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_bill")
 	webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_receive")
+
+	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")
diff --git a/patches/january_2013/holiday_list_patch.py b/patches/january_2013/holiday_list_patch.py
index e8e8f8c..714c0e8 100644
--- a/patches/january_2013/holiday_list_patch.py
+++ b/patches/january_2013/holiday_list_patch.py
@@ -1,7 +1,7 @@
 import webnotes
 def execute():
 	for name in webnotes.conn.sql("""select name from `tabHoliday List`"""):
-		holiday_list_wrapper = webnotes.model_wrapper("Holiday List", name[0])
+		holiday_list_wrapper = webnotes.bean("Holiday List", name[0])
 		
 		desc_count = _count([d.description for d in 
 			holiday_list_wrapper.doclist.get({"doctype": "Holiday"})])
diff --git a/patches/january_2013/remove_unwanted_permission.py b/patches/january_2013/remove_unwanted_permission.py
index deeb1b3..7053d9f 100644
--- a/patches/january_2013/remove_unwanted_permission.py
+++ b/patches/january_2013/remove_unwanted_permission.py
@@ -5,7 +5,7 @@
 			webnotes.conn.sql("""update tabDocPerm set report = 0 where parent = %s""", dt[0])
 		
 		
-		doctype = webnotes.model_wrapper("DocType", 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}):
diff --git a/patches/january_2013/stock_reconciliation_patch.py b/patches/january_2013/stock_reconciliation_patch.py
index fa919f4..9a25ffd 100644
--- a/patches/january_2013/stock_reconciliation_patch.py
+++ b/patches/january_2013/stock_reconciliation_patch.py
@@ -23,7 +23,7 @@
 		where ifnull(remark, '')!=''""")
 	fullname_map = {}
 	for reco, remark, modified_by in result:
-		webnotes.model_wrapper([{
+		webnotes.bean([{
 			"doctype": "Comment",
 			"comment": remark,
 			"comment_by": modified_by,
diff --git a/patches/june_2012/cms2.py b/patches/june_2012/cms2.py
index c476d91..414af73 100644
--- a/patches/june_2012/cms2.py
+++ b/patches/june_2012/cms2.py
@@ -67,13 +67,13 @@
 	}
 
 	import webnotes
-	from webnotes.model.wrapper import ModelWrapper
+	from webnotes.model.bean import Bean
 	import webnotes.modules.patch_handler
 
 	for dt in query_map:
 		for result in webnotes.conn.sql(query_map[dt], as_dict=1):
 			try:
-				ModelWrapper(dt, result['name'].encode('utf-8')).save()
+				Bean(dt, result['name'].encode('utf-8')).save()
 			except Exception, e:
 				webnotes.modules.patch_handler.log(unicode(e))
 			
diff --git a/projects/doctype/project/project.py b/projects/doctype/project/project.py
index 3e334e8..1de551c 100644
--- a/projects/doctype/project/project.py
+++ b/projects/doctype/project/project.py
@@ -20,7 +20,7 @@
 from webnotes.utils import flt, getdate
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/projects/doctype/project_control/project_control.py b/projects/doctype/project_control/project_control.py
index d11b260..53caab0 100644
--- a/projects/doctype/project_control/project_control.py
+++ b/projects/doctype/project_control/project_control.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import add_days, cint, cstr, date_diff, flt, now, nowdate, add_days
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 from webnotes.utils.email_lib import sendmail
 sql = webnotes.conn.sql
diff --git a/projects/doctype/task/task.py b/projects/doctype/task/task.py
index 79fca9a..ad2303e 100644
--- a/projects/doctype/task/task.py
+++ b/projects/doctype/task/task.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import getdate, today
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/projects/doctype/timesheet/timesheet.py b/projects/doctype/timesheet/timesheet.py
index 4f4d824..6e6e27a 100644
--- a/projects/doctype/timesheet/timesheet.py
+++ b/projects/doctype/timesheet/timesheet.py
@@ -20,7 +20,7 @@
 
 from webnotes.utils import cint, cstr, getdate, now, nowdate
 from webnotes.model import db_exists
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/selling/doctype/installation_note/installation_note.py b/selling/doctype/installation_note/installation_note.py
index 00d365a..b0e1d96 100644
--- a/selling/doctype/installation_note/installation_note.py
+++ b/selling/doctype/installation_note/installation_note.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr, getdate
 from webnotes.model import db_exists
 from webnotes.model.doc import make_autoname
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 from stock.utils import get_valid_serial_nos
diff --git a/selling/doctype/lead/get_leads.py b/selling/doctype/lead/get_leads.py
index cda7412..5b127e7 100644
--- a/selling/doctype/lead/get_leads.py
+++ b/selling/doctype/lead/get_leads.py
@@ -23,7 +23,7 @@
 def add_sales_communication(subject, content, sender, real_name, mail=None, 
 	status="Open", date=None):
 	def set_status(doctype, name):
-		w = webnotes.model_wrapper(doctype, name)
+		w = webnotes.bean(doctype, name)
 		w.ignore_permissions = True
 		w.doc.status = is_system_user and "Replied" or status
 		w.doc.save()
@@ -36,7 +36,7 @@
 
 	if not (lead_name or contact_name):
 		# none, create a new Lead
-		lead = webnotes.model_wrapper({
+		lead = webnotes.bean({
 			"doctype":"Lead",
 			"lead_name": real_name or sender,
 			"email_id": sender,
diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py
index 369fab7..9da5e6a 100644
--- a/selling/doctype/opportunity/opportunity.py
+++ b/selling/doctype/opportunity/opportunity.py
@@ -20,7 +20,7 @@
 from webnotes.utils import add_days, cstr, getdate
 from webnotes.model import db_exists
 from webnotes.model.doc import Document, addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/selling/doctype/plot_control/plot_control.py b/selling/doctype/plot_control/plot_control.py
index 7823b73..9431bf9 100644
--- a/selling/doctype/plot_control/plot_control.py
+++ b/selling/doctype/plot_control/plot_control.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cint, cstr, get_defaults, now
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py
index 6c1300b..c154a6a 100644
--- a/selling/doctype/quotation/quotation.py
+++ b/selling/doctype/quotation/quotation.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import cstr, getdate
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py
index 49dc999..797462a 100644
--- a/selling/doctype/sales_common/sales_common.py
+++ b/selling/doctype/sales_common/sales_common.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cint, cstr, flt, getdate, nowdate, formatdate
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint, _
 from setup.utils import get_company_currency
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 8686081..b79a6d6 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import cstr, flt, getdate
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/selling/doctype/sms_center/sms_center.py b/selling/doctype/sms_center/sms_center.py
index 416b1ec..c5db738 100644
--- a/selling/doctype/sms_center/sms_center.py
+++ b/selling/doctype/sms_center/sms_center.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/selling/page/sales_browser/sales_browser.py b/selling/page/sales_browser/sales_browser.py
index 5b5e4b8..b12c0f4 100644
--- a/selling/page/sales_browser/sales_browser.py
+++ b/selling/page/sales_browser/sales_browser.py
@@ -30,4 +30,4 @@
 		parent_field: webnotes.form_dict['parent'],
 		"is_group": webnotes.form_dict['is_group']
 	}]
-	webnotes.model_wrapper(doclist).save()
\ No newline at end of file
+	webnotes.bean(doclist).save()
\ No newline at end of file
diff --git a/setup/doctype/authorization_control/authorization_control.py b/setup/doctype/authorization_control/authorization_control.py
index 8e02bdf..33687c7 100644
--- a/setup/doctype/authorization_control/authorization_control.py
+++ b/setup/doctype/authorization_control/authorization_control.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import cstr, flt, has_common, make_esc
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import session, msgprint
 from setup.utils import get_company_currency
 
diff --git a/setup/doctype/authorization_rule/authorization_rule.py b/setup/doctype/authorization_rule/authorization_rule.py
index be6c0ae..9f19701 100644
--- a/setup/doctype/authorization_rule/authorization_rule.py
+++ b/setup/doctype/authorization_rule/authorization_rule.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cint, cstr, flt, has_common
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/setup/doctype/contact_control/contact_control.py b/setup/doctype/contact_control/contact_control.py
index ed90b99..3c37ecf 100644
--- a/setup/doctype/contact_control/contact_control.py
+++ b/setup/doctype/contact_control/contact_control.py
@@ -5,7 +5,7 @@
 from webnotes.utils import set_default
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/setup/doctype/print_heading/print_heading.py b/setup/doctype/print_heading/print_heading.py
index 87d21d7..d856eb4 100644
--- a/setup/doctype/print_heading/print_heading.py
+++ b/setup/doctype/print_heading/print_heading.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/setup/doctype/sales_browser_control/sales_browser_control.py b/setup/doctype/sales_browser_control/sales_browser_control.py
index 331fe78..ae9338f 100644
--- a/setup/doctype/sales_browser_control/sales_browser_control.py
+++ b/setup/doctype/sales_browser_control/sales_browser_control.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/setup/doctype/sales_partner/sales_partner.py b/setup/doctype/sales_partner/sales_partner.py
index f99833e..f629bff 100644
--- a/setup/doctype/sales_partner/sales_partner.py
+++ b/setup/doctype/sales_partner/sales_partner.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/setup/doctype/sales_person/sales_person.py b/setup/doctype/sales_person/sales_person.py
index 65e7ac1..ea21cd0 100644
--- a/setup/doctype/sales_person/sales_person.py
+++ b/setup/doctype/sales_person/sales_person.py
@@ -17,7 +17,7 @@
 from __future__ import unicode_literals
 import webnotes
 
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.utils import flt
 
 from webnotes.utils.nestedset import DocTypeNestedSet
diff --git a/setup/doctype/territory/territory.py b/setup/doctype/territory/territory.py
index d97a9ca..896d5c7 100644
--- a/setup/doctype/territory/territory.py
+++ b/setup/doctype/territory/territory.py
@@ -17,7 +17,7 @@
 from __future__ import unicode_literals
 import webnotes
 
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.utils import flt
 
 from webnotes.utils.nestedset import DocTypeNestedSet
diff --git a/setup/doctype/workflow_engine/workflow_engine.py b/setup/doctype/workflow_engine/workflow_engine.py
index f9e2cef..693027a 100644
--- a/setup/doctype/workflow_engine/workflow_engine.py
+++ b/setup/doctype/workflow_engine/workflow_engine.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import form, msgprint
 
diff --git a/setup/doctype/workflow_rule/workflow_rule.py b/setup/doctype/workflow_rule/workflow_rule.py
index 24b2add..1c2514d 100644
--- a/setup/doctype/workflow_rule/workflow_rule.py
+++ b/setup/doctype/workflow_rule/workflow_rule.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr
 from webnotes.model import db_exists
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes import form, msgprint
 
 sql = webnotes.conn.sql
diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py
index fc2736f..e5563cc 100644
--- a/stock/doctype/bin/bin.py
+++ b/stock/doctype/bin/bin.py
@@ -17,10 +17,10 @@
 from __future__ import unicode_literals
 import webnotes
 
-from webnotes.utils import add_days, cint, cstr, flt, get_defaults, now, nowdate
+from webnotes.utils import add_days, cint, cstr, flt, now, nowdate
 from webnotes.model import db_exists
 from webnotes.model.doc import Document, addchild
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 sql = webnotes.conn.sql
@@ -97,28 +97,34 @@
 
 	def reorder_item(self,doc_type,doc_name):
 		""" Reorder item if stock reaches reorder level"""
+		if not hasattr(webnotes, "auto_indent"): 
+			webnotes.auto_indent = webnotes.conn.get_value('Global Defaults', None, 'auto_indent')
 
-		if webnotes.conn.get_value('Global Defaults', None, 'auto_indent'):
+		if webnotes.auto_indent:
 			#check if re-order is required
-			ret = sql("""select re_order_level, item_name, description, brand, item_group,
-			 	lead_time_days, min_order_qty, email_notify, re_order_qty 
-				from tabItem where name = %s""", (self.doc.item_code), as_dict=1)
+			item_reorder = webnotes.conn.get("Item Reorder", 
+				{"parent": self.doc.item_code, "warehouse": self.doc.warehouse}, as_dict=1)
 			
-			current_qty = sql("""
-				select sum(t1.actual_qty) + sum(t1.indented_qty) + sum(t1.ordered_qty) -sum(t1.reserved_qty)
-				from tabBin t1, tabWarehouse t2
-				where t1.item_code = %s 
-				and t1.warehouse = t2.name
-				and t2.warehouse_type in ('Stores', 'Reserved', 'Default Warehouse Type')
-				and t1.docstatus != 2
-			""", self.doc.item_code)
+			if item_reorder:
+				reorder_level = item_reorder.warehouse_reorder_level
+				reorder_qty = item_reorder.warehouse_reorder_qty
+			else:
+				reorder_level, reorder_qty = webnotes.conn.get_valuee("Item", self.doc.item_code,
+					["re_order_level", "re_order_qty"])
+			
+			if flt(reorder_qty) and flt(self.doc.projected_qty) < flt(reorder_level):
+				self.create_material_request(doc_type, doc_name)
 
-			if ret[0]["re_order_level"] and current_qty and \
-					(flt(ret[0]['re_order_level']) > flt(current_qty[0][0])):
-				self.create_auto_indent(ret[0], doc_type, doc_name, current_qty[0][0])
-
-	def create_auto_indent(self, i , doc_type, doc_name, cur_qty):
+	def create_material_request(self, doc_type, doc_name):
 		"""	Create indent on reaching reorder level	"""
+		defaults = webnotes.conn.get_defaults()
+		mr = webnotes.bean([{
+			"doctype": "Material Request",
+			"company": defaults.company,
+			
+		}])
+		
+			
 		indent = Document('Material Request')
 		indent.transaction_date = nowdate()
 		indent.naming_series = 'IDT'
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index 4c5aeee..b8d20fb 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -18,7 +18,7 @@
 import webnotes
 
 from webnotes.utils import cstr, flt, getdate
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
@@ -312,9 +312,9 @@
 			""", self.doc.name)
 
 		if res and res[0][1]>0:
-			from webnotes.model.wrapper import ModelWrapper
+			from webnotes.model.bean import Bean
 			for r in res:
-				ps = ModelWrapper(dt='Packing Slip', dn=r[0])
+				ps = Bean(dt='Packing Slip', dn=r[0])
 				ps.cancel()
 			webnotes.msgprint("%s Packing Slip(s) Cancelled" % res[0][1])
 
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index c6ace19..a4c35b3 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr, flt
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes import msgprint
 
 sql = webnotes.conn.sql
diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py
index 28da848..4238e14 100644
--- a/stock/doctype/item/test_item.py
+++ b/stock/doctype/item/test_item.py
@@ -19,7 +19,7 @@
 import webnotes
 import copy
 
-from webnotes.model.wrapper import ModelWrapper
+from webnotes.model.bean import Bean
 from webnotes.model.doc import Document
 from webnotes.utils import flt
 
@@ -34,7 +34,7 @@
 		webnotes.conn.rollback()
 		
 	def testInsert(self):
-		d = ModelWrapper()
+		d = Bean()
 
 		count_before =  flt(sql("select count(*) from tab"+_doctype)[0][0])
 		if docok:
@@ -49,7 +49,7 @@
 	def testFailAssert(self):
 		if docnotok:
 			with self.assertRaises(Exception) as context:
-				d = ModelWrapper()
+				d = Bean()
 				d.doc = docnotok[0]
 				d.children = None
 				d.doc.fields['__islocal']=1
@@ -79,6 +79,31 @@
 test_records = [
 	[{
 		"doctype": "Item",
+		"item_code": "_Test Item",
+		"item_name": "_Test Item",
+		"description": "_Test Item",
+		"item_group": "_Test Item Group",
+		"is_stock_item": "Yes",
+		"is_asset_item": "No",
+		"has_batch_no": "No",
+		"has_serial_no": "No",
+		"is_purchase_item": "Yes",
+		"is_sales_item": "Yes",
+		"is_service_item": "No",
+		"is_sample_item": "No",
+		"inspection_required": "No",
+		"is_pro_applicable": "No",
+		"is_sub_contracted_item": "No",
+		"stock_uom": "_Test UOM"
+	}, {
+		"doctype": "Item Reorder",
+		"parentfield": "item_reorder",
+		"warehouse": "_Test Warehouse",
+		"warehouse_reorder_level": 20,
+		"warehouse_reorder_qty": 20
+	}],
+	[{
+		"doctype": "Item",
 		"item_code": "_Test Item Home Desktop 100",
 		"item_name": "_Test Item Home Desktop 100",
 		"description": "_Test Item Home Desktop 100",
diff --git a/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
index f2bc799..1fb7b9a 100644
--- a/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
+++ b/stock/doctype/landed_cost_wizard/landed_cost_wizard.py
@@ -18,7 +18,7 @@
 import webnotes
 from webnotes.utils import cint, cstr, flt
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/stock/doctype/material_request/material_request.js b/stock/doctype/material_request/material_request.js
index 224fcc6..fa16c6c 100644
--- a/stock/doctype/material_request/material_request.js
+++ b/stock/doctype/material_request/material_request.js
@@ -20,7 +20,7 @@
 wn.require('app/buying/doctype/purchase_common/purchase_common.js');
 wn.require('app/utilities/doctype/sms_control/sms_control.js');
 
-erpnext.buying.PurchaseRequestController = erpnext.buying.BuyingController.extend({
+erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.extend({
 	refresh: function(doc) {
 		this._super();
 		
@@ -39,7 +39,7 @@
 	}
 });
 
-var new_cscript = new erpnext.buying.PurchaseRequestController({frm: cur_frm});
+var new_cscript = new erpnext.buying.MaterialRequestController({frm: cur_frm});
 
 // for backward compatibility: combine new and previous states
 $.extend(cur_frm.cscript, new_cscript);
diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py
index c2cadda..e956364 100644
--- a/stock/doctype/material_request/material_request.py
+++ b/stock/doctype/material_request/material_request.py
@@ -5,7 +5,7 @@
 import webnotes
 
 from webnotes.utils import cstr, flt, get_defaults
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/stock/doctype/material_request/material_request.txt b/stock/doctype/material_request/material_request.txt
index 45dd416..2bf48f4 100644
--- a/stock/doctype/material_request/material_request.txt
+++ b/stock/doctype/material_request/material_request.txt
@@ -1,8 +1,8 @@
 [
  {
-  "creation": "2013-01-29 19:25:55", 
+  "creation": "2013-02-18 13:50:55", 
   "docstatus": 0, 
-  "modified": "2013-02-18 13:10:37", 
+  "modified": "2013-02-18 14:41:41", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -38,6 +38,19 @@
   "name": "Material Request"
  }, 
  {
+  "doctype": "DocField", 
+  "fieldname": "material_request_type", 
+  "fieldtype": "Select", 
+  "in_list_view": 1, 
+  "label": "Material Request Type", 
+  "options": "Purchase\nTransfer"
+ }, 
+ {
+  "doctype": "DocField", 
+  "fieldname": "column_break_2", 
+  "fieldtype": "Column Break"
+ }, 
+ {
   "description": "To manage multiple series please go to Setup > Manage Series", 
   "doctype": "DocField", 
   "fieldname": "naming_series", 
@@ -46,26 +59,11 @@
   "no_copy": 1, 
   "oldfieldname": "naming_series", 
   "oldfieldtype": "Select", 
-  "options": "MREQ\nIDT", 
+  "options": "MREQ-\nIDT", 
   "print_hide": 1, 
   "reqd": 1
  }, 
  {
-  "description": "The date at which current entry is made in system.", 
-  "doctype": "DocField", 
-  "fieldname": "transaction_date", 
-  "fieldtype": "Date", 
-  "in_filter": 1, 
-  "label": "Transaction Date", 
-  "no_copy": 1, 
-  "oldfieldname": "transaction_date", 
-  "oldfieldtype": "Date", 
-  "print_width": "100px", 
-  "reqd": 1, 
-  "search_index": 1, 
-  "width": "100px"
- }, 
- {
   "doctype": "DocField", 
   "fieldname": "items", 
   "fieldtype": "Section Break", 
@@ -141,6 +139,21 @@
   "width": "50%"
  }, 
  {
+  "description": "The date at which current entry is made in system.", 
+  "doctype": "DocField", 
+  "fieldname": "transaction_date", 
+  "fieldtype": "Date", 
+  "in_filter": 1, 
+  "label": "Transaction Date", 
+  "no_copy": 1, 
+  "oldfieldname": "transaction_date", 
+  "oldfieldtype": "Date", 
+  "print_width": "100px", 
+  "reqd": 1, 
+  "search_index": 1, 
+  "width": "100px"
+ }, 
+ {
   "description": "Select the relevant company name if you have multiple companies", 
   "doctype": "DocField", 
   "fieldname": "company", 
@@ -276,7 +289,7 @@
   "doctype": "DocField", 
   "fieldname": "remark", 
   "fieldtype": "Small Text", 
-  "in_list_view": 1, 
+  "in_list_view": 0, 
   "label": "Remarks", 
   "no_copy": 1, 
   "oldfieldname": "remark", 
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
new file mode 100644
index 0000000..d6e5350
--- /dev/null
+++ b/stock/doctype/material_request/test_material_request.py
@@ -0,0 +1,32 @@
+test_records = [
+	[
+		{
+			"company": "_Test Company", 
+			"doctype": "Material Request", 
+			"fiscal_year": "_Test Fiscal Year 2013", 
+			"transaction_date": "2013-02-18"
+		}, 
+		{
+			"description": "A 6", 
+			"doctype": "Material Request Item", 
+			"item_code": "_Test Item Home Desktop 100", 
+			"item_name": "A 6", 
+			"parentfield": "indent_details", 
+			"qty": 54.0, 
+			"schedule_date": "2013-02-18", 
+			"uom": "_Test UOM",
+			"warehouse": "_Test Warehouse"
+		}, 
+		{
+			"description": "Value 3.5", 
+			"doctype": "Material Request Item", 
+			"item_code": "_Test Item Home Desktop 200", 
+			"item_name": "Valve 3.5", 
+			"parentfield": "indent_details", 
+			"qty": 3.0, 
+			"schedule_date": "2013-02-19", 
+			"uom": "_Test UOM",
+			"warehouse": "_Test Warehouse"
+		}
+	]
+]
\ No newline at end of file
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py
index 94d2039..6c3669b 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr, flt, get_defaults
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py b/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py
index 92b0cb1..f0170bb 100644
--- a/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py
+++ b/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.py
@@ -20,7 +20,7 @@
 from webnotes.utils import flt
 from webnotes.model import db_exists
 from webnotes.model.doc import addchild
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/stock/doctype/serial_no/test_serial_no.py b/stock/doctype/serial_no/test_serial_no.py
index 1398e68..ef20de8 100644
--- a/stock/doctype/serial_no/test_serial_no.py
+++ b/stock/doctype/serial_no/test_serial_no.py
@@ -41,7 +41,7 @@
 			["2012-01-01", "02:00", "10006", 1200, 800],
 			["2012-01-01", "06:00", "10007", 1500, 900]]
 		for d in data:
-			webnotes.model_wrapper([{
+			webnotes.bean([{
 				"doctype": "Serial No",
 				"item_code": "Nebula 8",
 				"warehouse": "Default Warehouse", 
diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py
index 73af2bf..342cd6b 100644
--- a/stock/doctype/stock_entry/stock_entry.py
+++ b/stock/doctype/stock_entry/stock_entry.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr, cint, flt, comma_or
 from webnotes.model.doc import Document, addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint, _
 from stock.utils import get_incoming_rate
diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py
new file mode 100644
index 0000000..6678eb3
--- /dev/null
+++ b/stock/doctype/stock_entry/test_stock_entry.py
@@ -0,0 +1,99 @@
+import webnotes, unittest
+
+class TestStockEntry(unittest.TestCase):
+	def test_auto_material_request(self):
+		webnotes.conn.sql("""delete from `tabMaterial Request Item`""")
+		webnotes.conn.sql("""delete from `tabMaterial Request`""")
+
+		st1 = webnotes.bean(copy=test_records[0])
+		st1.insert()
+		st1.submit()
+
+		st2 = webnotes.bean(copy=test_records[0])
+		st2.insert()
+		st2.submit()
+		
+		mr_name = webnotes.conn.sql("""select parent from `tabMaterial Request Item`
+			where item_code='_Test Item'""")
+			
+		self.assertTrue(mr_name)
+
+test_records = [
+	[
+		{
+			"company": "_Test Company", 
+			"doctype": "Stock Entry", 
+			"posting_date": "2013-01-25", 
+			"posting_time": "17:14:24", 
+			"purpose": "Material Receipt"
+		}, 
+		{
+			"conversion_factor": 1.0, 
+			"doctype": "Stock Entry Detail", 
+			"item_code": "_Test Item", 
+			"parentfield": "mtn_details", 
+			"incoming_rate": 100,
+			"qty": 50.0, 
+			"stock_uom": "_Test UOM", 
+			"transfer_qty": 50.0, 
+			"uom": "_Test UOM",
+			"t_warehouse": "_Test Warehouse",
+		}, 
+	],
+	[
+		{
+			"company": "_Test Company", 
+			"doctype": "Stock Entry", 
+			"posting_date": "2013-01-25", 
+			"posting_time": "17:15", 
+			"purpose": "Material Issue"
+		}, 
+		{
+			"conversion_factor": 1.0, 
+			"doctype": "Stock Entry Detail", 
+			"item_code": "_Test Item", 
+			"parentfield": "mtn_details", 
+			"incoming_rate": 100,
+			"qty": 40.0, 
+			"stock_uom": "_Test UOM", 
+			"transfer_qty": 40.0, 
+			"uom": "_Test UOM",
+			"s_warehouse": "_Test Warehouse",
+		}, 
+	],
+	[
+		{
+			"company": "_Test Company", 
+			"doctype": "Stock Entry", 
+			"posting_date": "2013-01-25", 
+			"posting_time": "17:14:24", 
+			"purpose": "Material Transfer"
+		}, 
+		{
+			"conversion_factor": 1.0, 
+			"doctype": "Stock Entry Detail", 
+			"item_code": "_Test Item Home Desktop 100", 
+			"parentfield": "mtn_details", 
+			"incoming_rate": 100,
+			"qty": 45.0, 
+			"stock_uom": "_Test UOM", 
+			"transfer_qty": 45.0, 
+			"uom": "_Test UOM",
+			"s_warehouse": "_Test Warehouse",
+			"t_warehouse": "_Test Warehouse 1",
+		}, 
+		{
+			"conversion_factor": 1.0, 
+			"doctype": "Stock Entry Detail", 
+			"item_code": "_Test Item Home Desktop 100", 
+			"parentfield": "mtn_details", 
+			"qty": 45.0, 
+			"incoming_rate": 100,
+			"stock_uom": "_Test UOM", 
+			"transfer_qty": 45.0, 
+			"uom": "_Test UOM",
+			"s_warehouse": "_Test Warehouse",
+			"t_warehouse": "_Test Warehouse 1",
+		}
+	]
+]
\ No newline at end of file
diff --git a/stock/doctype/stock_ledger/stock_ledger.py b/stock/doctype/stock_ledger/stock_ledger.py
index 0c0e246..05fc0e0 100644
--- a/stock/doctype/stock_ledger/stock_ledger.py
+++ b/stock/doctype/stock_ledger/stock_ledger.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import add_days, cstr, flt, nowdate, cint
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import session, msgprint
 from stock.utils import get_valid_serial_nos
@@ -221,7 +221,7 @@
 		if args.get("warehouse"):
 			args["warehouse_type"] = webnotes.conn.get_value('Warehouse' , args["warehouse"],
 				'warehouse_type')
-		sle = webnotes.model_wrapper([args])
+		sle = webnotes.bean([args])
 		sle.ignore_permissions = 1
 		sle.insert()
 		return sle.doc.name
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 32fcf89..e0f7f09 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -248,7 +248,7 @@
 		}
 		args.update(opts)
 		# create stock ledger entry
-		sle_wrapper = webnotes.model_wrapper([args])
+		sle_wrapper = webnotes.bean([args])
 		sle_wrapper.ignore_permissions = 1
 		sle_wrapper.insert()
 		
diff --git a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index 7030c1b..80579ae 100644
--- a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -115,7 +115,7 @@
 			self.setUp()
 			
 	def submit_stock_reconciliation(self, qty, rate, posting_date, posting_time):
-		return webnotes.model_wrapper([{
+		return webnotes.bean([{
 			"doctype": "Stock Reconciliation",
 			"name": "RECO-001",
 			"__islocal": 1,
diff --git a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
index a02758d..dbcccc4 100644
--- a/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
+++ b/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr, flt, now
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/stock/doctype/warehouse/test_warehouse.py b/stock/doctype/warehouse/test_warehouse.py
index eb4554b..eed8186 100644
--- a/stock/doctype/warehouse/test_warehouse.py
+++ b/stock/doctype/warehouse/test_warehouse.py
@@ -3,5 +3,10 @@
 		"doctype": "Warehouse",
 		"warehouse_name": "_Test Warehouse",
 		"warehouse_type": "_Test Warehouse Type"
-	}]
+	}],
+	[{
+		"doctype": "Warehouse",
+		"warehouse_name": "_Test Warehouse 1",
+		"warehouse_type": "_Test Warehouse Type"
+	}]	
 ]
\ No newline at end of file
diff --git a/stock/doctype/warehouse/warehouse.py b/stock/doctype/warehouse/warehouse.py
index 380adaa..a7fc185 100644
--- a/stock/doctype/warehouse/warehouse.py
+++ b/stock/doctype/warehouse/warehouse.py
@@ -34,7 +34,7 @@
 				warehouse = %s", (item_code, warehouse))
 		bin = bin and bin[0][0] or ''
 		if not bin:
-			bin_wrapper = webnotes.model_wrapper([{
+			bin_wrapper = webnotes.bean([{
 				"doctype": "Bin",
 				"item_code": item_code,
 				"warehouse": warehouse,
diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js
index 473bb2f..a09cae7 100644
--- a/stock/page/stock_home/stock_home.js
+++ b/stock/page/stock_home/stock_home.js
@@ -7,6 +7,11 @@
 		icon: "icon-copy",
 		items: [
 			{
+				label: wn._("Material Request"),
+				description: wn._("Request Material for Transfer or Purchase."),
+				doctype:"Material Request"
+			},
+			{
 				label: wn._("Stock Entry"),
 				description: wn._("Transfer stock from one warehouse to another."),
 				doctype:"Stock Entry"
diff --git a/stock/stock_ledger.py b/stock/stock_ledger.py
index 26f03c6..60b5fd4 100644
--- a/stock/stock_ledger.py
+++ b/stock/stock_ledger.py
@@ -86,7 +86,7 @@
 	# update bin
 	if not webnotes.conn.exists({"doctype": "Bin", "item_code": args["item_code"], 
 			"warehouse": args["warehouse"]}):
-		bin_wrapper = webnotes.model_wrapper([{
+		bin_wrapper = webnotes.bean([{
 			"doctype": "Bin",
 			"item_code": args["item_code"],
 			"warehouse": args["warehouse"],
diff --git a/support/doctype/customer_issue/customer_issue.py b/support/doctype/customer_issue/customer_issue.py
index af93f33..3a4ffc1 100644
--- a/support/doctype/customer_issue/customer_issue.py
+++ b/support/doctype/customer_issue/customer_issue.py
@@ -19,7 +19,7 @@
 import webnotes
 
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes import session, msgprint
 from webnotes.utils import today
 
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py
index 46891dc..60962b1 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import add_days, cstr, getdate
 from webnotes.model.doc import Document, addchild
-from webnotes.model.wrapper import getlist
+from webnotes.model.bean import getlist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/support/doctype/maintenance_visit/maintenance_visit.py b/support/doctype/maintenance_visit/maintenance_visit.py
index 98a3f52..cf1ddeb 100644
--- a/support/doctype/maintenance_visit/maintenance_visit.py
+++ b/support/doctype/maintenance_visit/maintenance_visit.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import cstr
 from webnotes.model import db_exists
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
diff --git a/support/doctype/newsletter/test_newsletter.py b/support/doctype/newsletter/test_newsletter.py
index 98ad21f..4650c0a 100644
--- a/support/doctype/newsletter/test_newsletter.py
+++ b/support/doctype/newsletter/test_newsletter.py
@@ -2,7 +2,7 @@
 
 class TestNewsletter(unittest.TestCase):
 	def test_get_recipients_lead(self):
-		w = webnotes.model_wrapper(test_records[0])
+		w = webnotes.bean(test_records[0])
 		w.insert()
 		self.assertTrue("test_lead@example.com" in w.controller.get_recipients())
 		webnotes.conn.sql("""delete from `tabBulk Email`""")
@@ -10,24 +10,24 @@
 		self.assertTrue(webnotes.conn.get_value("Bulk Email", {"recipient": "test_lead@example.com"}))
 
 	def test_get_recipients_lead_by_status(self):
-		w = webnotes.model_wrapper(test_records[0])
+		w = webnotes.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.model_wrapper(test_records[1])
+		w = webnotes.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.model_wrapper(test_records[1])
+		w = webnotes.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.model_wrapper(test_records[2])
+		w = webnotes.bean(test_records[2])
 		w.insert()
 		self.assertTrue("test_custom2@example.com" in w.controller.get_recipients())
 		self.assertTrue(webnotes.conn.get("Lead", 
diff --git a/support/doctype/support_ticket/get_support_mails.py b/support/doctype/support_ticket/get_support_mails.py
index d431d8f..a91d483 100644
--- a/support/doctype/support_ticket/get_support_mails.py
+++ b/support/doctype/support_ticket/get_support_mails.py
@@ -38,12 +38,12 @@
 		ticket = None
 
 		if thread_id and webnotes.conn.exists("Support Ticket", thread_id):
-			ticket = webnotes.model_wrapper("Support Ticket", thread_id)
+			ticket = webnotes.bean("Support Ticket", thread_id)
 			ticket.doc.status = 'Open'
 			ticket.doc.save()
 				
 		else:
-			ticket = webnotes.model_wrapper([{
+			ticket = webnotes.bean([{
 				"doctype":"Support Ticket",
 				"description": mail.content,
 				"subject": mail.mail["Subject"],
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 43b8283..170497d 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -67,7 +67,7 @@
 
 @webnotes.whitelist()
 def set_status(name, status):
-	st = webnotes.model_wrapper("Support Ticket", name)
+	st = webnotes.bean("Support Ticket", name)
 	st.doc.status = status
 	st.save()
 	
diff --git a/utilities/doctype/profile_control/profile_control.py b/utilities/doctype/profile_control/profile_control.py
index 5f6b4d5..340293dc 100644
--- a/utilities/doctype/profile_control/profile_control.py
+++ b/utilities/doctype/profile_control/profile_control.py
@@ -20,7 +20,7 @@
 from webnotes.utils import cstr
 from webnotes.model import db_exists
 from webnotes.model.doc import Document
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/utilities/doctype/sms_control/sms_control.py b/utilities/doctype/sms_control/sms_control.py
index 61b45b1..857dfdb 100644
--- a/utilities/doctype/sms_control/sms_control.py
+++ b/utilities/doctype/sms_control/sms_control.py
@@ -21,7 +21,7 @@
 from webnotes.model.code import get_obj
 from webnotes.model.doc import Document
 from webnotes import msgprint
-from webnotes.model.wrapper import getlist, copy_doclist
+from webnotes.model.bean import getlist, copy_doclist
 
 sql = webnotes.conn.sql
 	
diff --git a/utilities/doctype/trash_control/trash_control.py b/utilities/doctype/trash_control/trash_control.py
index 50edbf5..341f837 100644
--- a/utilities/doctype/trash_control/trash_control.py
+++ b/utilities/doctype/trash_control/trash_control.py
@@ -19,7 +19,7 @@
 
 from webnotes.utils import now
 from webnotes.model import db_exists
-from webnotes.model.wrapper import copy_doclist
+from webnotes.model.bean import copy_doclist
 from webnotes.model.code import get_obj
 
 sql = webnotes.conn.sql
diff --git a/website/doctype/contact_us_settings/contact_us_settings.py b/website/doctype/contact_us_settings/contact_us_settings.py
index 8e6ef29..740b651 100644
--- a/website/doctype/contact_us_settings/contact_us_settings.py
+++ b/website/doctype/contact_us_settings/contact_us_settings.py
@@ -14,7 +14,7 @@
 		else:
 			self.doc.query_options = ["Sales", "Support", "General"]
 		if self.doc.address:
-			self.address = webnotes.model_wrapper("Address", self.doc.address).doc
+			self.address = webnotes.bean("Address", self.doc.address).doc
 			
 	def on_update(self):
 		from website.utils import clear_cache
diff --git a/website/doctype/product_settings/product_settings.py b/website/doctype/product_settings/product_settings.py
index 4e72be6..980f123 100644
--- a/website/doctype/product_settings/product_settings.py
+++ b/website/doctype/product_settings/product_settings.py
@@ -13,5 +13,5 @@
 		clear_cache()
 		
 		if self.doc.default_product_category:
-			webnotes.model_wrapper("Item Group", 
+			webnotes.bean("Item Group", 
 				self.doc.default_product_category).save()
\ No newline at end of file
diff --git a/website/helpers/slideshow.py b/website/helpers/slideshow.py
index 2c2ae4b..0afd80a 100644
--- a/website/helpers/slideshow.py
+++ b/website/helpers/slideshow.py
@@ -17,7 +17,7 @@
 import webnotes
 
 def get_slideshow(obj):
-	slideshow = webnotes.model_wrapper("Website Slideshow", obj.doc.slideshow)
+	slideshow = webnotes.bean("Website Slideshow", obj.doc.slideshow)
 	obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"})
 	obj.doc.slideshow_header = slideshow.doc.header or ""
 	for s in obj.slides:
diff --git a/website/utils.py b/website/utils.py
index 48ca844..1f27cc8 100644
--- a/website/utils.py
+++ b/website/utils.py
@@ -155,7 +155,7 @@
 			'name': page_name,
 		})
 		if page_name in page_settings_map:
-			args.obj = webnotes.model_wrapper(page_settings_map[page_name]).obj
+			args.obj = webnotes.bean(page_settings_map[page_name]).obj
 	else:
 		args = get_doc_fields(page_name)