File tree Expand file tree Collapse file tree
erpnext/stock/doctype/serial_and_batch_bundle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1545,10 +1545,13 @@ def get_available_qty_from_stock_ledger(self):
15451545 def get_available_qty_from_sabb (self ):
15461546 batches = [d .batch_no for d in self .entries if d .batch_no ]
15471547
1548+ sle = frappe .qb .DocType ("Stock Ledger Entry" )
15481549 child = frappe .qb .DocType ("Serial and Batch Entry" )
15491550
15501551 query = (
15511552 frappe .qb .from_ (child )
1553+ .inner_join (sle )
1554+ .on (child .parent == sle .serial_and_batch_bundle )
15521555 .select (
15531556 child .batch_no ,
15541557 child .qty ,
@@ -1557,6 +1560,7 @@ def get_available_qty_from_sabb(self):
15571560 )
15581561 .where (
15591562 (child .item_code == self .item_code )
1563+ & (sle .is_cancelled == 0 )
15601564 & (child .warehouse == self .warehouse )
15611565 & (child .is_cancelled == 0 )
15621566 & (child .batch_no .isin (batches ))
You can’t perform that action at this time.
0 commit comments