Skip to content

Backport #7132 to releases/28.0: Fix E-Document premature Commit during Inventory Pick posting#7251

Open
Groenbech96 wants to merge 4 commits intoreleases/28.0from
backport/releases/28.0/7132
Open

Backport #7132 to releases/28.0: Fix E-Document premature Commit during Inventory Pick posting#7251
Groenbech96 wants to merge 4 commits intoreleases/28.0from
backport/releases/28.0/7132

Conversation

@Groenbech96
Copy link
Contributor

@Groenbech96 Groenbech96 commented Mar 19, 2026

Summary

Cherry-pick of #7132 from releases/28.x to releases/28.0 (via PR #7210).

  • Fix E-Document premature Commit() during Inventory Pick posting that causes data inconsistency (Bug 625438)
  • Add AllowCreateEDocument guard to skip E-Document creation during Inventory Pick flows
  • Subscribe to OnAfterPostWhseActivityCompleted for deferred E-Document creation
  • Migrate Subcontracting subscriber to OnAfterPostWhseActivityCompleted
  • Add regression test for the fix

Original PR: #7132
28.x backport PR: #7210

AB#626088

Groenbech96 and others added 4 commits March 19, 2026 11:35
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>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Groenbech96 Groenbech96 requested a review from a team as a code owner March 19, 2026 10:36
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Mar 19, 2026
@github-actions github-actions bot added this to the Version 28.0 milestone Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant