brotherton-erpnext/erpnext/patches/v4_0/fields_to_be_renamed.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
3.0 KiB
Python
Raw Normal View History

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
2014-05-12 12:14:55 +00:00
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
2015-07-17 09:44:19 +00:00
from frappe.model.utils.rename_field import rename_field
2014-05-12 12:14:55 +00:00
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():
for dn in rename_map:
frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn))
2014-05-12 12:14:55 +00:00
for dt, field_list in rename_map.items():
for field in field_list:
rename_field(dt, field[0], field[1])