[Shopify] Fix Order Totals factbox opening an unrelated sales order for a linked posted invoice - #10307
Open
Onat Buyukakkus (onbuyuka) wants to merge 2 commits into
Open
[Shopify] Fix Order Totals factbox opening an unrelated sales order for a linked posted invoice#10307Onat Buyukakkus (onbuyuka) wants to merge 2 commits into
Onat Buyukakkus (onbuyuka) wants to merge 2 commits into
Conversation
…or a linked posted invoice The Order Totals factbox (page 30172) was not document-type aware: the Sales Document No. drill-down always opened the Sales Order page, and totals were resolved only from the open Sales Header. After posting, the open header is gone but the factbox retained stale document values. Resolve the sales document through the Shpfy Doc. Link To Doc. link table (same source as the Linked Documents factbox), preferring the posted invoice, then open invoice, then open order, with a fallback to the header fields for legacy orders. Totals are computed per document type (open vs posted), the Sales Document No. and Number of Lines drill-downs are now type-aware, and the section is cleared when no document resolves. Adds regression + general factbox coverage in a new test codeunit. Fixes AB#647019 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f09314b6-9542-408a-97ee-8a92b1f83c46
The var parameter SalesDocumentNo in ResolveSalesDocument/FindLinkedDocument collided with the page control of the same name, producing new AA0245 warnings that fail the AL-Go build. Rename the parameter to ResolvedDocumentNo. Verified with CodeCop (base.ruleset): the two AA0245 warnings are gone. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f09314b6-9542-408a-97ee-8a92b1f83c46
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.
What & why
On the Shopify Orders page, the Order Totals factbox (page 30172) was not document-type aware. The Sales Document No. drill-down always opened the Sales Order page, and the factbox resolved totals only from the open
Sales Header. When the linked document was an invoice — or the order had already been posted — this opened an unrelated sales order and could display stale totals, because the open header no longer exists butSales Invoice No.still held the old number.This change resolves the sales document through the same
Shpfy Doc. Link To Doc.link table that the Linked Documents factbox uses, so the factbox stays correct after posting:CalculateSalesTotals, posted invoices viaCalculatePostedSalesInvoiceTotals.Shpfy IOpenBCDocumentinterface (opens the correct open order / open invoice / posted invoice), and the Number of Lines drill-down is type-aware (Sales LinesvsPosted Sales Invoice Lines).Linked work
Fixes AB#647019
How I validated this
What I tested and the outcome
al_build) — package generated, 0 errors, no new analyzer warnings.ShpfyOrderTotalsFBTest(139587,Order Handling/) with 9 tests:Sales Document No., Excl./Incl. VAT, VAT, Number of Lines, Prices Including VAT, and Currency Code.Sales Lines(open) andPosted Sales Invoice Lines(posted).Risk & compatibility
Sales Order No./Sales Invoice No.preserves behavior for orders created before the document link table was populated.