Repository navigation
feat(sales): an order links by hand only an Activated framework contract of its account (#2917) - #2928
Merged
objectstack-fleet[bot] merged 4 commits intoDec 2, 2026
Conversation
…tract of its account (#2917) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
The account half of the rule stays contract_same_account's (#2728). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc
…cker filter (#2917) 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-12-02T11:11ZHead-sha: 维护者速读
席位核对
|
This was referenced Dec 2, 2026
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 #2917
Clause-②: no
Metadata-protocol: none
Metadata-impact: maintainer — a save-time rule added: a person's change of an order's Contract is refused unless the contract is an Activated framework contract; plus a warning on the Order Date
维护者速读
What changes
crm_sales_order.crm_contractkeepsdependsOn: ['crm_account']and gainslookupFilters(formframework, statusactivated) andallowCreate: false(a contract created from the picker would be a Draft the order may not take).sales_order_contract_link(beforeInsert/beforeUpdate, priority 95): a person's write that sets Contract to a contract that is notframework+activatedis refused,VALIDATION_FAILED400, naming the contract number; localized in zh-CN, ja-JP, es-ES. Judged only when Contract changes to a non-empty value; clearing passes; no person on the write (ctx.userabsent orsession.isSystem) is not judged, which covers Draft Contract's elevated write, the seed, system imports and flows. The account half stayscontract_same_account(Sales order: an order could be saved with another account's contract, so its Order to Cash rows could not be saved against it #2728), which keeps its own message on Contract.contract_term_order_date(conditional,warning): the Order Date outside the contract's Start Date to End Date warns and saves, judged when the write links the contract or changes the date.src/docs/crm_sales_orders.md+.zh.md,content/docs/(product)/sales/orders.mdx+ zh-Hans + zh-Hant. Changeset2917-order-contract-link-rule.md.frameworkunchanged) #2916's rename sweeps it with the rest.Read first (by risk):
src/sales/objects/sales_order.hook.ts(the person signal and the unchanged-value early return),src/sales/objects/sales_order.object.ts(the warning'spreviouspredicate),test/helpers/verify-stack.ts(activateContract, used by the re-fixtured suites).Tests
test/sales-order-contract-link.test.ts(18 cases, booted stack, REST door): link to Activated framework on create and update; refuse Expired, Terminated, Draft, In Approval framework, Activated and Draft order contract, Activated Other, each on create and update with code and message; another account's contract refused; refusal in zh-CN/ja-JP/es-ES from the packs; clear allowed; order still saves after its contract expires (Contract unchanged and sent back as it was); system insert with an Expired contract not judged; Draft Contract still links its Draft order contract; Order Date before/after term warns and saves, silent inside and on an unrelated edit; picker metadata pinned.framework-contract-quota,o2c-order-contract-later,o2c-parallel-figures,o2c-sales-order,sales-order-draft-contract,sales-order. Each now activates the contract (system write) or makes the ineligible link a system write, as an import would. Business assertions unchanged.refusal-envelopecount 116 → 117,sales-orderhook roster +sales_order_contract_link.Acceptance notes
["and",["contract_form","=","framework"],["status","=","activated"],["crm_account","=",ACCOUNT]], solookupFiltersanddependsOncombine; the "Browse all records" grid sends the same filter; Acme with CTR-0001 (Activated framework), CTR-0005 (Draft framework), CTR-0006 (Draft Other) listed CTR-0001 only. AfterallowCreate: falsethe picker shows no "Create new".customer_po_numberand answered 200.lookupFiltersis picker-only by the platform's own describe ("The picker narrows the choice only: a rule the save must enforce belongs on the server too"), hence the hook. No platform gap to file.POST /api/v1/data/crm_contract/query(fieldsid, contract_number, status, contract_form) andPOST /api/v1/data/crm_sales_order/query(fieldsorder_number, crm_contract); list orders whose contract is notframework+activated, and order contracts (contract_form: order) named by more than one order. No script ships:scripts/is outside this card's claimed file surface (open question in the report).Verification
Two-minute check:
pnpm dev, open any order, Edit, open Contract: only that account's Activated framework contracts are listed, and no Create new.Final head
91c54e54:pnpm validate0,pnpm typecheck0,pnpm lint0,pnpm hygiene0; full suitevitest run --shard=N/6, six shards all exit 0.Full suite, per shard (head 91c54e5)
Live API on the booted app (zh-CN)
VALIDATION_FAILED「合同CTR-0005不能关联到这张订单。只能选择同一客户、已激活的框架合同:请另选一份,或清空关联合同。」🤖 Generated with Claude Code
https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc