mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-14 02:31:21 +00:00
[patch] delete gl entries for cancelled vouchers
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
def execute():
|
||||
import webnotes
|
||||
entries = webnotes.conn.sql("""select voucher_type, voucher_no
|
||||
from `tabGL Entry` group by voucher_type, voucher_no""", as_dict=1)
|
||||
for entry in entries:
|
||||
try:
|
||||
cancelled_voucher = webnotes.conn.sql("""select name from `tab%s` where name = %s
|
||||
and docstatus=2""" % (entry['voucher_type'], "%s"), entry['voucher_no'])
|
||||
if cancelled_voucher:
|
||||
print entry
|
||||
webnotes.conn.sql("""delete from `tabGL Entry` where voucher_type = %s and
|
||||
voucher_no = %s""", (entry['voucher_type'], entry['voucher_no']))
|
||||
except:
|
||||
pass
|
||||
@@ -226,4 +226,5 @@ patch_list = [
|
||||
"execute:webnotes.delete_doc('Report', 'Item-wise Price List')",
|
||||
"patches.october_2013.p03_remove_sales_and_purchase_return_tool",
|
||||
"patches.october_2013.p04_update_report_permission",
|
||||
"patches.october_2013.p05_delete_gl_entries_for_cancelled_vouchers",
|
||||
]
|
||||
Reference in New Issue
Block a user