mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 11:55:11 +00:00
committed by
Mergify
parent
29c976e9ae
commit
080e9a3d73
@@ -186,26 +186,6 @@ class StockSettings(Document):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
|
||||||
# Don't allow if there are negative stock
|
|
||||||
from frappe.query_builder.functions import Round
|
|
||||||
|
|
||||||
precision = frappe.db.get_single_value("System Settings", "float_precision") or 3
|
|
||||||
bin = frappe.qb.DocType("Bin")
|
|
||||||
bin_with_negative_stock = (
|
|
||||||
frappe.qb.from_(bin)
|
|
||||||
.select(bin.name)
|
|
||||||
.where(Round(bin.actual_qty, precision) < 0)
|
|
||||||
.limit(1)
|
|
||||||
).run()
|
|
||||||
|
|
||||||
if bin_with_negative_stock:
|
|
||||||
frappe.throw(
|
|
||||||
_("As there are negative stock, you can not enable {0}.").format(
|
|
||||||
frappe.bold(_("Stock Reservation"))
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Enable -> Disable
|
# Enable -> Disable
|
||||||
else:
|
else:
|
||||||
# Don't allow if there are open Stock Reservation Entries
|
# Don't allow if there are open Stock Reservation Entries
|
||||||
|
|||||||
Reference in New Issue
Block a user