Page extension 6137 E-Doc. Purchase Order List

E-Document Core, Microsoft.Purchases.Document

src/Apps/W1/EDocument/App/src/Extensions/EDocPurchaseOrderList.PageExt.al113 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.Purchases.Document;using Microsoft.eServices.EDocument;using Microsoft.eServices.EDocument.OrderMatch;pageextension 6137 "E-Doc. Purchase Order List" extends "Purchase Order List"{    actions    {        addafter("P&osting")        {            group("E-Document")            {                action(MatchToOrder)                {                    Caption = 'Map E-Document Lines';                    ToolTip = 'Map received E-Document to the Purchase Order';                    ApplicationArea = All;                    Image = Reconcile;                    Visible = ShowMapToEDocument;                    trigger OnAction()                    var                        EDocument: Record "E-Document";                        EDocOrderMatch: Codeunit "E-Doc. Line Matching";                    begin                        EDocument.GetBySystemId(Rec."E-Document Link");                        EDocOrderMatch.RunMatching(EDocument);                    end;                }                action("PreviewEDocumentMapping")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Preview E-Document Mapping';                    Image = ViewDetails;                    ToolTip = 'Preview E-Document Mapping';                    trigger OnAction()                    var                        PurchaseLine: Record "Purchase Line";                        EDocMapping: Codeunit "E-Doc. Mapping";                    begin                        PurchaseLine.SetRange("Document No.", Rec."No.");                        EDocMapping.PreviewMapping(Rec, PurchaseLine, PurchaseLine.FieldNo("Line No."));                    end;                }            }        }        addlast(Prompting)        {#if not CLEAN29            action(MatchToOrderCopilotEnabled)            {                Caption = 'Map E-Document Lines';                ToolTip = 'Map received E-Document to the Purchase Order';                ApplicationArea = All;                Image = SparkleFilled;                Visible = false;                ObsoleteState = Pending;                ObsoleteReason = 'The E-Document Purchase Order Matching Copilot has been deprecated. AI-assisted line matching is now handled at import time in the E-Document Purchase Draft experience by codeunit "E-Doc. AI Tool Processor".';                ObsoleteTag = '29.0';                trigger OnAction()                var                    EDocument: Record "E-Document";                    EDocOrderMatch: Codeunit "E-Doc. Line Matching";                begin                    EDocument.GetBySystemId(Rec."E-Document Link");                    EDocOrderMatch.RunMatching(EDocument);                end;            }#endif        }        addlast(Category_Process)        {#if not CLEAN29            actionref(MapEDocumentCE_Promoted; MatchToOrderCopilotEnabled)            {                Visible = false;                ObsoleteState = Pending;                ObsoleteReason = 'The E-Document Purchase Order Matching Copilot has been deprecated. AI-assisted line matching is now handled at import time in the E-Document Purchase Draft experience by codeunit "E-Doc. AI Tool Processor".';                ObsoleteTag = '29.0';            }#endif            actionref(MapEDocument_Promoted; MatchToOrder)            {            }        }    }    trigger OnAfterGetCurrRecord()    var        EDocument: Record "E-Document";        EDocumentServiceStatus: Record "E-Document Service Status";    begin        ShowMapToEDocument := false;        if not IsNullGuid(Rec."E-Document Link") then begin            EDocument.GetBySystemId(Rec."E-Document Link");            EDocumentServiceStatus.SetRange("E-Document Entry No", EDocument."Entry No");            EDocumentServiceStatus.FindFirst();            ShowMapToEDocument := EDocumentServiceStatus.Status = Enum::"E-Document Service Status"::"Order Linked";        end;    end;    var        ShowMapToEDocument: Boolean;}