update account property as per root

This commit is contained in:
Nabin Hait 2012-10-05 14:32:36 +05:30
parent 91e9e5c47b
commit ee442dc104
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,14 @@
def execute():
import webnotes
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree('Account', 'parent_account')
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)

View File

@ -623,4 +623,8 @@ patch_list = [
'patch_module': 'patches.october_2012',
'patch_file': 'remove_old_customer_contact_address',
},
{
'patch_module': 'patches.october_2012',
'patch_file': 'update_account_property',
},
]