Why do you need this change?
We need to intercept the calculation of ToQtyToPickBase in UpdateToQtyToPick in Codeunit 7312 "Create Pick" before the standard block that assigns ToQtyToPickBase := QtyAvailableBase and caps it to TotalQtyToPickBase. At this point all input quantities are resolved, making it the correct position to apply an alternative base quantity calculation.
The standard block unconditionally sets ToQtyToPickBase to QtyAvailableBase and then caps it to TotalQtyToPickBase. This comparison does not account for scenarios where a near-zero rounding threshold must be applied to determine whether the available quantity covers the total, requiring a different condition to decide which value to assign to ToQtyToPickBase.
No event exists in UpdateToQtyToPick at any point. The public OnBeforeUpdateQuantitiesToPick event fires in UpdateQuantitiesToPick before the call to UpdateToQtyToPick and exposes all quantity parameters with IsHandled, but its scope covers the entire UpdateQuantitiesToPick call chain including UpdateFromQtyToPick and UpdateTotalQtyToPick. A subscriber there would have to replicate all three sub-procedures to bypass only the ToQtyToPickBase assignment inside UpdateToQtyToPick.
Describe the request
Add an integration event OnUpdateToQtyToPickOnBeforeSetToQtyToPickBase in UpdateToQtyToPick in Codeunit 7312 "Create Pick" before the standard ToQtyToPickBase assignment block, with IsHandled to allow a subscriber to set ToQtyToPickBase and skip the standard assignment.
local procedure UpdateToQtyToPick(QtyAvailableBase: Decimal; ToQtyPerUOM: Decimal; var ToQtyToPick: Decimal; var ToQtyToPickBase: Decimal; TotalQtyToPick: Decimal; TotalQtyToPickBase: Decimal)
var
IsHandled: Boolean;
begin
IsHandled := false;
OnUpdateToQtyToPickOnBeforeSetToQtyToPickBase(QtyAvailableBase, ToQtyPerUOM, ToQtyToPick, ToQtyToPickBase, TotalQtyToPick, TotalQtyToPickBase, IsHandled); // <---- New Event
if not IsHandled then begin
ToQtyToPickBase := QtyAvailableBase;
if ToQtyToPickBase > TotalQtyToPickBase then
ToQtyToPickBase := TotalQtyToPickBase;
end;
ToQtyToPick := Round(ToQtyToPickBase / ToQtyPerUOM, UnitOfMeasureManagement.QtyRndPrecision());
if ToQtyToPick > TotalQtyToPick then
ToQtyToPick := TotalQtyToPick;
if (ToQtyToPick <> TotalQtyToPick) and (ToQtyToPickBase = TotalQtyToPickBase) then
if Abs(1 - ToQtyToPick / TotalQtyToPick) <= UnitOfMeasureManagement.QtyRndPrecision() then
ToQtyToPick := TotalQtyToPick;
end;
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnUpdateToQtyToPickOnBeforeSetToQtyToPickBase(QtyAvailableBase: Decimal; ToQtyPerUOM: Decimal; var ToQtyToPick: Decimal; var ToQtyToPickBase: Decimal; TotalQtyToPick: Decimal; TotalQtyToPickBase: Decimal; var IsHandled: Boolean)
begin
end;
Alternatives evaluated: OnBeforeUpdateQuantitiesToPick fires in UpdateQuantitiesToPick before the call to UpdateToQtyToPick and exposes all quantity parameters with IsHandled, but bypassing it requires reimplementing the full UpdateFromQtyToPick and UpdateTotalQtyToPick logic alongside, since the entire call chain is skipped. No event exists inside UpdateToQtyToPick at any point.
Why do you need this change?
We need to intercept the calculation of
ToQtyToPickBaseinUpdateToQtyToPickin Codeunit 7312 "Create Pick" before the standard block that assignsToQtyToPickBase := QtyAvailableBaseand caps it toTotalQtyToPickBase. At this point all input quantities are resolved, making it the correct position to apply an alternative base quantity calculation.The standard block unconditionally sets
ToQtyToPickBasetoQtyAvailableBaseand then caps it toTotalQtyToPickBase. This comparison does not account for scenarios where a near-zero rounding threshold must be applied to determine whether the available quantity covers the total, requiring a different condition to decide which value to assign toToQtyToPickBase.No event exists in
UpdateToQtyToPickat any point. The publicOnBeforeUpdateQuantitiesToPickevent fires inUpdateQuantitiesToPickbefore the call toUpdateToQtyToPickand exposes all quantity parameters withIsHandled, but its scope covers the entireUpdateQuantitiesToPickcall chain includingUpdateFromQtyToPickandUpdateTotalQtyToPick. A subscriber there would have to replicate all three sub-procedures to bypass only theToQtyToPickBaseassignment insideUpdateToQtyToPick.Describe the request
Add an integration event
OnUpdateToQtyToPickOnBeforeSetToQtyToPickBaseinUpdateToQtyToPickin Codeunit 7312 "Create Pick" before the standardToQtyToPickBaseassignment block, withIsHandledto allow a subscriber to setToQtyToPickBaseand skip the standard assignment.Event Signature:
Alternatives evaluated: OnBeforeUpdateQuantitiesToPick fires in UpdateQuantitiesToPick before the call to UpdateToQtyToPick and exposes all quantity parameters with IsHandled, but bypassing it requires reimplementing the full UpdateFromQtyToPick and UpdateTotalQtyToPick logic alongside, since the entire call chain is skipped. No event exists inside UpdateToQtyToPick at any point.