fix: negative stock error while making stock reconciliation (backport #40016) (#40026)

* fix: negative stock error while making stock reconciliation (#40016)

fix: negative stock error while making stock reco
(cherry picked from commit da184d709b9f61bc9bd62cd6beddf5e19c661042)

# Conflicts:
#	erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot] 2024-02-22 11:38:49 +05:30 committed by GitHub
parent 6f364df48c
commit c964c45f4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -906,8 +906,13 @@ class StockReconciliation(StockController):
def has_negative_stock_allowed(self):
allow_negative_stock = cint(frappe.db.get_single_value("Stock Settings", "allow_negative_stock"))
if allow_negative_stock:
return True
if all(d.serial_and_batch_bundle and flt(d.qty) == flt(d.current_qty) for d in self.items):
if any(
((d.serial_and_batch_bundle or d.batch_no) and flt(d.qty) == flt(d.current_qty))
for d in self.items
):
allow_negative_stock = True
return allow_negative_stock