estimate manual accept
This commit is contained in:
parent
9f9318ddef
commit
993244a72e
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user