From fa9d64bb1a3bdbb7e5d2dbf9e694c2d5e7bbf831 Mon Sep 17 00:00:00 2001 From: Casey Date: Wed, 3 Dec 2025 11:55:57 -0600 Subject: [PATCH] update events --- custom_ui/events/estimate.py | 10 +++++++++- custom_ui/events/quotation.py | 8 -------- custom_ui/hooks.py | 6 ++++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/custom_ui/events/estimate.py b/custom_ui/events/estimate.py index 1991c05..0d9bcae 100644 --- a/custom_ui/events/estimate.py +++ b/custom_ui/events/estimate.py @@ -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") \ No newline at end of file + 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() \ No newline at end of file diff --git a/custom_ui/events/quotation.py b/custom_ui/events/quotation.py index da1cf48..cf99998 100644 --- a/custom_ui/events/quotation.py +++ b/custom_ui/events/quotation.py @@ -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() \ No newline at end of file diff --git a/custom_ui/hooks.py b/custom_ui/hooks.py index e4b9cbe..dc2bfae 100644 --- a/custom_ui/hooks.py +++ b/custom_ui/hooks.py @@ -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" } }