From 06ac21dd856a5b6ecfb37ccf20c3d83fa4d79c05 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:57:09 +0530 Subject: [PATCH] chore: Ignore stock validation for non stock invoices (backport #44549) (#44554) chore: Ignore stock validation for non stock invoices (#44549) * chore: Ignore stock validation for non stock invoices * chore: Ignore stock validation for non stock invoices (cherry picked from commit 1ac292285e217c77d2c9f9ce37e4c018c2f5e849) Co-authored-by: Deepesh Garg --- erpnext/controllers/sales_and_purchase_return.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index 7f9a5a35a73..696d404d16d 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -24,6 +24,10 @@ def validate_return(doc): if doc.return_against: validate_return_against(doc) + + if doc.doctype in ("Sales Invoice", "Purchase Invoice") and not doc.update_stock: + return + validate_returned_items(doc)