Nabin Hait | 0dfb8e9 | 2011-12-29 14:40:05 +0530 | [diff] [blame^] | 1 | def execute(): |
| 2 | import webnotes |
| 3 | from webnotes.model.code import get_obj |
| 4 | from webnotes.modules.module_manager import reload_doc |
| 5 | sql = webnotes.conn.sql |
| 6 | |
| 7 | reload_doc('hr', 'doctype', 'appraisal') |
| 8 | reload_doc('hr', 'doctype', 'appraisal_detail') |
| 9 | |
| 10 | sql("update `tabDocField` set `hidden` = 0 where fieldname = 'group_or_ledger' and parent = 'Cost Center'") |
| 11 | sql("update tabDocPerm set amend = 0 where parent = 'Salary Structure'") |
| 12 | sql("update tabDocPerm set cancel = 1 where parent = 'Company' and role = 'System Manager'") |
| 13 | |
| 14 | if sql("select count(name) from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1: |
| 15 | sql("delete from `tabDocField` where label = 'View Ledger Entry' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1") |
| 16 | if sql("select count(name) from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button'")[0][0] > 1: |
| 17 | sql("delete from `tabDocField` where label = 'Get Balance' and parent = 'Journal Voucher' and fieldtype = 'Button' limit 1") |
| 18 | |
| 19 | reload_doc('accounts', 'doctype', 'internal_reconciliation') |
| 20 | reload_doc('accounts', 'doctype', 'ir_payment_detail') |
| 21 | reload_doc('accounts', 'Module Def', 'Accounts') |
| 22 | |
| 23 | |
| 24 | reload_doc('setup', 'doctype','features_setup') |
| 25 | flds = ['page_break', 'projects', 'packing_details', 'discounts', 'brands', 'item_batch_nos', 'after_sales_installations', 'item_searial_nos', 'item_group_in_details', 'exports', 'imports', 'item_advanced', 'sales_extras', 'more_info', 'quality', 'manufacturing', 'pos', 'item_serial_nos'] |
| 26 | st = "'"+"', '".join(flds)+"'" |
| 27 | sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) |
| 28 | sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) |
| 29 | |
| 30 | fs = get_obj('Features Setup', 'Features Setup') |
| 31 | fs.doc.save() |
| 32 | fs.validate() |
| 33 | |
| 34 | if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1: |
| 35 | sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1") |
| 36 | |
| 37 | reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt') |
| 38 | |
| 39 | reload_doc('accounts', 'doctype', 'cost_center') |
| 40 | reload_doc('stock', 'Module Def', 'Stock') |
| 41 | sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'") |
| 42 | sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'") |
| 43 | |
| 44 | # Patch for adding packing related columns (packed by, checked by, shipping mark etc) |
| 45 | reload_doc('stock','doctype','delivery_note') |
| 46 | sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'") |
| 47 | sql("update `tabDocField` set allow_on_submit = 1 where fieldname in ('indent_details', 'po_details', 'purchase_receipt_details', 'entries', 'sales_order_details', 'delivery_note_details', 'quotation_details') and fieldtype = 'Table'") |
| 48 | |
| 49 | from webnotes.session_cache import clear_cache |
| 50 | clear_cache(webnotes.session['user']) |