Repository navigation
fix(revenue): Generate Quote copies the opportunity's product lines onto the quote (#2750) - #2782
Merged
Merged
Conversation
…point) Declarative updates of crm_sales_order.status, each offered only on the statuses its move leaves from in sales_order_status_progression. Work in progress: translations, tests and docs are not written yet, and the read-only Status half waits on a decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
…ons, tests and docs The three lifecycle actions from the resume point gain their confirm text, labels and success messages in all four locale packs; a disallowed move through an action answers the state machine's own refusal. Docs on the order pages, the product-sale walk-through and the FAQ say to click the buttons; Status stays editable on the form until objectstack#36806. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
…2750) quote_generation now reads the deal's crm_opportunity_line_item rows after create_quote and creates one crm_quote_line_item per row, as the rep, inside a guarded loop: the quote-line hooks price, title, number and roll up each copied line as they do a typed one, and the header discount applies to the rolled-up subtotal. A line the quote refuses is counted and named on a new result_partial screen (four locales). A deal with no lines keeps the header-only quote. Docs (three locales), the in-app quote page and the feature inventory row follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
…new link resolves Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAmQQaqVXpJepCqm4Xa
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
|
repo:hotcrm#1 · huangyiirene · session_01J8VVAmQQaqVXpJepCqm4Xa Seat record · ACCEPT · head
席位核对
|
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 #2750
Clause-②: no
Metadata-protocol: none
Metadata-impact: reviewer — a flow change (quote_generation) plus translations and docs; no permission set, sharing rule, object or field is touched, and nobody gains or loses access
维护者速读
What changes
src/revenue/flows/quote-generation.flow.ts: aftercreate_quote, aget_recordof the deal'scrm_opportunity_line_itemrows (limit: 1000, so a deal with no lines binds[]) and aloopthat creates onecrm_quote_line_itemper row through the ordinary insert, as the rep (the flow's defaultrunAs: 'user'). Each iteration is aguarded()try/catch (the repo's helper,src/sales/flows/_guarded-iteration.ts), countingcopiedCount/skippedCount.crm_product,quantity,unit_price,discount,description.list_priceis NOT sent: it isreadonlyon the quote line (the engine drops a caller's value) andquote_line_item_price_fillwrites it from the quote's price book on every insert that names a product, the rule a hand-typed line meets.product_titleandline_numbercome from their hooks the same way.quote_total_rolluprecomputes the quote Subtotal from its lines on each insert andquote_workflowderives Discount Amount / Total from it and the screen's discount. The header'ssubtotal: oppRecord.amountstays as the price of a line-less deal.result_partialscreen naming both counts. Clean copies end on the unchangedresultscreen (edgese6/e16, complementary conditionals onvars.skippedCount). Edgee4retired and left vacant; new edgese13–e17.src/revenue/translations/{zh-CN,es-ES,ja-JP}.ts:screens.result_partial(title, description, link label).content/docs/(product)/sales/quotes{,.zh-Hans,.zh-Hant}.mdx(Generating a quote steps 1–5, the sales-rep tip; the zh Discount-ceiling heading gets the explicitdiscount-ceilinganchor the new link needs, and the two existing in-page links move to it), the in-app pagesrc/revenue/docs/crm_revenue_quotes{,.zh}.md,docs/feature-inventory.mdrow QUO-004..changeset/2750-quote-copies-opportunity-lines.md(patch).Tests
test/flow-quote-lines.test.ts(booted stack via@objectstack/verify, every write as a sales rep):result.result_partialwith "1 … (1 copied)".result_partialin en / zh-CN / es-ES / ja-JP.e13re-pointed fromget_opp_linestocheck_stage(on-disk check: injected=1, removed=0) → the 2-line case goes red withexpected [] to deeply equal [ { …(6) }, { …(6) } ]; restored withgit checkout HEAD --,git diff HEADempty.Readings
pnpm verifyatb7cbd9f: validate, typecheck, lint (--strict), hygiene, build all green;pnpm testTest Files 334 passed / 1 failed (335), Tests 6465 passed / 1 failed / 58 skipped. The one failure wastest/docs-anchor-links.test.ts: the new#discount-ceilinglink on the zh pages had no matching heading id.fe0e5c3(docs-only: explicit anchor on the two zh headings, the two existing#折扣上限links moved to it). Atfe0e5c3:vitest run test/docs-→ Test Files 36 passed, Tests 773 passed / 9 skipped. The full suite was not re-run after that docs-only commit; CI runs it.vitest run test/flow-quote-lines.test.ts→ 11/11; withtest/flow-quote.test.tsandtest/quote-generation-result-screen.test.ts→ 42/42 (before the doc fix; nosrc/ortest/change sinceb7cbd9f).Acceptance notes
get_recordtakes no sort in 18.6.0 (GetRecordConfigSchemahas no sort key), so quote lines are numbered in the order the read returns them. On theobjectstack devboot this was the deal's order; under@objectstack/verifyit came back reversed, so the test matches lines by product. The docs say the order can differ. A sort onget_recordis a platform capability, raised in the report rather than worked around here.quote_accepted_orderalready numbers order lines the same way.line_numbers were 1 and 2, read back over REST); on the zh run it drew them in order. That is the related list's display order, unchanged by this PR.Verification
Dev boot (
objectstack dev, this branch), admin, en and zh-CN browser locales. Screenshots in the project files folderquote-from-opportunity-lines-2750/(not committed):en-two-lines-*: a deal with 2 lines (amount 38,300), discount 10% → quote QTE-0007 with 2 lines, Subtotal 38,300, Discount Amount 3,830, Total 34,470; result screen "Quote Created".en-partial-*: a deal with a 70% line and a 2 × 6,000 line → quote with 1 line, Subtotal 12,000; result screen "Quote Created, Lines Missing … 1 of the opportunity's product lines could not be copied onto it (1 copied)".zh-two-lines-*/zh-partial-*: the same in zh-CN ("报价单已创建" / "报价单已创建,部分明细未复制"); the quote page lists 报价单明细 2 with 小计 38,300.00.Read first:
src/revenue/flows/quote-generation.flow.ts(theget_opp_lines/copy_linesnodes and edgese6,e13–e17), thentest/flow-quote-lines.test.ts.Two-minute check: on a dev boot, Generate Quote on an opportunity with two product lines; the new quote shows the same two lines and a Subtotal equal to the opportunity's Amount.
🤖 Generated with Claude Code