brotherton-erpnext/patches/october_2012/update_account_property.py

14 lines
515 B
Python
Raw Normal View History

2012-10-05 09:02:36 +00:00
def execute():
import webnotes
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree('Account', 'parent_account')
2012-10-05 09:02:36 +00:00
roots = webnotes.conn.sql("""
select lft, rgt, debit_or_credit, is_pl_account, company from `tabAccount`
where ifnull(parent_account, '') = ''
""", as_dict=1)
for acc in roots:
webnotes.conn.sql("""update tabAccount set debit_or_credit = %(debit_or_credit)s,
is_pl_account = %(is_pl_account)s, company = %(company)s
where lft > %(lft)s and rgt < %(rgt)s""", acc, debug=1)