ALAppExtensions
ALAppExtensions copied to clipboard
[Event Request] Codeunit 6620 "Copy Document Mgt." - Procedure "CopyPurchCrMemoLinesToDoc" - new event "OnAfterItemLedgEntryBufSetFilterEntryTypeOnCopyPurchCrMemoLinesToDoc"
We need to set filter to the variable "ItemLedgEntryBuf" in Procedure "CopyPurchCrMemoLinesToDoc" of Codeunit 6620 "Copy Document Mgt." after your standard filter for lines with "Job No." and before calling the "ItemTrackingDocMgt".
Please add a new event raiser and publisher for doing this.
OLD CODE:
if (Type = Type::Item) and (Quantity <> 0) and ("Prod. Order No." = '') and
PurchaseDocCanReceiveTracking(ToPurchHeader)
then begin
FromPurchInvLine."Document No." := OldInvDocNo;
FromPurchInvLine."Line No." := "Return Shipment Line No.";
FromPurchInvLine.GetItemLedgEntries(ItemLedgEntryBuf, true);
if IsCopyItemTrkg(ItemLedgEntryBuf, CopyItemTrkg, FillExactCostRevLink) then begin
if "Job No." <> '' then
ItemLedgEntryBuf.SetFilter("Entry Type", '<> %1', ItemLedgEntryBuf."Entry Type"::"Negative Adjmt.");
if MoveNegLines or not ExactCostRevMandatory then
ItemTrackingDocMgt.CopyItemLedgerEntriesToTemp(TempTrkgItemLedgEntry, ItemLedgEntryBuf)
else
ItemTrackingDocMgt.CollectItemTrkgPerPostedDocLine(
TempItemTrkgEntry, TempTrkgItemLedgEntry, true, "Document No.", "Line No.");
NEW CODE:
if (Type = Type::Item) and (Quantity <> 0) and ("Prod. Order No." = '') and
PurchaseDocCanReceiveTracking(ToPurchHeader)
then begin
FromPurchInvLine."Document No." := OldInvDocNo;
FromPurchInvLine."Line No." := "Return Shipment Line No.";
FromPurchInvLine.GetItemLedgEntries(ItemLedgEntryBuf, true);
if IsCopyItemTrkg(ItemLedgEntryBuf, CopyItemTrkg, FillExactCostRevLink) then begin
if "Job No." <> '' then
ItemLedgEntryBuf.SetFilter("Entry Type", '<> %1', ItemLedgEntryBuf."Entry Type"::"Negative Adjmt.");
// start kvspsa - Event Raiser
OnAfterItemLedgEntryBufSetFilterEntryTypeOnCopyPurchCrMemoLinesToDoc(FromPurchLineBuf, ItemLedgEntryBuf);
// stop kvspsa
if MoveNegLines or not ExactCostRevMandatory then
ItemTrackingDocMgt.CopyItemLedgerEntriesToTemp(TempTrkgItemLedgEntry, ItemLedgEntryBuf)
else
ItemTrackingDocMgt.CollectItemTrkgPerPostedDocLine(
TempItemTrkgEntry, TempTrkgItemLedgEntry, true, "Document No.", "Line No.");
NEW PUBLISHER:
// start kvspsa - Event Publisher
[IntegrationEvent(false, false)]
local procedure OnBeforeItemLedgEntryFindOnSplitPstdPurchLinesPerILE(FromPurchLine: Record "Purchase Line"; var ReturnValue: Boolean; var IsHandled: Boolean)
begin
end;
// stop kvspsa
sorry. Wrong Publisher!
Correct Publisher Code:
// start kvspsa - Event Publisher
[IntegrationEvent(false, false)]
local procedure OnAfterItemLedgEntryBufSetFilterEntryTypeOnCopyPurchCrMemoLinesToDoc(var FromPurchLineBuf: Record "Purchase Line"; var ItemLedgEntryBuf: Record "Item Ledger Entry")
begin
end;
// stop kvspsa
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.