Repository navigation
fix(revenue): read a quote's Approved Discount % in percentage points (#2920) - #2930
Merged
objectstack-fleet[bot] merged 1 commit intoDec 3, 2026
Merged
Conversation
…#2920) crm_quote.approved_discount is a Field.percent with no max, so the platform's percentScaleOf read it as a fraction: an approved 35 drew as 3,500.00% on the record page beside Discount % 35.00%. Declare max: 100, the scale of the two discounts it is compared with, and pin all three on the whole-points scale in test/money-rollup-currency.test.ts. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K L1 review: ACCEPT · reviewer-class · seat lands (2026-12-03T01:52Z)
|
This was referenced Dec 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2920
Clause-②: no
Metadata-protocol: none
Metadata-impact: reviewer
维护者速读
What changes
crm_quote.approved_discount(Approved Discount %) was aField.percentwith nomax, so the platform (percentScaleOf,@objectstack/spec/data) read it as a fraction. It now declaresmax: 100, the percentage-points scale of the two discounts it is compared with (discountand the line items'discount, bothmax: 100), perdocs/developers/number-formats.mdand ruling B on #2910.Readers keep their behaviour: the
quote_discount_approvalflow stamps the larger ofdiscountandmax_line_discount(each at most 100, so the new bound refuses nothing it can write);discount_approval_before_presentedcompares raw stored numbers; no view, dataset or report names the field.Tests
test/money-rollup-currency.test.ts: a new block pinscrm_quote.approved_discount,crm_quote.discountandcrm_quote_line_item.discounton thewhole(points) scale.max: 100removed,crm_quote.approved_discountfails (1 failed, 33 passed); restored, 34 passed.Acceptance notes
objectstack devon main (983ca96, pin 19.0.0-next.3): Initech Cloud Migration Estimate set to Discount % 35, submitted, approved by the demo Sales Manager; the flow stampedapproved_discount: 35. The record page drew Approved Discount %3,500.00%beside Discount %35.00%. After this change, same record:35.00%.Verification
Local runs (head 2ec1247)
vitest run test/money-rollup-currency.test.ts test/quote-discount-approval.test.ts test/quote-discount-ceiling.test.ts test/flow-quote-print-presented.test.ts: 4 files, 116 tests passed, VERDICT command-exit 0.pnpm validate && pnpm typecheck && pnpm lint && pnpm hygiene: VERDICT command-exit 0 ("Validation passed").pnpm buildand the fullpnpm test: left to CI.Read first:
src/revenue/objects/quote.object.ts(theapproved_discountdeclaration), then the new block at the end oftest/money-rollup-currency.test.ts.Two-minute check:
pnpm exec vitest run test/money-rollup-currency.test.ts, expect 34 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K