Repository navigation
Conversation
…eeps it (#2755) New on the Payments tab of an invoice or of a billing milestone opened a payment whose prefilled parent was hidden behind "Select Account first"; choosing the account emptied it, and the payment was saved under the account alone, so the invoice's Paid / Open and the milestone's Received never moved. - crm_payment: the invoice and billing milestone lookups drop `dependsOn` and gain `lookupAutofill`. The invoice fills the account, and the contract and the milestone while the payment has none; the milestone fills the account. The invoice -> milestone fill does not overwrite: measured in the browser, an overwriting autofill empties a chosen milestone when the invoice has none, which the server keeps. - payment_plan_step_stamp: refuse a billing milestone of another account, naming it, as another account's invoice already was; judge both when a write moves the payment to another account. - payment_row_stamp: a payment naming its account takes no order or contract from an invoice or step of another account, so the refusal names what the user chose. - Translations (zh-CN, es-ES, ja-JP), tests, the Invoices and Payments manual and site page in every locale, changeset. The pickers now list every account's invoices and milestones; the refusal on save replaces the filter. A prefilled parent still does not fire `lookupAutofill` (objectstack-ai/objectstack#35050, hotcrm#2598), so the account is picked by hand from those two pages; not worked around here. Fixes #2755
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
12 tasks done
Collaborator
Author
|
Seat record · HOLD · head 独立评审已完成。评审判定本 PR 为 maintainer 类(改了 hook,并收紧了一条保存时的规则),按 2026-11-19 的裁定保持 draft,由维护者本人决定是否合并;本席位不转 ready、不挂 auto-merge。
Findings
与 #2767 的关系:行为上不矛盾,文本上冲突( Landing:等待维护者决定。 |
Collaborator
Author
|
Seat record · 浏览器实测 · head 在本分支的本地服务(独立开发库,zh-CN)上实测,五项全部通过。PR 保持 draft,未改动合并状态。
Nits(不阻塞):
未实测:批量更新、非管理员角色、en 语言环境。 |
Resolves the conflicts with #2767 (an invoice keeps its billing milestone): - _row-stamp.ts: one account check for both forms. A payment or an invoice that names its account takes nothing from an invoice or a step of another account, so payment_plan_step_stamp and invoice_plan_step_guard refuse it by its own name. - refusal-envelope.test.ts: 100 call sites (both new refusals). - o2c-collection-plan.test.ts: both imports kept.
…claude/fix-2755-payment-parent-link-8ccdb3
…nvoice's milestone wins (#2755) Review fixes on #2760: - payment_plan_step_stamp: a billing milestone of another account that the payment took from its invoice (the write did not name it) is refused by the invoice: "INV-… counts toward …, a billing milestone of another account. Correct the invoice's billing milestone, or choose another invoice." (reason invoice_milestone, translated in zh-CN, es-ES, ja-JP). - payment_row_stamp: the account an invoice or step is judged against is the one the write names, else the one its contract or order gives, else the row's own; a write naming only a contract no longer takes the order of another account's invoice and get refused under that order. - Manual and docs site: a save that sets the invoice gives the payment the invoice's milestone whenever the invoice has one (Received is a one-hop summary over the payments pointing at the step); the payment keeps its own only when the invoice has none or there is no invoice. - Collection-plan tests pin the exact refusal text and the stored values. Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Nov 25, 2026
…claude/fix-2755-payment-parent-link-8ccdb3 # Conflicts: # test/refusal-envelope.test.ts
…claude/fix-2755-payment-parent-link-8ccdb3 # Conflicts: # content/docs/(product)/order-to-cash/invoices-and-payments.mdx # content/docs/(product)/order-to-cash/invoices-and-payments.zh-Hans.mdx # content/docs/(product)/order-to-cash/invoices-and-payments.zh-Hant.mdx # src/o2c/docs/crm_o2c_invoices_payments.zh.md
…claude/fix-2755-payment-parent-link-8ccdb3 # Conflicts: # test/refusal-envelope.test.ts
…claude/fix-2755-payment-parent-link-8ccdb3 # Conflicts: # content/docs/(product)/order-to-cash/invoices-and-payments.mdx # content/docs/(product)/order-to-cash/invoices-and-payments.zh-Hans.mdx # content/docs/(product)/order-to-cash/invoices-and-payments.zh-Hant.mdx # src/o2c/docs/crm_o2c_invoices_payments.md # src/o2c/docs/crm_o2c_invoices_payments.zh.md # src/o2c/objects/payment.object.ts
This branch has not been deployed
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.
Description
A payment created from a payment plan's Payments tab → New lost its parent: the prefilled Payment Plan was hidden behind "Select Account first", picking the Account emptied it, and the save succeeded with no payment plan. The plan's Received never moved, and nothing said so.
Cause: on
crm_payment, thecrm_billing_milestonelookup declareddependsOn: ['crm_account']and nolookupAutofill. The order and contract lookups on the same object droppeddependsOnfor the same reason on #2560.The issue also reported the same loss from an invoice's Payments tab. Since main's #2806/#2819 (invoices and payments run in parallel), the payment's Invoice is hidden and the invoice page has no Payments tab, so that door no longer exists; this PR keeps main's ruling and does not bring the invoice lookup back. An API write or an import can still name an invoice, and the server rules below cover it.
Metadata-impact: maintainer — two hooks changed and a validation tightened (a payment naming another account's payment plan is now refused on save, by the payment plan when the write names it and by the invoice when an API write's invoice brought it; before, only another account's invoice was). No permission set, sharing rule, object or field is added, removed or renamed; no stored data changes.
Type of Change
Related Issues
Fixes #2755
Related to #2598 (objectstack-ai/objectstack#35050: a prefilled parent does not fire
lookupAutofill), #2806Changes Made
src/o2c/objects/payment.object.ts: the payment plan lookup dropsdependsOnand gainslookupAutofillfilling the account (overwrite: true). The invoice lookup is main's (Invoices and payments run in parallel: unlink them, show Unpaid and Uninvoiced instead of Receivable Balance, measure overdue on the payment plan, and generate a plan step when an order is confirmed #2806: hidden, no related list).src/o2c/objects/payment.hook.ts(payment_plan_step_stamp): refuses a payment plan of another account (milestone_named, naming it), next to the existing invoice refusal. When an API write names an invoice and the payment plan is the one the invoice brought (the write did not name it), the refusal names the invoice instead (invoice_milestone). The invoice and the step are each judged when the write sets them, and both when a write moves the payment to another account. The invoice's payment plan still replaces the payment's on save whenever the invoice has one (unchanged on main and here).src/o2c/objects/_row-stamp.ts: a payment takes no order or contract from an invoice or step of another account, so the refusal names the invoice or the step the write named rather than an order the user never saw. The account it is judged against is the one the write names, else the one its contract or order gives, else the row's own — so a write naming only a contract is covered too.test/refusal-envelope.test.tscounts both new call sites (110 after the merge with main).test/o2c-collection-plan.test.ts: the payment plan lookup carries nodependsOnand fills the account; the invoice lookup stays hidden with no Payments list (Invoices and payments run in parallel: unlink them, show Unpaid and Uninvoiced instead of Receivable Balance, measure overdue on the payment plan, and generate a plan step when an order is confirmed #2806); a payment entered from a plan step keeps it and the step counts it; a payment written with an invoice through the API keeps it; another account's step is refused by name (also under a contract of the payment's own account); an invoice whose payment plan is another account's is refused by the invoice; another account's invoice written with only a contract is refused by the invoice, not its order; moving a payment to another account while it keeps its invoice or step is refused; a control edit touching none of them is not judged. Refusals are pinned word for word, and each refused write is checked to store nothing (or to leave the row as it was).src/o2c/docs/crm_o2c_invoices_payments.md+.zh.md, andcontent/docs/(product)/order-to-cash/invoices-and-payments.mdx+.zh-Hans+.zh-Hant(on top of main's Invoices and payments run in parallel: unlink them, show Unpaid and Uninvoiced instead of Receivable Balance, measure overdue on the payment plan, and generate a plan step when an order is confirmed #2806 text)..changeset/2755-payment-keeps-invoice-and-milestone.md(patch).The trade-off
Without
dependsOnthe payment plan picker no longer filters by the account: it lists every account's payment plans the user may read. The server refusal replaces the filter, so a wrong pick is caught at save, not in the picker. When the form still carries a contract of the other account,payment_row_stamp(priority 50) refuses first and names the contract; the payment plan is named once the contract is out of the way.Not worked around
A prefilled parent does not fire
lookupAutofill(objectstack-ai/objectstack#35050, tracked on #2598), so from the payment plan's door the Account is still picked by hand. This PR does not work around that. What holds now: the prefilled payment plan is visible, survives picking the account, and is saved.Testing
typecheck,validate,hygienegreen;refusal-envelope, allo2c-*,docs-*,i18n-*andlocale-label-collisionstests pass (49 files, 1005 tests).pnpm verifylocally on 8d2076b: validate, typecheck, lint, hygiene and build green. In the full test run, 16 tests in 12 unrelated files timed out at 5 s under load; all 12 pass when re-run alone.(The invoice-door rows of the earlier run are dropped: #2806 hid that door.)
Checklist
src/declare their class (see theMetadata-impact:line above)Review fixes (Seat record)
Additional Notes
Draft on purpose: a maintainer-class metadata change stays a draft for the maintainer's merge (AGENTS.md, How a green PR lands). The independent review of Who decides a change has not been run on this PR yet.
Open for the maintainer, not decided here: under #2806 the hook still copies an API-named invoice's payment plan onto the payment (main left it so); whether that copy should stay is a product call.
Follow-ups, not in this PR:
lookupAutofillwithoverwrite: trueempties the target when the picked record's source is empty (platform behaviour, worth raising upstream).