update events

This commit is contained in:
Casey 2025-12-03 11:55:57 -06:00
parent 041e9f5461
commit fa9d64bb1a
3 changed files with 13 additions and 11 deletions

View File

@ -11,4 +11,12 @@ def after_insert(doc, method):
address_doc.save()
except Exception as e:
print("ERROR in after_insert hook:", str(e))
frappe.log_error(f"Error in estimate after_insert: {str(e)}", "Estimate Hook Error")
frappe.log_error(f"Error in estimate after_insert: {str(e)}", "Estimate Hook Error")
def after_save(doc, method):
if not doc.custom_sent:
return
print("DEBUG: Quotation has been sent, updating Address status")
address_doc = frappe.get_doc("Address", doc.custom_installation_address)
address_doc.custom_estimate_sent_status = "Completed"
address_doc.save()

View File

@ -8,11 +8,3 @@ def after_insert(doc, method):
address_doc.custom_estimate_sent_status = "In Progress"
address_doc.save()
def after_save(doc, method):
if not doc.custom_sent:
return
print("DEBUG: Quotation has been sent, updating Address status")
address_doc = frappe.get_doc("Address", doc.custom_installation_address)
address_doc.custom_quotation_sent = "Completed"
address_doc.save()

View File

@ -160,13 +160,15 @@ add_to_apps_screen = [
doc_events = {
"On-Site Meeting": {
"after_insert": "custom_ui.events.onsite_meeting.after_insert"
"after_insert": "custom_ui.events.onsite_meeting.after_insert",
"on_update": "custom_ui.events.onsite_meeting.on_update"
},
"Address": {
"after_insert": "custom_ui.events.address.after_insert"
},
"Quotation": {
"after_insert": "custom_ui.events.estimate.after_insert"
"after_insert": "custom_ui.events.estimate.after_insert",
"after_save": "custom_ui.events.estimate.after_save"
}
}