mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-31 02:40:43 +02:00
fix: validation for SABB deletion
(cherry picked from commit dd4bef0706)
This commit is contained in:
committed by
Mergify
parent
eb2571492f
commit
0bc98b609f
@@ -1347,7 +1347,36 @@ class SerialandBatchBundle(Document):
|
|||||||
if self.voucher_type == "POS Invoice":
|
if self.voucher_type == "POS Invoice":
|
||||||
return
|
return
|
||||||
|
|
||||||
if frappe.db.get_value(self.voucher_type, self.voucher_no, "docstatus") == 1:
|
child_doctype = self.voucher_type + " Item"
|
||||||
|
mapper = {
|
||||||
|
"Asset Capitalization": "Asset Capitalization Stock Item",
|
||||||
|
"Asset Repair": "Asset Repair Consumed Item",
|
||||||
|
"Stock Entry": "Stock Entry Detail",
|
||||||
|
}.get(self.voucher_type)
|
||||||
|
|
||||||
|
if mapper:
|
||||||
|
child_doctype = mapper
|
||||||
|
|
||||||
|
if self.voucher_type == "Delivery Note" and not frappe.db.exists(
|
||||||
|
"Delivery Note Item", self.voucher_detail_no
|
||||||
|
):
|
||||||
|
child_doctype = "Packed Item"
|
||||||
|
|
||||||
|
elif self.voucher_type == "Sales Invoice" and not frappe.db.exists(
|
||||||
|
"Sales Invoice Item", self.voucher_detail_no
|
||||||
|
):
|
||||||
|
child_doctype = "Packed Item"
|
||||||
|
|
||||||
|
elif self.voucher_type == "Subcontracting Receipt" and not frappe.db.exists(
|
||||||
|
"Subcontracting Receipt Item", self.voucher_detail_no
|
||||||
|
):
|
||||||
|
child_doctype = "Subcontracting Receipt Supplied Item"
|
||||||
|
|
||||||
|
if (
|
||||||
|
frappe.db.get_value(self.voucher_type, self.voucher_no, "docstatus") == 1
|
||||||
|
and self.voucher_detail_no
|
||||||
|
and frappe.db.exists(child_doctype, self.voucher_detail_no)
|
||||||
|
):
|
||||||
msg = f"""The {self.voucher_type} {bold(self.voucher_no)}
|
msg = f"""The {self.voucher_type} {bold(self.voucher_no)}
|
||||||
is in submitted state, please cancel it first"""
|
is in submitted state, please cancel it first"""
|
||||||
frappe.throw(_(msg))
|
frappe.throw(_(msg))
|
||||||
|
|||||||
Reference in New Issue
Block a user