mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 08:35:00 +00:00
fix(stock): ignore reserved stock while calculating batch qty
(cherry picked from commitb23c6e2687) # Conflicts: # erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py (cherry picked from commitac2402dd2a)
This commit is contained in:
@@ -159,8 +159,13 @@ class Batch(Document):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def recalculate_batch_qty(self):
|
def recalculate_batch_qty(self):
|
||||||
batches = get_batch_qty(
|
batches = get_batch_qty(
|
||||||
batch_no=self.name, item_code=self.item, for_stock_levels=True, consider_negative_batches=True
|
batch_no=self.name,
|
||||||
|
item_code=self.item,
|
||||||
|
for_stock_levels=True,
|
||||||
|
consider_negative_batches=True,
|
||||||
|
ignore_reserved_stock=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
batch_qty = 0.0
|
batch_qty = 0.0
|
||||||
if batches:
|
if batches:
|
||||||
for row in batches:
|
for row in batches:
|
||||||
@@ -240,6 +245,7 @@ def get_batch_qty(
|
|||||||
for_stock_levels=False,
|
for_stock_levels=False,
|
||||||
consider_negative_batches=False,
|
consider_negative_batches=False,
|
||||||
do_not_check_future_batches=False,
|
do_not_check_future_batches=False,
|
||||||
|
ignore_reserved_stock=False,
|
||||||
):
|
):
|
||||||
"""Returns batch actual qty if warehouse is passed,
|
"""Returns batch actual qty if warehouse is passed,
|
||||||
or returns dict of qty by warehouse if warehouse is None
|
or returns dict of qty by warehouse if warehouse is None
|
||||||
@@ -269,6 +275,7 @@ def get_batch_qty(
|
|||||||
"for_stock_levels": for_stock_levels,
|
"for_stock_levels": for_stock_levels,
|
||||||
"consider_negative_batches": consider_negative_batches,
|
"consider_negative_batches": consider_negative_batches,
|
||||||
"do_not_check_future_batches": do_not_check_future_batches,
|
"do_not_check_future_batches": do_not_check_future_batches,
|
||||||
|
"ignore_reserved_stock": ignore_reserved_stock,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2332,6 +2332,12 @@ def get_auto_batch_nos(kwargs):
|
|||||||
sre_reserved_batches = frappe._dict()
|
sre_reserved_batches = frappe._dict()
|
||||||
if not kwargs.ignore_reserved_stock:
|
if not kwargs.ignore_reserved_stock:
|
||||||
sre_reserved_batches = get_reserved_batches_for_sre(kwargs)
|
sre_reserved_batches = get_reserved_batches_for_sre(kwargs)
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
if kwargs.against_sales_order and only_consider_batches:
|
||||||
|
kwargs.batch_no = kwargs.warehouse = None
|
||||||
|
>>>>>>> b23c6e2687 (fix(stock): ignore reserved stock while calculating batch qty)
|
||||||
|
|
||||||
picked_batches = frappe._dict()
|
picked_batches = frappe._dict()
|
||||||
if kwargs.get("is_pick_list"):
|
if kwargs.get("is_pick_list"):
|
||||||
|
|||||||
Reference in New Issue
Block a user