[Master]-[Drop shipment reversal] Undo Shipment fails with blank Bin Code at bin-mandatory location - #11274
Conversation
| ItemJnlLine."Shortcut Dimension 2 Code" := PurchRcptLine."Shortcut Dimension 2 Code"; | ||
| ItemJnlLine."Dimension Set ID" := PurchRcptLine."Dimension Set ID"; | ||
| ItemJnlLine.Description := PurchRcptLine.Description; | ||
| ItemJnlLine."Drop Shipment" := (PurchRcptLine."Sales Order No." <> '') and (PurchRcptLine."Sales Order Line No." <> 0); |
There was a problem hiding this comment.
The new "Drop Shipment" derivation in UndoPurchaseReceiptLine.Codeunit.al uses (PurchRcptLine."Sales Order No." <> '') and (PurchRcptLine."Sales Order Line No." <> 0), but the existing, equivalent derivation elsewhere in the base app (PurchRcptLine.Table.al, InsertInvLineFromRcptLine: if "Sales Order No." = '' then PurchLine."Drop Shipment" := false else PurchLine."Drop Shipment" := true) keys off "Sales Order No." alone. If a drop-shipment receipt line can legitimately have a populated "Sales Order No." with a zero "Sales Order Line No." (e.g. due to partial data migration, an upstream defect, or a not-yet-linked line), the new undo logic would compute "Drop Shipment" = false while the rest of the app would treat the same line as a drop shipment, causing the reversing item journal line to under- or over-report Drop Shipment status inconsistently with sibling logic.
Recommendation:
- align the condition with the established
"Sales Order No." <> ''check used elsewhere, or, if the extra"Sales Order Line No." <> 0guard is intentionally stricter, add a brief comment explaining why undo processing diverges from the existing convention.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.41.6
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesThis change marks the undo item journal line as a drop shipment when reversing linked sales shipments and purchase receipts. That matches the reported scenario where undoing a drop shipment at a bin-mandatory location should not fail only because the posted line has no bin code. The fix is placed before the warehouse undo and item journal posting calls. This is the right point: Problem-solution fitFit: Strong The reported problem is a reversal failure for drop-shipment shipment/receipt flows at a bin-mandatory location. The diff sets the missing drop-shipment flag before the code reaches bin validation and ledger posting, so it addresses the full path that caused the failure. SuggestionsS1 (🔴 High): Missing drop-shipment undo regression test Risk assessment and necessityRisk: The code change is small, but it runs in inventory posting and ledger-entry reversal paths. A wrong or incomplete fix could still block reversals, or create item/value ledger entries that do not carry the drop-shipment state needed by later application logic. Necessity: The change is needed because drop-shipment reversals should not require normal bin validation for a blank bin code. The scope is appropriate because it covers the shared W1 sales and purchase flows plus the RU sales override.
|
Fixes AB#649618