From 6416a3136e2275a3d6018fd636c3f0c91df054ea Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 20 Dec 2021 22:56:15 +0530 Subject: [PATCH] fix: fetch appointment letter content in the same order as template (#28968) --- .../appointment_letter/appointment_letter.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/erpnext/hr/doctype/appointment_letter/appointment_letter.py b/erpnext/hr/doctype/appointment_letter/appointment_letter.py index 0120188d31c0..71327bf1b01c 100644 --- a/erpnext/hr/doctype/appointment_letter/appointment_letter.py +++ b/erpnext/hr/doctype/appointment_letter/appointment_letter.py @@ -12,14 +12,15 @@ class AppointmentLetter(Document): @frappe.whitelist() def get_appointment_letter_details(template): body = [] - intro= frappe.get_list("Appointment Letter Template", - fields = ['introduction', 'closing_notes'], - filters={'name': template - })[0] - content = frappe.get_list("Appointment Letter content", - fields = ['title', 'description'], - filters={'parent': template - }) + intro = frappe.get_list('Appointment Letter Template', + fields=['introduction', 'closing_notes'], + filters={'name': template} + )[0] + content = frappe.get_all('Appointment Letter content', + fields=['title', 'description'], + filters={'parent': template}, + order_by='idx' + ) body.append(intro) body.append({'description': content}) return body