add scripts for doctype changes
This commit is contained in:
parent
80aae6f09b
commit
a67e86af44
7 changed files with 115 additions and 76 deletions
0
custom_ui/events/__init__.py
Normal file
0
custom_ui/events/__init__.py
Normal file
11
custom_ui/events/onsite_meeting.py
Normal file
11
custom_ui/events/onsite_meeting.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import frappe
|
||||
|
||||
def after_insert(doc, method):
|
||||
print(doc.address)
|
||||
frappe.msgprint(f"On-Site Meeting '{doc.name}' has been created. Updating related records...")
|
||||
address_name = frappe.db.get_value("Address", fieldname="name", filters={"address_line1": doc.address})
|
||||
address_doc = frappe.get_doc("Address", address_name)
|
||||
frappe.msgprint(f"Related Address '{address_doc.address_title}' has been retrieved.")
|
||||
address_doc.custom_onsite_meeting_scheduled = "Completed"
|
||||
address_doc.save()
|
||||
frappe.msgprint(f"Related Address '{address_doc.address_title}' has been updated with custom_onsite_meeting_scheduled = 'Completed'.")
|
||||
19
custom_ui/events/quotation.py
Normal file
19
custom_ui/events/quotation.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import frappe
|
||||
|
||||
def after_insert(doc, method):
|
||||
address_title = doc.custom_installation_address
|
||||
address_name = frappe.db.get_value("Address", fieldname="name", filters={"address_title": address_title})
|
||||
if address_name:
|
||||
address_doc = frappe.get_doc("Address", address_name)
|
||||
address_doc.custom_estimate_sent_status = "In Progress"
|
||||
address_doc.save()
|
||||
|
||||
|
||||
def after_save(doc, method):
|
||||
if doc.custome_sent:
|
||||
address_title = doc.custom_installation_address
|
||||
address_name = frappe.db.get_value("Address", fieldname="name", filters={"address_title": address_title})
|
||||
if address_name:
|
||||
address_doc = frappe.get_doc("Address", address_name)
|
||||
address_doc.custom_quotation_sent = "Completed"
|
||||
address_doc.save()
|
||||
Loading…
Add table
Add a link
Reference in a new issue