diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a9ae54877f1..c1f43e38a79 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -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 diff --git a/erpnext/patches/4_0/countrywise_coa.py b/erpnext/patches/4_0/countrywise_coa.py index f2e0acf9d9f..7bf4b26d8b6 100644 --- a/erpnext/patches/4_0/countrywise_coa.py +++ b/erpnext/patches/4_0/countrywise_coa.py @@ -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'""") \ No newline at end of file + 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""") \ No newline at end of file