From 9537446aa6c23913f4e6cb5b545609b96e5d805b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Aug 2011 14:40:11 +0530 Subject: [PATCH 1/2] Permission given to material user for production material issue and back flush --- patches/patch.py | 4 +- stock/doctype/stock_entry/stock_entry.txt | 109 ++++++++++------------ 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 1568469a4f..8b7276b00d 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 339 +last_patch = 340 #------------------------------------------- @@ -1407,3 +1407,5 @@ def execute(patch_no): sql("update tabPage set name='question-view' where name='Question View'") elif patch_no == 339: reload_doc('production','doctype','bill_of_materials') + elif patch_no == 340: + sql("update `tabDocField` set permlevel = 0 where (fieldname in ('process', 'production_order', 'fg_completed_qty') or label = 'Get Items') and parent = 'Stock Entry'") diff --git a/stock/doctype/stock_entry/stock_entry.txt b/stock/doctype/stock_entry/stock_entry.txt index d7477c223b..63f718bec1 100644 --- a/stock/doctype/stock_entry/stock_entry.txt +++ b/stock/doctype/stock_entry/stock_entry.txt @@ -5,14 +5,14 @@ { 'creation': '2010-08-08 17:09:25', 'docstatus': 0, - 'modified': '2011-07-11 12:48:52', + 'modified': '2011-08-22 14:36:19', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1308741898', + '_last_update': '1311621379', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, @@ -40,7 +40,7 @@ 'subject': '%(remarks)s', 'tag_fields': 'purpose', 'use_template': 0, - 'version': 243 + 'version': 245 }, # These values are common for all DocField @@ -70,15 +70,15 @@ # DocPerm { - 'amend': 1, - 'cancel': 1, - 'create': 1, + 'amend': 0, + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', 'idx': 1, - 'permlevel': 0, + 'permlevel': 1, 'role': 'Material Manager', - 'submit': 1, - 'write': 1 + 'submit': 0, + 'write': 0 }, # DocPerm @@ -89,7 +89,7 @@ 'doctype': 'DocPerm', 'idx': 2, 'permlevel': 1, - 'role': 'Material Manager', + 'role': 'Material User', 'submit': 0, 'write': 0 }, @@ -102,7 +102,7 @@ 'doctype': 'DocPerm', 'idx': 3, 'permlevel': 0, - 'role': 'Material User', + 'role': 'Production User', 'submit': 1, 'write': 1 }, @@ -115,69 +115,60 @@ 'doctype': 'DocPerm', 'idx': 4, 'permlevel': 1, - 'role': 'Material User', + 'role': 'Production User', 'submit': 0, 'write': 0 }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': 'DocPerm', + 'idx': 5, + 'permlevel': 2, + 'role': 'Production User', + 'submit': 0, + 'write': 1 + }, + # DocPerm { 'amend': 1, 'cancel': 1, 'create': 1, 'doctype': 'DocPerm', - 'idx': 5, + 'idx': 6, 'permlevel': 0, - 'role': 'Production User', + 'role': 'Production Manager', 'submit': 1, 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', - 'idx': 6, - 'permlevel': 1, - 'role': 'Production User' - }, - - # DocPerm - { + 'amend': 0, + 'cancel': 0, 'create': 0, 'doctype': 'DocPerm', 'idx': 7, - 'permlevel': 2, - 'role': 'Production User', - 'write': 1 + 'permlevel': 1, + 'role': 'Production Manager', + 'submit': 0, + 'write': 0 }, # DocPerm { - 'amend': 1, - 'cancel': 1, - 'create': 1, + 'amend': 0, + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', 'idx': 8, - 'permlevel': 0, - 'role': 'Production Manager', - 'submit': 1, - 'write': 1 - }, - - # DocPerm - { - 'doctype': 'DocPerm', - 'idx': 9, - 'permlevel': 1, - 'role': 'Production Manager' - }, - - # DocPerm - { - 'doctype': 'DocPerm', - 'idx': 10, 'permlevel': 2, 'role': 'Production Manager', + 'submit': 0, 'write': 1 }, @@ -452,7 +443,7 @@ 'oldfieldname': 'process', 'oldfieldtype': 'Select', 'options': '\nMaterial Transfer\nBackflush', - 'permlevel': 2, + 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 0, @@ -474,7 +465,7 @@ 'oldfieldname': 'production_order', 'oldfieldtype': 'Link', 'options': 'Production Order', - 'permlevel': 2, + 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 1, @@ -493,7 +484,7 @@ 'no_copy': 0, 'oldfieldname': 'fg_completed_qty', 'oldfieldtype': 'Currency', - 'permlevel': 2, + 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 0, @@ -802,7 +793,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 36, + 'idx': 35, 'oldfieldtype': 'Column Break', 'permlevel': 0 }, @@ -814,13 +805,13 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 0, - 'idx': 37, + 'idx': 36, 'in_filter': 0, 'label': 'Get Items', 'no_copy': 0, 'oldfieldtype': 'Button', 'options': 'get_items', - 'permlevel': 2, + 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 0 @@ -830,7 +821,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 38, + 'idx': 37, 'oldfieldtype': 'Section Break', 'options': 'Simple', 'permlevel': 0 @@ -843,7 +834,7 @@ 'doctype': 'DocField', 'fieldname': 'mtn_details', 'fieldtype': 'Table', - 'idx': 39, + 'idx': 38, 'in_filter': 0, 'label': 'MTN Details', 'no_copy': 0, @@ -862,7 +853,7 @@ 'doctype': 'DocField', 'fieldname': 'total_amount', 'fieldtype': 'Currency', - 'idx': 40, + 'idx': 39, 'in_filter': 0, 'label': 'Total Amount', 'no_copy': 0, @@ -878,7 +869,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 41, + 'idx': 40, 'label': 'Other Details', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -890,7 +881,7 @@ 'doctype': 'DocField', 'fieldname': 'company', 'fieldtype': 'Link', - 'idx': 42, + 'idx': 41, 'in_filter': 1, 'label': 'Company', 'no_copy': 0, @@ -910,7 +901,7 @@ 'doctype': 'DocField', 'fieldname': 'fiscal_year', 'fieldtype': 'Select', - 'idx': 43, + 'idx': 42, 'in_filter': 0, 'label': 'Fiscal Year', 'no_copy': 0, @@ -930,7 +921,7 @@ 'doctype': 'DocField', 'fieldname': 'select_print_heading', 'fieldtype': 'Link', - 'idx': 44, + 'idx': 43, 'in_filter': 0, 'label': 'Select Print Heading', 'no_copy': 0, From fbe3f18d24ccc9f7b856e465462271d588260c9f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Aug 2011 14:41:28 +0530 Subject: [PATCH 2/2] Check serial no/bin qty integrity only if actual_qty > 0 --- stock/doctype/bin/bin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 798b442ed3..fc51d76829 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -38,11 +38,12 @@ class DocType: self.doc.save() - # check actual qty with total number of serial no - self.check_qty_with_serial_no() # update valuation for post dated entry if actual_qty: + # check actual qty with total number of serial no + self.check_qty_with_serial_no() + prev_sle = self.get_prev_sle(dt, posting_time, sle_id) cqty = flt(prev_sle.get('bin_aqat', 0)) # Block if actual qty becomes negative @@ -59,7 +60,7 @@ class DocType: if sql("select name from `tabItem` where ifnull(has_serial_no, 'No') = 'Yes' and name = '%s'" % self.doc.item_code): sr_count = sql("select count(name) from `tabSerial No` where item_code = '%s' and warehouse = '%s' and status ='In Store' and docstatus != 2" % (self.doc.item_code, self.doc.warehouse))[0][0] if sr_count != self.doc.actual_qty: - msg = "Actual Qty in Bin is mismatched with total number of serial no in store for item: '%s' and warehouse: '%s'" % (self.doc.item_code, self.doc.warehouse) + msg = "Actual Qty(%s) in Bin is mismatched with total number(%s) of serial no in store for item: '%s' and warehouse: '%s'" % (self.doc.actual_qty, sr_count, self.doc.item_code, self.doc.warehouse) msgprint(msg, raise_exception=1) sendmail(['developer@iwebnotes.com'], sender='automail@webnotestech.com', subject='Serial No Count vs Bin Actual Qty', parts=[['text/plain', msg]])