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 13:03:22 +00:00
|
|
|
|
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
|
2013-04-22 08:55:06 +00:00
|
|
|
where lft > %(lft)s and rgt < %(rgt)s""", acc)
|