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 | |
Nabin Hait | 0dfb8e9 | 2011-12-29 14:40:05 +0530 | [diff] [blame] | 23 | |
Nabin Hait | 0dfb8e9 | 2011-12-29 14:40:05 +0530 | [diff] [blame] | 24 | |
| 25 | if sql("select count(name) from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button'")[0][0] > 1: |
| 26 | sql("delete from `tabDocField` where label = 'Get Specification Details' and parent = 'QA Inspection Report' and fieldtype = 'Button' limit 1") |
| 27 | |
| 28 | reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt') |
| 29 | |
| 30 | reload_doc('accounts', 'doctype', 'cost_center') |
| 31 | reload_doc('stock', 'Module Def', 'Stock') |
| 32 | sql("delete from `tabModule Def Item` where display_name = 'Serial No' and parent = 'Support'") |
| 33 | sql("update `tabDocType` set subject = 'Item Code: %(item_code)s, Warehouse: %(warehouse)s' where name = 'Serial No'") |
| 34 | |
| 35 | # Patch for adding packing related columns (packed by, checked by, shipping mark etc) |
| 36 | reload_doc('stock','doctype','delivery_note') |
| 37 | sql("update `tabDocField` set allow_on_submit = 1 where fieldname = 'page_break'") |
| 38 | 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'") |
| 39 | |
| 40 | from webnotes.session_cache import clear_cache |
| 41 | clear_cache(webnotes.session['user']) |
Nabin Hait | 21d0b68 | 2011-12-29 15:39:26 +0530 | [diff] [blame] | 42 | |
| 43 | # FEATURES SETUP |
| 44 | #---------------- |
| 45 | reload_doc('setup', 'doctype','features_setup') |
| 46 | 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'] |
| 47 | st = "'"+"', '".join(flds)+"'" |
| 48 | sql("delete from `tabSingles` where field in (%s) and doctype = 'Features Setup'" % st) |
| 49 | sql("delete from `tabDocField` where fieldname in (%s) and parent = 'Features Setup'" % st) |
| 50 | sql("delete from `tabDefaultValue` where defkey in (%s) and parent = 'Control Panel'" % st) |
| 51 | |
| 52 | if not sql("select * from `tabDefaultValue` where defkey like 'fs_%' and parent = 'Control Panel'"): |
| 53 | rs = sql("select fieldname from tabDocField where parent='Features Setup' and fieldname is not null") |
| 54 | fs = get_obj('Features Setup', 'Features Setup') |
| 55 | for d in rs: |
| 56 | fs.doc.fields[d[0]] = 1 |
| 57 | fs.doc.save() |
| 58 | fs.validate() |