fix: duplicate serial nos

This commit is contained in:
Rohit Waghchaure
2025-10-14 12:01:46 +05:30
parent 4b21c2cc46
commit c95465cba1

View File

@@ -295,7 +295,7 @@ class SerialandBatchBundle(Document):
}
)
if self.returned_against and self.docstatus == 1:
if (self.returned_against or self.voucher_type == "Stock Reconciliation") and self.docstatus == 1:
kwargs["ignore_voucher_detail_no"] = self.voucher_detail_no
if self.docstatus == 1:
@@ -2802,7 +2802,10 @@ def get_stock_ledgers_for_serial_nos(kwargs):
else:
query = query.where(stock_ledger_entry[field] == kwargs.get(field))
if kwargs.voucher_no:
if kwargs.ignore_voucher_detail_no:
query = query.where(stock_ledger_entry.voucher_detail_no != kwargs.ignore_voucher_detail_no)
elif kwargs.voucher_no:
query = query.where(stock_ledger_entry.voucher_no != kwargs.voucher_no)
return query.run(as_dict=True)