Bid Meeting Note Form auto-connection to Project Template.
This commit is contained in:
parent
0e895b0c17
commit
273e507e77
1 changed files with 13 additions and 4 deletions
|
|
@ -811,10 +811,17 @@ def create_bid_meeting_note_form_templates():
|
||||||
for company, form_list in forms.items():
|
for company, form_list in forms.items():
|
||||||
for form in form_list:
|
for form in form_list:
|
||||||
# Idempotency check
|
# Idempotency check
|
||||||
if frappe.db.exists(
|
bid_meeting_filter = {"title": form["title"], "company": company}
|
||||||
"Bid Meeting Note Form",
|
# Get the id of the Bid Meeting Note Form if it exists
|
||||||
{"title": form["title"], "company": company},
|
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
|
continue
|
||||||
|
|
||||||
doc = frappe.new_doc("Bid Meeting Note Form")
|
doc = frappe.new_doc("Bid Meeting Note Form")
|
||||||
|
|
@ -847,6 +854,8 @@ def create_bid_meeting_note_form_templates():
|
||||||
)
|
)
|
||||||
|
|
||||||
doc.insert(ignore_permissions=True)
|
doc.insert(ignore_permissions=True)
|
||||||
|
frappe.db.set_value("Project Template", form["project_template"],
|
||||||
|
"bid_meeting_note_form", doc.name)
|
||||||
|
|
||||||
|
|
||||||
def create_companies():
|
def create_companies():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue