patch: delete gle for cancelled invoices
This commit is contained in:
parent
1a6299176a
commit
2ba88c4a5f
@ -96,4 +96,5 @@ erpnext.patches.v4_2.set_item_has_batch
|
||||
erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
|
||||
erpnext.patches.v4_2.repost_reserved_qty
|
||||
erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
|
||||
erpnext.patches.v4_2.fix_recurring_orders
|
||||
erpnext.patches.v4_2.fix_recurring_orders
|
||||
erpnext.patches.v4_2.delete_gl_entries_for_cancelled_invoices
|
||||
|
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
cancelled_invoices = frappe.db.sql_list("""select name from `tabSales Invoice`
|
||||
where docstatus = 2 and ifnull(update_stock, 0) = 1""")
|
||||
|
||||
frappe.db.sql("""delete from `tabGL Entry`
|
||||
where voucher_type = 'Sales Invoice' and voucher_no in (%s)"""
|
||||
% (', '.join(['%s']*len(cancelled_invoices))), tuple(cancelled_invoices))
|
Loading…
Reference in New Issue
Block a user