Backport #7132 to releases/28.x: Fix E-Document premature Commit during Inventory Pick posting#7210
Merged
Groenbech96 merged 4 commits intoreleases/28.xfrom Mar 19, 2026
Merged
Conversation
Fix E-Document premature `Commit()` during Inventory Pick posting that causes data inconsistency (Bug 625438). When an Inventory Pick posts with an E-Document Service Flow configured, the E-Document export path executes an unconditional `Commit()` inside `OnAfterPostSalesDoc`. This commits the Sales Shipment and ILE before warehouse entries are created, causing an inventory-to-warehouse ledger mismatch if the warehouse bin check later fails. - Add `AllowCreateEDocument` guard to `OnAfterPostSalesDoc`, `OnAfterTransferOrderPostShipment`, and `OnAfterPostServiceDoc` subscribers to skip E-Document creation during Inventory Pick flows (when `InvtPickPutaway`, `CommitIsSuppressed`, or `PreviewMode` is set) - Subscribe to the new `OnAfterPostWhseActivityCompleted` event for deferred E-Document creation — this event fires after all posting work completes (including `PostRelatedInboundTransfer`), so the full transaction is already persisted - Migrate Subcontracting subscriber from obsoleted `OnAfterPostWhseActivHeader` to `OnAfterPostWhseActivityCompleted` **NAV dependency:** NAV master PR [242528](https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_git/NAV/pullrequest/242528) (obsoletes `OnAfterPostWhseActivHeader`, adds `OnAfterPostWhseActivityCompleted`) [AB#625588](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/625588) Fixes #7178 --------- Co-authored-by: Magnus Hartvig Grønbech <magnushar@microsoft.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: mazhelez <mazhelez@users.noreply.github.com>
…Pick Test for bug 625438: verifies that when an Inventory Pick posting fails (lot not available on the selected bin), no Posted Sales Shipment, ILE, or E-Document is created. Also verifies the happy path where successful posting creates all expected records including the deferred E-Document. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Groenbech96
commented
Mar 18, 2026
src/Apps/W1/EDocument/Test/src/Processing/EDocInvtPickTest.Codeunit.al
Outdated
Show resolved
Hide resolved
JesperSchulz
previously approved these changes
Mar 18, 2026
Aleyenda
previously approved these changes
Mar 18, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
darjoo
approved these changes
Mar 19, 2026
aholstrup1
approved these changes
Mar 19, 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.
Summary
Cherry-pick of 590e653 from
maintoreleases/28.x.Commit()during Inventory Pick posting that causes data inconsistency (Bug 625438)AllowCreateEDocumentguard to skip E-Document creation during Inventory Pick flowsOnAfterPostWhseActivityCompletedfor deferred E-Document creationOnAfterPostWhseActivityCompletedOriginal PR: #7132
AB#625589