Repository navigation
feat(psa): a project shows Billed and Not Yet Billed beside Approved to Bill (#2622) - #2933
Conversation
…to Bill (#2622) Project Delivery phase 3 step 3b. The project's Financials gain Billed Labor and Billed Expenses (one-hop summaries over the time entries and expenses whose Billed On is filled), Billed (their sum) and Not Yet Billed (Approved to Bill minus Billed, a stored computed column so a list can filter on it). Projects to Bill lists the projects with something left to bill, for the people who bill. project_financials gains the four measures and Projects Overview a billing row. project_member hides the whole billing block, Approved to Bill and its halves included. A manual page follows billing from the approved hour to the payment; the docs site, feature inventory, STATUS, the plan and REQ-0002 are updated. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
… sees no billing tile (#2622) Measured in the browser: opened from a link, Projects Overview shows a team member neither the cost tiles nor the new billing row. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K Independent read-only review (Fable) · head
待维护者裁决Q1 · 订单上的「回款计划与订单金额不符」(裁决 C 说 3b 前重看)
Q2 · 项目成员能看到哪些开票数字
Evidence: Seat: items ⑥–⑧ go back to the dev as small fixes now; ③ is stated in the changeset. The PR stays a draft until the maintainer rules Q1/Q2 and merges. |
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K CI on
|
…hors are site-absolute (#2622) - project_financials: the Billed Labor and Billed Expenses synonyms read 已出账人工 / 已出账费用; 已开票 is Order to Cash's Invoiced. - test/psa-billed.test.ts: the Projects to Bill filter runs as the project manager and finance through REST; a project member is refused it (403) and lists projects with no billing field; a member aggregating the billing measures of project_financials is refused, the PM is answered. - projects_to_bill declares editInline, as its sibling project lists do (view-inline-edit). - content/docs projects index (three locales): the link to Prepare Billing is site-absolute, as docs-anchor-links requires. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K Q3 · Fable analysis · head 背景:「待出账项目」列表按「未出账金额」筛选和排序,而该字段对项目成员隐藏;平台对隐藏字段的筛选排序一律 403,仓库测试规定任何视图都不得筛选/排序被隐藏字段。导航入口已对成员隐藏,但视图切换器里成员仍能选到并撞上 403。无论 Q2 选 A 或 B,「未出账」都对成员隐藏,所以这条与 Q2 无关。本 PR 已在「项目总览」仪表盘加了「按项目的开票情况」表(已批准待开票 / 已出账 / 未出账,按未出账从高到低,前 20 条),该仪表盘本就不给成员。
建议:E——卡片允许「做不到就说明」,清单用途已由同一 PR 的仪表盘表满足,不动护栏、不加授权;若坚持要可操作列表,另立卡走 F。 旁证(未实测):新隐藏的 7 个开票字段没有加入 Evidence: |
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K Maintainer's rulings in chat, verbatim: 「Q1 选 B,Q2 选 A,Q3 选 E,旁证补上」 · recorded 2026-12-03T03:24Z
Sent back to the dev; the PR stays a draft for the maintainer's merge. |
…ill view, billing rows for two roles (#2622) The maintainer's ruling in chat: 「Q1 选 B,Q2 选 A,Q3 选 E,旁证补上」. - Q3 E: the projects_to_bill list view, its navigation entry and its labels in the four packs are removed. A list view cannot filter or sort on Not Yet Billed while project_member masks it (a view that queries a masked field breaks for that set's holders, authorization-coverage). The list for the people who bill is Projects Overview's Billing by Project table, now filtered to unbilled_amount > 0 and widened from 20 to 100 rows. Manuals, docs site, feature inventory, plan, REQ-0002 and the changeset say so. - Q2 A: the billing block stays hidden from project_member. - Q1 B: Order to Cash is unchanged; where the docs describe Payment Plan Differs after billing they point at hotcrm#2934. - Two-role rows: PSA_BILLING_FIELDS (_psa-grants.ts), seven read rows, carried by finance_controller, system_admin and project_manager, so a holder of one of them beside project_member still reads the billing block (the #2820 rule the cost fields follow). - Tests: two-role-field-rows pins the three pairs; psa-billed proves the REST filter for the PM and finance without a view, the member refusal, and the dashboard table's binding. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K CI on
|
CI shard 8 on 38475ee timed the Order to Cash disable case out at the default 5 s (1.5 s locally: a run, then a package disable and enable). As d66957a did for the flow-quote case, each psa-billed case above 0.5 s locally gets its own 15_000 budget, with the reason beside it; the default for the file is unchanged. Claude-Session: https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K
|
repo:hotcrm@sunhaolin · sunhaolin · session_017xRBcUpajguxop2zMyDN9K Head update:
Open for the maintainer (non-blocking):
Stays draft with |
Closes #2622
Clause-②: no
Metadata-protocol: none
Metadata-impact: maintainer — permission sets:
project_membergains sevenreadable: falsefield rows oncrm_project(Billable Labor, Billable Expenses and Approved to Bill, readable to a team member until now, plus the four new billing fields);finance_controller,system_adminandproject_managergain the seven matchingreadable: truerows (PSA_BILLING_FIELDS, the #2820 two-role rule); new fields, dataset measures and dashboard tiles otherwise.Ruling-ref: the maintainer in chat on this PR, relayed by the seat 2026-12-03: 「Q1 选 B,Q2 选 A,Q3 选 E,旁证补上」
维护者速读
What changes
crm_projectFinancials (src/psa/objects/project.object.ts):billed_labor_amount(summary ofcrm_time_entry.bill_amountthrough the entry's owncrm_project, filteris_billableand Billed On$null: false),billed_expense_amount(summary of approved billablecrm_expense.amount, Billed On$null: false),billed_amount(Billed, formula of the two),unbilled_amount(Not Yet Billed = Approved to Bill minus Billed, a stored computed column,expression, so a list can filter on it). One hop each; no summary of a summary. No stored flag was needed: the summary filter reads the Billed On lookup itself.ar_accountantreading time entries,project_memberkept from a step summary) were for a summary over the step and are not needed.unbilled_amount > 0, sorted by Not Yet Billed, 100 rows (widened from 20: it is the worklist). No list view (ruling Q3 E): a view that filters or sorts on Not Yet Billed breaks forproject_member, which masks it (test/authorization-coverage.test.ts, unchanged and green); the console measured 403 "You don't have access" for a member who picks such a view in the switcher.project_financials:billed_labor_sum,billed_expense_sum,billed_sum(derived sum),unbilled_sum(derived Approved to Bill minus Billed). Projects Overview: a billing row (Approved to Bill, Billed, Not Yet Billed metrics, Billing by Project table), every project whatever its status.project_memberhides the whole billing block (the card: "A project member sees none of the three figures"; ruling Q2 A). The member's own entries keep their bill rate. Two roles:PSA_BILLING_FIELDS(src/sales/profiles/_psa-grants.ts) givesfinance_controller,system_adminandproject_managera read row on each of the seven, so a holder of one of them besideproject_memberreads the block (the feat!: move to ObjectStack 19.0.0-next.2 and protocol 19 #2820 rule the cost fields follow);project_manageris included because it is the set that bills.crm_psa_billing(en +.zh.md), Billing Time and Expenses — From Approval to Payment; the cost page's billing section moves there; the overview page gains a billing section. Docs site: Projects (index, Time and Expenses) and Order to Cash (Collection Plan, a new Steps from a project's billing section), three locales.docs/feature-inventory.md(new PSA domain, PSA-001 and PSA-002),docs/STATUS.md(647 fields),psa-module-plan.md(phase 3b built), REQ-0002 traceability. Changeset.changeset/2622-project-billed.md.Acceptance notes
os migrate summary-nulls,os migrate stored-expressions) are named from--help; they were NOT run against an upgraded database.Tests
test/psa-billed.test.ts (new, 5 cases) and the narrowed sets, at e35cd45 / 050cce1
test/psa-billed.test.ts: after a run Billed + Not Yet Billed = Approved to Bill (1430.5 = 1430.5 + 0); new approved time and expense move Not Yet Billed only (1770.5 / 1430.5 / 340); a submitted expense moves nothing; deleting a billing step returns its rows to Not Yet Billed (600 / 0 / 600); a member reads none of the seven billing fields, the PM and finance read all three; the stored filterunbilled_amount > 0lists a project with something left and not one billed in full; with Order to Cash disabled the project reads 300 / 300 / 0 and new approved time moves it to 450 / 300 / 150.Tests 5 passed (5).project_memberrows, the member case failedmember reads no billable_labor_amount: expected 150 to be undefined.Tests 2 failed | 667 passed; the two were pins of decisions this card changes (psa-objects"the amount to bill stays readable",psa-module-packagenav roster), updated; rerun with 10 more files:Tests 236 passed (236); docs set after the last editTests 69 passed (69).pnpm validate0,pnpm typecheck0,pnpm lint(strict) 0,pnpm hygiene0,pnpm build0 at 050cce1. The fullpnpm testfarm is left to CI (a 560 s local attempt ran out of time behind the shared lock queue).Verification
Browser pass on a booted `objectstack dev` (19.0.0-next.3), as project manager, finance controller and project member, en and zh-CN, with Order to Cash on and off
Data: seed project PRJ-00002 linked to a seed order, a PM and a consultant staffed, a timesheet approved through the PM's Inbox (1.5 h, 300), Prepare Billing as the PM (one 300 step), then a second timesheet approved (2.5 h, 500). REST and screen agree: Approved to Bill 800, Billed 300, Not Yet Billed 500.
Approved to Bill 800.00 · Billed Labor 300.00 · Billed Expenses 0.00 · Billed 300.00 · Not Yet Billed 500.00(zh: 已批准待开票 800.00 · 已出账工时金额 300.00 · 已出账费用 · 已出账 · 未出账 500.00); the dashboard's billing row reads 800 / 300 / 500 and Billing by Project; the since-removed list view showed the project under the filter chip "Not Yet Billed: Greater than 0".GET /api/v1/meta/object/sys_audit_logand gets 404; the page renders.Class: maintainer. It changes a permission set (
project_memberloses read of Approved to Bill, Billable Labor and Billable Expenses, which it had), which AGENTS.md Who decides a change puts in the maintainer row; the PR stays a draft for his merge.First files to read:
src/sales/profiles/project-member.profile.ts(the permission change),src/psa/objects/project.object.ts(the four fields, the summary filters),src/psa/views/project.view.ts.Two-role rows, measured at 38475ee on a booted dev server over REST: project_manager+project_member and finance_controller+project_member read 7/7 billing fields; project_member alone 0/7. The Billing by Project table renders ("No data yet" on the fresh seed, no API error).
Two-minute check:
npx vitest run test/psa-billed.test.ts test/two-role-field-rows.test.ts— expect all passed.🤖 Generated with Claude Code
https://claude.ai/code/session_017xRBcUpajguxop2zMyDN9K