Bid Meeting Note Form auto-connection to Project Template.
This commit is contained in:
parent
0e895b0c17
commit
273e507e77
@ -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():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user