Patch: set root_type for old existing accounts

This commit is contained in:
Nabin Hait 2014-03-11 17:57:38 +05:30
parent 3dfe854108
commit 24e136e3f3
2 changed files with 12 additions and 2 deletions

View File

@ -28,6 +28,5 @@ execute:frappe.db.sql("""delete from `tabWebsite Item Group` where ifnull(item_g
erpnext.patches.4_0.remove_module_home_pages
erpnext.patches.4_0.split_email_settings
erpnext.patches.4_0.fix_employee_user_id
erpnext.patches.4_0.set_account_details
erpnext.patches.4_0.import_country_codes
execute:patches.4_0.countrywise_coa

View File

@ -5,5 +5,16 @@ 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'""")
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""")