fix: add filter for disabled batch

This commit is contained in:
s-aga-r 2023-06-30 12:34:39 +05:30
parent 988d755906
commit 90a77030a7

View File

@ -1312,7 +1312,10 @@ def get_available_batches(kwargs):
batch_ledger.warehouse,
Sum(batch_ledger.qty).as_("qty"),
)
.where(((batch_table.expiry_date >= today()) | (batch_table.expiry_date.isnull())))
.where(
(batch_table.disabled == 0)
& ((batch_table.expiry_date >= today()) | (batch_table.expiry_date.isnull()))
)
.where(stock_ledger_entry.is_cancelled == 0)
.groupby(batch_ledger.batch_no, batch_ledger.warehouse)
)