From 273e507e77523cebb8580fb5cee531bca94c5be4 Mon Sep 17 00:00:00 2001 From: rocketdebris Date: Tue, 10 Feb 2026 14:51:47 -0500 Subject: [PATCH] Bid Meeting Note Form auto-connection to Project Template. --- custom_ui/install.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/custom_ui/install.py b/custom_ui/install.py index 779b7aa..df8a186 100644 --- a/custom_ui/install.py +++ b/custom_ui/install.py @@ -811,10 +811,17 @@ def create_bid_meeting_note_form_templates(): for company, form_list in forms.items(): for form in form_list: # Idempotency check - if frappe.db.exists( - "Bid Meeting Note Form", - {"title": form["title"], "company": company}, - ): + bid_meeting_filter = {"title": form["title"], "company": company} + # Get the id of the Bid Meeting Note Form if it exists + bid_meeting_notes_id = frappe.db.exists("Bid Meeting Note Form", bid_meeting_filter) + if bid_meeting_notes_id: + # Check if the project template is connected to this Bid Meetings Note Form + template_connection = frappe.db.get_value("Project Template", + form["project_template"], "bid_meeting_note_form") + if not template_connection: + # Connect the Bid Meeting Note Form and Project Template + frappe.db.set_value("Project Template", form["project_template"], + "bid_meeting_note_form", bid_meeting_notes_id) continue doc = frappe.new_doc("Bid Meeting Note Form") @@ -847,6 +854,8 @@ def create_bid_meeting_note_form_templates(): ) doc.insert(ignore_permissions=True) + frappe.db.set_value("Project Template", form["project_template"], + "bid_meeting_note_form", doc.name) def create_companies():