From d2c8df9451824dcf1519425bd14b48585bdbe3b0 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Tue, 30 Jun 2026 20:23:14 +0530 Subject: [PATCH] fix: use correct variable to fetch valuation method (cherry picked from commit 1492c9fbc3fb7c0e8b2434d4ffeb7320838a70c6) --- erpnext/controllers/sales_and_purchase_return.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index e1e06b287f0..a8e39963ae1 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -144,7 +144,7 @@ def validate_returned_items(doc): ref.rate and flt(d.rate) > ref.rate and doc.doctype in ("Delivery Note", "Sales Invoice") - and get_valuation_method(ref.item_code, doc.company) != "Moving Average" + and get_valuation_method(d.item_code, doc.company) != "Moving Average" ): frappe.throw( _("Row # {0}: Rate cannot be greater than the rate used in {1} {2}").format(