Merge pull request #35945 from s-aga-r/BATCH-DISABLE-FILTER

fix: add filter for disabled batch
This commit is contained in:
s-aga-r 2023-06-30 13:39:11 +05:30 committed by GitHub
commit fa3ab678e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
)