[Event Request] Codeunit 99000854 "Inventory Profile Offsetting" CalcInventoryProfileRemainingQty
Why do you need this change?
Can we get events to modify calculation of the remaining quantity of the CalcInventoryProfileRemainingQty funtion in the codeunit "Inventory Profile Offsetting".
Describe the request
local procedure CalcInventoryProfileRemainingQty(var InventoryProfile: Record "Inventory Profile"; DocumentNo: Code[20]; LineNo: Integer) RemQty: Decimal
var
SalesLine: Record "Sales Line";
IsHandled: Boolean;
begin
OnBeforeCalcInventoryProfileRemainingQty(InventoryProfile, DocumentNo, LineNo, RemQty, IsHandled);
if IsHandled then
exit(RemQty);
RemQty := 0;
InventoryProfile.SetRange("Source Type", Database::"Sales Line");
InventoryProfile.SetRange("Source Order Status", SalesLine."Document Type"::Order);
InventoryProfile.SetRange("Ref. Blanket Order No.", DocumentNo);
if InventoryProfile.FindSet() then
repeat
SalesLine.SetLoadFields("Blanket Order No.", "Blanket Order Line No.");
SalesLine.Get(SalesLine."Document Type"::Order, InventoryProfile."Source ID", InventoryProfile."Source Ref. No.");
if (SalesLine."Blanket Order No." = DocumentNo) and (SalesLine."Blanket Order Line No." = LineNo) then
RemQty += InventoryProfile."Remaining Quantity (Base)";
until InventoryProfile.Next() = 0;
OnAfterCalcInventoryProfileRemainingQty(InventoryProfile, DocumentNo, LineNo, RemQty);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeCalcInventoryProfileRemainingQty(var InventoryProfile: Record "Inventory Profile"; DocumentNo: Code[20]; LineNo: Integer; var RemQty: Decimal; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterCalcInventoryProfileRemainingQty(var InventoryProfile: Record "Inventory Profile"; DocumentNo: Code[20]; LineNo: Integer; var RemQty: Decimal)
begin
end;
Internal work item: AB#604896
Hello @JosefKainzSHB Can you please provide a justification for adding IsHandled OnBeforeProcedure event? Would the OnAfter be enough for your requirement?
Hello @AleksandricMarko For my requirement the OnAfter event is enough. I just added the OnBefore event because i considered it good practice to add an OnBefore and an OnAfter event to a procedure
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. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 44914.