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 17:08:28 +05:30
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 17:08:28 +05:30
frappe.db.sql("""update tabAccount set account_type='Stock'
2014-03-25 18:28:49 +05:30
where account_name = 'Stock Assets'""")
2014-04-28 17:08:28 +05:30
ac_types = {"Fixed Asset Account": "Fixed Asset", "Bank or Cash": "Bank"}
2014-03-23 17:35:24 +05:30
for old, new in ac_types.items():
2014-04-28 17:08:28 +05:30
frappe.db.sql("""update tabAccount set account_type=%s
where account_type=%s""", (new, old))
2014-03-21 11:09:33 +05:30
2014-03-23 17:35:24 +05:30
try:
2014-04-28 17:08:28 +05:30
frappe.db.sql("""update `tabAccount` set report_type =
2014-03-23 17:35:24 +05:30
if(is_pl_account='Yes', 'Profit and Loss', 'Balance Sheet')""")
2014-04-28 17:08:28 +05:30
frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit
2014-03-23 17:35:24 +05:30
where ifnull(allow_negative_balance, 0) = 0""")
except:
2014-03-25 16:53:50 +05:30
pass