'Delete Stock Ledger Entries related to this voucher
and repost future Stock Ledger Entries'

def delete_and_repost_sle(self):

    existing_entries = frappe.db.sql(u'select    distinct    item_code,    warehouse\n DCTB  DCTB  DCTB from    `tabStock    Ledger    Entry`    where    voucher_type=%s    and    voucher_no=%s', (self.doctype, self.name), as_dict=1)
    frappe.db.sql(u'delete    from    `tabStock    Ledger    Entry`\n DCTB  DCTB  DCTB where    voucher_type=%s    and    voucher_no=%s', (self.doctype, self.name))
    for entries in existing_entries:
        update_entries_after({u'item_code': entries.item_code, u'warehouse': entries.warehouse, u'posting_date': self.posting_date, u'posting_time': self.posting_time})
