mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 00:44:45 +00:00
update account property as per root
This commit is contained in:
14
patches/october_2012/update_account_property.py
Normal file
14
patches/october_2012/update_account_property.py
Normal 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)
|
||||||
@@ -623,4 +623,8 @@ patch_list = [
|
|||||||
'patch_module': 'patches.october_2012',
|
'patch_module': 'patches.october_2012',
|
||||||
'patch_file': 'remove_old_customer_contact_address',
|
'patch_file': 'remove_old_customer_contact_address',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.october_2012',
|
||||||
|
'patch_file': 'update_account_property',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user