
from __future__ import unicode_literals
import frappe

def execute():
	frappe.reload_doc("setup", 'doctype', "company")
	frappe.reload_doc("accounts", 'doctype', "account")
	
	frappe.db.sql("""update tabAccount set account_type='Fixed Asset' 
		where account_type='Fixed Asset Account'""")
		
	for d in (('Asset', 'Debit', 'No'), ('Liability', 'Credit', 'No'), ('Expense', 'Debit', 'Yes'), 
			('Income', 'Credit', 'Yes')):
		frappe.db.sql("""update `tabAccount` set root_type = %s 
			where debit_or_credit=%s and is_pl_account=%s""", d)
			
	frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit 
		where ifnull(allow_negative_balance, 0) = 0""")

from __future__ import unicode_literals
import frappe

def execute():
	frappe.reload_doc("setup", 'doctype', "company")
	frappe.reload_doc("accounts", 'doctype', "account")
	
	frappe.db.sql("""update tabAccount set account_type='Fixed Asset' 
		where account_type='Fixed Asset Account'""")

	frappe.db.sql("""update `tabAccount` set report_type = 
		if(is_pl_account=='Yes', 'Profit and Loss', 'Balance Sheet')""")
			
	frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit 
		where ifnull(allow_negative_balance, 0) = 0""")
Patch to update old accounts property
Patch to update old accounts property

  
  from __future__ import unicode_literals
  import frappe
  
  def execute():
  	frappe.reload_doc("setup", 'doctype', "company")
  	frappe.reload_doc("accounts", 'doctype', "account")
  	
  	frappe.db.sql("""update tabAccount set account_type='Fixed Asset' 
  		where account_type='Fixed Asset Account'""")
+ 
- 		
- 	for d in (('Asset', 'Debit', 'No'), ('Liability', 'Credit', 'No'), ('Expense', 'Debit', 'Yes'), 
- 			('Income', 'Credit', 'Yes')):
- 		frappe.db.sql("""update `tabAccount` set root_type = %s 
+ 	frappe.db.sql("""update `tabAccount` set report_type = 
- 			where debit_or_credit=%s and is_pl_account=%s""", d)
+ 		if(is_pl_account=='Yes', 'Profit and Loss', 'Balance Sheet')""")
  			
  	frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit 
  		where ifnull(allow_negative_balance, 0) = 0""")
Patch to update old accounts property
## Code Before:

from __future__ import unicode_literals
import frappe

def execute():
	frappe.reload_doc("setup", 'doctype', "company")
	frappe.reload_doc("accounts", 'doctype', "account")
	
	frappe.db.sql("""update tabAccount set account_type='Fixed Asset' 
		where account_type='Fixed Asset Account'""")
		
	for d in (('Asset', 'Debit', 'No'), ('Liability', 'Credit', 'No'), ('Expense', 'Debit', 'Yes'), 
			('Income', 'Credit', 'Yes')):
		frappe.db.sql("""update `tabAccount` set root_type = %s 
			where debit_or_credit=%s and is_pl_account=%s""", d)
			
	frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit 
		where ifnull(allow_negative_balance, 0) = 0""")
## Instruction:
Patch to update old accounts property
## Code After:

from __future__ import unicode_literals
import frappe

def execute():
	frappe.reload_doc("setup", 'doctype', "company")
	frappe.reload_doc("accounts", 'doctype', "account")
	
	frappe.db.sql("""update tabAccount set account_type='Fixed Asset' 
		where account_type='Fixed Asset Account'""")

	frappe.db.sql("""update `tabAccount` set report_type = 
		if(is_pl_account=='Yes', 'Profit and Loss', 'Balance Sheet')""")
			
	frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit 
		where ifnull(allow_negative_balance, 0) = 0""")