Skip to content

Commit

Permalink
fix: negative stock error while making stock reconciliation (backport #…
Browse files Browse the repository at this point in the history
…40016) (#40026)

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

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

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

* chore: fix conflicts

---------

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
  • Loading branch information
mergify[bot] and rohitwaghchaure authored Feb 22, 2024
1 parent 6f364df commit c964c45
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,13 @@ def recalculate_current_qty(self, voucher_detail_no, sle_creation, add_new_sle=F

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
Expand Down

0 comments on commit c964c45

Please sign in to comment.