From 81e36a34a6cdfff5b8a0f3c62b37a5882920a7a9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 Aug 2011 15:03:01 +0530 Subject: [PATCH 01/16] Budget variance report based on company --- .../budget_variance_report/budget_variance_report.js | 10 ++++------ .../budget_variance_report/budget_variance_report.py | 7 +------ .../budget_variance_report/budget_variance_report.sql | 11 ++++++++++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.js b/accounts/search_criteria/budget_variance_report/budget_variance_report.js index ed5adb12f0..08c9693962 100644 --- a/accounts/search_criteria/budget_variance_report/budget_variance_report.js +++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.js @@ -1,17 +1,15 @@ report.customize_filters = function() { - - //this.hide_all_filters(); - this.mytabs.items['Select Columns'].hide(); - this.mytabs.items['More Filters'].hide(); - - this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'}); + this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Budget Detail', in_first_page:1}); this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1; this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Period'].df.in_first_page = 1; this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year; } + report.aftertableprint = function(t) { $yt(t,'*',1,{whiteSpace:'pre'}); } + +this.mytabs.items['More Filters'].hide(); this.mytabs.items['Select Columns'].hide(); diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.py b/accounts/search_criteria/budget_variance_report/budget_variance_report.py index 182f9e5356..9f7c690cbc 100644 --- a/accounts/search_criteria/budget_variance_report/budget_variance_report.py +++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.py @@ -131,11 +131,6 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx): col_idx[str(c) + n ] = len(colnames) - 1 - -# make default columns -#coltypes[col_idx[based_on]] = 'Link' -#coloptions[col_idx[based_on]]= based_on - # get start date start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date') if not start_date: @@ -162,7 +157,7 @@ for r in res: ch = make_child_lst(based_on,r[0].strip()) - actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t2.is_pl_account = 'Yes' and t1.is_cancelled = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']])) + actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(t1.is_cancelled, 'No') = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']])) #---------------------------------------------------------- actual = flt(actual[0][0]) diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql index d53f7e1ead..575fbfbc19 100644 --- a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql +++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql @@ -1 +1,10 @@ -SELECT CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM `tabCost Center` AS node,`tabCost Center` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft \ No newline at end of file +SELECT + CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name +FROM + `tabCost Center` AS node,`tabCost Center` AS parent +WHERE + node.lft BETWEEN parent.lft AND parent.rgt + AND node.docstatus !=2 + AND node.company_name like '%(company)s%%' +GROUP BY node.name +ORDER BY node.lft From 1d828f644a2e526030428489c6ede81da8a2969a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 17 Aug 2011 15:05:32 +0530 Subject: [PATCH 02/16] permission updated in employee --- hr/doctype/employee/employee.txt | 173 ++++++++++++++----------------- 1 file changed, 75 insertions(+), 98 deletions(-) diff --git a/hr/doctype/employee/employee.txt b/hr/doctype/employee/employee.txt index 49a494b99b..98caa2c9c2 100644 --- a/hr/doctype/employee/employee.txt +++ b/hr/doctype/employee/employee.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2011-02-17 11:16:08', + 'creation': '2010-08-08 17:08:59', 'docstatus': 0, - 'modified': '2011-06-27 14:39:04', + 'modified': '2011-08-11 17:27:12', 'modified_by': 'Administrator', 'owner': 'Administrator' }, @@ -26,7 +26,7 @@ 'show_in_menu': 0, 'subject': '%(employee_name)s', 'tag_fields': 'status', - 'version': 443 + 'version': 444 }, # These values are common for all DocField @@ -40,12 +40,14 @@ # These values are common for all DocPerm { + 'amend': 0, 'doctype': 'DocPerm', 'name': '__common__', 'parent': 'Employee', 'parentfield': 'permissions', 'parenttype': 'DocType', - 'read': 1 + 'read': 1, + 'submit': 0 }, # DocType, Employee @@ -56,21 +58,24 @@ # DocPerm { - 'cancel': 1, - 'create': 1, + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', 'idx': 1, 'permlevel': 0, - 'role': 'System Manager', - 'write': 1 + 'role': 'Employee', + 'write': 0 }, # DocPerm { + 'cancel': 0, + 'create': 0, 'doctype': 'DocPerm', 'idx': 2, 'permlevel': 1, - 'role': 'All' + 'role': 'All', + 'write': 0 }, # DocPerm @@ -95,22 +100,6 @@ 'write': 1 }, - # DocPerm - { - 'doctype': 'DocPerm', - 'idx': 5, - 'permlevel': 1, - 'role': 'HR User' - }, - - # DocPerm - { - 'doctype': 'DocPerm', - 'idx': 6, - 'permlevel': 1, - 'role': 'HR Manager' - }, - # DocField { 'doctype': 'DocField', @@ -141,7 +130,7 @@ 'no_copy': 1, 'oldfieldname': 'naming_series', 'oldfieldtype': 'Select', - 'options': 'WN-EMP\nEMP/', + 'options': 'EMP/', 'permlevel': 0, 'reqd': 0 }, @@ -173,8 +162,7 @@ 'oldfieldname': 'employee_name', 'oldfieldtype': 'Data', 'permlevel': 0, - 'reqd': 1, - 'search_index': 1 + 'reqd': 1 }, # DocField @@ -276,7 +264,7 @@ 'options': '\nActive\nLeft', 'permlevel': 0, 'reqd': 1, - 'search_index': 0 + 'search_index': 1 }, # DocField @@ -409,8 +397,7 @@ 'oldfieldtype': 'Link', 'options': 'Department', 'permlevel': 0, - 'reqd': 1, - 'search_index': 1 + 'reqd': 1 }, # DocField @@ -474,21 +461,11 @@ 'reqd': 0 }, - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'is_sales_person', - 'fieldtype': 'Check', - 'idx': 27, - 'label': 'Is Sales Person', - 'permlevel': 0 - }, - # DocField { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 28, + 'idx': 27, 'label': 'Salary Information', 'oldfieldtype': 'Section Break', 'permlevel': 0, @@ -501,11 +478,11 @@ 'doctype': 'DocField', 'fieldname': 'salary_mode', 'fieldtype': 'Select', - 'idx': 29, + 'idx': 28, 'label': 'Salary Mode', 'oldfieldname': 'salary_mode', 'oldfieldtype': 'Select', - 'options': '\nBank\nCash \nCheque', + 'options': '\nBank\nCash\nCheque', 'permlevel': 0, 'trigger': 'Client' }, @@ -518,7 +495,7 @@ 'fieldname': 'bank_name', 'fieldtype': 'Data', 'hidden': 0, - 'idx': 30, + 'idx': 29, 'in_filter': 1, 'label': 'Bank Name', 'oldfieldname': 'bank_name', @@ -535,7 +512,7 @@ 'fieldname': 'bank_ac_no', 'fieldtype': 'Data', 'hidden': 0, - 'idx': 31, + 'idx': 30, 'label': 'Bank A/C No.', 'oldfieldname': 'bank_ac_no', 'oldfieldtype': 'Data', @@ -547,7 +524,7 @@ 'doctype': 'DocField', 'fieldname': 'esic_card_no', 'fieldtype': 'Data', - 'idx': 32, + 'idx': 31, 'label': 'ESIC CARD No', 'oldfieldname': 'esic_card_no', 'oldfieldtype': 'Data', @@ -559,7 +536,7 @@ 'doctype': 'DocField', 'fieldname': 'pf_number', 'fieldtype': 'Data', - 'idx': 33, + 'idx': 32, 'label': 'PF Number', 'oldfieldname': 'pf_number', 'oldfieldtype': 'Data', @@ -571,7 +548,7 @@ 'doctype': 'DocField', 'fieldname': 'gratuity_lic_id', 'fieldtype': 'Data', - 'idx': 34, + 'idx': 33, 'label': 'Gratuity LIC ID', 'oldfieldname': 'gratuity_lic_id', 'oldfieldtype': 'Data', @@ -582,7 +559,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 35, + 'idx': 34, 'label': 'Contact Details', 'permlevel': 0 }, @@ -591,7 +568,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 36, + 'idx': 35, 'permlevel': 0, 'width': '50%' }, @@ -601,7 +578,7 @@ 'doctype': 'DocField', 'fieldname': 'cell_number', 'fieldtype': 'Data', - 'idx': 37, + 'idx': 36, 'label': 'Cell Number', 'permlevel': 0 }, @@ -611,7 +588,7 @@ 'doctype': 'DocField', 'fieldname': 'personal_email', 'fieldtype': 'Data', - 'idx': 38, + 'idx': 37, 'label': 'Personal Email', 'permlevel': 0 }, @@ -621,7 +598,7 @@ 'doctype': 'DocField', 'fieldname': 'notice_number_of_days', 'fieldtype': 'Int', - 'idx': 39, + 'idx': 38, 'label': 'Notice - Number of Days', 'oldfieldname': 'notice_number_of_days', 'oldfieldtype': 'Int', @@ -632,7 +609,7 @@ { 'doctype': 'DocField', 'fieldtype': 'HTML', - 'idx': 40, + 'idx': 39, 'label': 'Emergency Contact Details', 'options': 'Emergency Contact Details', 'permlevel': 0 @@ -643,7 +620,7 @@ 'doctype': 'DocField', 'fieldname': 'person_to_be_contacted', 'fieldtype': 'Data', - 'idx': 41, + 'idx': 40, 'label': 'Person To Be Contacted', 'permlevel': 0 }, @@ -653,7 +630,7 @@ 'doctype': 'DocField', 'fieldname': 'relation', 'fieldtype': 'Data', - 'idx': 42, + 'idx': 41, 'label': 'Relation', 'permlevel': 0 }, @@ -663,7 +640,7 @@ 'doctype': 'DocField', 'fieldname': 'emergency_phone_number', 'fieldtype': 'Data', - 'idx': 43, + 'idx': 42, 'label': 'Emergency Phone Number', 'permlevel': 0 }, @@ -672,7 +649,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 44, + 'idx': 43, 'permlevel': 0, 'width': '50%' }, @@ -682,7 +659,7 @@ 'doctype': 'DocField', 'fieldname': 'permanent_accommodation_type', 'fieldtype': 'Select', - 'idx': 45, + 'idx': 44, 'label': 'Permanent Accommodation Type', 'options': '\nRented\nOwned', 'permlevel': 0 @@ -693,7 +670,7 @@ 'doctype': 'DocField', 'fieldname': 'permanent_address', 'fieldtype': 'Small Text', - 'idx': 46, + 'idx': 45, 'label': 'Permanent Address', 'permlevel': 0 }, @@ -703,7 +680,7 @@ 'doctype': 'DocField', 'fieldname': 'current_accommodation_type', 'fieldtype': 'Select', - 'idx': 47, + 'idx': 46, 'label': 'Current Accommodation Type', 'options': '\nRented\nOwned', 'permlevel': 0 @@ -714,7 +691,7 @@ 'doctype': 'DocField', 'fieldname': 'current_address', 'fieldtype': 'Small Text', - 'idx': 48, + 'idx': 47, 'label': 'Current Address', 'permlevel': 0 }, @@ -723,7 +700,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 49, + 'idx': 48, 'label': 'Personal Details', 'permlevel': 0 }, @@ -732,7 +709,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 50, + 'idx': 49, 'permlevel': 0, 'width': '50%' }, @@ -742,7 +719,7 @@ 'doctype': 'DocField', 'fieldname': 'pan_number', 'fieldtype': 'Data', - 'idx': 51, + 'idx': 50, 'label': 'PAN Number', 'permlevel': 0 }, @@ -752,7 +729,7 @@ 'doctype': 'DocField', 'fieldname': 'passport_number', 'fieldtype': 'Data', - 'idx': 52, + 'idx': 51, 'label': 'Passport Number', 'permlevel': 0 }, @@ -763,7 +740,7 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 1, - 'idx': 53, + 'idx': 52, 'label': 'Employee Profile', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -775,7 +752,7 @@ 'doctype': 'DocField', 'fieldname': 'date_of_issue', 'fieldtype': 'Date', - 'idx': 54, + 'idx': 53, 'label': 'Date of Issue', 'permlevel': 0 }, @@ -785,7 +762,7 @@ 'doctype': 'DocField', 'fieldname': 'valid_upto', 'fieldtype': 'Date', - 'idx': 55, + 'idx': 54, 'label': 'Valid Upto', 'permlevel': 0 }, @@ -796,7 +773,7 @@ 'doctype': 'DocField', 'fieldtype': 'Button', 'hidden': 1, - 'idx': 56, + 'idx': 55, 'label': 'Salary Structure', 'oldfieldtype': 'Button', 'permlevel': 0, @@ -808,7 +785,7 @@ 'doctype': 'DocField', 'fieldname': 'place_of_issue', 'fieldtype': 'Data', - 'idx': 57, + 'idx': 56, 'label': 'Place of Issue', 'permlevel': 0 }, @@ -818,7 +795,7 @@ 'doctype': 'DocField', 'fieldname': 'marital_status', 'fieldtype': 'Select', - 'idx': 58, + 'idx': 57, 'label': 'Marital Status', 'options': '\nSingle\nMarried\nDivorced\nWidowed', 'permlevel': 0 @@ -829,7 +806,7 @@ 'doctype': 'DocField', 'fieldname': 'blood_group', 'fieldtype': 'Select', - 'idx': 59, + 'idx': 58, 'label': 'Blood Group', 'options': '\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-', 'permlevel': 0 @@ -839,7 +816,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 60, + 'idx': 59, 'permlevel': 0, 'width': '50%' }, @@ -851,7 +828,7 @@ 'doctype': 'DocField', 'fieldname': 'family_background', 'fieldtype': 'Small Text', - 'idx': 61, + 'idx': 60, 'label': 'Family Background', 'permlevel': 0 }, @@ -863,7 +840,7 @@ 'doctype': 'DocField', 'fieldname': 'health_details', 'fieldtype': 'Small Text', - 'idx': 62, + 'idx': 61, 'label': 'Health Details', 'permlevel': 0 }, @@ -872,7 +849,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 63, + 'idx': 62, 'label': 'Educational Qualification', 'permlevel': 0 }, @@ -882,7 +859,7 @@ 'doctype': 'DocField', 'fieldname': 'educational_qualification_details', 'fieldtype': 'Table', - 'idx': 64, + 'idx': 63, 'label': 'Educational Qualification Details', 'options': 'Educational Qualifications Detail', 'permlevel': 0 @@ -892,7 +869,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 65, + 'idx': 64, 'label': 'Career History', 'permlevel': 0 }, @@ -901,7 +878,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 66, + 'idx': 65, 'label': 'Previous Work Experience', 'options': 'Simple', 'permlevel': 0 @@ -912,7 +889,7 @@ 'doctype': 'DocField', 'fieldname': 'previous_experience_details', 'fieldtype': 'Table', - 'idx': 67, + 'idx': 66, 'label': 'Previous Experience Details', 'options': 'Previous Experience Detail', 'permlevel': 0 @@ -922,7 +899,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 68, + 'idx': 67, 'label': 'History In Company', 'options': 'Simple', 'permlevel': 0 @@ -933,7 +910,7 @@ 'doctype': 'DocField', 'fieldname': 'experience_in_company_details', 'fieldtype': 'Table', - 'idx': 69, + 'idx': 68, 'label': 'Experience In Company Details', 'options': 'Experience In Company Detail', 'permlevel': 0 @@ -943,7 +920,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Section Break', - 'idx': 70, + 'idx': 69, 'label': 'Exit', 'oldfieldtype': 'Section Break', 'permlevel': 0 @@ -953,7 +930,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 71, + 'idx': 70, 'permlevel': 0, 'width': '50%' }, @@ -963,7 +940,7 @@ 'doctype': 'DocField', 'fieldname': 'resignation_letter_date', 'fieldtype': 'Date', - 'idx': 72, + 'idx': 71, 'label': 'Resignation Letter Date', 'oldfieldname': 'resignation_letter_date', 'oldfieldtype': 'Date', @@ -975,7 +952,7 @@ 'doctype': 'DocField', 'fieldname': 'relieving_date', 'fieldtype': 'Date', - 'idx': 73, + 'idx': 72, 'in_filter': 1, 'label': 'Relieving Date', 'oldfieldname': 'relieving_date', @@ -988,7 +965,7 @@ 'doctype': 'DocField', 'fieldname': 'reason_for_leaving', 'fieldtype': 'Data', - 'idx': 74, + 'idx': 73, 'label': 'Reason for Leaving', 'oldfieldname': 'reason_for_leaving', 'oldfieldtype': 'Data', @@ -1000,7 +977,7 @@ 'doctype': 'DocField', 'fieldname': 'leave_encashed', 'fieldtype': 'Select', - 'idx': 75, + 'idx': 74, 'label': 'Leave Encashed?', 'oldfieldname': 'leave_encashed', 'oldfieldtype': 'Select', @@ -1013,7 +990,7 @@ 'doctype': 'DocField', 'fieldname': 'encashment_date', 'fieldtype': 'Date', - 'idx': 76, + 'idx': 75, 'label': 'Encashment Date', 'oldfieldname': 'encashment_date', 'oldfieldtype': 'Date', @@ -1024,7 +1001,7 @@ { 'doctype': 'DocField', 'fieldtype': 'Column Break', - 'idx': 77, + 'idx': 76, 'label': 'Exit Interview Details', 'oldfieldname': 'col_brk6', 'oldfieldtype': 'Column Break', @@ -1037,7 +1014,7 @@ 'doctype': 'DocField', 'fieldname': 'held_on', 'fieldtype': 'Date', - 'idx': 78, + 'idx': 77, 'label': 'Held On', 'oldfieldname': 'held_on', 'oldfieldtype': 'Date', @@ -1049,7 +1026,7 @@ 'doctype': 'DocField', 'fieldname': 'reason_for_resignation', 'fieldtype': 'Select', - 'idx': 79, + 'idx': 78, 'label': 'Reason for Resignation', 'oldfieldname': 'reason_for_resignation', 'oldfieldtype': 'Select', @@ -1062,7 +1039,7 @@ 'doctype': 'DocField', 'fieldname': 'new_workplace', 'fieldtype': 'Data', - 'idx': 80, + 'idx': 79, 'label': 'New Workplace', 'oldfieldname': 'new_workplace', 'oldfieldtype': 'Data', @@ -1074,7 +1051,7 @@ 'doctype': 'DocField', 'fieldname': 'feedback', 'fieldtype': 'Small Text', - 'idx': 81, + 'idx': 80, 'label': 'Feedback', 'oldfieldname': 'feedback', 'oldfieldtype': 'Text', @@ -1087,7 +1064,7 @@ 'fieldname': 'file_list', 'fieldtype': 'Text', 'hidden': 1, - 'idx': 82, + 'idx': 81, 'label': 'File List', 'permlevel': 0, 'print_hide': 1 @@ -1098,7 +1075,7 @@ 'doctype': 'DocField', 'fieldname': 'trash_reason', 'fieldtype': 'Small Text', - 'idx': 83, + 'idx': 82, 'label': 'Trash Reason', 'oldfieldname': 'trash_reason', 'oldfieldtype': 'Small Text', From 1ca982055b33916f4c03986b35523628253892bd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Aug 2011 12:48:09 +0530 Subject: [PATCH 03/16] Made some fields read only after saving --- stock/doctype/serial_no/serial_no.js | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/stock/doctype/serial_no/serial_no.js b/stock/doctype/serial_no/serial_no.js index 32620ddab0..a41113c313 100644 --- a/stock/doctype/serial_no/serial_no.js +++ b/stock/doctype/serial_no/serial_no.js @@ -7,15 +7,16 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { // ************************************** refresh *************************************************** cur_frm.cscript.refresh = function(doc, cdt, cdn) { - if(!doc.__islocal && doc.warehouse) set_field_permlevel('warehouse', 1); - if(!doc.__islocal && doc.item_code) set_field_permlevel('item_code', 1); - if(doc.__islocal) set_field_permlevel('status', 0); + if(!doc.__islocal) { + flds = ['item_code', 'warehouse', 'purchase_document_type', 'purchase_document_no', 'purchase_date', 'purchase_time', 'purchase_rate', 'supplier'] + for(i=0;i Date: Thu, 18 Aug 2011 12:49:21 +0530 Subject: [PATCH 04/16] Make stock ledger entry only on first time saving --- stock/doctype/serial_no/serial_no.py | 48 ++++++++++------------------ 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py index 9c993575ad..cf7fd50607 100644 --- a/stock/doctype/serial_no/serial_no.py +++ b/stock/doctype/serial_no/serial_no.py @@ -16,39 +16,19 @@ class DocType(TransactionBase): self.doc = doc self.doclist = doclist - -# ********************************* validate warranty / amc status *************************************** - - # -------------------- - # validate amc status - # -------------------- def validate_amc_status(self): - if self.doc.amc_expiry_date and getdate(self.doc.amc_expiry_date) >= datetime.date.today() and self.doc.maintenance_status == 'Out of AMC': - msgprint("AMC expiry date and maintenance status mismatch. Please verify") - raise Exception - elif (not self.doc.amc_expiry_date or getdate(self.doc.amc_expiry_date) < datetime.date.today()) and self.doc.maintenance_status == 'Under AMC': - msgprint("AMC expiry date and maintenance status mismatch. Please verify") - raise Exception + """ + validate amc status + """ + if (self.doc.maintenance_status == 'Out of AMC' and self.doc.amc_expiry_date and getdate(self.doc.amc_expiry_date) >= datetime.date.today()) or (self.doc.maintenance_status == 'Under AMC' and (not self.doc.amc_expiry_date or getdate(self.doc.amc_expiry_date) < datetime.date.today())): + msgprint("AMC expiry date and maintenance status mismatch. Please verify", raise_exception=1) - - # ------------------------- - # validate warranty status - # ------------------------- def validate_warranty_status(self): - if self.doc.warranty_expiry_date and getdate(self.doc.warranty_expiry_date) >= datetime.date.today() and self.doc.maintenance_status == 'Out of Warranty': - msgprint("Warranty expiry date and maintenance status mismatch. Please verify") - raise Exception - elif (not self.doc.warranty_expiry_date or getdate(self.doc.warranty_expiry_date) < datetime.date.today()) and self.doc.maintenance_status == 'Under Warranty': - msgprint("Warranty expiry date and maintenance status mismatch. Please verify") - raise Exception - - - # ------------------------------- - # validate warranty / amc status - # ------------------------------- - def validate_warranty_amc_status(self): - self.validate_warranty_status() - self.validate_amc_status() + """ + validate warranty status + """ + if (self.doc.maintenance_status == 'Out of Warranty' and self.doc.warranty_expiry_date and getdate(self.doc.warranty_expiry_date) >= datetime.date.today()) or (self.doc.maintenance_status == 'Under Warranty' and (not self.doc.warranty_expiry_date or getdate(self.doc.warranty_expiry_date) < datetime.date.today())): + msgprint("Warranty expiry date and maintenance status mismatch. Please verify", raise_exception=1) def validate_warehouse(self): @@ -56,6 +36,9 @@ class DocType(TransactionBase): msgprint("Warehouse is mandatory if this Serial No is In Store", raise_exception=1) def validate_item(self): + """ + Validate whether serial no is required for this item + """ item = sql("select name, has_serial_no from tabItem where name = '%s'" % self.doc.item_code) if not item: msgprint("Item is not exists in the system", raise_exception=1) @@ -67,7 +50,8 @@ class DocType(TransactionBase): # validate # --------- def validate(self): - self.validate_warranty_amc_status() + self.validate_warranty_status() + self.validate_amc_status() self.validate_warehouse() self.validate_item() @@ -102,7 +86,7 @@ class DocType(TransactionBase): # on update # ---------- def on_update(self): - if self.doc.warehouse and not sql("select name from `tabStock Ledger Entry` where serial_no = '%s'" % (self.doc.name)) and self.doc.status == 'In Store': + if self.doc.localname and self.doc.warehouse and self.doc.status == 'In Store' and not sql("select name from `tabStock Ledger Entry` where serial_no = '%s' and ifnull(is_cancelled, 'No') = 'No'" % (self.doc.name)): self.make_stock_ledger_entry(update_stock = 1) From 94d158852a58eee39dc5efc4f36c614857749596 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Aug 2011 12:50:46 +0530 Subject: [PATCH 05/16] Fixed MTN and Sales Return cancellation issue related to serial no --- stock/doctype/stock_ledger/stock_ledger.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/stock/doctype/stock_ledger/stock_ledger.py b/stock/doctype/stock_ledger/stock_ledger.py index 5188e0810c..dca975402c 100644 --- a/stock/doctype/stock_ledger/stock_ledger.py +++ b/stock/doctype/stock_ledger/stock_ledger.py @@ -57,11 +57,11 @@ class DocType: s = s.strip() sr_war = sql("select warehouse,name from `tabSerial No` where name = '%s'" % (s)) if not sr_war: - msgprint("Serial No %s does not exists",s, raise_exception = 1) + msgprint("Serial No %s does not exists"%s, raise_exception = 1) elif not sr_war[0][0]: - msgprint("Please set a warehouse in the Serial No %s" % s, raise_exception = 1) - elif sr_war[0][0] != d.warehouse: - msgprint("Serial No : %s for Item : %s doesn't exists in Warehouse : %s" % (s, d.item_code, d.warehouse), raise_exception = 1) + msgprint("Warehouse not mentioned in the Serial No %s" % s, raise_exception = 1) + elif (d.warehouse and sr_war[0][0] != d.warehouse) or (d.s_warehouse and sr_war[0][0] != d.s_warehouse): + msgprint("Serial No : %s for Item : %s doesn't exists in Warehouse : %s" % (s, d.item_code, d.warehouse or d.s_warehouse), raise_exception = 1) # ------------------------------------ @@ -119,10 +119,10 @@ class DocType: # ---------------------------------- # update serial no purchase details # ---------------------------------- - def update_serial_purchase_details(self, obj, d, serial_no, is_submit, is_transfer = 0): + def update_serial_purchase_details(self, obj, d, serial_no, is_submit, purpose = ''): exists = sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no)) if is_submit: - if exists and exists[0][2] != 2 and not is_transfer: + if exists and exists[0][2] != 2 and purpose not in ['Material Transfer', 'Sales Return']: msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1) elif exists: s = Document('Serial No', exists and exists[0][0]) @@ -133,8 +133,10 @@ class DocType: else: if exists and exists[0][1] == 'Delivered' and exists[0][2] != 2: msgprint("Serial No: %s is already delivered, you can not cancel the document." % serial_no, raise_exception=1) + elif purpose in ['Material Transfer', 'Sales Return']: + sql("update `tabSerial No` set status = '%s', purchase_document_type = '', purchase_document_no = '', warehouse = '%s' where name = '%s'" % (purpose == 'Material Transfer' and 'In Store' or 'Delivered', d.s_warehouse, serial_no)) else: - sql("update `tabSerial No` set docstatus = '%s', status = '%s', purchase_document_type = '', purchase_document_no = '', purchase_date = '', purchase_rate = '', supplier = null, supplier_name = '', supplier_address = '', warehouse = null where name = '%s'" % (not is_transfer and 2 or 0, is_transfer and 'In Store' or 'Not in Use', serial_no)) + sql("update `tabSerial No` set docstatus = 2, status = 'Not in Use', purchase_document_type = '', purchase_document_no = '', purchase_date = '', purchase_rate = '', supplier = null, supplier_name = '', supplier_address = '', warehouse = '' where name = '%s'" % serial_no) # ------------------------------- @@ -233,6 +235,7 @@ class DocType: sle.fields['warehouse_type'] = get_value('Warehouse' , args[k], 'warehouse_type') sle.fields[k] = args[k] sle_obj = get_obj(doc=sle) + # validate sle_obj.validate() sle.save(new = 1) From 5fb2b70136204e1a31b47a562aee3c3c9d184c55 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Aug 2011 12:51:39 +0530 Subject: [PATCH 06/16] Fixed MTN and Sales Return cancellation issue related to serial no --- stock/doctype/stock_entry/stock_entry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index 47f03946b2..a7d5d6d71f 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -355,6 +355,8 @@ class DocType: # ---------------------------------- def update_serial_no(self, is_submit): sl_obj = get_obj('Stock Ledger') + sl_obj.validate_serial_no_warehouse(self, 'mtn_details') + for d in getlist(self.doclist, 'mtn_details'): if d.serial_no: serial_nos = sl_obj.get_sr_no_list(d.serial_no) @@ -363,7 +365,7 @@ class DocType: if d.s_warehouse: sl_obj.update_serial_delivery_details(self, d, serial_no, is_submit) if d.t_warehouse: - sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, (self.doc.purpose in ['Material Transfer', 'Sales Return']) and 1 or 0) + sl_obj.update_serial_purchase_details(self, d, serial_no, is_submit, self.doc.purpose) if self.doc.purpose == 'Purchase Return': delete_doc("Serial No", serial_no) From 821fe55c52a60a2a81c5360c5ca8a5a5cef3f5f4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Aug 2011 14:25:10 +0530 Subject: [PATCH 07/16] check fn actual qty with total number of serial no in store --- stock/doctype/bin/bin.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py index 1a1eb701ab..798b442ed3 100644 --- a/stock/doctype/bin/bin.py +++ b/stock/doctype/bin/bin.py @@ -37,7 +37,10 @@ class DocType: 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() - + + # check actual qty with total number of serial no + self.check_qty_with_serial_no() + # update valuation for post dated entry if actual_qty: prev_sle = self.get_prev_sle(dt, posting_time, sle_id) @@ -48,6 +51,18 @@ class DocType: self.update_item_valuation(sle_id, dt, posting_time, serial_no, prev_sle) + def check_qty_with_serial_no(self): + """ + check actual qty with total number of serial no in store + Temporary validation added on: 18-07-2011 + """ + 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) + 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]]) + # -------------------------------- # get first stock ledger entry # -------------------------------- From 41743524a36b4e7a4e670313289eae61f3d5b841 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Aug 2011 14:26:27 +0530 Subject: [PATCH 08/16] validate wh for serial no only in submit --- stock/doctype/stock_entry/stock_entry.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index a7d5d6d71f..024bd1f34b 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -355,7 +355,8 @@ class DocType: # ---------------------------------- def update_serial_no(self, is_submit): sl_obj = get_obj('Stock Ledger') - sl_obj.validate_serial_no_warehouse(self, 'mtn_details') + if is_submit: + sl_obj.validate_serial_no_warehouse(self, 'mtn_details') for d in getlist(self.doclist, 'mtn_details'): if d.serial_no: From 9537446aa6c23913f4e6cb5b545609b96e5d805b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Aug 2011 14:40:11 +0530 Subject: [PATCH 09/16] 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 10/16] 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]]) From ff4bf867bf4cb82efd4493b9cbfd984ec98257b8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 22 Aug 2011 15:23:24 +0530 Subject: [PATCH 11/16] removed eval in pull_details fn --- 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 e88066a176..e57732ae29 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 b0788e948eb68c130b4fd74c398ecbad45cac1b5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 15:56:17 +0530 Subject: [PATCH 12/16] 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 6fcd0e26e493f4b37061971289692bbc68ae4328 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 16:15:14 +0530 Subject: [PATCH 13/16] 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 46cd8b2ebf7bec30559e0ea87fc1133478c0d941 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 17:20:51 +0530 Subject: [PATCH 14/16] 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 b77080acf33eaaac2aacb874bb0c00e400430916 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 23 Aug 2011 17:30:19 +0530 Subject: [PATCH 15/16] 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 247c3591ee0903d75980b09ee01563b456f8a0e8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Aug 2011 11:20:24 +0530 Subject: [PATCH 16/16] 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'")