From 62a9ac0601aa548cf4895a5885d0bb272dcef56f Mon Sep 17 00:00:00 2001 From: meichthys Date: Wed, 10 Sep 2025 04:47:27 +0000 Subject: [PATCH] only add "new Family" button if last name is populated --- church/church/doctype/church_person/church_person.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/church/church/doctype/church_person/church_person.js b/church/church/doctype/church_person/church_person.js index b59daa5..80e4084 100644 --- a/church/church/doctype/church_person/church_person.js +++ b/church/church/doctype/church_person/church_person.js @@ -3,10 +3,12 @@ frappe.ui.form.on("Church Person", { refresh(frm) { - // Add 'New Family From Person' button - frm.add_custom_button(__('New Family From Person'), function () { - frm.call("new_family_from_person") - }); + // Add 'New Family From Person' button if Last Name is populated + if (frm.doc.last_name) { + frm.add_custom_button(__('New Family From Person'), function () { + frm.call("new_family_from_person") + }) + }; // Add 'Church Person Tour' button frm.add_custom_button(__('Tutorial'), function () { frm.tour.init("Church Person").then(() => frm.tour.start());