fix: incorrect stock reco sle

This commit is contained in:
Mihir Kandoi
2025-07-14 16:25:29 +05:30
parent 896b21e78b
commit 597d5aff02

View File

@@ -1084,17 +1084,14 @@ class StockReconciliation(StockController):
}
)
if (
add_new_sle
and not frappe.db.get_value(
"Stock Ledger Entry",
{"voucher_detail_no": row.name, "actual_qty": ("<", 0), "is_cancelled": 0},
"name",
)
and not row.current_serial_and_batch_bundle
if add_new_sle and not frappe.db.get_value(
"Stock Ledger Entry",
{"voucher_detail_no": row.name, "actual_qty": ("<", 0), "is_cancelled": 0},
"name",
):
self.set_current_serial_and_batch_bundle(voucher_detail_no, save=True)
row.reload()
if not not row.current_serial_and_batch_bundle:
self.set_current_serial_and_batch_bundle(voucher_detail_no, save=True)
row.reload()
self.add_missing_stock_ledger_entry(row, voucher_detail_no, sle_creation)