brotherton-erpnext/erpnext/patches/v4_0/countrywise_coa.py

30 lines
1.0 KiB
Python
Raw Normal View History

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("setup", 'doctype', "company")
frappe.reload_doc("accounts", 'doctype', "account")
2014-04-28 11:38:28 +00:00
frappe.db.sql("""update tabAccount set account_type='Cash'
where account_type='Bank or Cash' and account_name in ('Cash', 'Cash In Hand')""")
2014-04-28 11:38:28 +00:00
frappe.db.sql("""update tabAccount set account_type='Stock'
2014-03-25 12:58:49 +00:00
where account_name = 'Stock Assets'""")
2014-04-28 11:38:28 +00:00
ac_types = {"Fixed Asset Account": "Fixed Asset", "Bank or Cash": "Bank"}
2014-03-23 12:05:24 +00:00
for old, new in ac_types.items():
2014-04-28 11:38:28 +00:00
frappe.db.sql("""update tabAccount set account_type=%s
where account_type=%s""", (new, old))
2014-03-21 05:39:33 +00:00
2014-03-23 12:05:24 +00:00
try:
2014-04-28 11:38:28 +00:00
frappe.db.sql("""update `tabAccount` set report_type =
2014-03-23 12:05:24 +00:00
if(is_pl_account='Yes', 'Profit and Loss', 'Balance Sheet')""")
2014-04-28 11:38:28 +00:00
frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit
2014-03-23 12:05:24 +00:00
where ifnull(allow_negative_balance, 0) = 0""")
except:
2014-03-25 11:23:50 +00:00
pass