Report when an estimate can't be marked Accepted; show every status on the estimate page

- Accepting sends Accepted by (the customer) with the accepted date, as QuickBooks' own Accept does, and
  checks what QuickBooks returns. If it keeps the old status or refuses, the Create issues page shows a
  warning with QuickBooks' message instead of only logging it.
- The estimate page's header shows the status badge for every status, Pending included.

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:43:17 -04:00
1 parent 338b4db237
commit 6ac0e27cb2
4 files changed
+35 -13

No files matched your search

+2 -1
View File
@@ -99,7 +99,8 @@ class QboEstimatesController < ApplicationController
# 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
flash[:notice] += " #{l(:notice_estimate_accepted, number: @estimate.doc_number)}" if accepted.accepted?
flash[:warning] = l(:warning_estimate_not_accepted, number: @estimate.doc_number, message: accepted.message) if accepted.failed?
redirect_to @return_path
else
# Rebuild the fields so the form keeps what was entered
+1 -1
View File
@@ -18,7 +18,7 @@
<% if invoice && form.locked == :paid %>
<% fully_paid = form.balance.to_d.zero? %>
<span class="qbo-estimate-status qbo-estimate-status-<%= fully_paid ? 'closed' : 'accepted' %>"><%= l(fully_paid ? :label_invoice_paid : :label_invoice_partially_paid) %></span>
<% elsif !invoice && form.txn_status.present? && form.txn_status != 'Pending' %>
<% elsif !invoice && form.txn_status.present? %>
<span class="qbo-estimate-status qbo-estimate-status-<%= form.txn_status.downcase %>"><%= form.txn_status %></span>
<% end %>
<% else %>