From de08639d492af457ac5e89782c88758fc18caa35 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 16 Aug 2016 10:01:38 +0530 Subject: [PATCH] [minor] fixes to patches while moving from v5 --- erpnext/patches.txt | 4 ++-- erpnext/patches/v5_0/rename_table_fieldnames.py | 1 + erpnext/patches/v7_0/rename_advance_table_fields.py | 11 +++++++---- ..._account_table_for_expense_claim_type_if_exists.py | 5 ++++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fd1fc74e91..ef9f4da5ab 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -22,6 +22,7 @@ execute:frappe.reload_doc('accounts', 'doctype', 'pos_setting') # 2014-01-29 execute:frappe.reload_doc('selling', 'doctype', 'customer') # 2014-01-29 execute:frappe.reload_doc('buying', 'doctype', 'supplier') # 2014-01-29 execute:frappe.reload_doc('accounts', 'doctype', 'asset_category') +execute:frappe.reload_doc('accounts', 'doctype', 'pricing_rule') execute:frappe.reload_doctype('Item') erpnext.patches.v4_0.map_charge_to_taxes_and_charges execute:frappe.reload_doc('support', 'doctype', 'newsletter') # 2014-01-31 @@ -103,7 +104,6 @@ erpnext.patches.v5_0.update_frozen_accounts_permission_role erpnext.patches.v5_0.update_dn_against_doc_fields execute:frappe.db.sql("update `tabMaterial Request` set material_request_type = 'Material Transfer' where material_request_type = 'Transfer'") execute:frappe.reload_doc('stock', 'doctype', 'item') -execute:frappe.db.sql("update `tabItem` i set apply_warehouse_wise_reorder_level=1, re_order_level=0, re_order_qty=0 where exists(select name from `tabItem Reorder` where parent=i.name)") erpnext.patches.v5_0.set_default_company_in_bom execute:frappe.reload_doc('crm', 'doctype', 'lead') execute:frappe.reload_doc('crm', 'doctype', 'opportunity') @@ -235,6 +235,7 @@ execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Taxes and Charges erpnext.patches.v6_4.set_user_in_contact erpnext.patches.v6_4.make_image_thumbnail #2015-10-20 erpnext.patches.v6_5.show_in_website_for_template_item +erpnext.patches.v7_0.create_budget_record erpnext.patches.v6_4.fix_expense_included_in_valuation execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate") erpnext.patches.v6_6.fix_website_image @@ -269,7 +270,6 @@ erpnext.patches.v7_0.update_party_status erpnext.patches.v7_0.update_item_projected erpnext.patches.v7_0.remove_features_setup erpnext.patches.v7_0.update_home_page -erpnext.patches.v7_0.create_budget_record execute:frappe.delete_doc_if_exists("Page", "financial-analytics") erpnext.patches.v7_0.update_project_in_gl_entry execute:frappe.db.sql('update tabQuotation set status="Cancelled" where docstatus=2') diff --git a/erpnext/patches/v5_0/rename_table_fieldnames.py b/erpnext/patches/v5_0/rename_table_fieldnames.py index d9af7b8402..e6667deb77 100644 --- a/erpnext/patches/v5_0/rename_table_fieldnames.py +++ b/erpnext/patches/v5_0/rename_table_fieldnames.py @@ -219,6 +219,7 @@ def execute(): frappe.reload_doc("manufacturing", "doctype", "production_order_operation") frappe.reload_doc("manufacturing", "doctype", "workstation_working_hour") frappe.reload_doc("stock", "doctype", "item_variant") + frappe.reload_doc("hr", "doctype", "salary_detail") frappe.reload_doc("accounts", "doctype", "party_account") frappe.reload_doc("accounts", "doctype", "fiscal_year_company") diff --git a/erpnext/patches/v7_0/rename_advance_table_fields.py b/erpnext/patches/v7_0/rename_advance_table_fields.py index ba8b2daf5c..34d81343e2 100644 --- a/erpnext/patches/v7_0/rename_advance_table_fields.py +++ b/erpnext/patches/v7_0/rename_advance_table_fields.py @@ -8,8 +8,11 @@ from frappe.model.utils.rename_field import rename_field def execute(): for dt in ("Sales Invoice Advance", "Purchase Invoice Advance"): frappe.reload_doctype(dt) - + frappe.db.sql("update `tab{0}` set reference_type = 'Journal Entry'".format(dt)) - - rename_field(dt, "journal_entry", "reference_name") - rename_field(dt, "jv_detail_no", "reference_row") \ No newline at end of file + + if frappe.get_meta(dt).has_field('journal_entry'): + rename_field(dt, "journal_entry", "reference_name") + + if frappe.get_meta(dt).has_field('jv_detail_no'): + rename_field(dt, "jv_detail_no", "reference_row") \ No newline at end of file diff --git a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py index 2c07e30adf..a067e71ed0 100644 --- a/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py +++ b/erpnext/patches/v7_0/setup_account_table_for_expense_claim_type_if_exists.py @@ -4,7 +4,10 @@ import frappe def execute(): frappe.reload_doc("hr", "doctype", "expense_claim_type") frappe.reload_doc("hr", "doctype", "expense_claim_account") - + + if not frappe.db.has_column('Expense Claim Type', 'default_account'): + return + for expense_claim_type in frappe.get_all("Expense Claim Type", fields=["name", "default_account"]): if expense_claim_type.default_account: doc = frappe.get_doc("Expense Claim Type", expense_claim_type.name)