[Master][ALL-E] No Reservation created when the item is selected by Description in Sales Lines#9653
Draft
sanjmaurya wants to merge 5 commits into
Draft
Conversation
…Bug-643213-Main-ReservationCreatedWhenItemISelected-byDescription
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.
Bug 643213: [Master][ALL-E] No Reservation created when the item is selected by Description in Sales Lines
Fixes AB#6493213
Issue :- No Reservation created when the item is selected by Description in Sales Lines
Cause :- Reserve = Always items, the automatic reservation in NoOnAfterValidate (SalesOrderSubform.Page.al) is gated by (Rec."Outstanding Qty. (Base)" <> 0) and (Rec."No." <> xRec."No."). That guard is evaluated after a CurrPage.SaveRecord() call.
Manual description entry: "No." is resolved inside the field's OnValidate, xRec."No." stays blank, so the guard holds → reservation created. (Already working after the CurrFieldNo edits.)
Description lookup (dropdown): "No." is set earlier in OnAfterLookup → SaveLookupSelection. By the time the inner CurrPage.SaveRecord() runs, xRec re-syncs to the saved record, so Rec."No." <> xRec."No." flips to false and AutoReserve() is skipped.
Solutions :- n NoOnAfterValidate, capture whether "No." changed into a local NoHasChanged before any CurrPage.SaveRecord() runs, and use that captured value in the reservation guard. This preserves the working manual path (value stays true) and fixes the lookup path.
Two files now carry the fix:
SalesLine.Table.al — CurrFieldNo := FieldNo("No.") set at the three points where Description resolves to an item No. (exact/similar match branches, SaveLookupSelection, RestoreLookupSelection), matching the Purchase Line pattern.
SalesOrderSubform.Page.al — capture NoHasChanged before SaveRecord and use it in the AutoReserve guard.