Repost sle for si without warehouse
This commit is contained in:
parent
7a31f6aaca
commit
11498cac94
@ -94,4 +94,5 @@ erpnext.patches.v4_2.discount_amount
|
|||||||
erpnext.patches.v4_2.update_landed_cost_voucher
|
erpnext.patches.v4_2.update_landed_cost_voucher
|
||||||
erpnext.patches.v4_2.set_item_has_batch
|
erpnext.patches.v4_2.set_item_has_batch
|
||||||
erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
|
erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
|
||||||
erpnext.patches.v4_2.repost_reserved_qty
|
erpnext.patches.v4_2.repost_reserved_qty
|
||||||
|
erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
|
34
erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
Normal file
34
erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# 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
|
||||||
|
from erpnext.stock.stock_ledger import NegativeStockError
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
si_list = frappe.db.sql("""select distinct si.name
|
||||||
|
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
|
||||||
|
where si.name = si_item.parent and si.modified > '2015-02-16' and si.docstatus=1
|
||||||
|
and ifnull(si_item.warehouse, '') = '' and ifnull(si.update_stock, 0) = 1
|
||||||
|
order by posting_date, posting_time""", as_dict=1)
|
||||||
|
|
||||||
|
failed_list = []
|
||||||
|
for si in si_list:
|
||||||
|
try:
|
||||||
|
si_doc = frappe.get_doc("Sales Invoice", si.name)
|
||||||
|
si_doc.docstatus = 2
|
||||||
|
si_doc.on_cancel()
|
||||||
|
|
||||||
|
si_doc.docstatus = 1
|
||||||
|
si_doc.set_missing_item_details()
|
||||||
|
si_doc.on_submit()
|
||||||
|
frappe.db.commit()
|
||||||
|
except:
|
||||||
|
failed_list.append(si.name)
|
||||||
|
frappe.local.stockledger_exceptions = None
|
||||||
|
frappe.db.rollback()
|
||||||
|
|
||||||
|
print "Failed to repost: ", failed_list
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user