From 467fe1d72f77c85e5ef65c7d81ba8a397ccfd4e9 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 15 Jul 2025 17:27:00 +0530 Subject: [PATCH] fix: added serial no condition (cherry picked from commit bb7ddd11f104a27086e83915acac6ddd48acee9c) --- erpnext/controllers/sales_and_purchase_return.py | 9 +++++---- erpnext/controllers/selling_controller.py | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index 011f21fe388..599221185d9 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -4,7 +4,7 @@ from collections import defaultdict import frappe -from frappe import _ +from frappe import _, bold from frappe.model.meta import get_field_precision from frappe.utils import cint, flt, format_datetime, get_datetime @@ -40,11 +40,12 @@ def validate_return_against(doc): frappe.throw( _("The {0} {1} does not match with the {0} {2} in the {3} {4}").format( doc.meta.get_label(party_type), - doc.get(party_type), - ref_doc.get(party_type), + bold(doc.get(party_type)), + bold(ref_doc.get(party_type)), ref_doc.doctype, ref_doc.name, - ) + ), + title=_("Party Mismatch"), ) if ( diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 5f7cfb165d4..d85c1b28f97 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -68,10 +68,13 @@ class SellingController(StockController): serial_nos = frappe.get_all( "Serial and Batch Entry", - filters={"parent": ("in", bundle_ids)}, + filters={"parent": ("in", bundle_ids), "serial_no": ("is", "set")}, pluck="serial_no", ) + if not serial_nos: + return + if serial_nos := frappe.get_all( "Serial No", filters={"name": ("in", serial_nos), "customer": ("is", "set")},