mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
Co-authored-by: Pandiyan P <pandiyanpalani37@gmail.com> Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com> fix: prevent selling items from sample retention warehouse (#55613)
This commit is contained in:
@@ -53,6 +53,7 @@ class SellingController(StockController):
|
|||||||
self.validate_for_duplicate_items()
|
self.validate_for_duplicate_items()
|
||||||
self.validate_target_warehouse()
|
self.validate_target_warehouse()
|
||||||
self.validate_auto_repeat_subscription_dates()
|
self.validate_auto_repeat_subscription_dates()
|
||||||
|
self.validate_sample_retention_warehouse()
|
||||||
for table_field in ["items", "packed_items"]:
|
for table_field in ["items", "packed_items"]:
|
||||||
if self.get(table_field):
|
if self.get(table_field):
|
||||||
self.set_serial_and_batch_bundle(table_field)
|
self.set_serial_and_batch_bundle(table_field)
|
||||||
@@ -874,6 +875,26 @@ class SellingController(StockController):
|
|||||||
|
|
||||||
validate_item_type(self, "is_sales_item", "sales")
|
validate_item_type(self, "is_sales_item", "sales")
|
||||||
|
|
||||||
|
def validate_sample_retention_warehouse(self):
|
||||||
|
if self.get("is_return"):
|
||||||
|
return
|
||||||
|
|
||||||
|
sample_retention_warehouse = frappe.db.get_single_value(
|
||||||
|
"Stock Settings", "sample_retention_warehouse"
|
||||||
|
)
|
||||||
|
if not sample_retention_warehouse:
|
||||||
|
return
|
||||||
|
|
||||||
|
items = self.get("items") + (self.get("packed_items"))
|
||||||
|
for item in items:
|
||||||
|
if item.get("warehouse") == sample_retention_warehouse:
|
||||||
|
frappe.throw(
|
||||||
|
_("Row {0}: Cannot sell item {1} from Sample Retention Warehouse {2}").format(
|
||||||
|
item.idx, frappe.bold(item.item_code), frappe.bold(sample_retention_warehouse)
|
||||||
|
),
|
||||||
|
title=_("Not Allowed"),
|
||||||
|
)
|
||||||
|
|
||||||
def update_stock_reservation_entries(self) -> None:
|
def update_stock_reservation_entries(self) -> None:
|
||||||
"""Updates Delivered Qty in Stock Reservation Entries."""
|
"""Updates Delivered Qty in Stock Reservation Entries."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user