brotherton-erpnext/erpnext/patches/v10_0/copy_projects_renamed_fields.py
Zarrar 6e0acbe4d0 Patch to copy old field data to new field (#11997)
* patch to copy old fields data to new ones

* fix for patches related to project

* use rename_field function, copy if only field present
2017-12-14 12:21:00 +05:30

12 lines
468 B
Python

import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
""" copy data from old fields to new """
frappe.reload_doc("projects", "doctype", "project")
if frappe.db.has_column('Project', 'total_sales_cost'):
rename_field('Project', "total_sales_cost", "total_sales_amount")
if frappe.db.has_column('Project', 'total_billing_amount'):
rename_field('Project', "total_billing_amount", "total_billable_amount")