From b7fd9aea6a5e1c37baace45874e38467d8f9f6cb Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 10 Mar 2026 13:35:22 +0530 Subject: [PATCH] fix: better validation message for Purchase Invoice with Update Stock (cherry picked from commit cfb06cf247b804dd62733dabf1a00ae1f8a2acc7) --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 43c72938f64..a8e073c353c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -728,9 +728,10 @@ class PurchaseInvoice(BuyingController): for item in self.get("items"): if item.purchase_receipt: frappe.throw( - _("Stock cannot be updated against Purchase Receipt {0}").format( - item.purchase_receipt - ) + _( + "Stock cannot be updated for Purchase Invoice {0} because a Purchase Receipt {1} has already been created for this transaction. Please disable the 'Update Stock' checkbox in the Purchase Invoice and save the invoice." + ).format(self.name, item.purchase_receipt), + title=_("Stock Update Not Allowed"), ) def validate_for_repost(self):