Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors E-Document purchase order matching warnings to replace the coarse-grained QuantityMismatch and NotYetReceived warning types with more specific, granular warning types: ExceedsInvoiceableQty, ExceedsRemainingToInvoice, and OverReceipt. It also improves the UI presentation by adding severity-based styling, a drill-down detail view, and a warning message field. Additionally, it adds a missing UoM validation check during invoice finalization.
Changes:
- Replaced
QuantityMismatch/NotYetReceivedwarnings with three new granular warning types (ExceedsInvoiceableQty,ExceedsRemainingToInvoice,OverReceipt) with computed warning messages stored in a new"Warning Message"field on the table - Refactored the draft subform page to display warnings with severity-based styling (Unfavorable/Ambiguous/Subordinate) and added a drill-down to show detailed warning messages
- Added a
MissingInformationForMatchcheck during invoice finalization to block creation when UoM information is missing
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
EDocPOMatchWarning.Enum.al |
Added three new enum values: ExceedsInvoiceableQty, ExceedsRemainingToInvoice, OverReceipt |
EDocPOMatchWarning.Table.al |
Added "Warning Message" Text[250] field to store computed warning details |
EDocPOMatching.Codeunit.al |
Replaced old warning logic with new granular quantity checks (I vs R, I vs J) and updated finalization/validation references |
EDocPurchaseDraftSubform.Page.al |
Extracted UpdateMatchWarnings and ShowMatchWarningDetails procedures; added severity-based styling and drill-down |
EDocCreatePurchaseInvoice.Codeunit.al |
Updated finalization to check ExceedsInvoiceableQty and added MissingInformationForMatch blocking check |
EDocPOMatchingUnitTests.Codeunit.al |
Expanded tests from 2 to 5 quantity warning scenarios, updated all references to new warning types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...Document/App/src/Processing/Import/Purchase/PurchaseOrderMatching/EDocPOMatching.Codeunit.al
Outdated
Show resolved
Hide resolved
| POMatchWarnings."E-Doc. Purchase Line SystemId" := EDocumentPurchaseLine.SystemId; | ||
| POMatchWarnings."Warning Type" := "E-Doc PO Match Warning"::MissingInformationForMatch; | ||
| POMatchWarnings.Insert(); | ||
| exit; |
There was a problem hiding this comment.
The MissingInformationForMatch warning is inserted without setting the "Warning Message" field (lines 234-236), while all other warning types set it. This requires ShowMatchWarningDetails() in the subform page to special-case this warning type with a hardcoded label. Consider setting the "Warning Message" here as well, so that all warning types are handled uniformly and future consumers of this record don't need to know about this special case.
| TempPOMatchWarnings.SetRange("Warning Type", "E-Doc PO Match Warning"::ExceedsInvoiceableQty); | ||
| if not TempPOMatchWarnings.IsEmpty() then | ||
| Error(SomeLinesNotYetReceivedErr); | ||
| TempPOMatchWarnings.SetRange("Warning Type", "E-Doc PO Match Warning"::MissingInformationForMatch); | ||
| if not TempPOMatchWarnings.IsEmpty() then | ||
| Error(MissingInformationForMatchErr); |
There was a problem hiding this comment.
The newly added MissingInformationForMatch finalization check (lines 57-59) blocks invoice creation when draft lines are missing unit of measure information. While the warning calculation itself is tested in EDocPOMatchingUnitTests, there's no test verifying that finalization is actually blocked when this warning is present. Consider adding a test that sets up a draft with a line missing UoM, matches it to a PO line, and verifies that ApplyDraftToBC raises the MissingInformationForMatchErr error. The existing ExceedsInvoiceableQty check (lines 54-56) similarly lacks a finalization-level test.
Fixes AB#621954