From 429b58b833e9da89aa6c726ef5f4b1b5f1a25838 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 12:59:50 +0530 Subject: [PATCH] fix: show transaction currency symbol in Payment Request schedule dialog and reference table (backport #57050) (#57312) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: show transaction currency symbol in Payment Request schedule dialog and reference table (#57050) * fix: show transaction currency symbol in Payment Request schedule dialog and reference table When company currency (INR) differs from customer currency (USD), the Amount column in the Select Payment Schedule dialog and the Payment Reference table on the Payment Request form incorrectly displayed the company currency symbol (₹) instead of the transaction currency symbol ($). - Pass `currency` from the parent document on each schedule row returned by `get_available_payment_schedules` so the dialog can resolve the symbol. - Add a hidden `currency` field to the dialog table and set `options: "currency"` on `payment_amount` so Frappe renders the correct symbol. - Propagate `currency` into Payment Reference rows in `set_payment_references`. - Add a hidden `currency` Link field to the Payment Reference child DocType and set `options: "currency"` on its `amount` field so the table renders correctly. * fix: preserve currency when serializing payment schedule rows get_available_payment_schedules set `schedule.currency` directly on the Payment Schedule Document row, but `currency` isn't a field on that DocType, so the API response serializer stripped it before it reached the client. The Select Payment Schedule dialog and the Payment Reference table therefore always fell back to the company currency symbol, even with the earlier options="currency" changes in place. Convert each row to a plain dict via as_dict() first, then set the currency key on the dict so it survives serialization. * refactor: source schedule currency in dialog instead of API serializer get_available_payment_schedules had to convert each child row with as_dict() and re-attach currency, because currency is not a field on Payment Schedule and the response serializer drops attributes set on the Document itself. The schedule dialog already has the transaction currency on frm.doc, so set it there and let the API keep returning the schedule rows unchanged. Payment Reference still stores currency per row. --------- (cherry picked from commit 83e04dd7738d5ada89683c3210ef193a17ee4bce) Co-authored-by: Henil Maru Co-authored-by: Claude Sonnet 4.6 Co-authored-by: Jatin3128 Co-authored-by: Jatin3128 <140256508+Jatin3128@users.noreply.github.com> --- .../payment_reference/payment_reference.json | 15 +++++++++++++-- .../doctype/payment_request/payment_request.py | 1 + erpnext/public/js/controllers/transaction.js | 14 +++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reference/payment_reference.json b/erpnext/accounts/doctype/payment_reference/payment_reference.json index a1adb181d35..4e1e0ac22e3 100644 --- a/erpnext/accounts/doctype/payment_reference/payment_reference.json +++ b/erpnext/accounts/doctype/payment_reference/payment_reference.json @@ -14,7 +14,8 @@ "section_break_mjlv", "due_date", "column_break_qghl", - "amount" + "amount", + "currency" ], "fields": [ { @@ -55,8 +56,18 @@ "fieldtype": "Currency", "in_list_view": 1, "label": "Amount", + "options": "currency", "precision": "2" }, + { + "fieldname": "currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Currency", + "options": "Currency", + "print_hide": 1, + "read_only": 1 + }, { "fieldname": "column_break_lnjp", "fieldtype": "Column Break" @@ -74,7 +85,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2026-01-19 02:21:36.455830", + "modified": "2026-07-11 00:00:00.000000", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reference", diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 4e12deb5097..70b28141cf6 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -784,6 +784,7 @@ def set_payment_references(payment_schedules): "description": row.get("description"), "due_date": row.get("due_date"), "amount": row.get("payment_amount"), + "currency": row.get("currency"), } ) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 410ab292170..63d450de221 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -518,7 +518,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe return; } - schedules.forEach((schedule) => (schedule.__checked = 1)); + schedules.forEach((schedule) => { + schedule.__checked = 1; + schedule.currency = frm.doc.currency; + }); const dialog = new frappe.ui.Dialog({ title: __("Select Payment Schedule"), @@ -552,10 +555,19 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe in_list_view: 1, read_only: 1, }, + { + fieldtype: "Link", + fieldname: "currency", + label: __("Currency"), + options: "Currency", + hidden: 1, + read_only: 1, + }, { fieldtype: "Currency", fieldname: "payment_amount", label: __("Amount"), + options: "currency", in_list_view: 1, read_only: 1, },