Skip to content

Backport #7132 to releases/28.x: Fix E-Document premature Commit during Inventory Pick posting#7210

Merged
Groenbech96 merged 4 commits intoreleases/28.xfrom
backport/releases/28.x/7132
Mar 19, 2026
Merged

Backport #7132 to releases/28.x: Fix E-Document premature Commit during Inventory Pick posting#7210
Groenbech96 merged 4 commits intoreleases/28.xfrom
backport/releases/28.x/7132

Conversation

@Groenbech96
Copy link
Contributor

@Groenbech96 Groenbech96 commented Mar 18, 2026

Summary

Cherry-pick of 590e653 from main to releases/28.x.

  • 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

Original PR: #7132

AB#625589

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>
@Groenbech96 Groenbech96 requested a review from a team as a code owner March 18, 2026 10:11
@github-actions github-actions bot added the AL: Apps (W1) Add-on apps for W1 label Mar 18, 2026
@github-actions github-actions bot added this to the Version 28.1 milestone Mar 18, 2026
…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 Groenbech96 self-assigned this Mar 18, 2026
JesperSchulz
JesperSchulz previously approved these changes Mar 18, 2026
Aleyenda
Aleyenda previously approved these changes Mar 18, 2026
@Groenbech96 Groenbech96 enabled auto-merge (squash) March 18, 2026 14:17
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Groenbech96 Groenbech96 dismissed stale reviews from Aleyenda and JesperSchulz via c9764a8 March 18, 2026 15:11
@Groenbech96 Groenbech96 requested a review from Aleyenda March 18, 2026 19:08
@Groenbech96 Groenbech96 merged commit 223613a into releases/28.x Mar 19, 2026
34 checks passed
@Groenbech96 Groenbech96 deleted the backport/releases/28.x/7132 branch March 19, 2026 13:50
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.

5 participants