Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 1 | # REMEMBER to update this |
| 2 | # ======================== |
nabinhait | a56fc00 | 2011-07-01 16:32:03 +0530 | [diff] [blame] | 3 | |
Nabin Hait | ef75761 | 2011-09-02 13:10:23 +0530 | [diff] [blame] | 4 | last_patch = 352 |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 5 | |
| 6 | #------------------------------------------- |
| 7 | |
| 8 | def execute(patch_no): |
| 9 | import webnotes |
Pratik Vyas | c1e6e4c | 2011-06-08 14:37:15 +0530 | [diff] [blame] | 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 |
Rushabh Mehta | 33bce67 | 2011-08-25 15:15:25 +0530 | [diff] [blame] | 16 | from webnotes.model import delete_doc |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 17 | |
Rushabh Mehta | 9e6e7fa | 2011-08-25 16:08:06 +0530 | [diff] [blame] | 18 | if patch_no == 301: |
nabinhait | 690c697 | 2011-06-28 14:42:07 +0530 | [diff] [blame] | 19 | from patches.delivery_billing_status_patch import run_patch |
| 20 | run_patch() |
nabinhait | b393000 | 2011-06-28 16:50:38 +0530 | [diff] [blame] | 21 | elif patch_no == 302: |
| 22 | sql("update `tabDocField` set no_copy = 1 where fieldname = 'naming_series'") |
Ravi Dey | 4c65119 | 2011-06-28 19:36:18 +0530 | [diff] [blame] | 23 | elif patch_no == 303: |
Ravi Dey | 27c5b40 | 2011-06-29 18:05:18 +0530 | [diff] [blame] | 24 | pass |
| 25 | elif patch_no == 304: |
Rushabh Mehta | c71eeb6 | 2011-06-30 08:28:36 +0530 | [diff] [blame] | 26 | sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'button'") |
Ravi Dey | c674e43 | 2011-06-29 18:15:12 +0530 | [diff] [blame] | 27 | reload_doc('setup', 'doctype', 'company') |
Ravi Dey | 79c2865 | 2011-06-29 18:55:19 +0530 | [diff] [blame] | 28 | elif patch_no == 305: |
| 29 | sql("update `tabDocField` set options = 'link:Company' where options='link:Company' and fieldname='company' and fieldtype='Select'") |
nabinhait | ec09797 | 2011-07-01 13:34:41 +0530 | [diff] [blame] | 30 | elif patch_no == 306: |
Ravi Dey | 94a332a | 2011-07-01 13:50:34 +0530 | [diff] [blame] | 31 | sql("update `tabDocField` set options = '\nAccount\nCompany\nCustomer\nSupplier\nEmployee\nWarehouse\nItem' where parent = 'Rename Tool' and fieldname = 'select_doctype'") |
| 32 | sql("update `tabDocField` set options = 'link:Item' where parent = 'Raw Materials Supplied' and fieldname = 'po_item'") |
| 33 | sql("update `tabDocField` set options = 'Sales Order' where parent = 'Indent Detail' and fieldname = 'sales_order_no'") |
| 34 | sql("update `tabDocField` set options = 'link:Company', fieldtype = 'Select' where parent = 'Stock Ledger Entry' and fieldname = 'company'") |
Nabin Hait | 31a407d | 2011-07-28 11:47:45 +0530 | [diff] [blame] | 35 | reload_doc('utilities', 'doctype', 'rename_tool') |
Ravi Dey | 627d01b | 2011-07-01 14:05:43 +0530 | [diff] [blame] | 36 | elif patch_no == 307: |
| 37 | sql("delete from `tabDocField` where parent = 'company' and label = 'Trash Company' and fieldtype = 'Button'") |
| 38 | reload_doc('setup', 'doctype', 'company') |
nabinhait | a56fc00 | 2011-07-01 16:32:03 +0530 | [diff] [blame] | 39 | elif patch_no == 308: |
Ravi Dey | c1886b5 | 2011-07-04 16:53:42 +0530 | [diff] [blame] | 40 | sql("update `tabDocField` set reqd = 0 where fieldname = 'select_item' and parent = 'Property Setter'") |
nabinhait | 1bd56b1 | 2011-07-05 14:41:36 +0530 | [diff] [blame] | 41 | elif patch_no == 309: |
| 42 | sql("delete from `tabDocField` where fieldname = 'item_attachments_details' and parent = 'Item'") |
nabinhait | 7f339e0 | 2011-07-05 15:43:17 +0530 | [diff] [blame] | 43 | sql("delete from `tabModule Def Item` where parent = 'Stock' and doc_name = 'Landed Cost Wizard'") |
nabinhait | 5deab24 | 2011-07-06 09:23:02 +0530 | [diff] [blame] | 44 | elif patch_no == 310: |
| 45 | from erpnext_structure_cleanup import run_patches |
| 46 | run_patches() |
nabinhait | 4bb8bf4 | 2011-07-06 10:11:11 +0530 | [diff] [blame] | 47 | elif patch_no == 311: |
| 48 | sql("update `tabDocField` set reqd = 0 where fieldname = 'select_item' and parent = 'Property Setter'") |
nabinhait | 4c38fbb | 2011-07-06 10:36:53 +0530 | [diff] [blame] | 49 | #reload_doc('core', 'doctype', 'property_setter') |
nabinhait | 4bb8bf4 | 2011-07-06 10:11:11 +0530 | [diff] [blame] | 50 | elif patch_no == 312: |
| 51 | sql("delete from `tabSessions`") |
| 52 | sql("delete from `__SessionCache`") |
nabinhait | d54ec52 | 2011-07-06 12:20:21 +0530 | [diff] [blame] | 53 | elif patch_no == 313: |
| 54 | dt = ['GL Entry', 'Stock Ledger Entry'] |
| 55 | for t in dt: |
| 56 | rec = sql("select voucher_type, voucher_no, ifnull(is_cancelled, 'No') from `tab%s` where modified >= '2011-07-06 10:00:00' group by voucher_no" % t) |
| 57 | for d in rec: |
nabinhait | fccbb09 | 2011-07-06 12:23:27 +0530 | [diff] [blame] | 58 | sql("update `tab%s` set docstatus = %s where name = '%s'" % (d[0], d[2]=='No' and 1 or 2, d[1])) |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 59 | |
nabinhait | d54ec52 | 2011-07-06 12:20:21 +0530 | [diff] [blame] | 60 | other_dt = ['Enquiry', 'Quotation', 'Sales Order', 'Indent', 'Purchase Order', 'Production Order', 'Customer Issue', 'Installation Note'] |
| 61 | for dt in other_dt: |
| 62 | rec = sql("select name, status from `tab%s` where modified >= '2011-07-06 10:00:00'" % dt) |
| 63 | for r in rec: |
| 64 | 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])) |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 65 | |
| 66 | |
nabinhait | d54ec52 | 2011-07-06 12:20:21 +0530 | [diff] [blame] | 67 | dt_list = ['Delivery Note', 'Purchase Receipt'] |
| 68 | for dt in dt_list: |
| 69 | sql("update `tab%s` set status = 'Submitted' where docstatus = 1 and modified >='2011-07-06 10:00:00'" % dt) |
| 70 | sql("update `tab%s` set status = 'Cancelled' where docstatus = 2 and modified >='2011-07-06 10:00:00'" % dt) |
| 71 | |
| 72 | 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'] |
| 73 | for d in dt_list: |
| 74 | tbl = sql("select options from `tabDocField` where fieldtype = 'Table' and parent = '%s'" % d) |
| 75 | for t in tbl: |
| 76 | sql("update `tab%s` t1, `tab%s` t2 set t1.docstatus = t2.docstatus where t1.parent = t2.name" % (t[0], d)) |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 77 | |
nabinhait | 22f7edd | 2011-07-06 12:45:02 +0530 | [diff] [blame] | 78 | elif patch_no == 314: |
| 79 | # delete double feed |
| 80 | sql("delete from tabFeed where subject like 'New %'") |
nabinhait | eb31540 | 2011-07-06 13:03:31 +0530 | [diff] [blame] | 81 | elif patch_no == 315: |
| 82 | # delete double feed |
| 83 | sql("delete from tabFeed where doc_name like 'New %'") |
| 84 | reload_doc('core', 'doctype', 'property_setter') |
| 85 | |
| 86 | from webnotes.model.doc import Document |
| 87 | m = Document('Module Def Role') |
| 88 | m.role = 'All' |
| 89 | m.parent = 'Home' |
| 90 | m.parenttype = 'Module Def' |
| 91 | m.parentfield = 'roles' |
| 92 | m.save(1) |
Ravi Dey | 7a6211d | 2011-07-07 15:49:24 +0530 | [diff] [blame] | 93 | elif patch_no == 316: |
Ravi Dey | 8982272 | 2011-07-07 15:52:35 +0530 | [diff] [blame] | 94 | pass |
| 95 | elif patch_no == 317: |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 96 | sql("update `tabPage` set name = 'profile-settings' where page_name = 'Profile Settings'") |
Anand Doshi | 56ab7e4 | 2011-07-07 18:37:58 +0530 | [diff] [blame] | 97 | elif patch_no == 318: |
Ravi Dey | cfc5dff | 2011-07-07 16:48:54 +0530 | [diff] [blame] | 98 | reload_doc('utilities', 'doctype', 'bulk_rename_tool') |
Anand Doshi | 52b1d5a | 2011-07-07 18:41:12 +0530 | [diff] [blame] | 99 | elif patch_no == 319: |
Anand Doshi | 56ab7e4 | 2011-07-07 18:37:58 +0530 | [diff] [blame] | 100 | sql("delete from tabFeed where doc_name like 'New %'") |
nabinhait | 63cf2b9 | 2011-07-08 13:30:46 +0530 | [diff] [blame] | 101 | elif patch_no == 320: |
| 102 | reload_doc('setup', 'doctype', 'series_detail') |
Ravi Dey | fac96e1 | 2011-07-08 13:38:16 +0530 | [diff] [blame] | 103 | elif patch_no == 321: |
Ravi Dey | 8491384 | 2011-07-08 13:46:09 +0530 | [diff] [blame] | 104 | reload_doc('hr','doctype','leave_application') |
| 105 | elif patch_no == 322: |
| 106 | sql("delete from `tabDocField` where parent = 'Leave Application' and fieldname = 'latter_head'") |
Nabin Hait | 2acac4b | 2011-07-10 13:52:05 +0530 | [diff] [blame] | 107 | elif patch_no == 323: |
| 108 | reload_doc('stock', 'doctype', 'stock_entry') |
Nabin Hait | e079a6e | 2011-07-10 14:15:52 +0530 | [diff] [blame] | 109 | sql("update `tabDocField` set options = 'get_stock_and_rate' where parent = 'Stock Entry' and label = 'Get Stock and Rate'") |
| 110 | sql("delete from `tabDocField` where label = 'Get Current Stock' and parent = 'Stock Entry'") |
nabinhait | 54b0e7d | 2011-07-13 16:40:03 +0530 | [diff] [blame] | 111 | elif patch_no == 324: |
| 112 | sql("delete from `tabDocField` where fieldname = 'test_field' and parent = 'Customer'") |
Ravi Dey | 9dd0c0b | 2011-07-13 18:08:38 +0530 | [diff] [blame] | 113 | elif patch_no == 325: |
| 114 | sql("update `tabDocField` set fieldtype = 'Data' where parent = 'Salary Slip' and fieldname = 'total_days_in_month'") |
| 115 | reload_doc('hr', 'doctype', 'salary_slip') |
Rushabh Mehta | 6179080 | 2011-07-17 10:52:47 +0530 | [diff] [blame] | 116 | elif patch_no == 326: |
| 117 | # load the new billing page |
| 118 | if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')): |
| 119 | reload_doc('server_tools','page','billing') |
nabinhait | e652636 | 2011-07-19 18:09:26 +0530 | [diff] [blame] | 120 | elif patch_no == 327: |
Rushabh Mehta | 391aa02 | 2011-07-25 14:07:50 +0530 | [diff] [blame] | 121 | # patch for support email settings now moved to email settings |
| 122 | reload_doc('setup','doctype','email_settings') |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 123 | |
Rushabh Mehta | 391aa02 | 2011-07-25 14:07:50 +0530 | [diff] [blame] | 124 | # map fields from support to email settings |
| 125 | field_map = { |
| 126 | 'support_email': 'email', |
| 127 | 'support_host':'host', |
| 128 | 'support_username': 'username', |
| 129 | 'support_password': 'password', |
Rushabh Mehta | b7186d4 | 2011-07-25 14:37:48 +0530 | [diff] [blame] | 130 | 'support_use_ssl': 'use_ssl', |
Rushabh Mehta | 391aa02 | 2011-07-25 14:07:50 +0530 | [diff] [blame] | 131 | 'sync_support_mails': 'integrate_incoming', |
| 132 | 'signature': 'support_signature' |
| 133 | } |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 134 | |
Rushabh Mehta | 391aa02 | 2011-07-25 14:07:50 +0530 | [diff] [blame] | 135 | for key in field_map: |
| 136 | webnotes.conn.set_value('Email Settings',None,key, \ |
| 137 | webnotes.conn.get_value('Support Email Settings',None,field_map[key])) |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 138 | |
Rushabh Mehta | 391aa02 | 2011-07-25 14:07:50 +0530 | [diff] [blame] | 139 | # delete support email settings |
Rushabh Mehta | 391aa02 | 2011-07-25 14:07:50 +0530 | [diff] [blame] | 140 | delete_doc('DocType', 'Support Email Settings') |
| 141 | |
Rushabh Mehta | 9b8fad2 | 2011-07-25 14:45:42 +0530 | [diff] [blame] | 142 | reload_doc('support','doctype','support_ticket') |
Nabin Hait | 587ac5c | 2011-07-26 15:46:10 +0530 | [diff] [blame] | 143 | sql("delete from tabDocField where fieldname='problem_description' and parent='Support Ticket'") |
| 144 | elif patch_no == 328: |
nabinhait | e652636 | 2011-07-19 18:09:26 +0530 | [diff] [blame] | 145 | if webnotes.conn.get_value('Control Panel', None, 'account_id') != 'axjanak2011': |
| 146 | sql("delete from `tabDocField` where fieldname = 'supplier_status' and parent = 'Supplier'") |
Nabin Hait | 587ac5c | 2011-07-26 15:46:10 +0530 | [diff] [blame] | 147 | elif patch_no == 329: |
nabinhait | de9826c | 2011-07-20 18:02:59 +0530 | [diff] [blame] | 148 | reload_doc('utilities', 'doctype', 'rename_tool') |
| 149 | reload_doc('utilities', 'doctype', 'bulk_rename_tool') |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 150 | elif patch_no == 330: |
| 151 | reload_doc('accounts', 'doctype', 'lease_agreement') |
| 152 | reload_doc('accounts', 'doctype', 'lease_installment') |
| 153 | |
| 154 | reload_doc('accounts', 'search_criteria', 'lease_agreement_list') |
| 155 | reload_doc('accounts', 'search_criteria', 'lease_monthly_future_installment_inflows') |
| 156 | reload_doc('accounts', 'search_criteria', 'lease_overdue_age_wise') |
Nabin Hait | f541b74 | 2011-07-28 15:33:42 +0530 | [diff] [blame] | 157 | reload_doc('accounts', 'search_criteria', 'lease_over_due_list') |
Brahma K | 0930762 | 2011-07-27 12:03:34 +0530 | [diff] [blame] | 158 | reload_doc('accounts', 'search_criteria', 'lease_receipts_client_wise') |
| 159 | reload_doc('accounts', 'search_criteria', 'lease_receipt_summary_year_to_date') |
| 160 | reload_doc('accounts', 'search_criteria', 'lease_yearly_future_installment_inflows') |
Brahma K | bcdade5 | 2011-07-27 12:11:09 +0530 | [diff] [blame] | 161 | |
| 162 | reload_doc('accounts', 'Module Def', 'Accounts') |
Brahma K | 3b1ebe0 | 2011-07-27 13:04:11 +0530 | [diff] [blame] | 163 | elif patch_no == 331: |
| 164 | p = get_obj('Patch Util') |
| 165 | # permission |
| 166 | p.add_permission('Lease Agreement', 'Accounts Manager', 0, read = 1, write=1,submit=1, cancel=1,amend=1) |
| 167 | p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1) |
Nabin Hait | d29916b | 2011-07-27 14:26:23 +0530 | [diff] [blame] | 168 | elif patch_no == 332: |
| 169 | sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") |
Brahma K | e8ec975 | 2011-08-16 12:21:07 +0530 | [diff] [blame] | 170 | elif patch_no == 333: |
Nabin Hait | d31de59 | 2011-08-10 14:01:27 +0530 | [diff] [blame] | 171 | sql("update `tabDocPerm` set `create` =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'") |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 172 | |
Nabin Hait | 812e718 | 2011-08-05 11:10:30 +0530 | [diff] [blame] | 173 | p = get_obj('Patch Util') |
| 174 | p.add_permission('DocType Mapper', 'System Manager', 0, read = 1, write=1, create=1) |
| 175 | p.add_permission('Role', 'System Manager', 0, read = 1, write=1, create=1) |
| 176 | p.add_permission('Print Format', 'System Manager', 0, read = 1, write=1, create=1) |
Nabin Hait | c4e579c | 2011-08-05 11:21:35 +0530 | [diff] [blame] | 177 | elif patch_no == 334: |
| 178 | reload_doc('knowledge_base', 'doctype', 'answer') |
Nabin Hait | f82b1cc | 2011-08-05 13:23:14 +0530 | [diff] [blame] | 179 | elif patch_no == 335: |
Nabin Hait | 2c0ab73 | 2011-08-05 13:40:04 +0530 | [diff] [blame] | 180 | for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']: |
Anand Doshi | b61abff | 2011-08-10 11:58:05 +0530 | [diff] [blame] | 181 | sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt)) |
| 182 | elif patch_no == 336: |
Anand Doshi | aabf174 | 2011-08-10 13:27:25 +0530 | [diff] [blame] | 183 | reload_doc('server_tools','page','billing') |
| 184 | elif patch_no == 337: |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 185 | item_list = webnotes.conn.sql("""SELECT name, description_html |
Anand Doshi | aabf174 | 2011-08-10 13:27:25 +0530 | [diff] [blame] | 186 | FROM tabItem""") |
| 187 | if item_list: |
| 188 | for item, html in item_list: |
| 189 | if html and "getfile" in html and "acx" in html: |
| 190 | ac_id = webnotes.conn.sql("""SELECT value FROM `tabSingles` WHERE doctype='Control Panel' AND field='account_id'""") |
| 191 | sp_acx = html.split("acx=") |
| 192 | l_acx = len(sp_acx) |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 193 | if l_acx > 1: |
Anand Doshi | aabf174 | 2011-08-10 13:27:25 +0530 | [diff] [blame] | 194 | for i in range(l_acx-1): |
| 195 | sp_quot = sp_acx[i+1].split('"') |
| 196 | if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0]) |
| 197 | sp_acx[i+1] = '"'.join(sp_quot) |
| 198 | html = "acx=".join(sp_acx) |
Nabin Hait | d31de59 | 2011-08-10 14:01:27 +0530 | [diff] [blame] | 199 | webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item)) |
Nabin Hait | 76980b0 | 2011-08-10 16:35:25 +0530 | [diff] [blame] | 200 | elif patch_no == 338: |
| 201 | # Patch for billing status based on amount |
| 202 | # reload so and dn |
| 203 | reload_doc('selling','doctype','sales_order') |
| 204 | reload_doc('stock','doctype','delivery_note') |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 205 | |
Nabin Hait | 76980b0 | 2011-08-10 16:35:25 +0530 | [diff] [blame] | 206 | # delete billed_qty field |
| 207 | sql("delete from `tabDocField` where fieldname = 'billed_qty' and parent in ('Sales Order Detail', 'Delivery Note Detail')") |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 208 | |
Nabin Hait | 76980b0 | 2011-08-10 16:35:25 +0530 | [diff] [blame] | 209 | # update billed amt in item table in so and dn |
| 210 | sql(""" update `tabSales Order Detail` so |
| 211 | set billed_amt = (select sum(amount) from `tabRV Detail` where `so_detail`= so.name and docstatus=1 and parent not like 'old%%'), modified = now()""") |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 212 | |
Nabin Hait | 76980b0 | 2011-08-10 16:35:25 +0530 | [diff] [blame] | 213 | sql(""" update `tabDelivery Note Detail` dn |
| 214 | set billed_amt = (select sum(amount) from `tabRV Detail` where `dn_detail`= dn.name and docstatus=1 and parent not like 'old%%'), modified = now()""") |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 215 | |
Nabin Hait | 76980b0 | 2011-08-10 16:35:25 +0530 | [diff] [blame] | 216 | # calculate % billed based on item table |
| 217 | sql(""" update `tabSales Order` so |
| 218 | set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabSales Order Detail` where parent = so.name), modified = now()""") |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 219 | |
Nabin Hait | 76980b0 | 2011-08-10 16:35:25 +0530 | [diff] [blame] | 220 | sql(""" update `tabDelivery Note` dn |
| 221 | set per_billed = (select sum(if(amount > ifnull(billed_amt, 0), billed_amt, amount))/sum(amount)*100 from `tabDelivery Note Detail` where parent = dn.name), modified = now()""") |
| 222 | |
| 223 | # update billing status based on % billed |
| 224 | sql("""update `tabSales Order` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed', |
| 225 | if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""") |
| 226 | sql("""update `tabDelivery Note` set billing_status = if(ifnull(per_billed,0) < 0.001, 'Not Billed', |
| 227 | if(per_billed >= 99.99, 'Fully Billed', 'Partly Billed'))""") |
Rushabh Mehta | ab5292a | 2011-08-16 10:04:29 +0530 | [diff] [blame] | 228 | |
Rushabh Mehta | af43b74 | 2011-08-11 12:37:11 +0530 | [diff] [blame] | 229 | # update name of questions page |
| 230 | sql("update tabPage set name='questions' where name='Questions'") |
Brahma K | 2eb8101 | 2011-08-16 12:27:48 +0530 | [diff] [blame] | 231 | sql("update tabPage set name='question-view' where name='Question View'") |
Brahma K | fce442e | 2011-08-16 14:48:46 +0530 | [diff] [blame] | 232 | elif patch_no == 339: |
Brahma K | e8ec975 | 2011-08-16 12:21:07 +0530 | [diff] [blame] | 233 | reload_doc('production','doctype','bill_of_materials') |
Nabin Hait | 9537446 | 2011-08-22 14:40:11 +0530 | [diff] [blame] | 234 | elif patch_no == 340: |
| 235 | sql("update `tabDocField` set permlevel = 0 where (fieldname in ('process', 'production_order', 'fg_completed_qty') or label = 'Get Items') and parent = 'Stock Entry'") |
Brahma K | 82187ce | 2011-08-23 15:42:34 +0530 | [diff] [blame] | 236 | elif patch_no == 341: |
| 237 | reload_doc('stock','doctype','delivery_note') |
Brahma K | 6716480 | 2011-08-23 16:22:29 +0530 | [diff] [blame] | 238 | reload_doc('stock','doctype','item') |
| 239 | reload_doc('selling','doctype','quotation') |
Brahma K | 82187ce | 2011-08-23 15:42:34 +0530 | [diff] [blame] | 240 | reload_doc('stock','Print Format','Delivery Note Packing List Wise') |
| 241 | |
| 242 | if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"): |
| 243 | from webnotes.model.doc import addchild |
| 244 | dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1) |
| 245 | ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1) |
| 246 | ch.format = 'Delivery Note Packing List Wise' |
| 247 | ch.save(1) |
Brahma K | c735d44 | 2011-08-23 18:38:48 +0530 | [diff] [blame] | 248 | elif patch_no == 342: |
Nabin Hait | a0760df | 2011-08-23 17:29:54 +0530 | [diff] [blame] | 249 | sql("update `tabDocField` set permlevel = 0 where parent = 'Stock Entry Detail' and fieldname in ('s_warehouse', 't_warehouse', 'fg_item')") |
Brahma K | b25ed70 | 2011-08-23 18:41:25 +0530 | [diff] [blame] | 250 | elif patch_no == 343: |
Brahma K | c735d44 | 2011-08-23 18:38:48 +0530 | [diff] [blame] | 251 | reload_doc('stock','doctype','item_customer_detail') |
Nabin Hait | cfe8ee8 | 2011-08-25 14:02:01 +0530 | [diff] [blame] | 252 | elif patch_no == 344: |
Nabin Hait | 7b8f53c | 2011-08-24 11:23:34 +0530 | [diff] [blame] | 253 | sql("delete from `tabDocFormat` where ifnull(format, '') = '' and parent = 'Delivery Note'") |
Rushabh Mehta | 33bce67 | 2011-08-25 15:15:25 +0530 | [diff] [blame] | 254 | elif patch_no == 345: |
Rushabh Mehta | 910d955 | 2011-08-30 16:09:01 +0530 | [diff] [blame] | 255 | # rerun 343 (merge confict) |
| 256 | reload_doc('stock','doctype','item_customer_detail') |
Nabin Hait | cfe8ee8 | 2011-08-25 14:02:01 +0530 | [diff] [blame] | 257 | sql("delete from `tabModule Def Item` where display_name = 'Salary Slip Control Panel' and parent = 'HR'") |
| 258 | reload_doc('hr','Module Def','HR') |
Rushabh Mehta | 33bce67 | 2011-08-25 15:15:25 +0530 | [diff] [blame] | 259 | elif patch_no == 346: |
Rushabh Mehta | 96fde95 | 2011-08-29 17:54:27 +0530 | [diff] [blame] | 260 | pass |
Nabin Hait | 2c03015 | 2011-08-25 19:41:24 +0530 | [diff] [blame] | 261 | elif patch_no == 347: |
| 262 | sql("delete from `tabField Mapper Detail` where from_field = to_field and map = 'Yes' and ifnull(checking_operator, '') = ''") |
Nabin Hait | 1d5cab8 | 2011-08-29 13:16:52 +0530 | [diff] [blame] | 263 | elif patch_no == 348: |
| 264 | sql("update `tabStock Ledger Entry` set is_cancelled = 'No' where voucher_type = 'Serial No'") |
Nabin Hait | e0410da | 2011-08-29 14:24:19 +0530 | [diff] [blame] | 265 | elif patch_no == 349: |
| 266 | delete_doc('Custom Script', 'Update Series-Server') |
| 267 | delete_doc('Custom Script', 'Profile-Client') |
| 268 | delete_doc('Custom Script', 'Event-Client') |
| 269 | delete_doc('Custom Script', 'File-Server') |
Rushabh Mehta | 96fde95 | 2011-08-29 17:54:27 +0530 | [diff] [blame] | 270 | |
| 271 | # reload profile with new fields for security |
| 272 | delete_doc('DocType', 'Profile') |
| 273 | reload_doc('core', 'doctype', 'profile') |
Nabin Hait | 7282fce | 2011-08-30 17:34:14 +0530 | [diff] [blame] | 274 | elif patch_no == 350: |
| 275 | reload_doc('stock', 'doctype', 'delivery_note_detail') |
| 276 | reload_doc('stock', 'doctype', 'item_customer_detail') |
Nabin Hait | 9359213 | 2011-08-31 11:27:51 +0530 | [diff] [blame] | 277 | elif patch_no == 351: |
| 278 | reload_doc('home', 'page', 'dashboard') |
Nabin Hait | ef75761 | 2011-09-02 13:10:23 +0530 | [diff] [blame] | 279 | elif patch_no == 352: |
| 280 | reload_doc('stock','doctype','delivery_note') |
| 281 | reload_doc('stock','doctype','item') |
| 282 | reload_doc('selling','doctype','quotation') |
| 283 | reload_doc('stock','Print Format','Delivery Note Packing List Wise') |
| 284 | |
| 285 | if not sql("select format from `tabDocFormat` where name = 'Delivery Note Packing List Wise' and parent = 'Delivery Note'"): |
| 286 | from webnotes.model.doc import addchild |
| 287 | dt_obj = get_obj('DocType', 'Delivery Note', with_children = 1) |
| 288 | ch = addchild(dt_obj.doc, 'formats', 'DocFormat', 1) |
| 289 | ch.format = 'Delivery Note Packing List Wise' |
| 290 | ch.save(1) |