Repository navigation
feat(o2c): confirming again refuses a Total Price below what the order invoiced or received (#2827) - #2836
Merged
objectstack-fleet[bot] merged 3 commits intoNov 27, 2026
Conversation
…r invoiced or received (#2827) Two cross_field validations the Order to Cash module adds to crm_sales_order through its objectExtensions entry, judged on the Draft -> Confirmed move only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
…n the manual, the docs site and a changeset (#2827) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
…2827) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
|
repo:hotcrm#1 · huangyiirene · session_01J8VVAk8tegvAi1ECkgCFfc ACCEPT · 2026-11-27T10:36ZHead-sha: 维护者速读
席位核对
|
sunhaolin
added a commit
that referenced
this pull request
Nov 27, 2026
#2836 landed on main after the release PR opened, with a 30th changeset (minor). The branch merged main; this commit removes .changeset/2827-reconfirm-total-floor.md and writes its line into the 6.7.0 notes: one bullet under Order to Cash and one sentence in the Integrations check of CHANGELOG.md, and one sentence in the Orders item of the whats-new page in three locales. `changeset version` on a copy of c9d500f computes 6.7.0 from all 30 changesets (7 minor, 21 patch, 2 empty), so the version stands. The marketplace listing reads 7,738 of 8,000 characters, nothing omitted. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 27, 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.
Requested by Irene · project thread
Fixes #2827
Clause-②: no
Metadata-protocol: none
Metadata-impact: maintainer — a validation rule tightened: an order moving from Draft to Confirmed is now refused when its Total Price is below its Invoiced or Received
维护者速读
What changes
validations[]entries the Order to Cash module adds tocrm_sales_orderthrough its existingobjectExtensionsentry,src/o2c/extensions/sales-order.extension.ts(ObjectExtensionSchema.validations, merged into the target). The sales package does not import o2c, and an o2c hook on the order is refused by ADR-0130 R4, so no hook. A tenant without the module has neither the figures nor the rules.invoiced_amount/received_amountare stored summary fields and are readable in the rule's{...previous, ...data}record on update. The refusal tests below fire on the booted stack, and the ablation shows they go green only through these rules.reconfirm_total_below_received,reconfirm_total_below_invoiced):cross_fieldontotal_price,events: ['update'], a transition gate (AGENTS.md rule 7). Each fires only whenprevious.status == "draft"andrecord.status == "confirmed"and the figure is strictly above the total. Every read carrieshas()(the TOTAL predicate rule). Total equal to the figure passes. A write that lowers the total and confirms in one request is judged on the recomputed total, because the total hook runs before validation (tested).authoredRuleMessagereturns the authored or translated text verbatim and interpolates no record values; the same limit is recorded oncontract_same_account. The order's page shows Total Price, Invoiced and Received side by side. Translated in the o2c packs (en/zh-CN/ja-JP/es-ES) underobjects.crm_sales_order._validations.test/i18n-package-ownership.test.ts: a module's row on another package's object may now also carry_validationsfor the rules that module contributes there, and nothing else. The positive control now coverscrm_sales_orderfields and rule messages in all four locales.src/o2c/docs/crm_o2c_invoices_payments.md(+.zh.md), sitecontent/docs/(product)/order-to-cash/invoices-and-payments.mdx(+ zh-Hans, zh-Hant). The sales manual is unchanged because an app-book page may not link to a module's book..changeset/2827-reconfirm-total-floor.md(minor).Tests
test/sales-order-reconfirm-floor.test.ts, 5 cases on the booted stack:400 VALIDATION_FAILED,fields[0]=total_price/rule_violation/ the sentence; zh-CN sentence viaaccept-language) and the order stays Draft. At 12,000 it confirms and Unpaid reads 2,000 (the card's acceptance).Ablation (on disk, then restored)
The
validationsarray was emptied insales-order.extension.ts(grep count ofreconfirm_total= 0) and the file re-run:Tests 3 failed | 2 passed (5). The three refuse cases fail withexpected 200 to be 400. The failing record showsreceived_amount: 10000, total_price: 8000, unpaid_amount: 0(the defect). The two non-gating cases pass either way, by design. Restored from a copy;git diffshowed only the intended change.Acceptance notes
Verification
b2caf7d2, throughos-verify-lock.sh:pnpm validate && pnpm typecheck && pnpm lint && pnpm test. ResultVERDICT command-exit 0,Test Files 342 passed (342),Tests 6568 passed | 58 skipped (6626).pnpm exec vitest run test/sales-order-reconfirm-floor.test.tsshould give 5 passed. In the console, put an order with a payment back in Draft, lower Total Price below Received and set Status to Confirmed; the save is refused on Total Price.src/o2c/extensions/sales-order.extension.ts(the predicate: transition and guards),test/i18n-package-ownership.test.ts(the widened allowance),src/o2c/translations/zh-CN.ts.🤖 Generated with Claude Code
https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc