estimate manual accept
This commit is contained in:
parent
9f9318ddef
commit
993244a72e
1 changed files with 8 additions and 0 deletions
|
|
@ -316,11 +316,19 @@ def manual_response(name, response):
|
||||||
accepted = True if response == "Accepted" else False
|
accepted = True if response == "Accepted" else False
|
||||||
new_status = "Estimate Accepted" if accepted else "Lost"
|
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_response = response
|
||||||
estimate.custom_current_status = new_status
|
estimate.custom_current_status = new_status
|
||||||
estimate.flags.ignore_permissions = True
|
estimate.flags.ignore_permissions = True
|
||||||
print("DEBUG: Updating estimate with response:", response, "and status:", new_status)
|
print("DEBUG: Updating estimate with response:", response, "and status:", new_status)
|
||||||
estimate.save()
|
estimate.save()
|
||||||
|
frappe.db.commit()
|
||||||
return build_success_response(estimate.as_dict())
|
return build_success_response(estimate.as_dict())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return build_error_response(str(e), 500)
|
return build_error_response(str(e), 500)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue