From 7b1a2dc89aba9bc62a0e5d51cd2d30534e7ccbb7 Mon Sep 17 00:00:00 2001 From: Brahma K Date: Tue, 16 Aug 2011 14:38:01 +0530 Subject: [PATCH 01/12] Purchase Voucher bug fix '.get_bin_details(arg)f' changed to '.get_bin_details(arg)' --- .../purchase_receipt/purchase_receipt.py | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/stock/doctype/purchase_receipt/purchase_receipt.py b/stock/doctype/purchase_receipt/purchase_receipt.py index 432998028a..bb2b456111 100644 --- a/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/stock/doctype/purchase_receipt/purchase_receipt.py @@ -13,7 +13,7 @@ sql = webnotes.conn.sql get_value = webnotes.conn.get_value in_transaction = webnotes.conn.in_transaction convert_to_lists = webnotes.conn.convert_to_lists - + # ----------------------------------------------------------------------------------------- from utilities.transaction_base import TransactionBase @@ -38,20 +38,20 @@ class DocType(TransactionBase): def get_default_schedule_date(self): get_obj(dt = 'Purchase Common').get_default_schedule_date(self) - + #-----------------Validation For Fiscal Year------------------------ def validate_fiscal_year(self): get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date') - - + + # Get Item Details def get_item_details(self, arg = ''): return get_obj(dt='Purchase Common').get_item_details(self,arg) - + # Get UOM Details def get_uom_details(self, arg = ''): return get_obj(dt='Purchase Common').get_uom_details(arg) - + # GET TERMS & CONDITIONS # ===================================================================================== def get_tc_details(self): @@ -59,16 +59,16 @@ class DocType(TransactionBase): # get available qty at warehouse def get_bin_details(self, arg = ''): - return get_obj(dt='Purchase Common').get_bin_details(arg)f + return get_obj(dt='Purchase Common').get_bin_details(arg) # Pull Purchase Order def get_po_details(self): self.validate_prev_docname() get_obj('DocType Mapper', 'Purchase Order-Purchase Receipt').dt_map('Purchase Order', 'Purchase Receipt', self.doc.purchase_order_no, self.doc, self.doclist, "[['Purchase Order','Purchase Receipt'],['PO Detail', 'Purchase Receipt Detail'],['Purchase Tax Detail','Purchase Tax Detail']]") - + # validate if PO has been pulled twice def validate_prev_docname(self): - for d in getlist(self.doclist, 'purchase_receipt_details'): + for d in getlist(self.doclist, 'purchase_receipt_details'): if self.doc.purchase_order_no and d.prevdoc_docname and self.doc.purchase_order_no == d.prevdoc_docname: msgprint(cstr(self.doc.purchase_order_no) + " Purchase Order details have already been pulled. ") raise Exception @@ -79,15 +79,15 @@ class DocType(TransactionBase): # validate accepted and rejected qty def validate_accepted_rejected_qty(self): for d in getlist(self.doclist, "purchase_receipt_details"): - - # If Reject Qty than Rejected warehouse is mandatory + + # If Reject Qty than Rejected warehouse is mandatory if flt(d.rejected_qty) and (not self.doc.rejected_warehouse): msgprint("Rejected Warehouse is necessary if there are rejections. See 'Receipt Items'") raise Exception - # Check Received Qty = Accepted Qty + Rejected Qty + # Check Received Qty = Accepted Qty + Rejected Qty if ((flt(d.qty) + flt(d.rejected_qty)) != flt(d.received_qty)): - + msgprint("Sum of Accepted Qty and Rejected Qty must be equal to Received quantity. Error for Item: " + cstr(d.item_code)) raise Exception @@ -99,8 +99,8 @@ class DocType(TransactionBase): if flt(self.doc.net_total) and flt(d.qty): #d.valuation_rate = (flt(d.purchase_rate) + ((flt(d.amount) * (total_b_cost)) / (self.doc.net_total * flt(d.qty))) + (flt(d.rm_supp_cost) / flt(d.qty))) / flt(d.conversion_factor) d.valuation_rate = (flt(d.purchase_rate) + ((flt(d.amount) * (total_b_cost)) / (self.doc.net_total * flt(d.qty))) + (flt(d.rm_supp_cost) / flt(d.qty)) + (flt(d.item_tax_amount)/flt(d.qty))) / flt(d.conversion_factor) - - # Check for Stopped status + + # Check for Stopped status def check_for_stopped_status(self, pc_obj): check_list =[] for d in getlist(self.doclist, 'purchase_receipt_details'): @@ -117,8 +117,8 @@ class DocType(TransactionBase): if not d.prevdoc_docname: msgprint("Purchse Order No. required against item %s"%d.item_code) raise Exception - - + + # validate def validate(self): self.po_required() @@ -137,20 +137,20 @@ class DocType(TransactionBase): self.check_for_stopped_status(pc_obj) # get total in words - dcc = TransactionBase().get_company_currency(self.doc.company) + dcc = TransactionBase().get_company_currency(self.doc.company) self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total) self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import) # update valuation rate self.update_valuation_rate() - + # On Update - # ---------------------------------------------------------------------------------------------------- + # ---------------------------------------------------------------------------------------------------- def on_update(self): if self.doc.rejected_warehouse: for d in getlist(self.doclist,'purchase_receipt_details'): d.rejected_warehouse = self.doc.rejected_warehouse - + self.update_rw_material_detail() get_obj('Stock Ledger').scrub_serial_nos(self) @@ -166,23 +166,23 @@ class DocType(TransactionBase): # Check if is_stock_item == 'Yes' if sql("select is_stock_item from tabItem where name=%s", d.item_code)[0][0]=='Yes': ord_qty = 0 - pr_qty = flt(d.qty) * flt(d.conversion_factor) - - # Check If Prevdoc Doctype is Purchase Order + pr_qty = flt(d.qty) * flt(d.conversion_factor) + + # Check If Prevdoc Doctype is Purchase Order if cstr(d.prevdoc_doctype) == 'Purchase Order': - # get qty and pending_qty of prevdoc + # get qty and pending_qty of prevdoc curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'PO Detail', 'Purchase Order - Purchase Receipt', self.doc.name) max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[0]), 0 - + if flt(qty) + flt(pr_qty) > flt(max_qty): curr_qty = (flt(max_qty) - flt(qty)) * flt(d.conversion_factor) else: curr_qty = flt(pr_qty) - + ord_qty = -flt(curr_qty) # update order qty in bin bin = get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(ord_qty), 0, 0, d.item_code, self.doc.transaction_date) - + # UPDATE actual qty to warehouse by pr_qty self.make_sl_entry(d, d.warehouse, flt(pr_qty), d.valuation_rate, is_submit) # UPDATE actual to rejected warehouse by rejected qty @@ -205,8 +205,8 @@ class DocType(TransactionBase): 'posting_time' : self.doc.posting_time, 'voucher_type' : 'Purchase Receipt', 'voucher_no' : self.doc.name, - 'voucher_detail_no' : d.name, - 'actual_qty' : qty, + 'voucher_detail_no' : d.name, + 'actual_qty' : qty, 'stock_uom' : d.stock_uom, 'incoming_rate' : in_value, 'company' : self.doc.company, @@ -220,11 +220,11 @@ class DocType(TransactionBase): def validate_inspection(self): for d in getlist(self.doclist, 'purchase_receipt_details'): #Enter inspection date for all items that require inspection ins_reqd = sql("select inspection_required from `tabItem` where name = %s", (d.item_code), as_dict = 1) - ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No' + ins_reqd = ins_reqd and ins_reqd[0]['inspection_required'] or 'No' if ins_reqd == 'Yes' and not d.qa_no: msgprint("Item: " + d.item_code + " requires QA Inspection. Please enter QA No or report to authorized person to create QA Inspection Report") - # Check for Stopped status + # Check for Stopped status def check_for_stopped_status(self, pc_obj): check_list =[] for d in getlist(self.doclist, 'purchase_receipt_details'): @@ -233,7 +233,7 @@ class DocType(TransactionBase): pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname) - # on submit + # on submit def on_submit(self): # Check for Approving Authority get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total) @@ -241,19 +241,19 @@ class DocType(TransactionBase): # Set status as Submitted set(self.doc,'status', 'Submitted') pc_obj = get_obj('Purchase Common') - + # Update Previous Doc i.e. update pending_qty and Status accordingly pc_obj.update_prevdoc_detail(self, is_submit = 1) - + # Update Serial Record get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1) - # Update Stock + # Update Stock self.update_stock(is_submit = 1) - - # Update last purchase rate + + # Update last purchase rate pc_obj.update_last_purchase_rate(self, 1) - + # on submit notification get_obj('Notification Control').notify_contact('Purchase Receipt', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person) @@ -271,11 +271,11 @@ class DocType(TransactionBase): def on_cancel(self): pc_obj = get_obj('Purchase Common') - + self.check_for_stopped_status(pc_obj) # 1.Check if Payable Voucher has been submitted against current Purchase Order # pc_obj.check_docstatus(check = 'Next', doctype = 'Payable Voucher', docname = self.doc.name, detail_doctype = 'PV Detail') - + submitted = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_receipt = '%s' and t1.docstatus = 1" % self.doc.name) if submitted: msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !") @@ -283,27 +283,27 @@ class DocType(TransactionBase): # 2.Set Status as Cancelled set(self.doc,'status','Cancelled') - - # 3. Cancel Serial No + + # 3. Cancel Serial No get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 0, is_incoming = 1) - # 4.Update Bin + # 4.Update Bin self.update_stock(is_submit = 0) - - # 5.Update Indents Pending Qty and accordingly it's Status + + # 5.Update Indents Pending Qty and accordingly it's Status pc_obj.update_prevdoc_detail(self, is_submit = 0) - # 6. Update last purchase rate + # 6. Update last purchase rate pc_obj.update_last_purchase_rate(self, 0) - + #----------- code for Sub-contracted Items ------------------- #--------check for sub-contracted items and accordingly update PR raw material detail table-------- def update_rw_material_detail(self): - + for d in getlist(self.doclist,'purchase_receipt_details'): item_det = sql("select is_sub_contracted_item, is_purchase_item from `tabItem` where name = '%s'"%(d.item_code)) - + if item_det[0][0] == 'Yes': if item_det[0][1] == 'Yes': if not self.doc.is_subcontracted: @@ -312,7 +312,7 @@ class DocType(TransactionBase): if self.doc.is_subcontracted == 'Yes': if not self.doc.supplier_warehouse: msgprint("Please Enter Supplier Warehouse for subcontracted Items") - raise Exception + raise Exception self.add_bom(d) else: self.doc.clear_table(self.doclist,'pr_raw_material_details',1) @@ -322,7 +322,7 @@ class DocType(TransactionBase): msgprint("Please Enter Supplier Warehouse for subcontracted Items") raise Exception self.add_bom(d) - + self.delete_irrelevant_raw_material() #---------------calculate amt in PR Raw Material Detail------------- self.calculate_amount(d) @@ -338,7 +338,7 @@ class DocType(TransactionBase): #-------------- add child function-------------------- chgd_rqd_qty = [] for i in bom_det: - + if i and not sql("select name from `tabPR Raw Material Detail` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)): rm_child = addchild(self.doc, 'pr_raw_material_details', 'PR Raw Material Detail', 1, self.doclist) @@ -347,7 +347,7 @@ class DocType(TransactionBase): rm_child.bom_detail_no = i and i[6] or '' rm_child.main_item_code = i and i[0] or '' rm_child.rm_item_code = i and i[1] or '' - rm_child.description = i and i[7] or '' + rm_child.description = i and i[7] or '' rm_child.stock_uom = i and i[5] or '' rm_child.rate = i and flt(i[3]) or flt(i[4]) rm_child.conversion_factor = d.conversion_factor @@ -363,7 +363,7 @@ class DocType(TransactionBase): chgd_rqd_qty.append(cstr(i[1])) pr_rmd.main_item_code = i[0] pr_rmd.rm_item_code = i[1] - pr_rmd.description = i[7] + pr_rmd.description = i[7] pr_rmd.stock_uom = i[5] pr_rmd.required_qty = flt(act_qty) pr_rmd.consumed_qty = flt(act_qty) @@ -372,20 +372,20 @@ class DocType(TransactionBase): pr_rmd.save() if chgd_rqd_qty: msgprint("Please check consumed quantity for Raw Material Item Code: '%s'in Raw materials Detail Table" % ((len(chgd_rqd_qty) > 1 and ','.join(chgd_rqd_qty[:-1]) +' and ' + cstr(chgd_rqd_qty[-1:][0]) ) or cstr(chgd_rqd_qty[0]))) - + # Delete irrelevant raw material from PR Raw material details - #-------------------------------------------------------------- + #-------------------------------------------------------------- def delete_irrelevant_raw_material(self): for d in getlist(self.doclist,'pr_raw_material_details'): if not sql("select name from `tabPurchase Receipt Detail` where name = '%s' and parent = '%s' and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)): d.parent = 'old_par:'+self.doc.name d.save() - + def calculate_amount(self, d): amt = 0 for i in getlist(self.doclist,'pr_raw_material_details'): - + if(i.reference_name == d.name): #if i.consumed_qty == 0: # msgprint("consumed qty cannot be 0. Please Enter consumed qty ") @@ -394,7 +394,7 @@ class DocType(TransactionBase): amt += i.amount d.rm_supp_cost = amt d.save() - + # --------------- Back Flush function called on submit and on cancel from update stock def bk_flush_supp_wh(self, is_submit): @@ -402,7 +402,7 @@ class DocType(TransactionBase): #--------- -ve quantity is passed as raw material qty has to be decreased when PR is submitted and it has to be increased when PR is cancelled consumed_qty = - flt(d.consumed_qty) self.make_sl_entry(d, self.doc.supplier_warehouse, flt(consumed_qty), 0, is_submit) - + # get current_stock # ---------------- @@ -411,13 +411,13 @@ class DocType(TransactionBase): if self.doc.supplier_warehouse: bin = sql("select actual_qty from `tabBin` where item_code = %s and warehouse = %s", (d.rm_item_code, self.doc.supplier_warehouse), as_dict = 1) d.current_stock = bin and flt(bin[0]['actual_qty']) or 0 - - - + + + # OTHER CHARGES TRIGGER FUNCTIONS # ==================================================================================== - + # *********** Get Tax rate if account type is TAX ******************** def get_rate(self,arg): return get_obj('Purchase Common').get_rate(arg,self) From ed9b0781287833cf069ecf6030d633b479b9c406 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Aug 2011 16:32:48 +0530 Subject: [PATCH 02/12] removed cstr in get_server_fields return value --- utilities/transaction_base.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 332e201986..3678298f7b 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -53,7 +53,7 @@ class TransactionBase: 'contact_email' : contact_email, 'contact_mobile' : contact_mobile } - return cstr(ret) + return ret # Get Address Text # ----------------------- @@ -125,7 +125,7 @@ class TransactionBase: 'shipping_address_name' : details and details[0]['name'] or '', 'shipping_address' : address_display } - return cstr(ret) + return ret # Get Lead Details # ----------------------- @@ -144,7 +144,7 @@ class TransactionBase: 'contact_mobile' : extract('mobile_no'), 'contact_email' : extract('email_id') } - return cstr(ret) + return ret # Get Supplier Default Primary Address - first load @@ -162,7 +162,7 @@ class TransactionBase: 'contact_mobile' : contact_mobile } ret.update(self.get_supplier_details(args['supplier'])) - return cstr(ret) + return ret # Get Supplier Address # ----------------------- @@ -178,7 +178,7 @@ class TransactionBase: 'contact_email' : contact_email, 'contact_mobile' : contact_mobile } - return cstr(ret) + return ret # Get Supplier Details # ----------------------- From 501f3d50984d12de336f2eab39e3131d23f97909 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 Aug 2011 10:29:58 +0530 Subject: [PATCH 03/12] str removed for get_server_fields return --- accounts/doctype/receivable_voucher/receivable_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.py b/accounts/doctype/receivable_voucher/receivable_voucher.py index 185b0b1dbc..0aaebbbe8e 100644 --- a/accounts/doctype/receivable_voucher/receivable_voucher.py +++ b/accounts/doctype/receivable_voucher/receivable_voucher.py @@ -162,7 +162,7 @@ class DocType(TransactionBase): if ret['warehouse']: actual_qty = sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (item_code, ret['warehouse'])) ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0 - return str(ret) + return ret # Get tax rate if account type is tax From 8eb1ec27bac6f534388a56d50ccce5d64f9b1074 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 17 Aug 2011 12:21:18 +0530 Subject: [PATCH 04/12] check if banner is not default --- home/page/event_updates/event_updates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home/page/event_updates/event_updates.py b/home/page/event_updates/event_updates.py index 6e811e756b..0798dca3a4 100644 --- a/home/page/event_updates/event_updates.py +++ b/home/page/event_updates/event_updates.py @@ -56,7 +56,8 @@ def get_setup_status(): percent = 20 ret = [] - if not webnotes.conn.get_value('Personalize', None, 'header_html'): + header = webnotes.conn.get_value('Control Panel', None, 'client_name') or '' + if header.startswith('
'): ret.append('Upload your company banner') else: percent += 20 From 496a65a45dd32ef30346d0e69f1f37888f7d6e53 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 17 Aug 2011 12:23:53 +0530 Subject: [PATCH 05/12] check if banner is not default --- home/page/event_updates/event_updates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home/page/event_updates/event_updates.py b/home/page/event_updates/event_updates.py index 0798dca3a4..85a121b206 100644 --- a/home/page/event_updates/event_updates.py +++ b/home/page/event_updates/event_updates.py @@ -57,7 +57,8 @@ def get_setup_status(): ret = [] header = webnotes.conn.get_value('Control Panel', None, 'client_name') or '' - if header.startswith('
'): + if header.startswith('
'\ + +webnotes.conn.get_value('Control Panel', None, 'company_name')): ret.append('Upload your company banner') else: percent += 20 From cddc2fa952e29a73ac077465b1a4a6e5637d7c1d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Aug 2011 14:55:32 +0530 Subject: [PATCH 06/12] Permission given to material user for production material issue and back --- 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 4613bc4ff0e83994c44358d4a2f6f46e7d0e4b22 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Aug 2011 15:29:35 +0530 Subject: [PATCH 07/12] removed eval --- accounts/doctype/payable_voucher/payable_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/payable_voucher/payable_voucher.py b/accounts/doctype/payable_voucher/payable_voucher.py index d7f628f459..b403d20c02 100644 --- a/accounts/doctype/payable_voucher/payable_voucher.py +++ b/accounts/doctype/payable_voucher/payable_voucher.py @@ -84,7 +84,7 @@ class DocType(TransactionBase): self.validate_duplicate_docname('purchase_order') self.doclist = get_obj('DocType Mapper', 'Purchase Order-Payable Voucher').dt_map('Purchase Order', 'Payable Voucher', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Payable Voucher'],['PO Detail', 'PV Detail']]") - ret = eval(self.get_credit_to()) + ret = self.get_credit_to() #self.doc.supplier_name = ret['supplier_name'] #self.doc.supplier_address = ret['supplier_address'] From ec72365f9115a63ec01118328b6ce28196a29683 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 15:54:46 +0530 Subject: [PATCH 08/12] removed eval --- accounts/doctype/receivable_voucher/receivable_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.py b/accounts/doctype/receivable_voucher/receivable_voucher.py index 0aaebbbe8e..267ea9212f 100644 --- a/accounts/doctype/receivable_voucher/receivable_voucher.py +++ b/accounts/doctype/receivable_voucher/receivable_voucher.py @@ -128,7 +128,7 @@ class DocType(TransactionBase): get_obj('DocType Mapper', 'Sales Order-Receivable Voucher').dt_map('Sales Order', 'Receivable Voucher', self.doc.sales_order_main, self.doc, self.doclist, "[['Sales Order', 'Receivable Voucher'],['Sales Order Detail', 'RV Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team']]") self.get_income_account('entries') - ret = eval(self.get_debit_to()) + ret = self.get_debit_to() if ret.has_key('debit_to'): self.doc.debit_to = ret['debit_to'] From 83c0d59d50805e8bf09daac9df2649c2a2a90763 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 16:16:03 +0530 Subject: [PATCH 09/12] removed eval --- hr/doctype/leave_allocation/leave_allocation.py | 2 +- hr/doctype/leave_application/leave_application.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hr/doctype/leave_allocation/leave_allocation.py b/hr/doctype/leave_allocation/leave_allocation.py index 46f78094a3..12fe37a85b 100755 --- a/hr/doctype/leave_allocation/leave_allocation.py +++ b/hr/doctype/leave_allocation/leave_allocation.py @@ -75,7 +75,7 @@ class DocType: # get total allocated leaves # --------------------------- def get_total_allocated_leaves(self): - leave_det = eval(self.get_carry_forwarded_leaves()) + leave_det = self.get_carry_forwarded_leaves() set(self.doc,'carry_forwarded_leaves',flt(leave_det['carry_forwarded_leaves'])) set(self.doc,'total_leaves_allocated',flt(leave_det['total_leaves_allocated'])) diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py index 01bf7fec50..1756f2a7ca 100755 --- a/hr/doctype/leave_application/leave_application.py +++ b/hr/doctype/leave_application/leave_application.py @@ -82,7 +82,7 @@ class DocType: if not self.is_lwp(): bal = self.get_leave_balance() tot_leaves = self.get_total_leave_days() - bal, tot_leaves = eval(bal), eval(tot_leaves) + bal, tot_leaves = bal, tot_leaves set(self.doc,'leave_balance',flt(bal['leave_balance'])) set(self.doc,'total_leave_days',flt(tot_leaves['total_leave_days'])) if flt(bal['leave_balance']) < flt(tot_leaves['total_leave_days']): From 3eb37ce0a658b57109c3f5b9d83aed2d74ac58d7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 17:21:21 +0530 Subject: [PATCH 10/12] source, target warehouse is editable for material user, manager in stock entry --- patches/patch.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index 8b7276b00d..f94c905eed 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 340 +last_patch = 342 #------------------------------------------- @@ -1409,3 +1409,17 @@ def execute(patch_no): 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'") + elif patch_no == 341: + reload_doc('stock','doctype','delivery_note') + reload_doc('stock','doctype','item') + reload_doc('selling','doctype','quotation') + reload_doc('stock','Print Format','Delivery Note Packing List Wise') + + if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"): + from webnotes.model.doc import addchild + dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1) + ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1) + ch.format = 'Delivery Note Packing List Wise' + ch.save(1) + elif patch_no == 342: + sql("update `tabDocField` set permlevel = 0 where parent = 'Stock Entry' and fieldname in ('s_warehouse', 't_warehouse', 'fg_item')") From 5198262505e8bc5e0c09d5ec533029410e502d2a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 17:29:15 +0530 Subject: [PATCH 11/12] source, target warehouse is editable for material user, manager in stock entry --- patches/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index f94c905eed..b4116b5b28 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1422,4 +1422,4 @@ def execute(patch_no): ch.format = 'Delivery Note Packing List Wise' ch.save(1) elif patch_no == 342: - sql("update `tabDocField` set permlevel = 0 where parent = 'Stock Entry' and fieldname in ('s_warehouse', 't_warehouse', 'fg_item')") + sql("update `tabDocField` set permlevel = 0 where parent = 'Stock Entry Detail' and fieldname in ('s_warehouse', 't_warehouse', 'fg_item')") From 7b8f53c1936a51d48ae97f4a0b8964682ad17d4e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Aug 2011 11:23:34 +0530 Subject: [PATCH 12/12] delete blank row in dn print format --- patches/patch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index b4116b5b28..9a2bb8371c 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 342 +last_patch = 343 #------------------------------------------- @@ -1423,3 +1423,5 @@ def execute(patch_no): ch.save(1) elif patch_no == 342: sql("update `tabDocField` set permlevel = 0 where parent = 'Stock Entry Detail' and fieldname in ('s_warehouse', 't_warehouse', 'fg_item')") + elif patch_no == 343: + sql("delete from `tabDocFormat` where ifnull(format, '') = '' and parent = 'Delivery Note'")