estimate manual accept

This commit is contained in:
Casey 2026-02-23 13:15:11 -06:00
parent 9f9318ddef
commit 993244a72e

View File

@ -316,11 +316,19 @@ def manual_response(name, response):
accepted = True if response == "Accepted" else False
new_status = "Estimate Accepted" if accepted else "Lost"
# If the estimate hasn't been submitted yet, submit it first
# so that on_update_after_submit hooks fire (Lead conversion, SO/Project creation, etc.)
if estimate.docstatus == 0:
print("DEBUG: Estimate not yet submitted, submitting now before setting response.")
estimate.flags.ignore_permissions = True
estimate.submit()
estimate.custom_response = response
estimate.custom_current_status = new_status
estimate.flags.ignore_permissions = True
print("DEBUG: Updating estimate with response:", response, "and status:", new_status)
estimate.save()
frappe.db.commit()
return build_success_response(estimate.as_dict())
except Exception as e:
return build_error_response(str(e), 500)