From 8dd861bda53a479304eb4b17f77a2309e41f3666 Mon Sep 17 00:00:00 2001 From: Nijil Y Date: Tue, 20 Dec 2011 17:17:51 +0530 Subject: [PATCH] Auto Indent creation when stock reaches re-order level --- erpnext/patches/auto_indent.py | 7 ++ .../doctype/sales_order/sales_order.py | 2 +- .../doctype/manage_account/manage_account.txt | 30 +++--- erpnext/stock/doctype/bin/bin.py | 77 +++++++++++++--- .../doctype/delivery_note/delivery_note.py | 3 +- erpnext/stock/doctype/item/item.txt | 92 ++----------------- .../doctype/stock_ledger/stock_ledger.py | 2 +- erpnext/stock/doctype/warehouse/warehouse.py | 4 +- 8 files changed, 96 insertions(+), 121 deletions(-) create mode 100644 erpnext/patches/auto_indent.py diff --git a/erpnext/patches/auto_indent.py b/erpnext/patches/auto_indent.py new file mode 100644 index 0000000000..e215e7cc85 --- /dev/null +++ b/erpnext/patches/auto_indent.py @@ -0,0 +1,7 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('manage_account', 'doctype', 'auto_indent') + reload_doc('item', 'doctype', 'email_notify') + webnotes.conn.sql("update `tabItem` set re_order_level = min_order_qty where re_order_level=''") + diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index ca5af7ae66..72245ebb94 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -446,7 +446,7 @@ class DocType(TransactionBase): 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 21306cf802..52c1ea122f 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.txt +++ b/erpnext/setup/doctype/manage_account/manage_account.txt @@ -5,18 +5,19 @@ { 'creation': '2010-08-08 17:09:09', 'docstatus': 0, - 'modified': '2011-12-14 15:08:22', + 'modified': '2011-12-20 11:14:24', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1323855454', + '_last_update': '1323855502', 'allow_copy': 1, 'allow_email': 1, 'allow_print': 1, 'colour': 'White:FFF', + 'default_print_format': 'Standard', 'doctype': 'DocType', 'hide_toolbar': 0, 'in_create': 1, @@ -27,7 +28,7 @@ 'section_style': 'Tabbed', 'server_code_error': ' ', 'show_in_menu': 1, - 'version': 516 + 'version': 515 }, # These values are common for all DocField @@ -239,6 +240,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%' @@ -312,20 +322,6 @@ 'options': 'Role' }, - # DocField - { - 'doctype': 'DocField', - 'fieldtype': 'Column Break' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldtype': 'HTML', - 'label': 'Acccount Info', - 'options': '
For more accounting defaults, Open Company
' - }, - # DocField { 'doctype': 'DocField', diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index bb1101ea3f..7c1ddb9132 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 @@ class DocType: # ------------- # 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 @@ class DocType: 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 @@ class DocType: # 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 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) + + + # Re order Auto Intent Generation + def reorder_indent(self,i,item_reorder_level,doc_type,doc_name): + 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 )) + email_list=[d for d in sql("select parent from tabUserRole where role in ('Purchase Manager','Material Manager') ")] + #if getattr(): + msg='An Indent has been raised for %s: %s on %s '%(doc_type, doc_name, nowdate()) + msgprint(email_list) + sendmail(['nijil@iwebnotes.com'], sender='automail@webnotestech.com', \ + subject='Auto Indent Generation Notification', parts=[['text/plain',msg]]) # 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 ea8c648b74..93f72df512 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -374,8 +374,7 @@ class DocType(TransactionBase): # 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 0d20f7b531..c670700e0c 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': 'To manage Item Group, click here', @@ -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 0970b78056..f339970afa 100644 --- a/erpnext/stock/doctype/stock_ledger/stock_ledger.py +++ b/erpnext/stock/doctype/stock_ledger/stock_ledger.py @@ -224,7 +224,7 @@ class DocType: 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 0b099fdce1..b9d560a4f4 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -52,12 +52,12 @@ class DocType: # 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)