From 2f00c9e427d90c2b499612d86af2408b7961839f Mon Sep 17 00:00:00 2001 From: Harsh Tandiya Date: Tue, 28 Jul 2026 17:26:21 +0530 Subject: [PATCH] fix: prefill "To" when composing email on proposal doctypes (#293) Frappe's communication composer resolves the recipient from the form's get_email_recipients handler, which none of the proposal doctypes defined, so the "To" field opened empty. Talk Proposal sources recipients from the speakers child table, the only place emails are stored. Event Proposal and Sponsorship Enquiry carry no contact email, so both fall back to the submitting user. Closes #246 Co-authored-by: Claude Opus 5 (cherry picked from commit a79850bbecbf9d02a14ce8d22247385872e09d80) --- buzz/proposals/doctype/event_proposal/event_proposal.js | 6 ++++++ .../doctype/sponsorship_enquiry/sponsorship_enquiry.js | 5 +++++ buzz/proposals/doctype/talk_proposal/talk_proposal.js | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/buzz/proposals/doctype/event_proposal/event_proposal.js b/buzz/proposals/doctype/event_proposal/event_proposal.js index 2ecbd086..be3e07a4 100644 --- a/buzz/proposals/doctype/event_proposal/event_proposal.js +++ b/buzz/proposals/doctype/event_proposal/event_proposal.js @@ -2,6 +2,12 @@ // For license information, please see license.txt frappe.ui.form.on("Event Proposal", { + // Guest submissions leave owner as "Guest", so there is nothing to prefill. + get_email_recipients(frm, fieldname) { + const owner = frm.doc.owner || ""; + return fieldname === "recipients" && owner.includes("@") ? [owner] : []; + }, + refresh(frm) { if (!frm.is_new() && frm.doc.docstatus == 0) { frm.set_intro("Buzz Event will be created on submission of this document", "yellow"); diff --git a/buzz/proposals/doctype/sponsorship_enquiry/sponsorship_enquiry.js b/buzz/proposals/doctype/sponsorship_enquiry/sponsorship_enquiry.js index c1b225b6..46cdf228 100644 --- a/buzz/proposals/doctype/sponsorship_enquiry/sponsorship_enquiry.js +++ b/buzz/proposals/doctype/sponsorship_enquiry/sponsorship_enquiry.js @@ -2,6 +2,11 @@ // For license information, please see license.txt frappe.ui.form.on("Sponsorship Enquiry", { + get_email_recipients(frm, fieldname) { + const owner = frm.doc.owner || ""; + return fieldname === "recipients" && owner.includes("@") ? [owner] : []; + }, + setup(frm) { frm.set_query("tier", (doc) => { return { diff --git a/buzz/proposals/doctype/talk_proposal/talk_proposal.js b/buzz/proposals/doctype/talk_proposal/talk_proposal.js index 9f3af9d3..b8f38b8b 100644 --- a/buzz/proposals/doctype/talk_proposal/talk_proposal.js +++ b/buzz/proposals/doctype/talk_proposal/talk_proposal.js @@ -2,6 +2,13 @@ // For license information, please see license.txt frappe.ui.form.on("Talk Proposal", { + get_email_recipients(frm, fieldname) { + if (fieldname !== "recipients") { + return []; + } + return (frm.doc.speakers || []).map((speaker) => speaker.email).filter(Boolean); + }, + refresh(frm) { if (frm.doc.status != "Accepted") { const btn = frm.add_custom_button(__("Accept and Create Talk"), () => {