
from __future__ import unicode_literals
import frappe

def execute():
	if frappe.db.exists("DocType", "Salary Component"):
		for dt in ("Salary Structure Earning", "Salary Structure Deduction", "Salary Slip Earning", 
			"Salary Slip Deduction", "Earning Type", "Deduction Type"):
				frappe.delete_doc("DocType", dt)
			

from __future__ import unicode_literals
import frappe

def execute():
	if frappe.db.exists("DocType", "Salary Component"):
		for dt in ("Salary Structure Earning", "Salary Structure Deduction", "Salary Slip Earning", 
			"Salary Slip Deduction", "Earning Type", "Deduction Type"):
				frappe.delete_doc("DocType", dt)
				
					
		for d in frappe.db.sql("""select name from `tabCustom Field` 
			where dt in ('Salary Detail', 'Salary Component')"""):
				frappe.get_doc("Custom Field", d[0]).save()
Create columns for custom fields in new table Salary Detail and Component
Create columns for custom fields in new table Salary Detail and Component

  
  from __future__ import unicode_literals
  import frappe
  
  def execute():
  	if frappe.db.exists("DocType", "Salary Component"):
  		for dt in ("Salary Structure Earning", "Salary Structure Deduction", "Salary Slip Earning", 
  			"Salary Slip Deduction", "Earning Type", "Deduction Type"):
  				frappe.delete_doc("DocType", dt)
- 			
+ 				
+ 					
+ 		for d in frappe.db.sql("""select name from `tabCustom Field` 
+ 			where dt in ('Salary Detail', 'Salary Component')"""):
+ 				frappe.get_doc("Custom Field", d[0]).save()
Create columns for custom fields in new table Salary Detail and Component
## Code Before:

from __future__ import unicode_literals
import frappe

def execute():
	if frappe.db.exists("DocType", "Salary Component"):
		for dt in ("Salary Structure Earning", "Salary Structure Deduction", "Salary Slip Earning", 
			"Salary Slip Deduction", "Earning Type", "Deduction Type"):
				frappe.delete_doc("DocType", dt)
			
## Instruction:
Create columns for custom fields in new table Salary Detail and Component
## Code After:

from __future__ import unicode_literals
import frappe

def execute():
	if frappe.db.exists("DocType", "Salary Component"):
		for dt in ("Salary Structure Earning", "Salary Structure Deduction", "Salary Slip Earning", 
			"Salary Slip Deduction", "Earning Type", "Deduction Type"):
				frappe.delete_doc("DocType", dt)
				
					
		for d in frappe.db.sql("""select name from `tabCustom Field` 
			where dt in ('Salary Detail', 'Salary Component')"""):
				frappe.get_doc("Custom Field", d[0]).save()