acc bal repost patch moved in separate file
This commit is contained in:
parent
c0d7434794
commit
df8304f00b
31
erpnext/patches/repost_account_bal.py
Normal file
31
erpnext/patches/repost_account_bal.py
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
def execute():
|
||||
import webnotes
|
||||
sql = webnotes.conn.sql
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
# stop session
|
||||
webnotes.conn.set_global('__session_status', 'stop')
|
||||
webnotes.conn.set_global('__session_status_message', 'Patch is running in background. \nPlease wait until it completed...\n')
|
||||
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.begin()
|
||||
|
||||
# repost
|
||||
comp = sql("select name from tabCompany where docstatus!=2")
|
||||
fy = sql("select name from `tabFiscal Year` order by year_start_date asc")
|
||||
for c in comp:
|
||||
prev_fy = ''
|
||||
for f in fy:
|
||||
fy_obj = get_obj('Fiscal Year', f[0])
|
||||
fy_obj.doc.past_year = prev_fy
|
||||
fy_obj.doc.company = c[0]
|
||||
fy_obj.doc.save()
|
||||
fy_obj.repost()
|
||||
prev_fy = f[0]
|
||||
sql("commit")
|
||||
sql("start transaction")
|
||||
|
||||
# free session
|
||||
webnotes.conn.set_global('__session_status', '')
|
||||
webnotes.conn.set_global('__session_status_message', '')
|
Loading…
x
Reference in New Issue
Block a user