mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-12 17:23:38 +00:00
feat: allow negative stock for the batch item
(cherry picked from commit 376ab0e346)
This commit is contained in:
committed by
Mergify
parent
3e0a7f2400
commit
b6afe7f4da
@@ -1462,6 +1462,9 @@ class SerialandBatchBundle(Document):
|
||||
def throw_negative_batch(self, batch_no, available_qty, precision):
|
||||
from erpnext.stock.stock_ledger import NegativeStockError
|
||||
|
||||
if frappe.db.get_single_value("Stock Settings", "allow_negative_stock_for_batch"):
|
||||
return
|
||||
|
||||
frappe.throw(
|
||||
_(
|
||||
"""
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
"disable_serial_no_and_batch_selector",
|
||||
"use_serial_batch_fields",
|
||||
"do_not_update_serial_batch_on_creation_of_auto_bundle",
|
||||
"allow_negative_stock_for_batch",
|
||||
"serial_and_batch_bundle_section",
|
||||
"set_serial_and_batch_bundle_naming_based_on_naming_series",
|
||||
"section_break_gnhq",
|
||||
@@ -546,6 +547,13 @@
|
||||
"fieldname": "validate_material_transfer_warehouses",
|
||||
"fieldtype": "Check",
|
||||
"label": "Validate Material Transfer Warehouses"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "If enabled, the system will allow negative stock entries for the batch, but this could calculate the valuation rate incorrectly, so avoid using this option.",
|
||||
"fieldname": "allow_negative_stock_for_batch",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Negative Stock for Batch"
|
||||
}
|
||||
],
|
||||
"hide_toolbar": 1,
|
||||
@@ -554,7 +562,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2026-01-02 18:19:59.034785",
|
||||
"modified": "2026-02-09 15:01:12.466175",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Settings",
|
||||
|
||||
@@ -30,6 +30,7 @@ class StockSettings(Document):
|
||||
allow_from_pr: DF.Check
|
||||
allow_internal_transfer_at_arms_length_price: DF.Check
|
||||
allow_negative_stock: DF.Check
|
||||
allow_negative_stock_for_batch: DF.Check
|
||||
allow_partial_reservation: DF.Check
|
||||
allow_to_edit_stock_uom_qty_for_purchase: DF.Check
|
||||
allow_to_edit_stock_uom_qty_for_sales: DF.Check
|
||||
|
||||
Reference in New Issue
Block a user