From b6492f75e1bced1c4f53675836f9d4993fc78f4d Mon Sep 17 00:00:00 2001 From: kurogeek Date: Mon, 5 Oct 2026 07:12:36 +0000 Subject: [PATCH] feat: Payment Entry Cheque/Reference Date follows Posting Date Set on new entries and whenever Posting Date changes; the field stays editable for cheques dated differently. --- default_thai_company/public/js/payment_entry.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/default_thai_company/public/js/payment_entry.js b/default_thai_company/public/js/payment_entry.js index 5f4a827..5c9a9d3 100644 --- a/default_thai_company/public/js/payment_entry.js +++ b/default_thai_company/public/js/payment_entry.js @@ -1,4 +1,18 @@ frappe.ui.form.on("Payment Entry", { + onload(frm) { + if (frm.is_new() && frm.doc.posting_date && !frm.doc.reference_date) { + frm.set_value("reference_date", frm.doc.posting_date); + } + }, + + // Cheque/Reference Date follows Posting Date; the field stays editable for the + // cases where the cheque is dated differently. + posting_date(frm) { + if (frm.doc.posting_date) { + frm.set_value("reference_date", frm.doc.posting_date); + } + }, + apply_tax_withholding_amount(frm) { if (frm.doc.party_type !== "Customer" || frm.doc.payment_type !== "Receive") return; if (!frm.doc.apply_tax_withholding_amount) {