From c1ef503d98ec630356c0d4314d6aa28ed9ceed17 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 29 Jul 2011 13:01:54 +0530 Subject: [PATCH 1/8] Patch to transfer db_name to account_id in control panel --- patches/patch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/patches/patch.py b/patches/patch.py index 86fcff62901..9894d20249a 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 332 +last_patch = 333 #------------------------------------------- @@ -1336,3 +1336,7 @@ def execute(patch_no): p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1) elif patch_no == 332: sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") + elif patch_no == 333: + cp = Document('Control Panel','Control Panel') + cp.account_id = str(webnotes.cookies['account_id']).split('=')[-1] + cp.save() \ No newline at end of file From 38d12235385b2930f148616193e41d3377810699 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 29 Jul 2011 13:13:46 +0530 Subject: [PATCH 2/8] Removed patch to modify account id in control panel. Will write script to update that --- patches/patch.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 9894d20249a..b3dc6a333b3 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 333 +last_patch = 332 #------------------------------------------- @@ -1335,8 +1335,4 @@ def execute(patch_no): p.add_permission('Lease Agreement', 'Accounts Manager', 0, read = 1, write=1,submit=1, cancel=1,amend=1) p.add_permission('Lease Agreement', 'Accounts Manager', 1, read = 1) elif patch_no == 332: - sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") - elif patch_no == 333: - cp = Document('Control Panel','Control Panel') - cp.account_id = str(webnotes.cookies['account_id']).split('=')[-1] - cp.save() \ No newline at end of file + sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") \ No newline at end of file From 510dad7aa7a8503fef008bdd6237bb9121d3c62a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 2 Aug 2011 12:54:23 +0530 Subject: [PATCH 3/8] fixed error in period closing voucher --- .../doctype/period_closing_voucher/period_closing_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/accounts/doctype/period_closing_voucher/period_closing_voucher.py index ed42459ca5c..c7e5db66395 100644 --- a/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -129,7 +129,7 @@ class DocType: # save le.save(1) - le_obj.on_update(adv_adj = '') + le_obj.on_update(adv_adj = '', cancel = '') # Reposting Balances From 542da5e9eeeda2e5ce749fe4294d418b532a86dc Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 2 Aug 2011 13:31:59 +0530 Subject: [PATCH 4/8] merged patch from stable --- patches/patch.py | 131 ++++------------------------------------------- 1 file changed, 9 insertions(+), 122 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 5def7a9f8e3..2fbffd8d5b2 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -56,17 +56,8 @@ def execute(patch_no): pass elif patch_no == 40: -<<<<<<< HEAD -<<<<<<< HEAD - import_from_files(record_list=[['material_management','doctype','item']]) -======= - - import_from_files(record_list=[['stock','doctype','item']]) ->>>>>>> stable -======= - import_from_files(record_list=[['stock','doctype','item']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + elif patch_no == 42: acc = sql("select name, lft, rgt from tabAccount where account_name in ('Incomes', 'Expenses')") for d in acc: @@ -134,17 +125,8 @@ def execute(patch_no): elif patch_no == 56: 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'") elif patch_no == 57: -<<<<<<< HEAD -<<<<<<< HEAD + import_from_files(record_list=[['selling','doctype','sales_order_detail']]) - import_from_files(record_list=[['crm','doctype','sales_order_detail']]) -======= - - import_from_files(record_list=[['selling','doctype','sales_order_detail']]) ->>>>>>> stable -======= - import_from_files(record_list=[['selling','doctype','sales_order_detail']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 58: # module def patches sql("update `tabModule Def` set module_page = NULL where name not in ('Event Updates', 'Setup', 'My Company')") @@ -178,17 +160,8 @@ def execute(patch_no): sql("delete from `tabTDS Category Account` where company not in (select name from tabCompany)") elif patch_no == 62: # Import Supplier Quotation -<<<<<<< HEAD -<<<<<<< HEAD - import_from_files(record_list=[['srm','doctype','supplier_quotation']]) -======= - - import_from_files(record_list=[['buying','doctype','supplier_quotation']]) ->>>>>>> stable -======= - import_from_files(record_list=[['buying','doctype','supplier_quotation']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + # Adding Status Filter sql("update tabDocType set search_fields = concat('status,',search_fields) where name IN ('Delivery Note','Leave Transaction')") # Import Other Charges @@ -196,17 +169,8 @@ def execute(patch_no): import_from_files(record_list=[['setup','doctype','other_charges']]) elif patch_no == 63: sql("update `tabDocField` set permlevel = 1 where fieldname in ('return_date', 'return_details') and parent = 'Sales and Purchase Return Wizard'") -<<<<<<< HEAD -<<<<<<< HEAD - import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['material_management', 'doctype', 'sales_and_purchase_return_wizard'], ['material_management', 'doctype', 'stock_entry']]) -======= - - import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['stock', 'doctype', 'sales_and_purchase_return_wizard'], ['stock', 'doctype', 'stock_entry']]) ->>>>>>> stable -======= - import_from_files(record_list = [['accounts', 'doctype', 'rv_detail'], ['stock', 'doctype', 'sales_and_purchase_return_wizard'], ['stock', 'doctype', 'stock_entry']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + elif patch_no == 64: sql("update tabDocField set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where options in ('RFQ','Supplier Quotation')") sql("update tabDocType set `read_only` = 1, in_create = 1 where name in ('RFQ','Supplier Quotation')") @@ -387,17 +351,7 @@ def execute(patch_no): p.add_permission('Salary Slip', 'Employee', 1, read = 1, match = 'owner') elif patch_no == 79: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD - - 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']]) -======= - - import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','Payroll']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','Payroll']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + import_from_files(record_list=[['hr','doctype','leave_application'],['hr','doctype','leave_allocation'],['hr','doctype','leave_control_panel'],['hr','doctype','holiday_list'],['hr','doctype','holiday_list_detail'],['hr','Module Def','HR']]) elif patch_no == 80: # Holiday List sql("update `tabHoliday List Detail` set description = holiday_name") @@ -450,17 +404,7 @@ def execute(patch_no): elif patch_no == 81: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['payroll','Module Def','Payroll']]) -======= - - import_from_files(record_list=[['hr','Module Def','Payroll']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','Module Def','Payroll']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c + import_from_files(record_list=[['hr','Module Def','HR']]) elif patch_no == 82: sql("update tabDocType set search_fields = 'employee,leave_type,total_leaves_allocated,fiscal_year' where name = 'Leave Allocation'") sql("update tabDocType set search_fields = 'employee,leave_type,from_date,to_date,total_leave_days,fiscal_year' where name = 'Leave Application'") @@ -486,32 +430,13 @@ def execute(patch_no): sql("update tabDocPerm set `match` = '' where parent = 'Leave Application' and role = 'HR User'") elif patch_no == 86: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['payroll','doctype','leave_type']]) -======= - import_from_files(record_list=[['hr','doctype','leave_type']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','doctype','leave_type']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 87: sql("update `tabLeave Type` set is_lwp = 1 where name = 'Leave Without Pay'") elif patch_no == 88: # Import Modules -<<<<<<< HEAD -<<<<<<< HEAD + import_from_files(record_list=[['hr','doctype','leave_allocation']]) - import_from_files(record_list=[['payroll','doctype','leave_allocation']]) -======= - - import_from_files(record_list=[['hr','doctype','leave_allocation']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','doctype','leave_allocation']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 89: sql("delete from `tabModule Def Item` where doc_type = 'Setup Forms' and doc_name in ('Payroll Rule', 'IT Checklist', 'Employee Profile') and parent = 'Payroll'") sql("update `tabDocField` set `hidden` = 1, `print_hide` = 1, `report_hide` = 1 where parent = 'Leave Type' and fieldname = 'is_encash'") @@ -529,17 +454,7 @@ def execute(patch_no): 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'") sql("update `tabField Mapper Detail` set from_field = 'customer' where to_field = 'customer' and parent = 'Sales Order-Receivable Voucher'") elif patch_no == 94: -<<<<<<< HEAD -<<<<<<< HEAD - - import_from_files(record_list=[['crm','doctype','sms_center']]) -======= - import_from_files(record_list=[['selling','doctype','sms_center']]) ->>>>>>> stable -======= - import_from_files(record_list=[['selling','doctype','sms_center']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 95: import_from_files(record_list=[['mapper','DocType Mapper','Sales Order-Receivable Voucher'], ['mapper','DocType Mapper','Delivery Note-Receivable Voucher']]) elif patch_no == 96: @@ -570,17 +485,8 @@ def execute(patch_no): elif patch_no == 103: sql("update tabDocField set fieldname = '' where fieldtype = 'HTML'") elif patch_no == 104: -<<<<<<< HEAD -<<<<<<< HEAD + import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','HR'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']]) - 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']]) -======= - - import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','Payroll'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']]) ->>>>>>> stable -======= - import_from_files(record_list=[['hr','search_criteria','stdsrch_00001'],['hr','search_criteria','stdsrch_00002'],['hr','search_criteria','stdsrch_00003'],['hr','Module Def','Payroll'],['hr','doctype','leave_application'],['hr','doctype','leave_allocation']]) ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 105: # Employee Leave Balance 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')") @@ -1040,17 +946,8 @@ def execute(patch_no): elif patch_no == 239: reload_doc('core', 'doctype', 'docfield') reload_doc('core', 'doctype', 'doctype') -<<<<<<< HEAD -<<<<<<< HEAD + from patches.old_patches.feed_patch import set_subjects_and_tagfields - from patches.feed_patch import set_subjects_and_tagfields -======= - - from patches.old_patches.feed_patch import set_subjects_and_tagfields ->>>>>>> stable -======= - from patches.old_patches.feed_patch import set_subjects_and_tagfields ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c set_subjects_and_tagfields() elif patch_no == 240: # again for sales order (status) @@ -1123,18 +1020,8 @@ def execute(patch_no): 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'") sql("update `tabItem` set description_html = replace(description_html, 'http://46.4.50.84/v170-test/', '')") elif patch_no == 257: -<<<<<<< HEAD -<<<<<<< HEAD - from patches.customer_address import run_old_data_sync_patch - run_old_data_sync_patch() -======= - from patches.old_patches.customer_address import run_old_data_sync_patch - run_old_data_sync_patch() ->>>>>>> stable -======= from patches.old_patches.customer_address import run_old_data_sync_patch run_old_data_sync_patch() ->>>>>>> 809530c4b9d9dd0e9cbdf8006da83c5af822df7c elif patch_no == 258: sql("update tabDocField set `default`=NULL where fieldname = 'naming_series'") elif patch_no == 259: From b61abff9cdfce86493b18196354afc736c0c2ff1 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Aug 2011 11:58:05 +0530 Subject: [PATCH 5/8] Reload billing page patch --- patches/patch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 76019c0f6bc..26372b063f9 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 335 +last_patch = 336 #------------------------------------------- @@ -1354,4 +1354,6 @@ def execute(patch_no): reload_doc('knowledge_base', 'doctype', 'answer') elif patch_no == 335: for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']: - sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt)) \ No newline at end of file + sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt)) + elif patch_no == 336: + reload_doc('server_tools','page','billing') \ No newline at end of file From aabf1748a28d137c89fd73f2e7f5801ddaabeb88 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 10 Aug 2011 13:27:25 +0530 Subject: [PATCH 6/8] Added patch to update account id value in description_html of item, which maps the image url to the description --- patches/patch.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 26372b063f9..94e0f11b2e1 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 336 +last_patch = 337 #------------------------------------------- @@ -1356,4 +1356,21 @@ def execute(patch_no): for dt in ['Account', 'Cost Center', 'Territory', 'Item Group', 'Customer Group']: sql("update `tabDocField` set fieldtype = 'Link', options = %s where fieldname = 'old_parent' and parent = %s", (dt, dt)) elif patch_no == 336: - reload_doc('server_tools','page','billing') \ No newline at end of file + reload_doc('server_tools','page','billing') + elif patch_no == 337: + item_list = webnotes.conn.sql("""SELECT name, description_html + FROM tabItem""") + if item_list: + for item, html in item_list: + if html and "getfile" in html and "acx" in html: + ac_id = webnotes.conn.sql("""SELECT value FROM `tabSingles` WHERE doctype='Control Panel' AND field='account_id'""") + sp_acx = html.split("acx=") + l_acx = len(sp_acx) + if l_acx > 1: + for i in range(l_acx-1): + sp_quot = sp_acx[i+1].split('"') + if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0]) + sp_acx[i+1] = '"'.join(sp_quot) + html = "acx=".join(sp_acx) + webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item)) + \ No newline at end of file From d31de59d2e5f335a034b0ff3f7c8151bdf5efe12 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Aug 2011 14:01:27 +0530 Subject: [PATCH 7/8] fixed error in patch --- patches/patch.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index 94e0f11b2e1..cd68b13e21a 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1344,7 +1344,7 @@ def execute(patch_no): elif patch_no == 332: sql("update `tabDocField` set permlevel=1, hidden = 1 where parent = 'Bulk Rename Tool' and fieldname = 'file_list'") elif patch_no == 333: - sql("update `tabDocPerm` set create =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'") + sql("update `tabDocPerm` set `create` =1 where role = 'Accounts Manager' and parent = 'Lease Agreement'") p = get_obj('Patch Util') p.add_permission('DocType Mapper', 'System Manager', 0, read = 1, write=1, create=1) @@ -1372,5 +1372,4 @@ def execute(patch_no): if len(sp_quot) > 1: sp_quot[0] = str(ac_id[0][0]) sp_acx[i+1] = '"'.join(sp_quot) html = "acx=".join(sp_acx) - webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item)) - \ No newline at end of file + webnotes.conn.sql("""UPDATE tabItem SET description_html=%s WHERE name=%s""", (html, item)) From b1e8be462b819644c2cf41820b833c7dad875411 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 10 Aug 2011 14:16:43 +0530 Subject: [PATCH 8/8] error fixed in patch util --- utilities/doctype/patch_util/patch_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/doctype/patch_util/patch_util.py b/utilities/doctype/patch_util/patch_util.py index 8413fc0747c..828c8050970 100644 --- a/utilities/doctype/patch_util/patch_util.py +++ b/utilities/doctype/patch_util/patch_util.py @@ -86,7 +86,7 @@ class DocType: d.parenttype = 'DocType' d.parentfield = 'permissions' - d.level = level + d.permlevel = level d.role = role d.read = read d.write = write