microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
768 stars 611 forks source link

codeunit 7311 "Whse. Worksheet-Create" (AvailQtyToPick instead of AvailQtyToPickBase) #22554

Closed YevgenKar closed 10 months ago

YevgenKar commented 1 year ago

Please include the following with each issue:

1. Describe the bug pls check, codeunit 7311 "Whse. Worksheet-Create" procedure AdjustQtyToHandle variable AvailQtyToPick . Variable must be converted to AvailQtyToPickBase and only then transferred to procedure CalcReservedNotFromILEQty to variable QtyBaseAvailToPick

2. To Reproduce just check the code in codeunit 7311

//******error source code
local procedure AdjustQtyToHandle(var WhseWkshLine: Record "Whse. Worksheet Line")
    var
        TypeHelper: Codeunit "Type Helper";
        AvailQtyToPick, AvailQtyToPickBase : Decimal;
    begin
        AvailQtyToPick := WhseWkshLine.AvailableQtyToPickExcludingQCBins();
        WhseWkshLine."Qty. to Handle" := TypeHelper.Minimum(AvailQtyToPick, WhseWkshLine."Qty. Outstanding");
        WhseWkshLine."Qty. to Handle (Base)" := WhseWkshLine.CalcBaseQty(WhseWkshLine."Qty. to Handle");
        AvailQtyToPickBase := WhseWkshLine.CalcBaseQty(AvailQtyToPick);
        WhseWkshLine.CalcReservedNotFromILEQty(AvailQtyToPickBase, WhseWkshLine."Qty. to Handle", WhseWkshLine."Qty. to Handle (Base)");
    end;

//******bug-fixed code to replace
local procedure AdjustQtyToHandle(var WhseWkshLine: Record "Whse. Worksheet Line")
    var
        TypeHelper: Codeunit "Type Helper";
        AvailQtyToPick, AvailQtyToPickBase : Decimal;
    begin
        AvailQtyToPick := WhseWkshLine.AvailableQtyToPickExcludingQCBins();
        WhseWkshLine."Qty. to Handle" := TypeHelper.Minimum(AvailQtyToPick, WhseWkshLine."Qty. Outstanding");
        WhseWkshLine."Qty. to Handle (Base)" := WhseWkshLine.CalcBaseQty(WhseWkshLine."Qty. to Handle");
// >>
// comment to fix bug
        // WhseWkshLine.CalcReservedNotFromILEQty(AvailQtyToPick, WhseWkshLine."Qty. to Handle", WhseWkshLine."Qty. to Handle (Base)");
// added to fix bug
        AvailQtyToPickBase := WhseWkshLine.CalcBaseQty(AvailQtyToPick);
        WhseWkshLine.CalcReservedNotFromILEQty(AvailQtyToPickBase, WhseWkshLine."Qty. to Handle", WhseWkshLine."Qty. to Handle (Base)");
//>>
    end;

3. Expected behavior when creating lines in the pick worksheet, the quantity to handle must be an integer with the available quantity to pick, and it is decimal (with numbers after the decimal point)

4. Actual behavior when creating lines in the pick worksheet, the quantity to handle with the available quantity to pick is decimal (with numbers after the decimal point)

5. Versions:

JesperSchulz commented 10 months ago

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: 13768.

JesperSchulz commented 9 months ago

Availability update: We will publish a fix for this issue in the next update for release 23.

Build ID to track: 13981.