mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 15:39:20 +00:00
Patch to recalculate requested qty and ordered qty for all items
This commit is contained in:
@@ -87,3 +87,4 @@ execute:frappe.delete_doc("DocType", "Purchase Request")
|
|||||||
execute:frappe.delete_doc("DocType", "Purchase Request Item")
|
execute:frappe.delete_doc("DocType", "Purchase Request Item")
|
||||||
erpnext.patches.v4_2.recalculate_bom_cost
|
erpnext.patches.v4_2.recalculate_bom_cost
|
||||||
erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
|
erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
|
||||||
|
erpnext.patches.v4_2.update_requested_and_ordered_qty
|
||||||
|
|||||||
24
erpnext/patches/v4_2/update_requested_and_ordered_qty.py
Normal file
24
erpnext/patches/v4_2/update_requested_and_ordered_qty.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# 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():
|
||||||
|
from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty, get_ordered_qty
|
||||||
|
|
||||||
|
count=0
|
||||||
|
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse from
|
||||||
|
(select item_code, warehouse from tabBin
|
||||||
|
union
|
||||||
|
select item_code, warehouse from `tabStock Ledger Entry`) a"""):
|
||||||
|
try:
|
||||||
|
count += 1
|
||||||
|
update_bin_qty(item_code, warehouse, {
|
||||||
|
"indented_qty": get_indented_qty(item_code, warehouse),
|
||||||
|
"ordered_qty": get_ordered_qty(item_code, warehouse)
|
||||||
|
})
|
||||||
|
if count / 200 == 0:
|
||||||
|
frappe.db.commit()
|
||||||
|
except:
|
||||||
|
frappe.db.rollback()
|
||||||
Reference in New Issue
Block a user