account conflict
diff --git a/erpnext/patches/auto_indent.py b/erpnext/patches/auto_indent.py
new file mode 100644
index 0000000..1877bd1
--- /dev/null
+++ b/erpnext/patches/auto_indent.py
@@ -0,0 +1,8 @@
+def execute():
+	import webnotes
+	from webnotes.modules.module_manager import reload_doc
+	reload_doc('setup', 'doctype', 'manage_account')
+	reload_doc('stock', 'doctype', 'item')
+	webnotes.conn.sql("alter table `tabItem` drop column `minimum_inventory_level`")
+	webnotes.conn.sql("update `tabItem` set re_order_level = minimum_inventory_level wehre ifnull(re_order_level,0) = 0 ")
+		
\ No newline at end of file
diff --git a/erpnext/patches/task_email_notification.py b/erpnext/patches/task_email_notification.py
new file mode 100644
index 0000000..e6a7afa
--- /dev/null
+++ b/erpnext/patches/task_email_notification.py
@@ -0,0 +1,4 @@
+def execute():
+	import webnotes
+	from webnotes.modules.module_manager import reload_doc
+	reload_doc('projects', 'doctype', 'ticket')
diff --git a/erpnext/projects/doctype/ticket/ticket.py b/erpnext/projects/doctype/ticket/ticket.py
index baf85e7..b048425 100644
--- a/erpnext/projects/doctype/ticket/ticket.py
+++ b/erpnext/projects/doctype/ticket/ticket.py
@@ -7,9 +7,9 @@
 from webnotes.model.doclist import getlist, copy_doclist
 from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
 from webnotes import session, form, is_testing, msgprint, errprint
-
 sql = webnotes.conn.sql
 set = webnotes.conn.set
+get_value = webnotes.conn.get_value
 
 # -----------------------------------------------------------------------------------------
 
@@ -32,7 +32,7 @@
       return ret
   
   def get_allocated_to_name(self):
-    as_em = sql("select first_name, last_name from `tabProfile` where name=%s",self.doc.allocated_to)
+    as_em = sql("select first_name, last_name from `tabProfile` where name=%s",str(self.doc.allocated_to))
     ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
     return ret
 
@@ -68,6 +68,12 @@
   #--------------------------------------------   
   
   def on_update(self):
+    if (self.doc.status =='Open') and (self.doc.task_email_notify==1):
+       	msg2= 'A task %s has been assigned to you by %s on %s \n%s Project:%s \t Review Date:%s\nClosing Date:%s  Details \n %s' \
+       	%(self.doc.name,self.doc.senders_name,self.doc.opening_date," ",self.doc.project, \
+       	self.doc.review_date,self.doc.closing_date,self.doc.description)
+    	sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', \
+    	subject='A task has been assigned', parts=[['text/plain',msg2]])
     pass
         
   #validate before sending for approval
diff --git a/erpnext/projects/doctype/ticket/ticket.txt b/erpnext/projects/doctype/ticket/ticket.txt
index e9d5ff0..2680fba 100644
--- a/erpnext/projects/doctype/ticket/ticket.txt
+++ b/erpnext/projects/doctype/ticket/ticket.txt
@@ -5,17 +5,18 @@
 	{
 		'creation': '2011-01-28 17:52:35',
 		'docstatus': 0,
-		'modified': '2010-12-03 10:04:58',
+		'modified': '2011-12-20 20:52:58',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1307707462',
+		'_last_update': '1323333040',
 		'allow_trash': 1,
 		'autoname': 'TIC/.####',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Master',
 		'module': 'Projects',
@@ -25,7 +26,7 @@
 		'show_in_menu': 0,
 		'subject': '%(subject)s',
 		'tag_fields': 'status',
-		'version': 245
+		'version': 246
 	},
 
 	# These values are common for all DocField
@@ -39,12 +40,17 @@
 
 	# These values are common for all DocPerm
 	{
+		'amend': 1,
+		'cancel': 1,
+		'create': 1,
 		'doctype': 'DocPerm',
 		'name': '__common__',
 		'parent': 'Ticket',
 		'parentfield': 'permissions',
 		'parenttype': 'DocType',
-		'read': 1
+		'read': 1,
+		'submit': 1,
+		'write': 1
 	},
 
 	# DocType, Ticket
@@ -55,41 +61,28 @@
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 0,
-		'role': 'All',
-		'write': 1
+		'role': 'All'
 	},
 
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 1,
-		'role': 'All',
-		'write': 0
+		'role': 'All'
 	},
 
 	# DocPerm
 	{
-		'amend': 1,
-		'cancel': 1,
-		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 0,
-		'role': 'Projects User',
-		'write': 1
+		'role': 'Projects User'
 	},
 
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 1,
 		'role': 'Projects User'
 	},
@@ -98,7 +91,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Task Details',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0,
@@ -111,7 +103,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'subject',
 		'fieldtype': 'Data',
-		'idx': 2,
 		'in_filter': 1,
 		'label': 'Subject',
 		'oldfieldname': 'subject',
@@ -125,8 +116,8 @@
 		'doctype': 'DocField',
 		'fieldname': 'status',
 		'fieldtype': 'Select',
-		'idx': 3,
 		'label': 'Status',
+		'no_copy': 1,
 		'oldfieldname': 'status',
 		'oldfieldtype': 'Select',
 		'options': 'Open\nPending Review\nClosed\nCancelled',
@@ -137,9 +128,17 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldname': 'task_email_notify',
+		'fieldtype': 'Check',
+		'label': 'Sent Mail Notification',
+		'permlevel': 0
+	},
+
+	# DocField
+	{
+		'doctype': 'DocField',
 		'fieldname': 'opening_date',
 		'fieldtype': 'Date',
-		'idx': 4,
 		'label': 'Creation Date',
 		'oldfieldname': 'opening_date',
 		'oldfieldtype': 'Date',
@@ -155,7 +154,6 @@
 		'fieldname': 'review_date',
 		'fieldtype': 'Date',
 		'hidden': 1,
-		'idx': 5,
 		'label': 'Review Date',
 		'oldfieldname': 'review_date',
 		'oldfieldtype': 'Date',
@@ -170,7 +168,6 @@
 		'fieldname': 'closing_date',
 		'fieldtype': 'Date',
 		'hidden': 1,
-		'idx': 6,
 		'label': 'Closing Date',
 		'oldfieldname': 'closing_date',
 		'oldfieldtype': 'Date',
@@ -182,7 +179,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'priority',
 		'fieldtype': 'Select',
-		'idx': 7,
 		'in_filter': 1,
 		'label': 'Priority',
 		'oldfieldname': 'priority',
@@ -199,7 +195,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'project',
 		'fieldtype': 'Link',
-		'idx': 8,
 		'label': 'Project',
 		'oldfieldname': 'project',
 		'oldfieldtype': 'Link',
@@ -214,7 +209,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer',
 		'fieldtype': 'Link',
-		'idx': 9,
 		'label': 'Customer',
 		'oldfieldname': 'customer',
 		'oldfieldtype': 'Link',
@@ -228,7 +222,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'customer_name',
 		'fieldtype': 'Data',
-		'idx': 10,
 		'label': 'Customer Name',
 		'oldfieldname': 'customer_name',
 		'oldfieldtype': 'Data',
@@ -239,7 +232,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 11,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -251,7 +243,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'allocated_to',
 		'fieldtype': 'Link',
-		'idx': 12,
 		'label': 'Allocated To',
 		'oldfieldname': 'allocated_to',
 		'oldfieldtype': 'Link',
@@ -266,7 +257,6 @@
 		'fieldname': 'allocated_to_name',
 		'fieldtype': 'Data',
 		'hidden': 1,
-		'idx': 13,
 		'label': 'Allocated To Name',
 		'oldfieldname': 'allocated_to_name',
 		'oldfieldtype': 'Data',
@@ -278,7 +268,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'senders_name',
 		'fieldtype': 'Data',
-		'idx': 14,
 		'in_filter': 1,
 		'label': 'Raised By',
 		'oldfieldname': 'senders_name',
@@ -293,7 +282,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'senders_email',
 		'fieldtype': 'Data',
-		'idx': 15,
 		'label': 'Email',
 		'oldfieldname': 'senders_email',
 		'oldfieldtype': 'Data',
@@ -306,7 +294,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'senders_contact_no',
 		'fieldtype': 'Data',
-		'idx': 16,
 		'label': 'Senders Contact No',
 		'oldfieldname': 'senders_contact_no',
 		'oldfieldtype': 'Data',
@@ -318,7 +305,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'senders_company',
 		'fieldtype': 'Data',
-		'idx': 17,
 		'label': 'Senders Company',
 		'oldfieldname': 'senders_company',
 		'oldfieldtype': 'Data',
@@ -330,7 +316,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'category',
 		'fieldtype': 'Link',
-		'idx': 18,
 		'label': 'Category',
 		'oldfieldname': 'category',
 		'oldfieldtype': 'Link',
@@ -343,7 +328,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'external_or_internal',
 		'fieldtype': 'Select',
-		'idx': 19,
 		'label': 'External or Internal',
 		'oldfieldname': 'external_or_internal',
 		'oldfieldtype': 'Select',
@@ -357,7 +341,6 @@
 		'fieldname': 'amended_from',
 		'fieldtype': 'Data',
 		'hidden': 1,
-		'idx': 20,
 		'label': 'Amended From',
 		'no_copy': 1,
 		'oldfieldname': 'amended_from',
@@ -373,7 +356,6 @@
 		'fieldname': 'amendment_date',
 		'fieldtype': 'Date',
 		'hidden': 1,
-		'idx': 21,
 		'label': 'Amendment Date',
 		'no_copy': 1,
 		'oldfieldname': 'amendment_date',
@@ -387,7 +369,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 22,
 		'oldfieldtype': 'Section Break',
 		'options': 'Simple',
 		'permlevel': 0
@@ -398,7 +379,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'description',
 		'fieldtype': 'Text Editor',
-		'idx': 23,
 		'label': 'Details',
 		'oldfieldname': 'description',
 		'oldfieldtype': 'Text Editor',
@@ -414,7 +394,6 @@
 		'fieldname': 'first_creation_flag',
 		'fieldtype': 'Int',
 		'hidden': 1,
-		'idx': 24,
 		'in_filter': 0,
 		'label': 'First Creation Flag',
 		'no_copy': 1,
@@ -431,7 +410,6 @@
 		'fieldname': 'second_creation_flag',
 		'fieldtype': 'Int',
 		'hidden': 1,
-		'idx': 25,
 		'label': 'Second Creation Flag',
 		'no_copy': 1,
 		'oldfieldname': 'second_creation_flag',
@@ -444,7 +422,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 26,
 		'label': 'Time and Budget',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -454,7 +431,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 27,
 		'label': 'Expected',
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
@@ -466,7 +442,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'exp_start_date',
 		'fieldtype': 'Date',
-		'idx': 28,
 		'label': 'Expected Start Date',
 		'oldfieldname': 'exp_start_date',
 		'oldfieldtype': 'Date',
@@ -479,7 +454,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'exp_end_date',
 		'fieldtype': 'Date',
-		'idx': 29,
 		'in_filter': 1,
 		'label': 'Expected End Date',
 		'oldfieldname': 'exp_end_date',
@@ -494,7 +468,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'exp_total_hrs',
 		'fieldtype': 'Data',
-		'idx': 30,
 		'label': 'Total Hours (Expected)',
 		'oldfieldname': 'exp_total_hrs',
 		'oldfieldtype': 'Data',
@@ -507,7 +480,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'allocated_budget',
 		'fieldtype': 'Currency',
-		'idx': 31,
 		'label': 'Allocated Budget',
 		'oldfieldname': 'allocated_budget',
 		'oldfieldtype': 'Currency',
@@ -518,7 +490,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 32,
 		'label': 'Actual',
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
@@ -530,7 +501,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'act_start_date',
 		'fieldtype': 'Date',
-		'idx': 33,
 		'label': 'Actual Start Date',
 		'oldfieldname': 'act_start_date',
 		'oldfieldtype': 'Date',
@@ -542,7 +512,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'act_end_date',
 		'fieldtype': 'Date',
-		'idx': 34,
 		'label': 'Actual End Date',
 		'oldfieldname': 'act_end_date',
 		'oldfieldtype': 'Date',
@@ -554,7 +523,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'act_total_hrs',
 		'fieldtype': 'Data',
-		'idx': 35,
 		'label': 'Total Hours (Actual)',
 		'oldfieldname': 'act_total_hrs',
 		'oldfieldtype': 'Data',
@@ -566,7 +534,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'actual_budget',
 		'fieldtype': 'Currency',
-		'idx': 36,
 		'label': 'Actual Budget',
 		'oldfieldname': 'actual_budget',
 		'oldfieldtype': 'Currency',
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index ca5af7a..72245eb 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -446,7 +446,7 @@
 				if not d[0]:
 					msgprint("Message: Please enter Reserved Warehouse for item %s as it is stock item."% d[1])
 					raise Exception
-				bin = get_obj('Warehouse', d[0]).update_bin( 0, flt(update_stock) * flt(d[2]), 0, 0, 0, d[1], self.doc.transaction_date)
+				bin = get_obj('Warehouse', d[0]).update_bin( 0, flt(update_stock) * flt(d[2]), 0, 0, 0, d[1], self.doc.transaction_date,doc_type=self.doc.doctype,doc_name=self.doc.name, is_amended = (self.doc.amended_from and 'Yes' or 'No'))
 	
 	# Gets Items from packing list
 	#=================================
diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt
index edee81b..8a156a0 100644
--- a/erpnext/setup/doctype/manage_account/manage_account.txt
+++ b/erpnext/setup/doctype/manage_account/manage_account.txt
@@ -12,7 +12,8 @@
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1323943888',
+
+		'_last_update': '1323855502',
 		'allow_copy': 1,
 		'allow_email': 1,
 		'allow_print': 1,
@@ -28,7 +29,7 @@
 		'section_style': 'Tabbed',
 		'server_code_error': ' ',
 		'show_in_menu': 1,
-		'version': 516
+		'version': 515
 	},
 
 	# These values are common for all DocField
@@ -241,6 +242,15 @@
 	# DocField
 	{
 		'doctype': 'DocField',
+		'fieldname': 'auto_indent',
+		'fieldtype': 'Check',
+		'label': 'Raise Indent when stock reaches re-order level'
+	},
+
+	# DocField
+	{
+		'default': '1',
+		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
 		'width': '50%'
 	},
@@ -500,4 +510,4 @@
 		'label': 'Employee Records to be created by ',
 		'options': '\nNaming Series\nEmployee Number'
 	}
-]
\ No newline at end of file
+]
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index bb1101e..757dbb9 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -1,11 +1,18 @@
 # Please edit this list and import only required elements
 import webnotes
 
-from webnotes.utils import cint, cstr, flt, nowdate
-from webnotes.model.code import get_obj
-from webnotes import msgprint
+from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
+from webnotes.model import db_exists
+from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
+from webnotes.model.doclist import getlist, copy_doclist
+from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
+from webnotes import session, form, is_testing, msgprint, errprint
 
+set = webnotes.conn.set
 sql = webnotes.conn.sql
+get_value = webnotes.conn.get_value
+
+
 
 # -----------------------------------------------------------------------------------------
 
@@ -18,9 +25,9 @@
 	# -------------
 	# stock update
 	# -------------
-	def update_stock(self, actual_qty=0, reserved_qty=0, ordered_qty=0, indented_qty=0, planned_qty=0, dt=None, sle_id='', posting_time='', serial_no = '', is_cancelled = 'No'):
-
-		if not dt: dt = nowdate()
+	def update_stock(self, actual_qty=0, reserved_qty=0, ordered_qty=0, indented_qty=0, planned_qty=0, dt=None, sle_id='', posting_time='', serial_no = '', is_cancelled = 'No',doc_type='',doc_name='',is_amended='No'):
+		if not dt: 
+			dt = nowdate()
 		# update the stock values (for current quantities)
 		self.doc.actual_qty = flt(self.doc.actual_qty) + flt(actual_qty)
 		self.doc.ordered_qty = flt(self.doc.ordered_qty) + flt(ordered_qty)
@@ -28,9 +35,10 @@
 		self.doc.indented_qty = flt(self.doc.indented_qty) + flt(indented_qty)
 		self.doc.planned_qty = flt(self.doc.planned_qty) + flt(planned_qty)
 		self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + flt(self.doc.indented_qty) + flt(self.doc.planned_qty) - flt(self.doc.reserved_qty)
-
 		self.doc.save()
-			
+		if(( flt(actual_qty)<0 or flt(reserved_qty)>0 )and is_cancelled == 'No' and is_amended=='No'):
+			msgprint('is_amended '+is_amended)
+			self.reorder_item(doc_type,doc_name)	
 		
 		if actual_qty:
 			# check actual qty with total number of serial no
@@ -299,13 +307,52 @@
 
 	# item re-order
 	# -------------
-	def reorder_item(self):
-		#check if re-order is required
-		projected_qty = flt(self.doc.actual_qty) + flt(self.doc.indented_qty) + flt(self.doc.ordered_qty)
-		item_reorder_level = sql("select reorder_level from `%sItem` where name = '%s'" % (self.prefix, self.doc.item_code))[0][0] or 0
-		if flt(item_reorder_level) > flt(projected_qty):
-			msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent raised (Not Implemented).")
-	
+	def reorder_item(self,doc_type,doc_name):
+		msgprint(get_value('Manage Account', None, 'auto_indent'))
+		if get_value('Manage Account', None, 'auto_indent'):
+			#check if re-order is required
+			indent_detail_fields = sql("select re_order_level,item_name,description,brand,item_group,lead_time_days,min_order_qty,email_notify from tabItem where item_code = %s",(self.doc.item_code),as_dict=1)
+			i =	indent_detail_fields[0] 
+			item_reorder_level = i['re_order_level'] or 0	 
+			if ((flt(item_reorder_level) > flt(self.doc.projected_qty)) and item_reorder_level) :
+				self.reorder_indent(i,item_reorder_level,doc_type,doc_name,email_notify=i['email_notify'])
+
+		
+	# Re order Auto Intent Generation
+	def reorder_indent(self,i,item_reorder_level,doc_type,doc_name,email_notify='1'):
+		indent = Document('Indent')
+		indent.transaction_date = nowdate()
+		indent.naming_series = 'IDT'
+		indent.company = get_defaults()['company']
+		indent.fiscal_year = get_defaults()['fiscal_year']
+		indent.remark = "This is an auto generated Indent. It was raised because the projected quantity has fallen below the minimum re-order level"
+		indent.save(1)
+		indent_obj = get_obj('Indent',indent.name,with_children=1)
+		indent_details_child = addchild(indent_obj.doc,'indent_details','Indent Detail',0)
+		indent_details_child.item_code = self.doc.item_code
+		indent_details_child.uom = self.doc.stock_uom
+		indent_details_child.warehouse = self.doc.warehouse
+		indent_details_child.schedule_date= add_days(nowdate(),i['lead_time_days'])
+		indent_details_child.item_name = i['item_name']
+		indent_details_child.description = i['description']
+		indent_details_child.item_group = i['item_group']
+		if (i['min_order_qty'] < ( flt(item_reorder_level)-flt(self.doc.projected_qty) )):
+			indent_details_child.qty =flt(flt(item_reorder_level)-flt(self.doc.projected_qty))
+		else:
+			indent_details_child.qty = i['min_order_qty']
+		indent_details_child.brand = i['brand']
+		indent_details_child.save()
+		indent_obj = get_obj('Indent',indent.name,with_children=1)
+		indent_obj.validate()
+		set(indent_obj.doc,'docstatus',1)
+		indent_obj.on_submit()
+		msgprint("Item: " + self.doc.item_code + " is to be re-ordered. Indent %s raised.Was generated from %s %s"%(indent.name,doc_type, doc_name ))
+		if(email_notify)		
+			email_list=[d for d in sql("select  from tabUserRole where role in ('Purchase Manager','Material Manager') ")]
+			#if getattr():
+			msg1='An Indent has been raised for item %s: %s on %s '%(doc_type, doc_name, nowdate())
+			sendmail(email_list, sender='automail@webnotestech.com', \
+			subject='Auto Indent Generation Notification', parts=[['text/plain',msg1]])	
 	# validate
 	def validate(self):
 		self.validate_mandatory()
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index ea8c648..93f72df 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -374,8 +374,7 @@
 				# if prevdoc_doctype = "Sales Order"
 				if d[3] < 0 :
 					# Reduce Reserved Qty from warehouse
-					bin = get_obj('Warehouse', d[0]).update_bin(0, flt(update_stock) * flt(d[3]), 0, 0, 0, d[1], self.doc.transaction_date)
-
+					bin = get_obj('Warehouse', d[0]).update_bin(0, flt(update_stock) * flt(d[3]), 0, 0, 0, d[1], self.doc.transaction_date,doc_type=self.doc.doctype,doc_name=self.doc.name, is_amended = (self.doc.amended_from and 'Yes' or 'No'))
 				# Reduce actual qty from warehouse
 				self.make_sl_entry(d, d[0], - flt(d[2]) , 0, update_stock)
 		get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
diff --git a/erpnext/stock/doctype/item/item.txt b/erpnext/stock/doctype/item/item.txt
index 0d20f7b..c670700 100644
--- a/erpnext/stock/doctype/item/item.txt
+++ b/erpnext/stock/doctype/item/item.txt
@@ -5,18 +5,19 @@
 	{
 		'creation': '2010-08-08 17:09:05',
 		'docstatus': 0,
-		'modified': '2011-08-18 13:03:31',
+		'modified': '2011-12-20 11:15:42',
 		'modified_by': 'Administrator',
 		'owner': 'Administrator'
 	},
 
 	# These values are common for all DocType
 	{
-		'_last_update': '1313651083',
+		'_last_update': '1323333040',
 		'allow_attach': 1,
 		'allow_trash': 1,
 		'autoname': 'field:item_code',
 		'colour': 'White:FFF',
+		'default_print_format': 'Standard',
 		'doctype': 'DocType',
 		'document_type': 'Master',
 		'max_attachments': 1,
@@ -28,7 +29,7 @@
 		'show_in_menu': 0,
 		'subject': '%(item_name)s',
 		'tag_fields': 'item_group',
-		'version': 161
+		'version': 162
 	},
 
 	# These values are common for all DocField
@@ -62,7 +63,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 1,
 		'permlevel': 1,
 		'role': 'Material Manager',
 		'submit': 0,
@@ -75,7 +75,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 2,
 		'permlevel': 0,
 		'role': 'Material Manager',
 		'submit': 0,
@@ -88,7 +87,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 3,
 		'permlevel': 1,
 		'role': 'Material User',
 		'submit': 0,
@@ -101,7 +99,6 @@
 		'cancel': 0,
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 4,
 		'permlevel': 0,
 		'role': 'Material User',
 		'submit': 0,
@@ -113,7 +110,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 5,
 		'permlevel': 0,
 		'role': 'Material Master Manager',
 		'write': 1
@@ -123,7 +119,6 @@
 	{
 		'create': 0,
 		'doctype': 'DocPerm',
-		'idx': 6,
 		'permlevel': 1,
 		'role': 'Material Master Manager',
 		'write': 0
@@ -134,7 +129,6 @@
 		'cancel': 1,
 		'create': 1,
 		'doctype': 'DocPerm',
-		'idx': 7,
 		'permlevel': 0,
 		'role': 'System Manager',
 		'write': 1
@@ -143,7 +137,6 @@
 	# DocPerm
 	{
 		'doctype': 'DocPerm',
-		'idx': 8,
 		'permlevel': 1,
 		'role': 'System Manager'
 	},
@@ -152,7 +145,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 1,
 		'label': 'Item',
 		'no_copy': 0,
 		'oldfieldtype': 'Section Break',
@@ -164,7 +156,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'trash_reason',
 		'fieldtype': 'Small Text',
-		'idx': 2,
 		'label': 'Trash Reason',
 		'oldfieldname': 'trash_reason',
 		'oldfieldtype': 'Small Text',
@@ -178,7 +169,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'item_code',
 		'fieldtype': 'Data',
-		'idx': 3,
 		'in_filter': 0,
 		'label': 'Item Code',
 		'oldfieldname': 'item_code',
@@ -193,7 +183,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'item_name',
 		'fieldtype': 'Data',
-		'idx': 4,
 		'in_filter': 1,
 		'label': 'Item Name',
 		'oldfieldname': 'item_name',
@@ -210,7 +199,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'item_group',
 		'fieldtype': 'Link',
-		'idx': 5,
 		'in_filter': 1,
 		'label': 'Item Group',
 		'oldfieldname': 'item_group',
@@ -224,7 +212,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'HTML',
-		'idx': 6,
 		'label': 'IGHelp',
 		'oldfieldtype': 'HTML',
 		'options': '<a href="javascript:cur_frm.cscript.IGHelp();">To manage Item Group, click here</a>',
@@ -237,7 +224,6 @@
 		'fieldname': 'brand',
 		'fieldtype': 'Link',
 		'hidden': 0,
-		'idx': 7,
 		'label': 'Brand',
 		'oldfieldname': 'brand',
 		'oldfieldtype': 'Link',
@@ -251,7 +237,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 8,
 		'permlevel': 0
 	},
 
@@ -260,7 +245,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'description',
 		'fieldtype': 'Text',
-		'idx': 9,
 		'in_filter': 0,
 		'label': 'Description',
 		'oldfieldname': 'description',
@@ -276,7 +260,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'description_html',
 		'fieldtype': 'Text',
-		'idx': 10,
 		'label': 'Description HTML',
 		'permlevel': 0
 	},
@@ -287,7 +270,6 @@
 		'description': 'Generates HTML to include image (1st attachment) in the description',
 		'doctype': 'DocField',
 		'fieldtype': 'Button',
-		'idx': 11,
 		'label': 'Add Image',
 		'permlevel': 0
 	},
@@ -296,7 +278,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 12,
 		'label': 'Inventory',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -309,7 +290,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'stock_uom',
 		'fieldtype': 'Link',
-		'idx': 13,
 		'label': 'Default UoM',
 		'oldfieldname': 'stock_uom',
 		'oldfieldtype': 'Link',
@@ -326,7 +306,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_stock_item',
 		'fieldtype': 'Select',
-		'idx': 14,
 		'label': 'Is Stock Item',
 		'oldfieldname': 'is_stock_item',
 		'oldfieldtype': 'Select',
@@ -340,7 +319,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'valuation_method',
 		'fieldtype': 'Select',
-		'idx': 15,
 		'label': 'Valuation Method',
 		'oldfieldname': 'valuation_method',
 		'oldfieldtype': 'Select',
@@ -353,7 +331,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'default_warehouse',
 		'fieldtype': 'Link',
-		'idx': 16,
 		'label': 'Default Warehouse',
 		'oldfieldname': 'default_warehouse',
 		'oldfieldtype': 'Link',
@@ -368,7 +345,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'tolerance',
 		'fieldtype': 'Currency',
-		'idx': 17,
 		'label': 'Allowance Percent',
 		'oldfieldname': 'tolerance',
 		'oldfieldtype': 'Currency',
@@ -380,7 +356,6 @@
 		'doctype': 'DocField',
 		'fieldname': 're_order_level',
 		'fieldtype': 'Currency',
-		'idx': 18,
 		'label': 'Re-Order Level',
 		'oldfieldname': 're_order_level',
 		'oldfieldtype': 'Currency',
@@ -389,18 +364,11 @@
 
 	# DocField
 	{
-		'colour': 'White:FFF',
-		'default': '0.00',
-		'description': 'If stock level for this item has reached the minimum inventory level, system will prompt you to raise an Indent (Purchase Requisition).',
 		'doctype': 'DocField',
-		'fieldname': 'minimum_inventory_level',
-		'fieldtype': 'Currency',
-		'idx': 19,
-		'label': 'Minimum Inventory Level',
-		'oldfieldname': 'minimum_inventory_level',
-		'oldfieldtype': 'Currency',
-		'permlevel': 0,
-		'reqd': 0
+		'fieldname': 'email_notify',
+		'fieldtype': 'Check',
+		'label': 'Send Email Notification when stock reaches re-order level',
+		'permlevel': 0
 	},
 
 	# DocField
@@ -412,7 +380,6 @@
 		'fieldname': 'min_order_qty',
 		'fieldtype': 'Currency',
 		'hidden': 0,
-		'idx': 20,
 		'label': 'Minimum Order Qty',
 		'oldfieldname': 'min_order_qty',
 		'oldfieldtype': 'Currency',
@@ -423,7 +390,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 21,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -437,7 +403,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_asset_item',
 		'fieldtype': 'Select',
-		'idx': 22,
 		'label': 'Is Asset Item',
 		'oldfieldname': 'is_asset_item',
 		'oldfieldtype': 'Select',
@@ -453,7 +418,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'has_batch_no',
 		'fieldtype': 'Select',
-		'idx': 23,
 		'label': 'Has Batch No',
 		'oldfieldname': 'has_batch_no',
 		'oldfieldtype': 'Select',
@@ -470,7 +434,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'has_serial_no',
 		'fieldtype': 'Select',
-		'idx': 24,
 		'in_filter': 1,
 		'label': 'Has Serial No',
 		'oldfieldname': 'has_serial_no',
@@ -485,7 +448,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'warranty_period',
 		'fieldtype': 'Data',
-		'idx': 25,
 		'label': 'Warranty Period (in days)',
 		'oldfieldname': 'warranty_period',
 		'oldfieldtype': 'Data',
@@ -497,7 +459,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'end_of_life',
 		'fieldtype': 'Date',
-		'idx': 26,
 		'label': 'End of Life',
 		'oldfieldname': 'end_of_life',
 		'oldfieldtype': 'Date',
@@ -509,7 +470,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'nett_weight',
 		'fieldtype': 'Float',
-		'idx': 27,
 		'label': 'Nett Weight',
 		'permlevel': 0
 	},
@@ -519,7 +479,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'gross_weight',
 		'fieldtype': 'Float',
-		'idx': 28,
 		'label': 'Gross Weight',
 		'permlevel': 0
 	},
@@ -529,7 +488,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'weight_uom',
 		'fieldtype': 'Link',
-		'idx': 29,
 		'label': 'Weight UOM',
 		'options': 'UOM',
 		'permlevel': 0
@@ -540,7 +498,6 @@
 		'colour': 'White:FFF',
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 30,
 		'label': 'Purchase Details',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -554,7 +511,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_purchase_item',
 		'fieldtype': 'Select',
-		'idx': 31,
 		'label': 'Is Purchase Item',
 		'oldfieldname': 'is_purchase_item',
 		'oldfieldtype': 'Select',
@@ -570,7 +526,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'lead_time_days',
 		'fieldtype': 'Int',
-		'idx': 32,
 		'label': 'Lead Time Days',
 		'no_copy': 1,
 		'oldfieldname': 'lead_time_days',
@@ -585,7 +540,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'purchase_account',
 		'fieldtype': 'Link',
-		'idx': 33,
 		'label': 'Default Expense Account',
 		'oldfieldname': 'purchase_account',
 		'oldfieldtype': 'Link',
@@ -601,7 +555,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'cost_center',
 		'fieldtype': 'Link',
-		'idx': 34,
 		'label': 'Default Cost Center',
 		'oldfieldname': 'cost_center',
 		'oldfieldtype': 'Link',
@@ -616,7 +569,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'buying_cost',
 		'fieldtype': 'Currency',
-		'idx': 35,
 		'label': 'Buying Cost',
 		'no_copy': 1,
 		'oldfieldname': 'buying_cost',
@@ -630,7 +582,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'last_purchase_rate',
 		'fieldtype': 'Currency',
-		'idx': 36,
 		'label': 'Last Purchase Rate',
 		'no_copy': 1,
 		'oldfieldname': 'last_purchase_rate',
@@ -643,7 +594,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'standard_rate',
 		'fieldtype': 'Currency',
-		'idx': 37,
 		'label': 'Standard Rate',
 		'oldfieldname': 'standard_rate',
 		'oldfieldtype': 'Currency',
@@ -654,7 +604,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 38,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -665,7 +614,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'uom_conversion_details',
 		'fieldtype': 'Table',
-		'idx': 39,
 		'label': 'UOM Conversion Details',
 		'oldfieldname': 'uom_conversion_details',
 		'oldfieldtype': 'Table',
@@ -677,7 +625,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 40,
 		'label': 'Sales Details',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -691,7 +638,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_sales_item',
 		'fieldtype': 'Select',
-		'idx': 41,
 		'in_filter': 1,
 		'label': 'Is Sales Item',
 		'oldfieldname': 'is_sales_item',
@@ -709,7 +655,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_service_item',
 		'fieldtype': 'Select',
-		'idx': 42,
 		'in_filter': 1,
 		'label': 'Is Service Item',
 		'oldfieldname': 'is_service_item',
@@ -727,7 +672,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_sample_item',
 		'fieldtype': 'Select',
-		'idx': 43,
 		'label': 'Allow Samples',
 		'oldfieldname': 'is_sample_item',
 		'oldfieldtype': 'Select',
@@ -741,7 +685,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'max_discount',
 		'fieldtype': 'Currency',
-		'idx': 44,
 		'label': 'Max Discount (%)',
 		'oldfieldname': 'max_discount',
 		'oldfieldtype': 'Currency',
@@ -753,7 +696,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'default_income_account',
 		'fieldtype': 'Link',
-		'idx': 45,
 		'label': 'Default Income Account',
 		'options': 'Account',
 		'permlevel': 0
@@ -764,7 +706,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'default_sales_cost_center',
 		'fieldtype': 'Link',
-		'idx': 46,
 		'label': 'Cost Center',
 		'options': 'Cost Center',
 		'permlevel': 0
@@ -776,7 +717,6 @@
 		'fieldname': 'sales_rate',
 		'fieldtype': 'Currency',
 		'hidden': 1,
-		'idx': 47,
 		'label': 'Sales Rate',
 		'oldfieldname': 'sales_rate',
 		'oldfieldtype': 'Currency',
@@ -787,7 +727,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Column Break',
-		'idx': 48,
 		'oldfieldtype': 'Column Break',
 		'permlevel': 0,
 		'width': '50%'
@@ -800,7 +739,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'ref_rate_details',
 		'fieldtype': 'Table',
-		'idx': 49,
 		'label': 'Ref Rate Details',
 		'oldfieldname': 'ref_rate_details',
 		'oldfieldtype': 'Table',
@@ -814,7 +752,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'item_customer_details',
 		'fieldtype': 'Table',
-		'idx': 50,
 		'label': 'Customer Codes',
 		'options': 'Item Customer Detail',
 		'permlevel': 0
@@ -824,7 +761,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 51,
 		'label': 'Item Tax',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -835,7 +771,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'item_tax',
 		'fieldtype': 'Table',
-		'idx': 52,
 		'label': 'Item Tax1',
 		'oldfieldname': 'item_tax',
 		'oldfieldtype': 'Table',
@@ -847,7 +782,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 53,
 		'label': 'Inspection Criteria',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -859,7 +793,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'inspection_required',
 		'fieldtype': 'Select',
-		'idx': 54,
 		'label': 'Inspection Required',
 		'no_copy': 0,
 		'oldfieldname': 'inspection_required',
@@ -874,7 +807,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'item_specification_details',
 		'fieldtype': 'Table',
-		'idx': 55,
 		'label': 'Item Specification Detail',
 		'oldfieldname': 'item_specification_details',
 		'oldfieldtype': 'Table',
@@ -886,7 +818,6 @@
 	{
 		'doctype': 'DocField',
 		'fieldtype': 'Section Break',
-		'idx': 56,
 		'label': 'Manufacturing',
 		'oldfieldtype': 'Section Break',
 		'permlevel': 0
@@ -900,7 +831,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_manufactured_item',
 		'fieldtype': 'Select',
-		'idx': 57,
 		'label': 'Allow Bill of Materials',
 		'oldfieldname': 'is_manufactured_item',
 		'oldfieldtype': 'Select',
@@ -915,7 +845,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'default_bom',
 		'fieldtype': 'Link',
-		'idx': 58,
 		'label': 'Default BOM',
 		'no_copy': 1,
 		'oldfieldname': 'default_bom',
@@ -932,7 +861,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_pro_applicable',
 		'fieldtype': 'Select',
-		'idx': 59,
 		'label': 'Allow Production Order',
 		'oldfieldname': 'is_pro_applicable',
 		'oldfieldtype': 'Select',
@@ -949,7 +877,6 @@
 		'doctype': 'DocField',
 		'fieldname': 'is_sub_contracted_item',
 		'fieldtype': 'Select',
-		'idx': 60,
 		'label': 'Is Sub Contracted Item',
 		'oldfieldname': 'is_sub_contracted_item',
 		'oldfieldtype': 'Select',
@@ -964,8 +891,8 @@
 		'fieldname': 'file_list',
 		'fieldtype': 'Text',
 		'hidden': 1,
-		'idx': 61,
 		'label': 'File List',
+		'no_copy': 1,
 		'permlevel': 0,
 		'print_hide': 1
 	},
@@ -976,7 +903,6 @@
 		'fieldname': 'customer_code',
 		'fieldtype': 'Data',
 		'hidden': 1,
-		'idx': 62,
 		'in_filter': 1,
 		'label': 'Customer Code',
 		'no_copy': 1,
diff --git a/erpnext/stock/doctype/stock_ledger/stock_ledger.py b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
index 0970b78..f339970 100644
--- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py
@@ -224,7 +224,7 @@
 			if v["actual_qty"]:
 				sle_id = self.make_entry(v)
 
-			get_obj('Warehouse', v["warehouse"]).update_bin(flt(v["actual_qty"]), 0, 0, 0, 0, v["item_code"], v["posting_date"], sle_id, v["posting_time"], '', v["is_cancelled"])
+			get_obj('Warehouse', v["warehouse"]).update_bin(flt(v["actual_qty"]), 0, 0, 0, 0, v["item_code"], v["posting_date"], sle_id, v["posting_time"], '', v["is_cancelled"],v["voucher_type"],v["voucher_no"])
 
 
 	# -----------
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 0b099fd..b9d560a 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -52,12 +52,12 @@
 
 	# update bin
 	# ----------
-	def update_bin(self, actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, item_code, dt, sle_id = '',posting_time = '', serial_no = '', is_cancelled = 'No'):
+	def update_bin(self, actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, item_code, dt, sle_id = '',posting_time = '', serial_no = '', is_cancelled = 'No',doc_type='',doc_name='',is_amended='No'):
 		self.validate_asset(item_code)
 		it_det = get_value('Item', item_code, 'is_stock_item')
 		if it_det and it_det == 'Yes':
 			bin = self.get_bin(item_code)
-			bin.update_stock(actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, dt, sle_id, posting_time, serial_no, is_cancelled)
+			bin.update_stock(actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, dt, sle_id, posting_time, serial_no, is_cancelled,doc_type,doc_name,is_amended)
 			return bin
 		else:
 			msgprint("[Stock Update] Ignored %s since it is not a stock item" % item_code)