added repost function gl_control
This commit is contained in:
parent
0f191d6df1
commit
a2ee615c94
@ -8,7 +8,6 @@ from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
@ -385,7 +384,7 @@ class DocType:
|
||||
|
||||
# set voucher balance
|
||||
#sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
|
||||
set(voucher_obj.doc, 'outstanding_amount', flt(bal))
|
||||
webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal))
|
||||
|
||||
# Send Mail
|
||||
if msg:
|
||||
@ -400,3 +399,24 @@ In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and foll
|
||||
sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
|
||||
# Acknowledge User
|
||||
msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found."))
|
||||
|
||||
def repost_illegal_cancelled(self, after_date='2011-01-01'):
|
||||
"""
|
||||
Find vouchers that are not cancelled correctly and repost them
|
||||
"""
|
||||
vl = sql("""
|
||||
select voucher_type, voucher_no, sum(debit) as sum_debit, sum(credit) as sum_credit
|
||||
from `tabGL Entry`
|
||||
where is_cancelled='Yes' and creation > %s
|
||||
group by voucher_type, voucher_no
|
||||
""", after_date, as_dict=1))
|
||||
ac_list = []
|
||||
for v in vl:
|
||||
if c['sum_debit'] != 0 or c['sum_credit'] != 0:
|
||||
ac_list += [a[0] for a in sql("""
|
||||
select distinct account from `tabGL Entry`
|
||||
where voucher_type=%s and voucher_no = %s
|
||||
""", (c['voucher_type'], c['voucher_no']))]
|
||||
|
||||
for a in set(ac_list):
|
||||
get_obj('Account', a).respost()
|
Loading…
Reference in New Issue
Block a user