Update accounts_controller.py
Updating Bin quantity based on doctype to optimize running efficiency.
This commit is contained in:
parent
1062d7eee0
commit
b44af32628
@ -1238,10 +1238,15 @@ def validate_and_delete_children(parent, data):
|
|||||||
d.delete()
|
d.delete()
|
||||||
|
|
||||||
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty, get_ordered_qty
|
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty, get_ordered_qty
|
||||||
update_bin_qty(d.item_code, d.warehouse, {
|
# updating both will be time consuming, update it based on the doctype. reserved qty if sales order, otherwise ordered qty
|
||||||
"reserved_qty": get_reserved_qty(d.item_code, d.warehouse),
|
if parent.doctype == "Sales Order":
|
||||||
"ordered_qty": get_ordered_qty(d.item_code, d.warehouse)
|
update_bin_qty(d.item_code, d.warehouse, {
|
||||||
})
|
"reserved_qty": get_reserved_qty(d.item_code, d.warehouse)
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
update_bin_qty(d.item_code, d.warehouse, {
|
||||||
|
"ordered_qty": get_ordered_qty(d.item_code, d.warehouse)
|
||||||
|
})
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, child_docname="items"):
|
def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, child_docname="items"):
|
||||||
|
Loading…
Reference in New Issue
Block a user