Fix failing test: revert quote-based discount to use sourceQuote.DiscountAmount

The quote discount must come from the agreed quote price, not the job's pricing
snapshot (which may have DiscountAmount=0 for legacy or unset reasons). The job
snapshot fix only applies to direct jobs where no source quote exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 11:29:12 -04:00
parent 3a1928f9bf
commit b2d6fae400
@@ -469,11 +469,10 @@ public class InvoicesController : Controller
});
}
// Use the quote's agreed tax rate. For discount, prefer the job's current pricing
// snapshot — it is recalculated on every save and captures any post-conversion edits.
// Fall back to the original quote discount only if no snapshot exists.
// Use the quote's agreed tax rate and discount — these represent the customer-approved
// price and must not be recomputed from the job's current state.
dto.TaxPercent = sourceQuote.TaxPercent;
dto.DiscountAmount = jobBreakdown?.DiscountAmount ?? sourceQuote.DiscountAmount;
dto.DiscountAmount = sourceQuote.DiscountAmount;
}
else if (hadJobItems)
{