From 0c54e2d0d08668797a5f149d9dce3fa98c4cd267 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 12 May 2014 17:44:55 +0530 Subject: [PATCH] 4_0 patch dir renamed to v4_0 --- erpnext/patches/4_0/fields_to_be_renamed.py | 131 ------------------ erpnext/patches/{4_0 => v4_0}/__init__.py | 0 .../patches/{4_0 => v4_0}/countrywise_coa.py | 0 .../customer_discount_to_pricing_rule.py | 0 erpnext/patches/v4_0/fields_to_be_renamed.py | 131 ++++++++++++++++++ .../{4_0 => v4_0}/fix_contact_address.py | 0 .../{4_0 => v4_0}/fix_employee_user_id.py | 0 .../{4_0 => v4_0}/import_country_codes.py | 0 .../map_charge_to_taxes_and_charges.py | 0 .../move_warehouse_user_to_restrictions.py | 0 .../patches/{4_0 => v4_0}/new_permissions.py | 0 .../reload_purchase_print_format.py | 0 .../reload_sales_print_format.py | 0 .../remove_india_specific_fields.py | 0 .../{4_0 => v4_0}/remove_module_home_pages.py | 0 .../{4_0 => v4_0}/rename_sitemap_to_route.py | 0 .../{4_0 => v4_0}/split_email_settings.py | 0 ...to_sales_person_in_maintenance_schedule.py | 0 .../{4_0 => v4_0}/update_user_properties.py | 0 .../{4_0 => v4_0}/validate_v3_patch.py | 0 20 files changed, 131 insertions(+), 131 deletions(-) delete mode 100644 erpnext/patches/4_0/fields_to_be_renamed.py rename erpnext/patches/{4_0 => v4_0}/__init__.py (100%) rename erpnext/patches/{4_0 => v4_0}/countrywise_coa.py (100%) rename erpnext/patches/{4_0 => v4_0}/customer_discount_to_pricing_rule.py (100%) create mode 100644 erpnext/patches/v4_0/fields_to_be_renamed.py rename erpnext/patches/{4_0 => v4_0}/fix_contact_address.py (100%) rename erpnext/patches/{4_0 => v4_0}/fix_employee_user_id.py (100%) rename erpnext/patches/{4_0 => v4_0}/import_country_codes.py (100%) rename erpnext/patches/{4_0 => v4_0}/map_charge_to_taxes_and_charges.py (100%) rename erpnext/patches/{4_0 => v4_0}/move_warehouse_user_to_restrictions.py (100%) rename erpnext/patches/{4_0 => v4_0}/new_permissions.py (100%) rename erpnext/patches/{4_0 => v4_0}/reload_purchase_print_format.py (100%) rename erpnext/patches/{4_0 => v4_0}/reload_sales_print_format.py (100%) rename erpnext/patches/{4_0 => v4_0}/remove_india_specific_fields.py (100%) rename erpnext/patches/{4_0 => v4_0}/remove_module_home_pages.py (100%) rename erpnext/patches/{4_0 => v4_0}/rename_sitemap_to_route.py (100%) rename erpnext/patches/{4_0 => v4_0}/split_email_settings.py (100%) rename erpnext/patches/{4_0 => v4_0}/update_incharge_name_to_sales_person_in_maintenance_schedule.py (100%) rename erpnext/patches/{4_0 => v4_0}/update_user_properties.py (100%) rename erpnext/patches/{4_0 => v4_0}/validate_v3_patch.py (100%) diff --git a/erpnext/patches/4_0/fields_to_be_renamed.py b/erpnext/patches/4_0/fields_to_be_renamed.py deleted file mode 100644 index 2bbd4300c9..0000000000 --- a/erpnext/patches/4_0/fields_to_be_renamed.py +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model import rename_field -from frappe.modules import scrub, get_doctype_module - -def execute(): - rename_map = { - "Quotation Item": [ - ["ref_rate", "price_list_rate"], - ["base_ref_rate", "base_price_list_rate"], - ["adj_rate", "discount_percentage"], - ["export_rate", "rate"], - ["basic_rate", "base_rate"], - ["amount", "base_amount"], - ["export_amount", "amount"] - ], - - "Sales Order Item": [ - ["ref_rate", "price_list_rate"], - ["base_ref_rate", "base_price_list_rate"], - ["adj_rate", "discount_percentage"], - ["export_rate", "rate"], - ["basic_rate", "base_rate"], - ["amount", "base_amount"], - ["export_amount", "amount"], - ["reserved_warehouse", "warehouse"] - ], - - "Delivery Note Item": [ - ["ref_rate", "price_list_rate"], - ["base_ref_rate", "base_price_list_rate"], - ["adj_rate", "discount_percentage"], - ["export_rate", "rate"], - ["basic_rate", "base_rate"], - ["amount", "base_amount"], - ["export_amount", "amount"] - ], - - "Sales Invoice Item": [ - ["ref_rate", "price_list_rate"], - ["base_ref_rate", "base_price_list_rate"], - ["adj_rate", "discount_percentage"], - ["export_rate", "rate"], - ["basic_rate", "base_rate"], - ["amount", "base_amount"], - ["export_amount", "amount"] - ], - - "Supplier Quotation Item": [ - ["import_ref_rate", "price_list_rate"], - ["purchase_ref_rate", "base_price_list_rate"], - ["discount_rate", "discount_percentage"], - ["import_rate", "rate"], - ["purchase_rate", "base_rate"], - ["amount", "base_amount"], - ["import_amount", "amount"] - ], - - "Purchase Order Item": [ - ["import_ref_rate", "price_list_rate"], - ["purchase_ref_rate", "base_price_list_rate"], - ["discount_rate", "discount_percentage"], - ["import_rate", "rate"], - ["purchase_rate", "base_rate"], - ["amount", "base_amount"], - ["import_amount", "amount"] - ], - - "Purchase Receipt Item": [ - ["import_ref_rate", "price_list_rate"], - ["purchase_ref_rate", "base_price_list_rate"], - ["discount_rate", "discount_percentage"], - ["import_rate", "rate"], - ["purchase_rate", "base_rate"], - ["amount", "base_amount"], - ["import_amount", "amount"] - ], - - "Purchase Invoice Item": [ - ["import_ref_rate", "price_list_rate"], - ["purchase_ref_rate", "base_price_list_rate"], - ["discount_rate", "discount_percentage"], - ["import_rate", "rate"], - ["rate", "base_rate"], - ["amount", "base_amount"], - ["import_amount", "amount"], - ["expense_head", "expense_account"] - ], - - "Item": [ - ["purchase_account", "expense_account"], - ["default_sales_cost_center", "selling_cost_center"], - ["cost_center", "buying_cost_center"], - ["default_income_account", "income_account"], - ], - "Item Price": [ - ["ref_rate", "price_list_rate"] - ] - } - - reload_docs(rename_map) - - for dt, field_list in rename_map.items(): - for field in field_list: - rename_field(dt, field[0], field[1]) - -def reload_docs(docs): - for dn in docs: - frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn)) - - # reload all standard print formats - for pf in frappe.db.sql("""select name, module from `tabPrint Format` - where ifnull(standard, 'No') = 'Yes'""", as_dict=1): - try: - frappe.reload_doc(pf.module, "Print Format", pf.name) - except Exception, e: - print e - pass - - # reload all standard reports - for r in frappe.db.sql("""select name, ref_doctype from `tabReport` - where ifnull(is_standard, 'No') = 'Yes' - and report_type in ('Report Builder', 'Query Report')""", as_dict=1): - try: - frappe.reload_doc(get_doctype_module(r.ref_doctype), "Report", r.name) - except Exception, e: - print e - pass diff --git a/erpnext/patches/4_0/__init__.py b/erpnext/patches/v4_0/__init__.py similarity index 100% rename from erpnext/patches/4_0/__init__.py rename to erpnext/patches/v4_0/__init__.py diff --git a/erpnext/patches/4_0/countrywise_coa.py b/erpnext/patches/v4_0/countrywise_coa.py similarity index 100% rename from erpnext/patches/4_0/countrywise_coa.py rename to erpnext/patches/v4_0/countrywise_coa.py diff --git a/erpnext/patches/4_0/customer_discount_to_pricing_rule.py b/erpnext/patches/v4_0/customer_discount_to_pricing_rule.py similarity index 100% rename from erpnext/patches/4_0/customer_discount_to_pricing_rule.py rename to erpnext/patches/v4_0/customer_discount_to_pricing_rule.py diff --git a/erpnext/patches/v4_0/fields_to_be_renamed.py b/erpnext/patches/v4_0/fields_to_be_renamed.py new file mode 100644 index 0000000000..b2f42f12b7 --- /dev/null +++ b/erpnext/patches/v4_0/fields_to_be_renamed.py @@ -0,0 +1,131 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model import rename_field +from frappe.modules import scrub, get_doctype_module + +rename_map = { + "Quotation Item": [ + ["ref_rate", "price_list_rate"], + ["base_ref_rate", "base_price_list_rate"], + ["adj_rate", "discount_percentage"], + ["export_rate", "rate"], + ["basic_rate", "base_rate"], + ["amount", "base_amount"], + ["export_amount", "amount"] + ], + + "Sales Order Item": [ + ["ref_rate", "price_list_rate"], + ["base_ref_rate", "base_price_list_rate"], + ["adj_rate", "discount_percentage"], + ["export_rate", "rate"], + ["basic_rate", "base_rate"], + ["amount", "base_amount"], + ["export_amount", "amount"], + ["reserved_warehouse", "warehouse"] + ], + + "Delivery Note Item": [ + ["ref_rate", "price_list_rate"], + ["base_ref_rate", "base_price_list_rate"], + ["adj_rate", "discount_percentage"], + ["export_rate", "rate"], + ["basic_rate", "base_rate"], + ["amount", "base_amount"], + ["export_amount", "amount"] + ], + + "Sales Invoice Item": [ + ["ref_rate", "price_list_rate"], + ["base_ref_rate", "base_price_list_rate"], + ["adj_rate", "discount_percentage"], + ["export_rate", "rate"], + ["basic_rate", "base_rate"], + ["amount", "base_amount"], + ["export_amount", "amount"] + ], + + "Supplier Quotation Item": [ + ["import_ref_rate", "price_list_rate"], + ["purchase_ref_rate", "base_price_list_rate"], + ["discount_rate", "discount_percentage"], + ["import_rate", "rate"], + ["purchase_rate", "base_rate"], + ["amount", "base_amount"], + ["import_amount", "amount"] + ], + + "Purchase Order Item": [ + ["import_ref_rate", "price_list_rate"], + ["purchase_ref_rate", "base_price_list_rate"], + ["discount_rate", "discount_percentage"], + ["import_rate", "rate"], + ["purchase_rate", "base_rate"], + ["amount", "base_amount"], + ["import_amount", "amount"] + ], + + "Purchase Receipt Item": [ + ["import_ref_rate", "price_list_rate"], + ["purchase_ref_rate", "base_price_list_rate"], + ["discount_rate", "discount_percentage"], + ["import_rate", "rate"], + ["purchase_rate", "base_rate"], + ["amount", "base_amount"], + ["import_amount", "amount"] + ], + + "Purchase Invoice Item": [ + ["import_ref_rate", "price_list_rate"], + ["purchase_ref_rate", "base_price_list_rate"], + ["discount_rate", "discount_percentage"], + ["import_rate", "rate"], + ["rate", "base_rate"], + ["amount", "base_amount"], + ["import_amount", "amount"], + ["expense_head", "expense_account"] + ], + + "Item": [ + ["purchase_account", "expense_account"], + ["default_sales_cost_center", "selling_cost_center"], + ["cost_center", "buying_cost_center"], + ["default_income_account", "income_account"], + ], + "Item Price": [ + ["ref_rate", "price_list_rate"] + ] +} + +def execute(): + reload_docs() + + for dt, field_list in rename_map.items(): + for field in field_list: + rename_field(dt, field[0], field[1]) + +def reload_docs(): + for dn in rename_map: + frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn)) + + # reload all standard print formats + for pf in frappe.db.sql("""select name, module from `tabPrint Format` + where ifnull(standard, 'No') = 'Yes'""", as_dict=1): + try: + frappe.reload_doc(pf.module, "Print Format", pf.name) + except Exception, e: + print e + pass + + # reload all standard reports + for r in frappe.db.sql("""select name, ref_doctype from `tabReport` + where ifnull(is_standard, 'No') = 'Yes' + and report_type in ('Report Builder', 'Query Report')""", as_dict=1): + try: + frappe.reload_doc(get_doctype_module(r.ref_doctype), "report", r.name) + except Exception, e: + print e + pass diff --git a/erpnext/patches/4_0/fix_contact_address.py b/erpnext/patches/v4_0/fix_contact_address.py similarity index 100% rename from erpnext/patches/4_0/fix_contact_address.py rename to erpnext/patches/v4_0/fix_contact_address.py diff --git a/erpnext/patches/4_0/fix_employee_user_id.py b/erpnext/patches/v4_0/fix_employee_user_id.py similarity index 100% rename from erpnext/patches/4_0/fix_employee_user_id.py rename to erpnext/patches/v4_0/fix_employee_user_id.py diff --git a/erpnext/patches/4_0/import_country_codes.py b/erpnext/patches/v4_0/import_country_codes.py similarity index 100% rename from erpnext/patches/4_0/import_country_codes.py rename to erpnext/patches/v4_0/import_country_codes.py diff --git a/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py b/erpnext/patches/v4_0/map_charge_to_taxes_and_charges.py similarity index 100% rename from erpnext/patches/4_0/map_charge_to_taxes_and_charges.py rename to erpnext/patches/v4_0/map_charge_to_taxes_and_charges.py diff --git a/erpnext/patches/4_0/move_warehouse_user_to_restrictions.py b/erpnext/patches/v4_0/move_warehouse_user_to_restrictions.py similarity index 100% rename from erpnext/patches/4_0/move_warehouse_user_to_restrictions.py rename to erpnext/patches/v4_0/move_warehouse_user_to_restrictions.py diff --git a/erpnext/patches/4_0/new_permissions.py b/erpnext/patches/v4_0/new_permissions.py similarity index 100% rename from erpnext/patches/4_0/new_permissions.py rename to erpnext/patches/v4_0/new_permissions.py diff --git a/erpnext/patches/4_0/reload_purchase_print_format.py b/erpnext/patches/v4_0/reload_purchase_print_format.py similarity index 100% rename from erpnext/patches/4_0/reload_purchase_print_format.py rename to erpnext/patches/v4_0/reload_purchase_print_format.py diff --git a/erpnext/patches/4_0/reload_sales_print_format.py b/erpnext/patches/v4_0/reload_sales_print_format.py similarity index 100% rename from erpnext/patches/4_0/reload_sales_print_format.py rename to erpnext/patches/v4_0/reload_sales_print_format.py diff --git a/erpnext/patches/4_0/remove_india_specific_fields.py b/erpnext/patches/v4_0/remove_india_specific_fields.py similarity index 100% rename from erpnext/patches/4_0/remove_india_specific_fields.py rename to erpnext/patches/v4_0/remove_india_specific_fields.py diff --git a/erpnext/patches/4_0/remove_module_home_pages.py b/erpnext/patches/v4_0/remove_module_home_pages.py similarity index 100% rename from erpnext/patches/4_0/remove_module_home_pages.py rename to erpnext/patches/v4_0/remove_module_home_pages.py diff --git a/erpnext/patches/4_0/rename_sitemap_to_route.py b/erpnext/patches/v4_0/rename_sitemap_to_route.py similarity index 100% rename from erpnext/patches/4_0/rename_sitemap_to_route.py rename to erpnext/patches/v4_0/rename_sitemap_to_route.py diff --git a/erpnext/patches/4_0/split_email_settings.py b/erpnext/patches/v4_0/split_email_settings.py similarity index 100% rename from erpnext/patches/4_0/split_email_settings.py rename to erpnext/patches/v4_0/split_email_settings.py diff --git a/erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py b/erpnext/patches/v4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py similarity index 100% rename from erpnext/patches/4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py rename to erpnext/patches/v4_0/update_incharge_name_to_sales_person_in_maintenance_schedule.py diff --git a/erpnext/patches/4_0/update_user_properties.py b/erpnext/patches/v4_0/update_user_properties.py similarity index 100% rename from erpnext/patches/4_0/update_user_properties.py rename to erpnext/patches/v4_0/update_user_properties.py diff --git a/erpnext/patches/4_0/validate_v3_patch.py b/erpnext/patches/v4_0/validate_v3_patch.py similarity index 100% rename from erpnext/patches/4_0/validate_v3_patch.py rename to erpnext/patches/v4_0/validate_v3_patch.py