Mark an estimate Accepted when issues are created from it

Creating issues from an estimate means the work is going ahead, so a pending estimate becomes Accepted in
QuickBooks (sparse update with today's accepted date, like closing an estimate) and the local estimate is
synced, so its status badge updates. Accepted, Closed, Converted and Rejected estimates are left alone. A
failure is logged and doesn't affect the created issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-31 12:36:05 -04:00
1 parent ec6fecbd85
commit 338b4db237
4 files changed
+32 -1

No files matched your search

@@ -96,7 +96,10 @@ class QboEstimatesController < ApplicationController
if created.any?
Redmine::Hook.call_hook(:qbo_billing_issues_created, { estimate: @estimate, issues: created, params: params })
# The work is going ahead: a pending estimate becomes Accepted in QuickBooks
accepted = RedmineQboBilling::EstimateWriter.accept(@estimate.id, user: User.current)
flash[:notice] = l(:notice_estimate_issues_created, count: created.size)
flash[:notice] += " #{l(:notice_estimate_accepted, number: @estimate.doc_number)}" if accepted
redirect_to @return_path
else
# Rebuild the fields so the form keeps what was entered