Resolve purchase lines to items on exact description match - #10466
Conversation
8d477c6 to
c234d0b
Compare
|
The new tests prove Text-to-Account Mapping takes precedence over the description match, but nothing proves that an Item Reference match still wins over the new description-match fallback when both would resolve the line. Add a regression test combining both signals to protect the resolution order (Item Reference > Text-to-Account Mapping > description match) against future reordering. Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
c234d0b to
04a23e9
Compare
04a23e9 to
8d384b1
Compare
|
The new tests hand-insert Suggested fix (apply manually — could not be anchored as a one-click suggestion): EDocumentPurchaseLine := LibraryEDoc.InsertPurchaseDraftLine(EDocument);
EDocumentPurchaseLine.Description := Item.Description;
EDocumentPurchaseLine.Modify();Knowledge: Line mapping was unavailable, so this was posted as an issue comment. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
Joshua (mynjj)
left a comment
There was a problem hiding this comment.
Please be aware that after this PR: #7546
This fix will no longer be applicable
What & why
Inbound invoice lines were falling through to G/L account matching even when an item with the exact same description already existed. The line was posted to a G/L account instead of the item.
This PR adds a deterministic step that resolves the line to the item when there is exactly one eligible item with that description. It runs after item reference and text-to-account mapping, so no impact on explicit setup.
Fixes AB#647171
How I validated this
What I tested and the outcome
Imported a sample invoice with a line whose description exactly matches an existing item. Before the change it resolved to a G/L account, after the change it resolves to the item.
Risk & compatibility
Matching only triggers when exactly one non blocked item matches and the unit of measure fits, so ambiguous cases keep the old behavior. No schema or upgrade impact.