blob: 334b6566788ed7135a0d31d3732c76dec0188da9 [file] [log] [blame]
Pratik Vyasc1e6e4c2011-06-08 14:37:15 +05301# REMEMBER to update this
2# ========================
Rushabh Mehta64b6c2c2011-06-22 16:38:11 +05303last_patch = 291
Pratik Vyasc1e6e4c2011-06-08 14:37:15 +05304
5#-------------------------------------------
6
7def execute(patch_no):
8 import webnotes
9 from webnotes.modules.import_module import import_from_files
10 from webnotes.modules.module_manager import reload_doc
11
12 from webnotes.model.code import get_obj
13 sql = webnotes.conn.sql
14 from webnotes.utils import cint, cstr, flt
15 from webnotes.model.doc import Document
16
17 if patch_no==33:
18 pass
19 elif patch_no==34:
20 webnotes.conn.sql("update `tabDocField` set options = 'Letter Head', print_hide = 1 where fieldname = 'letter_head' and fieldtype = 'Link'")
21 elif patch_no==35:
22 webnotes.conn.sql("update tabDocType set module = 'Event Updates' where name = 'Feed Control'")
23 elif patch_no==36:
24 # remove delivery note foreign key in Serial Number
25 from webnotes.model.db_schema import DbTable
26 t = DbTable('Serial No')
27 fk_list = t.get_foreign_keys()
28 for f in fk_list:
29 if f[0]=='delivery_note_no':
30 webnotes.conn.commit()
31 webnotes.conn.sql("alter table `tabSerial No` drop foreign key `%s`" % f[1])
32 webnotes.conn.begin()
33 webnotes.conn.sql("update tabDocField set fieldtype='Data' where fieldname='delivery_note_no' and parent='Serial No' limit 1")
34 elif patch_no==37:
35 import os
36 mod_path = webnotes.defs.modules_path
37 path_list = []
38 for m in os.listdir(mod_path):
39 for t in ['doctype', 'page', 'search_criteria']:
40 dt_path = os.path.join(mod_path, m, t)
41 if os.path.exists(dt_path):
42 for dt in os.listdir(dt_path):
43 if '.' not in dt and os.path.exists(os.path.join(dt_path, dt, dt+ '.txt')):
44 path_list.append(os.path.join(dt_path, dt, dt+ '.txt'))
45
46 for d in path_list:
47 doclist = eval(open(d,'r').read())
48 webnotes.conn.sql("update `tab%s` set module = '%s' where name = '%s'" % (doclist[0]['doctype'], doclist[0]['module'], doclist[0]['name']))
49
50 elif patch_no==38:
51 import webnotes
52 webnotes.conn.set_global("system_message", "System Updates: Hello! You would have noticed some changes on the Home Page. As a part of our commitment to make the system more friendly and social, we have re-designed the feed so that now you will only see feed that is relevant to you (either you have created something or you have been mentioned in the document).<br><br>On the individual listings, you can add tags and also color them!<br><br>You will also get time-to-time updates from our side here. Do keep sending your feedback at support@erpnext.com.")
53 webnotes.conn.set_global("system_message_id", "1")
54
55 elif patch_no == 39:
56 pass
57
58 elif patch_no == 40:
59
60 import_from_files(record_list=[['material_management','doctype','item']])
61 elif patch_no == 42:
62 acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')")
63 for d in acc:
64 sql("update tabAccount set is_pl_account = 'Yes' where lft >= '%s' and rgt <= '%s'" % (d[1], d[2]))
65 elif patch_no == 43:
66 import webnotes.model
67 webnotes.model.delete_doc('Page', 'Module Manager')
68
69 # cleanup of Service, Customer Support, Utilities Modules
70 # -------------------------------------------------------
71 elif patch_no == 44:
72 from webnotes.model import delete_doc
73
74 for dt in sql("select name from tabDocType where module in ('Customer Support')"):
75 delete_doc('DocType', dt[0])
76
77 for dt in sql("select name from `tabSearch Criteria` where module in ('Customer Support')"):
78 delete_doc('Search Criteria', dt[0])
79
80 for dt in sql("select name from tabPage where module in ('Customer Support')"):
81 delete_doc('Page', dt[0])
82
83 # move a couple
84 webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % ('DocType', '%s', '%s'), ('Application Internal', 'Patch Util'))
85 webnotes.conn.sql("update `tab%s` set module=%s where name=%s" % ('DocType', '%s', '%s'), ('Application Internal', 'DocType Property Setter'))
86
87 # remove utilities
88 webnotes.conn.sql('delete from `tabModule Def` where name in ("Customer Support", "Utilities")')
89
90 elif patch_no == 45:
91 webnotes.conn.sql('delete from tabDocField where options="Ticket Response Detail"')
92
93 elif patch_no == 46:
94 import webnotes
95 webnotes.conn.set_global("system_message", "<b>SYSTEM DOWNTIME:</b> Hello! As part of our commitment to keep improving the service, we are planning a scheduled maintenance on our servers for 4 hrs on 16-Jan-2011(Sunday), from 10AM to 2PM. Do keep sending your feedback at support@erpnext.com.")
96 webnotes.conn.set_global("system_message_id", "2")
97
98 elif patch_no == 47:
99 import webnotes
100 webnotes.conn.set_global("system_message", "")
101 webnotes.conn.set_global("system_message_id", "3")
102
103 elif patch_no == 48:
104 webnotes.conn.sql("update tabDocField set options = 'Print Heading' where fieldname = 'select_print_heading'")
105
106 elif patch_no == 49:
107 webnotes.conn.sql("update tabDocType set autoname = '' where name = 'Search Criteria'")
108 elif patch_no == 50:
109 sql("update tabDocField set in_filter = 1 where fieldname in ('cost_center', 'income_account', 'Item Group') and parent = 'RV Detail'")
110 elif patch_no == 51:
111 sql("update tabDocField set options = 'link:Print Heading' where fieldtype = 'Select' and fieldname = 'select_print_heading' and parent = 'POS Setting'")
112 elif patch_no == 52:
113 sql("update tabDocField set print_hide = 1 where fieldname = 'letter_head'")
114 elif patch_no == 53:
115 sql("update tabDocType set search_fields = 'lead_name,lead_owner,status,contact_by,contact_date' where name = 'Lead'")
116 elif patch_no == 54:
117 sql("delete from tabDocField where parent = 'Supplier' and label = 'Supplier Contacts' and fieldtype = 'Section Break'")
118 elif patch_no == 55:
119 sql("commit")
120 try:
121 sql("alter table tabFeed add column `_user_tags` varchar(180)")
122 except Exception, e:
123 if e.args[0]!=1060:
124 raise e
125 elif patch_no == 56:
126 sql("delete from `tabModule Def Item` where parent = 'CRM' and doc_type = 'Reports' and doc_name = 'Delivery Note' and display_name = 'Territory, Item Group wise GP'")
127 elif patch_no == 57:
128
129 import_from_files(record_list=[['crm','doctype','sales_order_detail']])
130 elif patch_no == 58:
131 # module def patches
132 sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')")
133 sql("delete from `tabModule Def Item` where doc_type in ('Separator', 'Setup Forms', 'More Reports')")
134 sql("delete from `tabModule Def Item` where doc_name = 'Project Activity'")
135 sql("update `tabModule Def` set module_label = 'People', disabled='No', is_hidden='No' where name = 'My Company'")
136
137 # insert new module items
138 from webnotes.model.doc import make_autoname
139 if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Ticket'"):
140 sql("""insert into `tabModule Def Item`
141 (name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
142 (%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Ticket', 'Task', 1)""", make_autoname('MDI.#####'))
143
144 if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Timesheet'"):
145 sql("""insert into `tabModule Def Item`
146 (name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
147 (%s, 'Projects', 'Module Def', 'items', 0, 'Forms', 'Timesheet', 'Timesheet', 2)""", make_autoname('MDI.#####'))
148
149 if not sql("select name from `tabModule Def Item` where parent='Projects' and doc_name='Projects'"):
150 sql("""insert into `tabModule Def Item`
151 (name, parent, parenttype, parentfield, docstatus, doc_type, doc_name, display_name, idx) values
152 (%s, 'Projects', 'Module Def', 'items', 0, 'Pages', 'Projects', 'Gantt Chart', 1)""", make_autoname('MDI.#####'))
153
154 elif patch_no == 59:
155 webnotes.conn.set_value('Control Panel',None,'mail_footer','')
156 webnotes.conn.set_global('global_mail_footer','<div style="margin-top:8px; padding: 8px; font-size: 11px; text-align:right; border-top: 1px solid #AAA">Sent via <a href="https://www.erpnext.com">ERPNext</a></div>')
157 elif patch_no == 60:
158 sql("delete from `tabModule Def Item` where display_name = 'Point of Sales'")
159 elif patch_no == 61:
160 sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)")
161 elif patch_no == 62:
162 # Import Supplier Quotation
163
164 import_from_files(record_list=[['srm','doctype','supplier_quotation']])
165 # Adding Status Filter
166 sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')")
167 # Import Other Charges
168
169 import_from_files(record_list=[['setup','doctype','other_charges']])
170 elif patch_no == 63:
171 sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'")
172
173 import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']])
174 elif patch_no == 64:
175 sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')")
176 sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')")
177 sql("update tabDocField set `report_hide` = 0 where fieldname in ('email_id','phone_1','fax_1') and parent = 'Customer'")
178 elif patch_no == 65:
179 # Monthly Trend Analyzer <-> Trend Analyzer
180 sql("update `tabSearch Criteria` set criteria_name = 'Trend Analyzer' where criteria_name = 'Monthly Trend Analyzer' and name = 'SRCH/00159'")
181 sql("update `tabModule Def Item` set display_name = 'Trend Analyzer' where parent = 'Analysis' and display_name = 'Monthly Trend Analyzer'")
182 elif patch_no == 66:
183 import webnotes
184 webnotes.conn.set_global("system_message", """<h3>UI Updates</h3>Based on user feedback, we have made a couple of changes in the UI:<ul><li>Sidebar menus are now collapsable</li><li>Forms are now scrollable (we removed the confusing tabs)</li><li>Feed is a lot more descriptive</li></ul>Do send us your feedback!""")
185 webnotes.conn.set_global("system_message_id", "4")
186
187 sql("update `tabModule Def Item` set doc_type = 'Setup Forms' where doc_name in ('TDS Payment', 'TDS Return Acknowledgement', 'Form 16A', 'Period Closing Voucher', 'IT Checklist')")
188 from webnotes.session_cache import clear_cache
189 clear_cache(webnotes.session['user'])
190 elif patch_no == 67:
191 sql("update `tabDocField` set in_filter = 1 where fieldname = 'brand' and parent = 'RV Detail'")
192 sql("delete from `tabModule Def Item` where (display_name = 'Sales Invoice' and parent = 'CRM') or (display_name = 'Purchase Invoice' and parent = 'SRM')")
193 elif patch_no == 68:
194 from webnotes.modules.import_module import import_from_files
195 import_from_files(record_list=[['payroll','doctype','employee'],['roles','Role','Employee']])
196 elif patch_no == 69:
197 # delete flds from employee master
198 p = get_obj('Patch Util')
199 emp_del_flds = ['month_of_birth']
200 for f in emp_del_flds:
201 p.delete_field('Employee', f)
202
203 sql("Update tabDocField set `default` = 'Active' where fieldname = 'status' and parent = 'Employee'")
204
205 # map parent flds
206 fld_map = ['cell_number', 'personal_email', 'person_to_be_contacted', 'relation', 'emergency_phone_number', 'pan_number', 'passport_number', 'date_of_issue', 'valid_upto', 'place_of_issue', 'marital_status', 'blood_group', 'permanent_accommodation_type']
207
208 emp_prof = sql("select t1.name, t1.employee, t1.permanent_address_line_1, t1.permanent_address_line_2, t1.city1, t1.state1, t1.country1, t1.pin_code1, t1.phn_no1, t1.present_address_line_1, t1.present_address_line_2, t1.city2, t1.state2, t1.country2, t1.pin_code2, t1.phn_no2, t1.fathers_name, t1.fathers_occupation, t1.mothers_name, t1.mothers_occupation, t1.spouses_name, t1.spouses_occupation, t1.height_cms, t1.weight_kgs, t1.allergies, t1.other_medical_concerns, t1.physical_handicap from `tabEmployee Profile` t1, `tabEmployee` t2 where t1.employee = t2.name")
209 for e in emp_prof:
210 prof_obj = get_obj('Employee Profile', e[0])
211 emp_obj = get_obj('Employee', e[1])
212 for d in fld_map:
213 emp_obj.doc.fields[d] = prof_obj.doc.fields[d]
214 emp_obj.doc.current_accommodation_type = prof_obj.doc.present_accommodation_type
215
216 # address
217 per_addr = cstr(e[2]) + '\n' + cstr(e[3]) + '\n' + cstr(e[4]) + '\n' + cstr(e[5]) + ', ' + cstr(e[6]) + '\n' + 'PIN - ' + cstr(e[7]) + '\n' + 'Ph. No' + cstr(e[8])
218 cur_addr = cstr(e[9]) + '\n' + cstr(e[10]) + '\n' + cstr(e[11]) + '\n' + cstr(e[12]) + ', ' + cstr(e[13]) + '\n' + 'PIN - ' + cstr(e[14]) + '\n' + 'Ph. No' + cstr(e[15])
219 emp_obj.doc.permanent_address = per_addr
220 emp_obj.doc.current_address = cur_addr
221 #family
222 fam = "Father's Name: " + cstr(e[16]) + '\n' + "Father's Occupation: " + cstr(e[17]) + '\n' + "Mother's Name: " + cstr(e[18]) + '\n' + "Mother's Occupation: " + cstr(e[19]) + '\n' + "Spouse's Name: " + cstr(e[20]) + '\n' + "Spouse's Occupation: " + cstr(e[21])
223 emp_obj.doc.family_background = fam
224 # health
225 health = 'Height(cms): ' + cstr(e[22]) + '\n' + 'Weight(kgs): ' + cstr(e[23]) + '\n' + 'Allergies: ' +cstr( e[24]) + '\n' + 'Other Medical Concern: ' + cstr(e[25]) + '\n' + 'Physically Handicapped(if any): ' + cstr(e[26])
226 emp_obj.doc.health_details = health
227 emp_obj.doc.save()
228
229
230 # map tables
231 tbl_list = ['Experience In Company Detail', 'Previous Experience Detail', 'Educational Qualifications Detail']
232 for t in tbl_list:
233 sql("update `tab%s` t1, `tabEmployee Profile` t2 set t1.parent = t2.employee, t1.parenttype = 'Employee' where t1.parent = t2.name" % t)
234
235
236 # overwrite idx?????????
237
238
239 # delete emp profile
240 webnotes.model.delete_doc('DocType', 'Employee Profile')
241 for e in emp_prof:
242 webnotes.model.delete_doc('Employee Profile', e[0])
243
244 elif patch_no == 70:
245 # update search criteria module -> System
246 sql("update tabDocType set module='System' where name='Search Criteria'")
247
248 # Cleanups to Contact
249 sql("update tabDocField set fieldtype='Data' where options='Designation' and parent='Contact'")
250 sql("update tabDocField set fieldtype='Data' where options='Department' and parent='Contact'")
251 sql("update tabDocField set depends_on='eval:(cint(doc.is_customer) || cint(doc.is_supplier) || cint(doc.is_sales_partner))' where fieldname='is_primary_contact' and parent='Contact'")
252
253 # import Contact, Employee
254 from webnotes.modules.import_module import import_from_files
255 import_from_files(record_list=[['tools','doctype','contact']])
256
257
258 # remove last_contact_date from Lead
259 sql("delete from tabDocField where fieldname='last_contact_date' and parent='Lead'")
260
261 elif patch_no == 71:
262 # Make Stock Qty and Conversion Factor field editable. Also no need to mention Conversion factor in table can do it directly
263 sql("update `tabDocField` set `permlevel` = 0, `width` = '100px', `trigger` = 'Client' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname in ('stock_qty','conversion_factor')")
264 sql("update `tabDocField` set `width` = '100px' where parent IN ('PO Detail','Purchase Receipt Detail') and fieldname = 'stock_uom'")
265
266 elif patch_no == 72:
267 # Core Patch
268 # ----------
269
270 from webnotes.modules.import_module import import_from_files
271
272 # import module def
273 import_from_files(record_list = [['core', 'Module Def', 'Core']])
274 elif patch_no == 73:
275 # set module in DocTypes
276 sql("update tabDocType set module='Core' where name in ('DocType', 'DocField', 'DocPerm', 'Role', 'UserRole', 'Profile', 'Print Format', 'DocFormat', 'Control Panel', 'Event', 'Event Role', 'Event User', 'DefaultValue', 'Default Home Page', 'File', 'File Group', 'File Data', 'Letter Head', 'Module Def', 'Module Def Item', 'Module Def Role', 'Page', 'Page Role', 'Search Criteria', 'DocType Label', 'DocType Mapper', 'Field Mapper Detail', 'Table Mapper Detail')")
277
278 # set module in Page
279 sql("update tabPage set module='Core' where name='Login Page'")
280
281 # move file browser to Tools
282 sql("update tabPage set module='Tools' where name='File Browser'")
283 sql("update tabDocType set module='Tools' where name='File Browser Control'")
284 sql("update tabDocType set module='Application Internal' where name='Profile Control'")
285 elif patch_no == 74:
286 p = get_obj('Patch Util')
287 # permission
288 p.delete_permission('Employee', 'Administrator', 0)
289 p.delete_permission('Employee', 'Administrator', 1)
290 p.add_permission('Employee', 'Employee', 0, read = 1, match = 'owner')
291 p.add_permission('Employee', 'Employee', 1, read = 1, match = 'owner')
292 sql("delete from `tabDocField` where parent = 'Employee' and label = 'Payroll Rule'")
293 elif patch_no == 75:
294 #sal structure patch
295 # import
296 from webnotes.modules.import_module import import_from_files
297 import_from_files(record_list=[['payroll','doctype','salary_structure'], ['payroll','doctype','earning_detail'],['payroll','doctype','deduction_detail']])
298 elif patch_no == 76:
299 # property
300 p = get_obj('Patch Util')
301 p.set_field_property('Salary Structure', 'is_active', 'default', 'Yes')
302 p.set_field_property('Salary Structure', 'ctc', 'reqd', '1')
303 p.set_field_property('Earning Detail', 'modified_value', 'width', '')
304 p.set_field_property('Earning Detail', 'modified_value', 'trigger', 'Client')
305 p.set_field_property('Deduction Detail', 'd_modified_amt', 'width', '')
306 p.set_field_property('Earning Detail', 'd_modified_amt', 'trigger', 'Client')
307 sql("Update tabDocField set `description` = 'You can create more earning and deduction type from Setup --> HR' where label = 'Earning & Deduction' and parent = 'Salary Structure' and fieldtype = 'Section Break'")
308
309 # delete
310 sql("update `tabSalary Structure` set net_pay = total")
311 sql("delete from tabDocField where label in ('LWP Help', 'Calculate Total', 'Total') and parent = 'Salary Structure'")
312 sql("delete from tabDocPerm where parent in ('Earning Detail', 'Deduction Detail')")
313
314
315 # permission
316 p.delete_permission('Salary Structure', 'Administrator', 0)
317 p.delete_permission('Salary Structure', 'Administrator', 1)
318 p.add_permission('Salary Structure', 'Employee', 0, read = 1, match = 'owner')
319 p.add_permission('Salary Structure', 'Employee', 1, read = 1, match = 'owner')
320 elif patch_no == 77:
321 # sal slip patch
322 # import
323 from webnotes.modules.import_module import import_from_files
324 import_from_files(record_list=[['payroll','doctype','salary_slip'], ['payroll','doctype','ss_earning_detail'],['payroll','doctype','ss_deduction_detail'], ['mapper', 'DocType Mapper', 'Salary Structure-Salary Slip']])
325 elif patch_no == 78:
326 p = get_obj('Patch Util')
327 # delete
328 sql("update `tabSalary Slip` set leave_encashment_amount = encashment_amount")
329 p.delete_field('Salary Slip', 'encashment_amount')
330 p.delete_field('Salary Slip', 'year')
331 p.delete_field('Salary Slip', 'flag')
332 sql("delete from tabDocField where label = 'Process Payroll' and parent = 'Salary Slip'")
333
334 # field property
335 p.set_field_property('Salary Slip', 'bank_name', 'permlevel', '1')
336 p.set_field_property('Salary Slip', 'leave_without_pay', 'permlevel', '0')
337 p.set_field_property('Salary Slip', 'leave_without_pay', 'trigger', 'Client')
338 p.set_field_property('SS Earning Detail', 'e_type', 'permlevel', '0')
339 p.set_field_property('SS Earning Detail', 'e_type', 'fieldtype', 'Link')
340 p.set_field_property('SS Earning Detail', 'e_type', 'options', 'Earning Type')
341 p.set_field_property('SS Deduction Detail', 'd_type', 'permlevel', '0')
342 p.set_field_property('SS Deduction Detail', 'd_type', 'fieldtype', 'Link')
343 p.set_field_property('SS Deduction Detail', 'd_type', 'options', 'Deduction Type')
344 sql("update `tabSS Earning Detail` set e_modified_amount = e_amount")
345 sql("update `tabSS Deduction Detail` set d_modified_amount = d_amount")
346
347 # permission
348 p.delete_permission('Salary Slip', 'Administrator', 0)
349 p.delete_permission('Salary Slip', 'Administrator', 1)
350 p.add_permission('Salary Slip', 'Employee', 0, read = 1, match = 'owner')
351 p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner')
352 elif patch_no == 79:
353 # Import Modules
354
355 import_from_files(record_list=[['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation'],['payroll','doctype','leave_control_panel'],['payroll','doctype','holiday_list'],['payroll','doctype','holiday_list_detail'],['payroll','Module Def','Payroll']])
356 elif patch_no == 80:
357 # Holiday List
358 sql("update `tabHoliday List Detail` set description = holiday_name")
359 sql("delete from tabDocField where parent = 'Holiday List Detail' and fieldname = 'holiday_name'")
360 sql("update tabDocField set fieldtype = 'Select', options = 'link:Fiscal Year' where parent = 'Holiday List' and fieldname = 'fiscal_year'")
361 sql("delete from tabDocPerm where role in ('Administrator','HR User') and parent = 'Holiday List'")
362
363 # Leave Control Panel
364 # --------------------
365 sql("delete from `tabDocField` where parent = 'Leave Control Panel' and label in ('Leave Control Panel','Allocation Details') and fieldtype = 'Section Break'")
366 sql("delete from tabDocField where parent = 'Leave Control Panel' and fieldname in ('col_brk3','allocation_type','col_brk2','from_date','to_date','leave_transaction_type','posting_date')")
367 sql("update tabDocField set fieldtype = 'Select', options = 'link:Fiscal Year' where parent = 'Leave Control Panel' and fieldname = 'fiscal_year'")
368 sql("update tabDocField set fieldtype = 'Select', options = 'link:Leave Type' where parent = 'Leave Control Panel' and fieldname = 'leave_type'")
369 sql("update tabDocField set reqd = 1 where parent = 'Leave Control Panel' and fieldname = 'no_of_days'")
370
371 # Leave Application
372 # ------------------
373 for d in sql("select * from `tabLeave Transaction` where leave_transaction_type = 'Deduction' and ifnull(deduction_type, '') = 'Leave'", as_dict = 1):
374 lp = Document('Leave Application')
375 lp.employee = d['employee']
376 lp.leave_type = d['leave_type']
377 lp.posting_date = d['date']
378 lp.fiscal_year = d['fiscal_year']
379 lp.leave_balance = d['pre_balance']
380 lp.half_day = d['half_day']
381 lp.from_date = d['from_date']
382 lp.to_date = d['to_date']
383 lp.total_leave_days = d['total_leave']
384 lp.description = d['reason']
385 lp.docstatus = cint(d['docstatus'])
386 lp.save(1)
387
388 # Leave Allocation
389 # -----------------
390 for d in sql("select * from `tabLeave Transaction` where leave_transaction_type = 'Allocation'", as_dict = 1):
391 la = Document('Leave Allocation')
392 la.employee = d['employee']
393 la.leave_type = d['leave_type']
394 la.posting_date = d['date']
395 la.fiscal_year = d['fiscal_year']
396 la.new_leaves_allocated = d['total_leave']
397 la.total_leaves_allocated = d['total_leave']
398 la.description = d['reason']
399 la.docstatus = cint(d['docstatus'])
400 la.save(1)
401
402 # Payroll Module Def
403 # -------------------
404 sql("delete from `tabModule Def Item` where doc_name = 'Leave Transaction' and display_name = 'Leave Transaction' and parent = 'Payroll' and doc_type = 'Forms'")
405
406 elif patch_no == 81:
407 # Import Modules
408
409 import_from_files(record_list=[['payroll','Module Def','Payroll']])
410 elif patch_no == 82:
411 sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
412 sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
413 elif patch_no == 83:
414 # delete leave transaction
415 webnotes.conn.sql("set foreign_key_checks=0")
416 sql("delete from `tabLeave Transaction`")
417 import webnotes.model
418 webnotes.model.delete_doc('DocType','Badge Settings Detail')
419 webnotes.model.delete_doc('DocType','Leave Transaction')
420 webnotes.conn.sql("set foreign_key_checks=1")
421 elif patch_no == 84:
422 p = get_obj('Patch Util')
423 p.set_field_property('SS Earning Detail', 'e_amount', 'permlevel', '1')
424 p.set_field_property('SS Deduction Detail', 'd_amount', 'permlevel', '1')
425 elif patch_no == 85:
426 # permission
427 p = get_obj('Patch Util')
428 p.add_permission('Leave Application', 'Employee', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
429 p.add_permission('Leave Application', 'Employee', 1, read = 1, match = 'owner')
430 p.add_permission('Leave Allocation', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
431 p.add_permission('Leave Allocation', 'HR User', 1, read = 1)
432 sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'")
433 elif patch_no == 86:
434 # Import Modules
435
436 import_from_files(record_list=[['payroll','doctype','leave_type']])
437 elif patch_no == 87:
438 sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'")
439 elif patch_no == 88:
440 # Import Modules
441
442 import_from_files(record_list=[['payroll','doctype','leave_allocation']])
443 elif patch_no == 89:
444 sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'")
445 sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'")
446 elif patch_no == 90:
447 sql("update `tabLeave Allocation` set docstatus = 1")
448 elif patch_no == 91:
449 import webnotes
450 webnotes.conn.set_global("system_message", """<h3>System Updates</h3>Based on user feedback, we have cleaned up HR module (Partly):<ul><li>Employee and Employee Profile are merged into a single document</li><li>Salary Structure and Salary Slip are now more user friendly</li><li>Leave Transaction document is now divided into 2 documents Leave Application and Leave Allocation</li></ul>We will work on Reports, Attendance and other documents of Payroll module next week<br><br> Do send us your feedback!""")
451 webnotes.conn.set_global("system_message_id", "5")
452 elif patch_no == 92:
453 sql("update tabDocField set label = 'Get Charges' where parent IN ('Sales Order','Delivery Note','Receivable Voucher') and label = 'Get Other Charges' and fieldtype = 'Button'")
454 # Automated Other Charges Calculation basis
455 sql("update tabDocField set options = '', `trigger` = 'Client' where parent IN ('Quotation','Sales Order','Delivery Note','Receivable Voucher') and label = 'Get Charges' and fieldtype = 'Button'")
456 elif patch_no == 93:
457 sql("update `tabTable Mapper Detail` set validation_logic = 'qty > ifnull(billed_qty,0) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail'")
458 sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'")
459 elif patch_no == 94:
460
461 import_from_files(record_list=[['crm','doctype','sms_center']])
462 elif patch_no == 95:
463
464 import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
465 elif patch_no == 96:
466 sql("delete from `tabModule Def Item` where doc_type = 'Reports' and display_name = 'Cenvat Credit - Input or Capital Goods' and parent = 'Accounts'")
467 elif patch_no == 97:
468 sql("update tabFeed set doc_label = 'Feed', doc_name = name where ifnull(doc_name,'') = '' and ifnull(doc_label,'') = ''")
469 elif patch_no == 98:
470 import_from_files(record_list=[['accounts','doctype','payable_voucher']])
471 elif patch_no == 99:
472 import_from_files(record_list=[['accounts','doctype','account']])
473 elif patch_no == 100:
474 p = get_obj('Patch Util')
475 p.set_field_property('Account', 'level', 'hidden', '1')
476 p.set_field_property('Account', 'level', 'print_hide', '1')
477 p.set_field_property('Account', 'account_type', 'search_index', '0')
478 p.set_field_property('TDS Detail', 'tds_category', 'width', '150px')
479 p.set_field_property('TDS Detail', 'special_tds_rate_applicable', 'width', '150px')
480 p.set_field_property('TDS Detail', 'special_tds_rate', 'width', '150px')
481 p.set_field_property('TDS Detail', 'special_tds_limit', 'width', '150px')
482 elif patch_no == 101:
483 # Leave Application Details and Leave Allocation Details
484 sql("update tabDocField set search_index = 1, in_filter = 1 where fieldname in ('employee','leave_type','fiscal_year') and parent in ('Leave Application','Leave Allocation')")
485 get_obj('DocType','Leave Application').doc.save()
486 get_obj('DocType','Leave Allocation').doc.save()
487 elif patch_no == 102:
488 # make item description field editable in production order
489 sql("update tabDocField set permlevel = 0 where fieldname = 'description' and parent = 'Production Order'")
490 elif patch_no == 103:
491 sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'")
492 elif patch_no == 104:
493
494 import_from_files(record_list=[['payroll','search_criteria','stdsrch_00001'],['payroll','search_criteria','stdsrch_00002'],['payroll','search_criteria','stdsrch_00003'],['payroll','Module Def','Payroll'],['payroll','doctype','leave_application'],['payroll','doctype','leave_allocation']])
495 elif patch_no == 105:
496 # Employee Leave Balance
497 sql("delete from `tabModule Def Item` where parent = 'Payroll' and doc_type = 'Reports' and display_name IN ('Employeewise Leave Transaction Details','Employeewise Balance Leave Report')")
498 # Update Search Fields
499 sql("update tabDocType set search_fields = 'employee,employee_name,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'")
500 sql("update tabDocType set search_fields = 'employee,employee_name,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'")
501 elif patch_no == 106:
502 for d in sql("select name,employee,employee_name from `tabLeave Allocation`"):
503 if not cstr(d[2]):
504 sql("update `tabLeave Allocation` set employee_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Employee',cstr(d[1]),'employee_name'), cstr(d[0])))
505 for d in sql("select name,employee,employee_name from `tabLeave Application`"):
506 if not cstr(d[2]):
507 sql("update `tabLeave Application` set employee_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Employee',cstr(d[1]),'employee_name'), cstr(d[0])))
508 elif patch_no == 107:
509 sql("delete from `tabDocField` where fieldname = 'fiscal_year' and parent = 'Employee'")
510 elif patch_no == 108:
511 import_from_files(record_list=[['payroll','search_criteria','srch_std_00013']])
512 elif patch_no == 109:
513 import_from_files(record_list=[['payroll','search_criteria','srch_std_00015']])
514 elif patch_no == 110:
515 import_from_files(record_list=[['payroll','doctype','salary_structure'], ['payroll', 'doctype', 'salary_slip']])
516 elif patch_no == 111:
517 sql("update tabDocType set search_fields = 'transfer_date, from_warehouse, to_warehouse, purpose, remarks' where name = 'Stock Entry'")
518 elif patch_no == 112:
519 sql("delete from tabDocField where label = 'Get Other Charges' and fieldtype = 'Button' and parent = 'Receivable Voucher'")
520 elif patch_no == 113:
521 sql("update tabDocField set reqd = 1 where parent = 'Customer' and fieldname = 'phone_1'")
522 elif patch_no == 114:
523 for d in sql("select name, master_name, credit_days, credit_limit from tabAccount where master_type = 'Customer'"):
524 if cstr(d[1]):
525 days, limit = cint(d[2]), flt(d[3])
526 cust_det = sql("select credit_days, credit_limit from tabCustomer where name = '%s'" % (cstr(d[1])))
527 if not days: days = cust_det and cint(cust_det[0][0]) or 0
528 if not limit: limit = cust_det and flt(cust_det[0][1]) or 0
529 sql("COMMIT")
530 sql("START TRANSACTION")
531 sql("update tabAccount set credit_days = '%s', credit_limit = '%s' where name = '%s'" % (days, limit, cstr(d[0])))
532 sql("COMMIT")
533
534 elif patch_no == 115:
535 # patch for timesheet cleanup
536 from webnotes.model import delete_doc
537 delete_doc('DocType', 'Timesheet Detail')
538
539 from webnotes.modules.import_module import import_from_files
540 import_from_files(record_list = [['Projects', 'DocType', 'Timesheet'], ['Projects', 'DocType', 'Timesheet Detail'], ['Projects', 'DocType', 'Activity Type']])
541
542 elif patch_no == 116:
543 # again!
544 from webnotes.model import delete_doc
545 delete_doc('DocType', 'Timesheet Detail')
546
547 from webnotes.modules.import_module import import_from_files
548 import_from_files(record_list = [['Projects', 'DocType', 'Timesheet Detail']])
549 elif patch_no == 117:
550 op = '\n' + 'Walk In'
551 sql("update `tabDocField` set `options` = concat(options, %s) where parent = 'Enquiry' and fieldname = 'source' and options not like '%%Walk%%'", op)
552 elif patch_no == 118:
553 from webnotes.utils import get_defaults
554 ss = sql("select name, net_pay from `tabSalary Slip`")
555 for d in ss:
556 if d[1]:
557 w = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], d[1])
558 sql("update `tabSalary Slip` set net_pay_in_words = '%s' where name = '%s'" % (w, d[0]))
559 elif patch_no == 119:
560 sql("update tabDocType set in_create = 1 where name = 'Profile'")
561 elif patch_no == 120:
562 sql("update tabDocField set permlevel = 0 where parent = 'Sales and Purchase Return Wizard' and fieldname = 'return_date'")
563 elif patch_no == 121:
564 import_from_files(record_list = [['CRM', 'DocType', 'Return Detail'], ['Material Management', 'DocType', 'Sales and Purchase Return Wizard']])
565 elif patch_no == 122:
566 sql("delete from tabDocField where (fieldname = 'serial_no' or label = 'Warrany Status') and parent = 'Sales Order'")
567 elif patch_no == 123:
568 import_from_files(record_list = [['CRM', 'Module Def', 'CRM'], ['CRM', 'Search Criteria', 'STDSRCH/00004']])
569 elif patch_no == 124:
570 import webnotes
571 webnotes.conn.set_global("system_message", """<h3>Updates(New)</h3>We have added a new report in the Selling Module.<br><br><b>Sales Personwise Transaction Summary: </b>In this report you can see sales person's contribution in a particular order, delivery or invoice. You can select voucher type in "Based On" filter.<br><br> Do send us your feedback!""")
572 webnotes.conn.set_global("system_message_id", "5")
573 elif patch_no == 125:
574 import_from_files(record_list = [['Material Management', 'DocType', 'Delivery Note']])
575 elif patch_no == 126:
576 sql("delete from tabDocField where parent = 'Delivery Note' and label in ('Make Sales Invoice', 'Make Installation Note', 'Intro Note')")
577 elif patch_no == 127:
578 sql("delete from tabDocPerm where role = 'All' and parent = 'Expense Voucher' and (permlevel = 0 or permlevel = 2)")
579 p = get_obj('Patch Util')
580 p.add_permission('Expense Voucher', 'Employee', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1, match = 'owner')
581 p.add_permission('Expense Voucher', 'HR Manager', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
582 p.add_permission('Expense Voucher', 'HR User', 0, read = 1, write = 1, create = 1, submit = 1, cancel = 1, amend = 1)
583 elif patch_no == 128:
584 from webnotes.modules import import_module
585 import_module.import_from_files(record_list=[['crm','doctype','sales_order'], ['crm','doctype','sales_order_detail'], ['material_management','doctype','delivery_note'], ['material_management','doctype','delivery_note_detail']])
586 elif patch_no == 129:
587 sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Sales Order-Receivable Voucher' and from_table = 'Sales Order Detail' and to_table = 'RV Detail'")
588 sql("update `tabTable Mapper Detail` set validation_logic = '(qty > ifnull(billed_qty, 0) or amount > ifnull(billed_amt, 0)) and docstatus = 1' where parent = 'Delivery Note-Receivable Voucher' and from_table = 'Delivery Note Detail' and to_table = 'RV Detail'")
589 elif patch_no == 130:
590 # update from rv
591 from webnotes.model.code import get_obj
592 from webnotes.utils import cstr
593 for d in sql("select name, docstatus from `tabReceivable Voucher` where ifnull(docstatus,0) != 0"):
594 sql("COMMIT")
595 sql("START TRANSACTION")
596 try:
597 obj = get_obj('Receivable Voucher', cstr(d[0]), with_children = 1)
598 is_submit = 1
599 if cint(d[1]) == 2: is_submit = 0
600 get_obj('Sales Common').update_prevdoc_detail(is_submit, obj)
601 except:
602 pass
603 sql("COMMIT")
604
605 # update from dn
606 from webnotes.model.code import get_obj
607 for d in sql("select name, docstatus from `tabDelivery Note` where ifnull(docstatus,0) != 0"):
608 sql("COMMIT")
609 sql("START TRANSACTION")
610 try:
611 obj = get_obj('Delivery Note', cstr(d[0]), with_children = 1)
612 is_submit = 1
613 if cint(d[1]) == 2: is_submit = 0
614 get_obj('Sales Common').update_prevdoc_detail(is_submit, obj)
615 except:
616 pass
617 sql("COMMIT")
618 elif patch_no == 131:
619 sql("update `tabDocType` set allow_trash = 1 where name = 'Purchase Other Charges'")
620 sql("update tabDocPerm set `cancel` = 1 where parent = 'Purchase Other Charges' and permlevel = 0 and `read` = 1 and `write` = 1")
621 elif patch_no == 132:
622 sql("update tabDocField set no_copy = 0 where parent = 'Receivable Voucher' and fieldname = 'customer'")
623 elif patch_no == 133:
624 from webnotes.modules import import_module
625 import_module.import_from_files(record_list=[['accounts','doctype','receivable_voucher']])
626 elif patch_no == 134:
627 sql("update tabDocField set no_copy = 1 where parent = 'Receivable Voucher' and fieldname = 'posting_time'")
628 elif patch_no == 135:
629 sql("update tabDocField set `default` = 'Today' where parent = 'Receivable Voucher' and fieldname = 'due_date'")
630 elif patch_no == 136:
631 from webnotes.modules import import_module
632 import_module.import_from_files(record_list=[['accounts','doctype','rv_detail']])
633 elif patch_no == 137:
634 from webnotes.modules import import_module
635 import_module.import_from_files(record_list=[['setup','doctype','price_list']])
636 elif patch_no == 138:
637 sql("update `tabDocType` set allow_attach = 1 where name = 'Price List'")
638 elif patch_no == 139:
639 from webnotes.modules import import_module
640 import_module.import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']])
641 elif patch_no == 140:
642 from webnotes.modules import import_module
643 import_module.import_from_files(record_list=[['accounts','doctype','rv_detail']])
644 elif patch_no == 141:
645 sql("delete from tabDocField where (fieldname = 'letter_head' or label = 'Letter Head') and parent = 'Company'")
646 elif patch_no == 142:
647 # fixes to letter head and personalize
648 from webnotes.model import delete_doc
649
650 delete_doc('DocType', 'Batch Settings')
651 delete_doc('DocType', 'Batch Settings Detail')
652 delete_doc('DocType', 'Social Badge')
653 delete_doc('Page', 'Personalize Page')
654 delete_doc('DocType', 'Personalize Page Control')
655
656 import_from_files(record_list=[['core','doctype','letter_head'], ['setup','doctype','personalize']])
657 elif patch_no == 144:
658 webnotes.conn.sql("update tabDocField set fieldtype='Code' where parent='Letter Head' and fieldname='content'")
659 elif patch_no == 145:
660 sql("update `tabDocField` set permlevel=1 where fieldname = 'group_or_ledger' and parent = 'Account'")
661 elif patch_no == 146:
662 import_from_files(record_list=[['accounts','doctype','account']])
663 elif patch_no == 147:
664 import_from_files(record_list=[['mapper', 'DocType Mapper', 'Purchase Order-Payable Voucher'], ['mapper', 'DocType Mapper', 'Purchase Receipt-Payable Voucher'], ['mapper', 'DocType Mapper', 'Purchase Order-Purchase Receipt']])
665 elif patch_no == 148:
666 sql("delete from `tabDocField` where (fieldname = 'account_balances' or label = 'Balances') and parent = 'Account'")
667 sql("update tabDocType set istable = 0, section_style = 'Simple', search_fields = 'account, period, fiscal_year, balance' where name = 'Account Balance'")
668 sql("update tabDocField set permlevel = 0 where parent = 'Account Balance'")
669 p = get_obj('Patch Util')
670 p.add_permission('Account Balance', 'Accounts User', 0, read = 1)
671 p.add_permission('Account Balance', 'Accounts Manager', 0, read = 1)
672 import_from_files(record_list=[['accounts','doctype','account_balance']])
673 elif patch_no == 149:
674 sql("update `tabAccount Balance` set account = parent")
675 elif patch_no == 150:
676 sql("update tabDocField set in_filter = 1, search_index = 1 where parent = 'Account Balance' and fieldname in ('account', 'period', 'fiscal_year', 'start_date', 'end_date')")
677 ac_bal = Document("DocType", "Account Balance")
678 ac_bal.save()
679 elif patch_no == 151:
680 sql("delete from tabDocField where label = 'Add / Manage Contacts' and fieldtype = 'Button' and parent = 'Customer'")
681 sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'note' and to_field = 'note'")
682 elif patch_no == 152:
683 import_from_files(record_list=[['crm','doctype','sales_order'], ['material_management','doctype','delivery_note'], ['crm','doctype','customer'], ['crm','doctype','shipping_address'], ['mapper', 'DocType Mapper', 'Sales Order-Delivery Note']])
684 elif patch_no == 153:
685 sql("delete from `tabDocField` where fieldname = 'sales_person' and parent = 'Customer'")
686 elif patch_no == 154:
687 import_from_files(record_list=[['material_management','doctype','serial_no'], ['maintenance','doctype','customer_issue']])
688 elif patch_no == 155:
689 for d in sql("select name, item_code from `tabSerial No`"):
690 sql("COMMIT")
691 sql("START TRANSACTION")
692 sql("update `tabSerial No` set item_name = '%s' where name = '%s'" % (webnotes.conn.get_value('Item',cstr(d[1]),'item_name'), cstr(d[0])))
693 sql("COMMIT")
694 elif patch_no == 156:
695 sql("update tabDocField set fieldtype = 'Code' where fieldname = 'html' and parent = 'Print Format'")
696 elif patch_no == 157:
697 import_from_files(record_list=[['accounts', 'doctype', 'journal_voucher'], ['accounts', 'Print Format', 'Payment Receipt Voucher'], ['accounts', 'Print Format', 'Cheque Printing Format']])
698 elif patch_no == 158:
699 from webnotes.model.doc import addchild
700 sql("delete from tabDocField where parent = 'Customer Issue' and fieldname = 'customer_group'")
701 elif patch_no == 159:
702 sql("update tabAccount set account_type = 'Chargeable' where account_name in ('Advertising and Publicity', 'Freight & Forwarding Charges', 'Miscellaneous Expenses', 'Sales Promotion Expenses')")
703 elif patch_no == 160:
704 sql("update `tabDocType` set search_fields = 'posting_date, due_date, debit_to, fiscal_year, grand_total, outstanding_amount' where name = 'Receivable Voucher'")
705 sql("update `tabDocType` set search_fields = 'posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount' where name = 'Payable Voucher'")
706 elif patch_no == 161:
707 sql("update tabDocType set autoname = 'field:batch_id' where name = 'Batch'")
708 sql("update tabDocField set no_copy = 1 where parent = 'Batch' and fieldname = 'batch_id'")
709 elif patch_no == 162:
710 import_from_files(record_list=[['crm', 'search_criteria', 'sales_order_pending_items1']])
711 elif patch_no == 163:
712 sql("delete from `tabModule Def Item` where display_name = 'Sales Orderwise Pending Packing Item Summary' and parent = 'CRM'")
713 import_from_files(record_list=[['crm', 'search_criteria', 'sales_orderwise_pending_qty_to_deliver'], ['crm', 'search_criteria', 'sales_orderwise_pending_amount_to_bill'], ['crm', 'search_criteria', 'delivered_items_to_be_install']])
714 elif patch_no == 164:
715 import_from_files(record_list=[['srm', 'search_criteria', 'pending_po_items_to_receive'], ['srm', 'search_criteria', 'pending_po_items_to_bill']])
716 elif patch_no == 165:
717 pass
718 elif patch_no == 166:
719 import_from_files(record_list=[['srm', 'doctype', 'purchase_order']])
720 elif patch_no == 167:
721 if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['ax0000956', 'ax0001338']:
722 sql("delete from tabDocField where parent = 'Purchase Order' and fieldname in ('test_certificate_required', 'estimated_cost', 'transport', 'vendor_reference', 'transportation_required', 'mode_of_dispatch', 'octroi')")
723 elif patch_no == 168:
724 sql("update tabDocField set fieldtype = 'Data', options = 'Suggest' where fieldname = 'bank_name' and parent = 'Employee'")
725 elif patch_no == 169:
726 import_from_files(record_list=[['accounts', 'doctype', 'pv_detail'], ['accounts', 'doctype', 'rv_detail']])
727 elif patch_no == 170:
728 import_from_files(record_list=[['mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher']])
729 elif patch_no == 171:
730 import_from_files(record_list=[['srm', 'doctype', 'supplier']])
731 elif patch_no == 172:
732 import webnotes
733 webnotes.conn.set_global("system_message", """<b>Welcome to the new financial year 2011-2012 !!! </b><br><br> So obvious question in your mind is how to start Entries in the New Fiscal Year in ERPNext? What are the changes you have to make in the system? <br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
734 webnotes.conn.set_global("system_message_id", "6")
735 elif patch_no == 173:
736 sql("delete from tabDocField where label = 'Get Other Charges' and parent = 'Delivery Note'")
737 sql("update tabDocField set reqd = 0 where fieldname = 'posting_time' and parent = 'Serial No'")
738 elif patch_no == 174:
739 c = sql("select count(name) from `tabField Mapper Detail` where parent = 'Delivery Note-Receivable Voucher' and from_field = 'description' and to_field = 'description' and match_id = 2")
740 if c and cint(c[0][0]) > 1:
741 sql("update `tabField Mapper Detail` set match_id = 1 where parent = 'Delivery Note-Receivable Voucher' and from_field = 'description' and to_field = 'description' limit 1")
742 elif patch_no == 175:
743 import webnotes
744 webnotes.conn.set_global("system_message", """If your financial year starts on 1st April then you have make some changes in the system to start entry in the new year.<br>We have made some guidelines regarding the basic steps you should follow. Please click on link <a href='http://erpnext.blogspot.com/2011/03/how-to-start-entries-in-new-fiscal-year.html'>How to start Entries in the New Fiscal Year in ERPNext?</a>""")
745 webnotes.conn.set_global("system_message_id", "6")
746 elif patch_no == 176:
747 sql("update tabDocPerm set role='Guest', `write`=0, `create`=0 where role='Administrator' and parent='Notification Control' limit 1")
748 elif patch_no == 177:
749 sql("delete from `tabDocField` where label = 'Next Steps' and parent = 'Purchase Order'")
750 sql("update tabDocField set options = 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order' where parent = 'Stock Entry' and fieldname = 'purpose'")
751 elif patch_no == 178:
752 import_from_files(record_list = [['payroll', 'doctype', 'salary_slip']])
753 elif patch_no == 179:
754 from webnotes.utils import get_defaults
755 sl = sql("select name, net_pay from `tabSalary Slip`")
756 for d in sl:
757 in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], round(flt(d[1])))
758 sql("update `tabSalary Slip` set rounded_total = '%s', total_in_words = '%s' where name = '%s'" % (round(flt(d[1])), in_words, d[0]))
759 elif patch_no == 180:
760 sql("delete from tabDocField where parent = 'Salary Slip' and fieldname = 'net_pay_in_words'")
761 elif patch_no == 181:
762 import_from_files(record_list = [['accounts', 'doctype', 'journal_voucher']])
763 elif patch_no == 182:
764 sql("update tabDocField set options = CONCAT(options, '\nWrite Off Voucher') where fieldname = 'voucher_type' and parent = 'Journal Voucher'")
765 elif patch_no == 183:
766 sql("delete from tabDocField where label = 'SMS' and fieldtype = 'Section Break' and parent in ('Enquiry', 'Lead', 'Sales Order', 'Delivery Note')")
767 elif patch_no == 184:
768 from webnotes.model import delete_doc
769 delete_doc('DocType', 'Feed')
770 delete_doc('DocType', 'Feed List')
771 delete_doc('DocType', 'Feed Control')
772
773 # add trigger
774 from webnotes.model.triggers import add_trigger
775 add_trigger('*','*','*','event_updates.update_feed')
776
777 webnotes.conn.commit()
778
779 try:
780 sql("drop table tabFeed")
781 sql("drop table `tabFeed List`")
782 except: pass
783
784 # import
785 from webnotes.modules.module_manager import reload_doc
786 reload_doc('event_updates','doctype','feed')
787 elif patch_no==185:
788 sql("delete from tabDocTrigger where method = 'webnotes.widgets.follow.on_docsave'")
789 elif patch_no==186:
790 from webnotes.modules.module_manager import reload_doc
791 reload_doc('event_updates','doctype','feed')
792 elif patch_no == 187:
793 sql("update tabDocType set autoname = '' where name = 'QA Inspection Report'")
794 elif patch_no == 188:
795 import_from_files(record_list = [['srm', 'doctype', 'qa_inspection_report']])
796 elif patch_no == 189:
797 sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('entries', 'other_charges') and parent = 'Receivable Voucher'")
798 elif patch_no == 190:
799 sql("update tabDocField set permlevel=0 where fieldname = 'fiscal_year' and parent = 'Stock Entry'")
800 elif patch_no == 191:
801 import_from_files(record_list = [['maintenance', 'doctype', 'customer_issue']])
802 elif patch_no == 192:
803 sql("delete from `tabModule Def Item` where parent = 'Material Management' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
804 import_from_files(record_list = [['srm', 'Module Def', 'SRM']])
805 elif patch_no == 193:
806 sql("update tabDocField set fieldtype='Button', `trigger`='Client' where parent='Letter Head' and fieldname='set_from_image'")
807 elif patch_no == 194:
808 sql("delete from `tabModule Def Item` where parent = 'SRM' and doc_name = 'Landed Cost Wizard' and display_name = 'Landed Cost Wizard'")
809 import_from_files(record_list = [['material_management', 'Module Def', 'Material Management']])
810 elif patch_no == 195:
811 from webnotes.modules.module_manager import reload_doc
812 reload_doc('setup','doctype','manage_account')
813 elif patch_no == 196:
814 sql("update `tabModule Def` set module_page = null where name = 'Material Management'")
815 elif patch_no == 197:
816 sql("update `tabDocField` set permlevel = 0, in_filter = 1 where fieldname = 'warranty_amc_status' and parent = 'Customer Issue'")
817 import_from_files(record_list = [['maintenance', 'doctype', 'customer_issue']])
818 elif patch_no == 198:
819 sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent in ('Quoattion', 'Sales Order', 'Delivery Note', 'Receivable Voucher')")
820 sql("delete from `tabDocField` where label in ('SMS', 'Send SMS') and parent = 'Purchase Order'")
821 sql("delete from `tabDocField` where (label in ('Send SMS', 'SMS Html') or fieldname in ('sms_message', 'lead_sms_detail', 'enquiry_sms_detail')) and parent in ('Lead', 'Enquiry')")
822 from webnotes.model import delete_doc
823 delete_doc('DocType', 'Lead SMS Detail')
824 delete_doc('DocType', 'Enquiry SMS Detail')
825 elif patch_no == 199:
826 sql("update tabDocField set reqd = 0 where parent = 'Attendance' and fieldname = 'shifts'")
827 elif patch_no == 200:
828 reload_doc('event_updates','page','profile_settings')
829 elif patch_no == 201:
830 reload_doc('setup','doctype','price_list')
831 elif patch_no == 202:
832 name1 = sql("select name from tabDocField where parent='Price List' and label='Clear Prices' limit 1,1")
833 name2 = sql("select name from tabDocField where parent='Price List' and label='Update Prices' limit 1,1")
834 if name1:
835 sql("delete from tabDocField where name=%s limit 1", name1[0][0])
836 if name2:
837 sql("delete from tabDocField where name=%s limit 1", name2[0][0])
838 elif patch_no == 203:
839 sql("delete from tabDocField where parent = 'Company' and fieldname = 'default_salary_account' limit 1")
840 elif patch_no == 204:
841 sql("delete from tabDocField where parent = 'Company' and fieldname = 'default_salary_acount' limit 1")
842 elif patch_no == 205:
843 sql("update `tabDocField` set `default` = '' where fieldname = 'naming_series' and parent = 'Installation Note'")
844 elif patch_no == 206:
845 reload_doc('crm','doctype','installation_note')
846 elif patch_no == 207:
847 import_from_files(record_list = [['setup', 'doctype', 'company']])
848 elif patch_no == 208:
849 sql("delete from `tabDocField` where (label in ('SMS', 'Send SMS') or fieldname in ('message', 'customer_mobile_no')) and parent ='Quotation'")
850 default_currency = get_obj('Manage Account').doc.default_currency
851 sql("update tabCompany set default_currency = '%s'" % default_currency)
852 elif patch_no == 209:
853 import_from_files(record_list = [['setup', 'doctype', 'company']])
854 elif patch_no == 210:
855 sql("delete FROM `tabDocField` WHERE parent = 'Lead' AND label in ('CC:','Attachment Html','Create New File','Attachment')")
856 elif patch_no == 212:
857 # reload company because of disturbed UI
858 import_from_files(record_list = [['setup', 'doctype', 'company']])
859 elif patch_no == 213:
860 reload_doc('crm','doctype','lead')
861 reload_doc('setup','doctype','company')
862 elif patch_no == 214:
863 reload_doc('crm','doctype','sales_order')
864 elif patch_no == 215:
865 # patch for item and image in description
866 sql("update tabDocField set width = '300px' where fieldname='description'")
867 reload_doc('material_management', 'doctype', 'item')
868 sql("delete from __DocTypeCache")
869 elif patch_no == 216:
870 import_from_files(record_list = [['material_management', 'doctype', 'serial_no'], ['material_management', 'doctype', 'stock_ledger_entry']])
871 elif patch_no == 217:
872 sql("update tabDocField set options = '\nIn Store\nDelivered\nNot in Use' where fieldname = 'status' and parent = 'Serial No'")
873 sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Delivery Note Detail'")
874 sql("update tabDocField set no_copy = 1 where fieldname = 'serial_no' and parent = 'Stock Entry Detail'")
875 elif patch_no == 218:
876 for d in sql("select name from `tabSerial No`"):
877 sql("Commit")
878 sql("Start Transaction")
879 s = Document('Serial No', d[0])
880 if s.pr_no:
881 s.purchase_document_type = 'Purchase Receipt'
882 s.purchase_document_no = s.pr_no
883 if s.delivery_note_no:
884 s.delivery_document_type = 'Delivery Note'
885 s.delivery_document_no = s.delivery_note_no
886 if s.notes:
887 s.delivery_note_no = s.notes
888 s.company = webnotes.utils.get_defaults()['company']
889 s.fiscal_year = webnotes.utils.get_defaults()['fiscal_year']
890 s.save()
891 elif patch_no == 219:
892 sql("delete from tabDocField where fieldname in ('pr_no', 'make', 'label', 'delivery_note_no', 'notes') and parent = 'Serial No'")
893 elif patch_no == 220:
894 sql("update tabDocField set label = 'Incoming Rate' where fieldname = 'purchase_rate' and parent = 'Serial No'")
895 sql("update tabDocField set label = 'Incoming Time' where fieldname = 'purchase_time' and parent = 'Serial No'")
896 elif patch_no == 221:
897 sql("update tabDocField set reqd = 1 where fieldname in ('purchase_rate', 'warehouse') and parent = 'Serial No'")
898 elif patch_no == 222:
899 sql("update tabDocField set options = '\nDelivery Note\nReceivable Voucher\nStock Entry' where fieldname = 'delivery_document_type' and parent = 'Serial No'")
900 elif patch_no == 223:
901 sql("update tabDocField set hidden = 0 where fieldname in ('pay_to_recd_from', 'total_amount', 'total_amount_in_words') and parent = 'Journal Voucher'")
902 sql("update tabDocField set permlevel = 0 where fieldname = 'pay_to_recd_from' and parent = 'Journal Voucher'")
903 elif patch_no == 224:
904 import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail'], ['accounts', 'Print Format', 'Payment Receipt Voucher']])
905 elif patch_no == 225:
906 import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail']])
907 elif patch_no == 226:
908 import_from_files(record_list = [['material_management', 'doctype', 'delivery_note_packing_detail']])
909 elif patch_no == 227:
910 reload_doc('material_management', 'doctype', 'item')
911 if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011':
912 sql("delete from tabDocField where parent = 'Item' and fieldname='alternate_description' limit 1")
913 elif patch_no == 228:
914 # knowledge base patch
915 reload_doc('knowledge_base', 'doctype', 'question')
916 reload_doc('knowledge_base', 'doctype', 'answer')
917 reload_doc('knowledge_base', 'page', 'questions')
918 reload_doc('knowledge_base', 'Module Def', 'Knowledge Base')
919 sql("update `tabModule Def` set disabled='No' where name='Knowledge Base'")
920 elif patch_no == 229:
921 reload_doc('knowledge_base', 'page', 'question_view')
922 elif patch_no == 230:
923 reload_doc('srm', 'doctype', 'indent')
924 reload_doc('srm', 'doctype', 'indent_detail')
925 reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
926 elif patch_no == 231:
927 reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Indent')
928 elif patch_no == 232:
929 sql("update `tabDocField` set options = 'Sales Order' where fieldname = 'sales_order_no' and parent = 'Indent'")
930 elif patch_no == 233:
931 reload_doc('Mapper', 'DocType Mapper', 'Sales Order-Receivable Voucher')
932 reload_doc('Mapper', 'DocType Mapper', 'Delivery Note-Receivable Voucher')
933 elif patch_no == 234:
934 sql("update `tabTable Mapper Detail` set validation_logic = 'docstatus=1' where parent = 'Sales Order-Indent' and from_table = 'Sales Order Detail'")
935 elif patch_no == 235:
936 for sc in sql("""select name from `tabSearch Criteria` where ifnull(name,'')
937 like 'srch%' or ifnull(name,'') like '%stdsrch'"""):
938 try:
939 get_obj('Search Criteria', sc[0]).rename()
940 except AttributeError, e:
941 pass
942 reload_doc('core', 'doctype', 'system_console')
943 elif patch_no == 236:
944 # warehouse not mandatory for delivered serial nos
945 sql("update tabDocField set reqd=0 where parent='Serial No' and fieldname='warehouse'")
946 elif patch_no == 237:
947 sql("update tabDocField set depends_on = 'eval:doc.is_pos==1' where fieldname = 'cash_bank_account' and parent = 'Receivable Voucher'")
948 elif patch_no == 238:
949 reload_doc('accounts', 'doctype', 'receivable_voucher')
950 reload_doc('accounts', 'GL Mapper', 'POS with write off')
951 elif patch_no == 239:
952 reload_doc('core', 'doctype', 'docfield')
953 reload_doc('core', 'doctype', 'doctype')
954
955 from patches.feed_patch import set_subjects_and_tagfields
956 set_subjects_and_tagfields()
957 elif patch_no == 240:
958 # again for sales order (status)
959 from patches.feed_patch import set_subjects_and_tagfields
960 set_subjects_and_tagfields()
961 elif patch_no == 241:
962 sql("update `tabDocField` set fieldtype = 'Text', options = '', in_filter = '' where fieldname = 'serial_no' and parent = 'Stock Ledger Entry'")
963 elif patch_no == 242:
964 if webnotes.conn.get_value('Control Panel', None, 'account_id') not in ['axjanak2011']:
965 sql("commit")
966 try:
967 sql("alter table `tabStock Ledger Entry` drop index serial_no")
968 except:
969 pass
970
971 sql("alter table `tabStock Ledger Entry` change serial_no serial_no text")
972 elif patch_no == 243:
973 # moving custom script and custom fields to framework
974 webnotes.conn.set_value('DocType', 'Custom Script', 'module', 'Core')
975 webnotes.conn.set_value('DocType', 'Custom Field', 'module', 'Core')
976 reload_doc('setup', 'doctype', 'company')
977 elif patch_no == 244:
978 reload_doc('material_management', 'search_criteria', 'shortage_to_indent')
979 elif patch_no == 245:
980 from patches.doctype_permission_patch import set_doctype_permissions
981 set_doctype_permissions()
982
983 from patches.feed_patch import set_subjects_and_tagfields
984 set_subjects_and_tagfields()
985 elif patch_no == 246:
986 webnotes.conn.set_value('DocType','Stock Entry','tag_fields','purpose')
987 webnotes.conn.set_value('DocType','Stock Entry','subject','%(remarks)s')
988 elif patch_no == 247:
989 webnotes.conn.set_value('DocType','Stock Entry','subject','%(remarks)s')
990 elif patch_no == 248:
991 reload_doc('setup', 'doctype', 'manage_account')
992 elif patch_no == 249:
993 sql("update `tabDocPerm` t1, `tabDocType` t2 set t1.role = 'System Manager' where t1.role = 'Administrator' and t1.parent = t2.name and t2.module != 'Core'")
994 elif patch_no == 250:
995 from patches.feed_patch import support_patch
996 support_patch()
997 elif patch_no == 251:
998 from webnotes.model import db_schema
999 db_schema.remove_all_foreign_keys()
1000 from patches.customer_address import run_patch
1001 run_patch()
1002 elif patch_no == 252:
1003 reload_doc('maintenance','doctype','support_ticket')
1004 reload_doc('maintenance','doctype','support_ticket_response')
1005 elif patch_no == 253:
1006 reload_doc('accounts','doctype','ledger_balance_export')
1007 reload_doc('accounts','doctype','ledger_detail')
1008 reload_doc('accounts', 'Module Def', 'Accounts')
1009
1010 from webnotes.model.db_schema import updatedb
1011 updatedb('Ledger Balance Export')
1012 updatedb('Ledger Detail')
1013 elif patch_no == 254:
1014 reload_doc('settings', 'doctype', 'sms_settings')
1015 reload_doc('settings', 'doctype', 'static_parameter_detail')
1016
1017 from webnotes.model.db_schema import updatedb
1018 updatedb('SMS Settings')
1019 updatedb('Static Parameter Detail')
1020 elif patch_no == 255:
1021 from patches.customer_address import run_old_data_sync_patch
1022 run_old_data_sync_patch()
1023 elif patch_no == 256:
1024 sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170-test/', '')")
1025 sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170-test/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
1026 sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')")
1027 elif patch_no == 257:
1028 from patches.customer_address import run_old_data_sync_patch
1029 run_old_data_sync_patch()
1030 elif patch_no == 258:
1031 sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'")
1032 elif patch_no == 259:
1033 sql("update `tabQuotation Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
1034 sql("update `tabSales Order Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
1035 sql("update `tabRV Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
1036 sql("update `tabDelivery Note Detail` set description = replace(description, 'http://46.4.50.84/v170-test/', '')")
1037 elif patch_no == 260:
1038 sql("update `tabLetter Head` set content = replace(content, 'http://46.4.50.84/v170/', '')")
1039 sql("update `tabSingles` set value = replace(value, 'http://46.4.50.84/v170/', '') where field in ('letter_head', 'client_name') and doctype = 'Control Panel'")
1040 sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170/', '')")
1041 sql("update `tabQuotation Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
1042 sql("update `tabSales Order Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
1043 sql("update `tabRV Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
1044 sql("update `tabDelivery Note Detail` set description = replace(description, 'http://46.4.50.84/v170/', '')")
1045 elif patch_no == 261:
1046 sql("update `tabPrint Format` set html = replace(html, 'customer_address', 'address_display')")
1047 elif patch_no == 262:
1048 from patches.customer_address import sync_lead_phone
1049 sync_lead_phone()
1050 elif patch_no == 263:
1051 ol = ['','Open','To Reply','Waiting for Customer','Hold','Closed']
1052 sql("update tabDocField set options=%s where parent=%s and fieldname=%s", ('\n'.join(ol), 'Support Ticket', 'status'))
1053 elif patch_no == 264:
1054 sql("delete from tabDocField where parent = 'Customer Issue' and (fieldname = 'issue_in' or fieldname = 'issue_category')")
1055 sql("update tabDocField set options=NULL where parent='Support Ticket' and label = 'Send'")
1056 elif patch_no == 266:
1057 reload_doc('setup','doctype','support_email_settings')
1058 elif patch_no == 267:
1059 sql("update `tabPrint Format` set html = replace(html, 'supplier_address', 'address_display')")
1060 elif patch_no == 268:
1061 sql("update `tabDocPerm` set permlevel = 0 where permlevel is null")
1062 elif patch_no == 269:
1063 p = get_obj('Patch Util')
1064 p.add_permission('GL Entry', 'Accounts User', 0, read = 1)
1065 elif patch_no == 270:
1066 pages = ['Accounts Setup', 'Accounts', 'Accounting Reports','GeneralLedger','How do I - Accounts','Making Opening Entries',\
1067 'Analysis','How do I - CRM','How do I - Inventory','Inventory Setup', 'Stock','HR','HR & Payroll Setup',\
1068 'Payroll Setup','Production Setup','Production','Buying','SRM Setup','Contact Page','Forum','Messages','Test Toolbar',\
1069 'Trend Analyzer']
1070 from webnotes.model import delete_doc
1071 sql("delete from `tabPage Visit`")
1072 for p in pages:
1073 try: delete_doc('Page', p)
1074 except: pass
1075 elif patch_no == 271:
1076 # tags patch
1077 reload_doc('crm','doctype','sales_order')
1078 reload_doc('material_management','doctype','delivery_note')
1079 sql("delete from tabDocField where fieldname='per_amt_billed' and parent in ('Sales Order', 'Delivery Note')")
1080
1081 sql("""update `tabSales Order` set delivery_status = if(ifnull(per_delivered,0) < 0.001, 'Not Delivered',
1082 if(per_delivered >= 99.99, 'Fully Delivered', 'Partly Delivered'))""")
1083 sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
1084 if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
1085 sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed',
1086 if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""")
1087 elif patch_no == 272:
1088 from webnotes.model import delete_doc
1089 try:
1090 delete_doc('Search Criteria', '_SRCH00003')
1091 except:
1092 pass
1093 reload_doc('accounts', 'search_criteria', 'purchase_register')
1094 elif patch_no == 276:
1095 from webnotes.model import delete_doc
1096 sn = sql("select name from `tabSearch Criteria` where criteria_name = 'Sales Personwise Transaction Summary'")
1097 for d in sn:
1098 delete_doc('Search Criteria', d[0])
1099 reload_doc('crm', 'search_criteria', 'sales_personwise_transaction_summary')
nabinhaite0250fb2011-06-14 13:35:31 +05301100 elif patch_no == 277:
1101 webnotes.model.delete_doc('DocType','HomePage Settings')
1102 webnotes.model.delete_doc('DocType','Badge Settings')
1103 sql("update tabDocType set module='Home' where module in ('Event Updates', 'My Company')")
1104 sql("update tabPage set module='Home' where module in ('Event Updates', 'My Company')")
1105 sql("update `tabSearch Criteria` set module='Home' where module in ('Event Updates', 'My Company')")
1106
1107
1108 delete_pages = ('Chat User Gallery', 'Badge Info', 'Home', 'Website Setup', 'Test Page', 'Setup Masters', 'Service', 'Selling', 'Sales Reports', 'Organize','My Cart', 'My Activity', 'Manage Users', 'Maintenance', 'Getting Started', 'Gantt Test', 'Custom Reports - Stock', 'Custom Reports - Selling', 'Custom Reports - Production', 'Custom Reports - Payroll', 'Custom Reports - Maintenance', 'Custom Reports - Buying', 'Custom Reports - Accounts', 'CRM Setup', 'CRM Reports')
1109 for p in delete_pages:
1110 webnotes.model.delete_doc('Page',p)
nabinhaitb7789a52011-06-14 17:33:12 +05301111 elif patch_no == 278:
1112 sql("update tabDocTrigger set method = 'home.update_feed' where method = 'event_updates.update_feed'")
nabinhaitc43ece72011-06-15 11:55:32 +05301113 elif patch_no == 279:
1114 dt = ['GL Entry', 'Stock Ledger Entry']
1115 for t in dt:
1116 rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tab%s` where modified >= '2011-06-15 01:00:00' group by voucher_no" % t)
1117 for d in rec:
1118 sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
1119
1120 other_dt = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note']
1121 for dt in other_dt:
1122 rec = sql("select name, status from `tab%s` where modified >= '2011-06-15 01:00:00'" % dt)
1123 for r in rec:
1124 sql("update `tab%s` set docstatus = %s where name = '%s'" % (dt, (r[1] in ['Submitted', 'Closed'] and 1 or r[1]=='Cancelled' and 2 or 0), r[0]))
nabinhait75e67cf2011-06-15 13:13:27 +05301125 elif patch_no == 280:
1126 reload_doc('accounts', 'doctype', 'form_16a')
nabinhaite7221212011-06-15 14:39:31 +05301127 elif patch_no == 281:
1128 dt_list = ['Delivery Note', 'Purchase Receipt']
1129 for dt in dt_list:
nabinhaite7221212011-06-15 14:39:31 +05301130 sql("update `tab%s` set status = 'Submitted' where docstatus = 1 and modified >='2011-06-15 01:00:00'" % dt)
1131 sql("update `tab%s` set status = 'Cancelled' where docstatus = 2 and modified >='2011-06-15 01:00:00'" % dt)
nabinhait5f4ea812011-06-15 15:17:57 +05301132 elif patch_no == 282:
1133 dt_list = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note', 'Receivable Voucher', 'Payable Voucher', 'Delivery Note', 'Purchase Receipt', 'Journal Voucher', 'Stock Entry']
1134 for d in dt_list:
1135 tbl = sql("select options from `tabDocField` where fieldtype = 'Table' and parent = '%s'" % d)
1136 for t in tbl:
1137 sql("update `tab%s` t1, `tab%s` t2 set t1.docstatus = t2.docstatus where t1.parent = t2.name" % (t[0], d))
nabinhait746d29b2011-06-16 12:41:39 +05301138 elif patch_no == 283:
1139 rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tabGL Entry` where modified >= '2011-06-15 01:00:00' order by name ASC")
1140 for d in rec:
1141 sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1]))
nabinhaitf7d80002011-06-20 13:51:26 +05301142 elif patch_no == 284:
1143 reload_doc('maintenance', 'doctype', 'support_ticket')
1144 sql("update `tabDocField` set in_filter = 1 where fieldname in ('raised_by', 'subject') and parent = 'Support Ticket'")
nabinhait6150e652011-06-20 16:34:48 +05301145 elif patch_no == 286:
nabinhait4b59bea2011-06-20 14:07:04 +05301146 reload_doc('accounts', 'search_criteria', 'itemwise_sales_register')
1147 reload_doc('accounts', 'search_criteria', 'itemwise_purchase_register')
nabinhait58f01022011-06-21 15:05:43 +05301148 elif patch_no == 287:
nabinhait8b849fe2011-06-21 15:09:55 +05301149 sql("update `tabDocField` set no_copy = 1 where fieldname in ('per_received', 'per_billed', 'per_delivered') and parent in ('Purchase Order', 'Purchase Receipt', 'Sales Order', 'Delivery Note')")
nabinhait5559ed92011-06-21 17:04:22 +05301150 elif patch_no == 288:
1151 reload_doc('accounts', 'doctype', 'payable_voucher')
nabinhait33dee782011-06-21 17:17:39 +05301152 elif patch_no == 289:
1153 sql("update `tabDocType` set subject = 'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding' where name = 'Payable Voucher'")
1154 sql("update `tabDocType` set search_fields = 'status,transaction_date,customer,lead,order_type' where name = 'Quotation'")
Anand Doshib9f7e392011-06-22 12:11:47 +05301155 elif patch_no == 290:
Anand Doshif14abfb2011-06-22 12:24:40 +05301156 count = sql("""SELECT * FROM `tabModule Def`
Anand Doshib9f7e392011-06-22 12:11:47 +05301157 WHERE `module_name` LIKE 'Home'""")
1158 if not count:
1159 md = Document('Module Def')
1160 md.module_name = 'Home'
1161 md.module_label = 'Home'
Rushabh Mehta64b6c2c2011-06-22 16:38:11 +05301162 md.save(1)
1163 elif patch_no == 291:
1164 relaod_doc('tools','doctype','rename_tool')
1165