Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d4422bb
feat(edoc): add Sub Total Mismatch notification type and handlers
ventselartur Jul 16, 2026
326f199
fix(edoc): stop overwriting purchase draft header total; notify on mi…
ventselartur Jul 16, 2026
e6e7785
test(edoc): cover purchase draft header total invariant and mismatch …
ventselartur Jul 16, 2026
4f7b286
test(edoc): strengthen draft totals tests (precondition assert, servi…
ventselartur Jul 16, 2026
50d902a
test(edoc): add subtotal mismatch notification test on line add; simp…
ventselartur Jul 16, 2026
7d00b83
test(edoc): expand purchase draft totals coverage
ventselartur Jul 16, 2026
0efa0b7
add more tests
ventselartur Jul 16, 2026
0711826
feat(edoc): add Sub Total Mismatch Dismissed flag to purchase header
ventselartur Jul 23, 2026
b84c6d0
fix(edoc): suppress dismissed sub total mismatch notification and re-…
ventselartur Jul 23, 2026
51b9dff
fix(edoc): persist dismissal on header when dismissing sub total mism…
ventselartur Jul 23, 2026
06b453c
test(edoc): cover sub total mismatch dismissal persistence and re-arm
ventselartur Jul 23, 2026
67953b0
merge from main
ventselartur Jul 24, 2026
e0bebb4
merge from main
ventselartur Jul 27, 2026
a39512b
move dismiss field from e-doc purch header to e-doc notification
ventselartur Jul 27, 2026
d38231c
Redesign the feature to evaluate the mismatch from header and from ch…
ventselartur Jul 31, 2026
ae0bd06
Merge remote-tracking branch 'origin/main' into bugs/642364-edoc-purc…
ventselartur Jul 31, 2026
44187d1
address PR review feedback
ventselartur Jul 31, 2026
3adc4d6
Fix currency tests
ventselartur Jul 31, 2026
d0c6221
address PR review feedback
ventselartur Aug 3, 2026
ebd6fb5
Set TestPermissions = Disabled on E-Doc purchase draft totals tests
Copilot Aug 3, 2026
d704503
Refactore according to the feedback
ventselartur Aug 6, 2026
b30b396
Remove locks on the new labels
ventselartur Aug 6, 2026
3688b11
Merge branch 'bugs/642364-edoc-purchase-draft-header-totals' of https…
ventselartur Aug 6, 2026
1a3d751
Reset notification handler expectation state in Initialize
ventselartur Aug 7, 2026
c32da47
Rename 0000UVM telemetry label to match the state it measures
ventselartur Aug 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/Apps/W1/EDocument/App/docs/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,29 @@ The codebase uses compiler directives to manage deprecation:
- `#if not CLEANSCHEMA26` / `#if not CLEANSCHEMA29` -- table schema changes (field removals) that need separate cleanup due to schema migration constraints

When reading the code, content inside these blocks is legacy. The code outside (or in the `#else` branch) is the current implementation.

## Notification state vs. display

Purchase Document Draft notifications are split across two codeunits so that a
call site tells you whether UI is raised.

`"E-Doc. Draft Notif. State"` (6436) owns the `E-Document Notification` rows, the
Sub Total mismatch calculation, and its telemetry. It never constructs or sends a
`Notification` and knows nothing about `My Notifications`.

`"E-Document Notification"` (6123) is the only codeunit consumers call. It gates on
`My Notifications`, delegates state changes downward, builds `Notification` objects,
and hosts the `Dismiss…`/`Disable…` action handlers. The dependency is one-way.

The procedure verb is the contract:

| Prefix | Guarantee |
|---|---|
| `Add…` / `Refresh…` / `Remove…` / `ReArm…` | State only, never displays |
| `Show…` / `RefreshAndShow…` | Displays a notification |
| `Is…` | Query, no side effects |

Handler names passed to `Notification.AddAction` are resolved by string at runtime,
so `DismissSubTotalMismatchNotification` and friends cannot be renamed safely.

*Updated: 2026-08-05 -- documented the notification state vs. display split.*

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ table 6126 "E-Document Notification"
Caption = 'Message';
ToolTip = 'Specifies the message of the E-Document notification.';
}
field(6; Dismissed; Boolean)
{
Caption = 'Dismissed';
DataClassification = SystemMetadata;
ToolTip = 'Specifies whether the user has dismissed the notification.';
}
}
keys
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ enum 6126 "E-Document Notification Type"
{
Caption = 'Vendor Matched By Name Not Address';
}
value(2; "Sub Total Mismatch")
{
Caption = 'Sub Total Mismatch';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ page 6183 "E-Doc. Purchase Draft Subform"
TempEDocumentPOMatchWarnings: Record "E-Doc PO Match Warning";
EDocPurchaseHistMapping: Codeunit "E-Doc. Purchase Hist. Mapping";
EDocPOMatching: Codeunit "E-Doc. PO Matching";
EDocumentNotification: Codeunit "E-Document Notification";
AdditionalColumns, OrderMatchedCaption, MatchWarningsCaption, MatchWarningsStyleExpr, MatchedEntityName : Text;
LineAmount: Decimal;
DimVisible1, DimVisible2, HasAdditionalColumns, IsEDocumentMatchedToAnyPOLine, IsLineMatchedToOrderLine, IsLineMatchedToReceiptLine, HasEDocumentOrderMatchWarnings, VATProdPostGroupIsVisible : Boolean;
Expand Down Expand Up @@ -382,6 +383,12 @@ page 6183 "E-Doc. Purchase Draft Subform"
SetVATProductPostingGroupVisibility();
end;

trigger OnDeleteRecord(): Boolean
begin
EDocumentNotification.RefreshAndShowSubTotalMismatchAfterLineDeletion(Rec);
exit(true);
end;

internal procedure SetEDocumentPurchaseHeader(EDocPurchHeader: Record "E-Document Purchase Header")
begin
EDocumentPurchaseHeader := EDocPurchHeader;
Expand All @@ -407,10 +414,8 @@ page 6183 "E-Doc. Purchase Draft Subform"
VATProdPostGroupIsVisible := PurchSetup."Resolve VAT Group Purch EDoc";
end;

local procedure UpdateCalculatedAmounts(UpdateParentRecord: Boolean)
local procedure UpdateCalculatedAmounts(UserModifiedAmount: Boolean)
var
TotalEDocPurchaseLine: Record "E-Document Purchase Line";
EDocumentImportHelper: Codeunit "E-Document Import Helper";
LineSubtotal: Decimal;
DiscountExceedsSubtotalErr: Label 'Discount should not exceed the subtotal of the line';
begin
Expand All @@ -423,19 +428,9 @@ page 6183 "E-Doc. Purchase Draft Subform"
else
if Rec."Total Discount" / LineSubtotal > 1 then
Error(DiscountExceedsSubtotalErr);
if not UpdateParentRecord then
if not UserModifiedAmount then
exit;
if not EDocumentPurchaseHeader.Get(Rec."E-Document Entry No.") then
exit;
EDocumentPurchaseHeader."Sub Total" := 0;
TotalEDocPurchaseLine.SetRange("E-Document Entry No.", Rec."E-Document Entry No.");
if TotalEDocPurchaseLine.FindSet() then
repeat
EDocumentPurchaseHeader."Sub Total" += Round(TotalEDocPurchaseLine.Quantity * TotalEDocPurchaseLine."Unit Price", EDocumentImportHelper.GetCurrencyRoundingPrecision(EDocumentPurchaseHeader."Currency Code")) - TotalEDocPurchaseLine."Total Discount";
until TotalEDocPurchaseLine.Next() = 0;
EDocumentPurchaseHeader.Total := EDocumentPurchaseHeader."Sub Total" + EDocumentPurchaseHeader."Total VAT" - EDocumentPurchaseHeader."Total Discount";
EDocumentPurchaseHeader.Modify();
CurrPage.Update();
EDocumentNotification.RefreshAndShowSubTotalMismatchAfterLineEdit(Rec);
end;

local procedure SetHasAdditionalColumns()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ page 6181 "E-Document Purchase Draft"
begin
UpdateTotal();
EDocumentPurchaseHeader.Modify();
GlobalEDocumentNotification.RefreshAndShowSubTotalMismatchAfterHeaderEdit(EDocumentPurchaseHeader);
CurrPage.Update();
end;
}
Expand Down Expand Up @@ -266,6 +267,7 @@ page 6181 "E-Document Purchase Draft"
trigger OnValidate()
begin
EDocumentPurchaseHeader.Modify();
GlobalEDocumentNotification.RefreshAndShowSubTotalMismatchAfterHeaderEdit(EDocumentPurchaseHeader);
CurrPage.Update();
end;
}
Expand Down Expand Up @@ -509,7 +511,6 @@ page 6181 "E-Document Purchase Draft"
var
EDocumentDataStorage: Record "E-Doc. Data Storage";
PurchasesPayablesSetup: Record "Purchases & Payables Setup";
EDocumentNotification: Codeunit "E-Document Notification";
EDocPOMatching: Codeunit "E-Doc. PO Matching";
MatchesRemovedMsg: Label 'This e-document was matched to purchase order lines, but the matches are no longer consistent with the current data. The matches have been removed';
begin
Expand All @@ -528,7 +529,7 @@ page 6181 "E-Document Purchase Draft"
HasErrors := false;
PageEditable := IsEditable();
IsCreditMemo := Rec."Document Type" = Enum::"E-Document Type"::"Purchase Credit Memo";
EDocumentNotification.SendPurchaseDocumentDraftNotifications(Rec."Entry No");
GlobalEDocumentNotification.RefreshAndShowPendingDraftNotifications(Rec."Entry No");
if PurchasesPayablesSetup.Get() then
ApplyVATDiffEnabled := PurchasesPayablesSetup."Apply VAT Diff. For Purch EDoc";

Expand Down Expand Up @@ -779,6 +780,7 @@ page 6181 "E-Document Purchase Draft"
EDocumentPurchaseHeader: Record "E-Document Purchase Header";
EDocumentServiceStatus: Record "E-Document Service Status";
EDocumentErrorHelper: Codeunit "E-Document Error Helper";
GlobalEDocumentNotification: Codeunit "E-Document Notification";
EDocumentProcessing: Codeunit "E-Document Processing";
FeatureTelemetry: Codeunit "Feature Telemetry";
GlobalEDocumentHelper: Codeunit "E-Document Helper";
Expand Down
Loading
Loading