mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-22 08:08:29 +00:00
fix: negative error not throw for backdated entry
(cherry picked from commit 88a947ff4e)
This commit is contained in:
committed by
Mergify
parent
a777a11919
commit
1fc21d60c6
@@ -1323,18 +1323,9 @@ class TestStockEntry(FrappeTestCase):
|
|||||||
posting_date="2021-07-02", # Illegal SE
|
posting_date="2021-07-02", # Illegal SE
|
||||||
purpose="Material Transfer",
|
purpose="Material Transfer",
|
||||||
),
|
),
|
||||||
dict(
|
|
||||||
item_code=item_code,
|
|
||||||
qty=2,
|
|
||||||
from_warehouse=warehouse_names[0],
|
|
||||||
to_warehouse=warehouse_names[1],
|
|
||||||
batch_no=batch_no,
|
|
||||||
posting_date="2021-07-02", # Illegal SE
|
|
||||||
purpose="Material Transfer",
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, create_stock_entries, sequence_of_entries)
|
self.assertRaises(NegativeStockError, create_stock_entries, sequence_of_entries)
|
||||||
|
|
||||||
@change_settings("Stock Settings", {"allow_negative_stock": 0})
|
@change_settings("Stock Settings", {"allow_negative_stock": 0})
|
||||||
def test_future_negative_sle_batch(self):
|
def test_future_negative_sle_batch(self):
|
||||||
|
|||||||
@@ -1385,12 +1385,12 @@ def get_batch_current_qty(batch):
|
|||||||
|
|
||||||
|
|
||||||
def throw_negative_batch_validation(batch_no, qty):
|
def throw_negative_batch_validation(batch_no, qty):
|
||||||
frappe.msgprint(
|
# This validation is important for backdated stock transactions with batch items
|
||||||
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"The Batch {0} has negative batch quantity {1}. To fix this, go to the batch and click on Recalculate Batch Qty. If the issue still persists, create an inward entry."
|
"The Batch {0} has negative batch quantity {1}. To fix this, go to the batch and click on Recalculate Batch Qty. If the issue still persists, create an inward entry."
|
||||||
).format(bold(get_link_to_form("Batch", batch_no)), bold(qty)),
|
).format(bold(get_link_to_form("Batch", batch_no)), bold(qty)),
|
||||||
title=_("Warning!"),
|
title=_("Negative Stock Error"),
|
||||||
indicator="orange",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user