From 2f70d4ba57ecd579b3d628063d8350fe79f0caef Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Tue, 18 Nov 2025 15:44:21 +0100 Subject: [PATCH 1/9] Add microsoftInternal__NAV-202855 --- dataset/bcbench_nav.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index c03cbfa64..1771ff497 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,3 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.3", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From e426b6e0fe02ca1b7e186c73ee5997294bb7dd8d Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Tue, 18 Nov 2025 17:06:53 +0100 Subject: [PATCH 2/9] Use 26.0 Now --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index 1771ff497..9f97f883f 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.3", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From 477522ac5d028a30c29d964d65b13b3a3d46837e Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Tue, 18 Nov 2025 20:19:47 +0100 Subject: [PATCH 3/9] Use 25.5 Now --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index 9f97f883f..cc1b57b0c 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.5", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From ca64a730f1986054374d7fff30f95deb50bacd49 Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Tue, 18 Nov 2025 20:50:06 +0100 Subject: [PATCH 4/9] Use 25.0 --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index cc1b57b0c..86a8cc0bd 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.5", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From 18f07d19b387827fe66d0ae457b5a83213136318 Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Tue, 18 Nov 2025 21:46:21 +0100 Subject: [PATCH 5/9] Use 24.0 --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index 86a8cc0bd..0d22e64ee 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "24.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From b6d8e786b9d11b81022b301419141135a08151a4 Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Wed, 19 Nov 2025 00:48:15 +0100 Subject: [PATCH 6/9] Use 24.5 --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index 0d22e64ee..b8b10327f 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "24.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "24.5", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From 49e8e1d5e039cd4347c564da2a02d7ab91781f98 Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Wed, 19 Nov 2025 09:12:18 +0100 Subject: [PATCH 7/9] Use 26.0.28412.0 --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index b8b10327f..f75aa08df 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "24.5", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "26.0.28412.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From 132ad3c9c6ab69f829f01644adbc481e15bc9979 Mon Sep 17 00:00:00 2001 From: Jiawen Sun Date: Wed, 19 Nov 2025 12:36:43 +0100 Subject: [PATCH 8/9] Use 25.2 --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index f75aa08df..f1e4adf01 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "26.0.28412.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.2", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} From 22122c651711cfd396dc00b26408c7a005d3f3c2 Mon Sep 17 00:00:00 2001 From: "Haoran Sun (Business Central)" Date: Tue, 25 Nov 2025 08:18:21 +0100 Subject: [PATCH 9/9] try 25.3 --- dataset/bcbench_nav.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataset/bcbench_nav.jsonl b/dataset/bcbench_nav.jsonl index f1e4adf01..1771ff497 100644 --- a/dataset/bcbench_nav.jsonl +++ b/dataset/bcbench_nav.jsonl @@ -23,4 +23,4 @@ {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-206527", "base_commit": "d8e867062d4137cf5df2d9d2b8a71bb53210f685", "created_at": "2025-02-07", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "problem_statement": "Title: If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\nRepro Steps:\n1. Use existing Item with no activity, or create new item. This will be the COMPONENT Item. Will use PCS as UOM.\n2. For the Component Item, go into Related > Item UOM > and set 'Quantity Rounding Precision' = 1 on the bottom.\n3. Component Item should have\n Replenishment System = PURCHASE\n Rounding Precision = .01\n Reorder Policy = Lot-for-Lot\n Include Inventory = TRUE\n4. Then have another Item, I'll call it FG Item which is:\n Replenishment System = PRODUNCTION ORDER\n Rounding Precision = 1\n Reorder Policy = ORDER\n Production BOM => Create new Certified Production BOM that consumes COMPONENT Item with 'Quantity Per' = .09\n5. Now create Sales Order for any Customer for FG Item for 1 Quantity at BLUE (or MAIN) location.\n6. On the Sales Order go to Actions > Plan > Planning > Create Prod. Order and choose 'Released' and 'Item Order'.\n7. Then choose Order Tracking and then 'Show' which will take you to the Released Prod. Order.\n8. We will see prod. Order for FG Item with 1 qty. Go to Line > Components\n\n**EXPECTED RESULTS** = 'Quantity Per' and 'Expected Quantity' = .09\n**ACTUAL RESULTS** = 'Quantity Per' and 'Expected Quantity' = 0\n\nIf you were then to delete the Released Production Order, and go to the Planning Worksheet and run the Calc. Regenerative Plan for the 2 items, you would receive an error:\n\"The value in the Qty. Rounding Precision field on the Item Unit of Measure page is causing the rounding precision for the Expected Quantity field to be incorrect.\"\n\nDescription:\n2If a component's Item UOM has a 'Quantity Rounding Precision' set to 1, and a Finished Good consumes partial quantity, the Production Order created from the Planning section of a Sales Order pulls in the Component but with a 'Quantity Per' and 'Expected Quantity' of 0. If we are producing 1 FG Item and the 'Quantity Per' is set to consume .1 component, we would expect 'Quantity Per' and 'Expected Quantity' both = .1. There is no error message.\n\nBut if you run the Planning Worksheet's 'Calc. Regenerative Plan', then you will get an error message about the 'Quantity Rounding Precision'.\n\nI don't believe the 'Quantity Rounding Precision' in the Item UOM should have any influence on this process. I always thought this field was only for scenario with Picking and when Base UOM is larger than the smallest UOM, and picking in smallest UOM. There is a lot of confusion about this 'Quantity Rounding Precision' field within the Item UOM actually.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\nindex 7415eaa53cc..2573227dbca 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrderPlanningIII.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137088 \"SCM Order Planning - III\"\n LineExistErr: Label 'Requistion line in %1 worksheet should exist for item %2';\n PurchaseLineQuantityBaseErr: Label '%1.%2 must be nearly equal to %3.', Comment = '%1 : Purchase Line, %2 : Quantity (Base), %3 : Value.';\n BOMFixedQtyCalcFormulaErr: Label 'BOM Fixed Quantity Calculation Formula should be used to calculate the values.';\n+ RelesedProdOrderComponentQtyPerRoundingErr: Label 'Relesed Production Order Item Component Quantity per %1 Not Match With Expected Result %2';\n+ RelesedProdOrderComponentExpQtyRoundingErr: Label 'Relesed Production Order Item Component Expected Quantity %1 Not Match With Expected Result %2';\n \n [Test]\n [HandlerFunctions('MakeSupplyOrdersPageHandler')]\n@@ -2988,6 +2990,73 @@ codeunit 137088 \"SCM Order Planning - III\"\n VerifyStartingTimeOnFirmPlannedProductionOrder(StartingTime, ChildItem.\"No.\", ProductionOrderNo);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ModalPageHandler,ErrorMessageHandler')]\n+ procedure ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking()\n+ var\n+ BaseItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ComponentItem: Record Item;\n+ ProdOrderComp: Record \"Prod. Order Component\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProductItem: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ ExpectedQty: Decimal;\n+ RelesedProdOrderNo: Code[20];\n+ Status: Enum \"Production Order Status\";\n+ begin\n+ // [SCENARIO 562766] If a component's Item UOM has a 'Quantity Rounding Precision' of 1, & a Finished Good consumes partial quantity, \n+ // the Prod. Order created from the Planning of a Sales Order pulls in the Component with a 'Qty. Per' and 'Exp. Qty.' of 0.\n+ Initialize();\n+\n+ // [GIVEN] Created Component Item\n+ LibraryInventory.CreateItem(ComponentItem);\n+ ComponentItem.Validate(\"Replenishment System\", ComponentItem.\"Replenishment System\"::Purchase);\n+ ComponentItem.Validate(\"Rounding Precision\", LibraryRandom.RandPrecision());\n+ ComponentItem.Validate(\"Reordering Policy\", ComponentItem.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ ComponentItem.Validate(\"Include Inventory\", true);\n+ ComponentItem.Modify(true);\n+\n+ // [GIVEN] Set Qty. Rounding Precision = 1 for Component Item\n+ BaseItemUnitOfMeasure.Get(ComponentItem.\"No.\", ComponentItem.\"Base Unit of Measure\");\n+ BaseItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", 1);\n+ BaseItemUnitOfMeasure.Modify();\n+\n+ // [GIVEN] Created Production Bom using Component Item\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, ComponentItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, ComponentItem.\"No.\", LibraryRandom.RandDecInDecimalRange(0.01, 0.99, 2));\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify();\n+\n+ // [GIVEN] Created Master Item and Production Bom Assigned to Master Item\n+ LibraryInventory.CreateItem(ProductItem);\n+ ProductItem.Validate(\"Replenishment System\", ProductItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProductItem.Validate(\"Rounding Precision\", 1);\n+ ProductItem.Validate(\"Reordering Policy\", ProductItem.\"Reordering Policy\"::Order);\n+ ProductItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ProductItem.Modify(true);\n+\n+ // [GIVEN] Created Sales Order Using Master Item Quantity - 1\n+ CreateSalesOrder(SalesHeader, ProductItem.\"No.\", '', 1, 1);\n+\n+ // [WHEN] Created Released Prod. Order From Sales Order Using Planning\n+ LibraryPlanning.CreateProdOrderUsingPlanning(ProductionOrder, Status::\"Firm Planned\", SalesHeader.\"No.\", ProductItem.\"No.\");\n+ RelesedProdOrderNo := LibraryManufacturing.ChangeStatusFirmPlanToReleased(ProductionOrder.\"No.\");\n+\n+ // [WHEN] Find Released Production Order Component\n+ FindProdOrderLine(ProdOrderLine, RelesedProdOrderNo);\n+ FindProdOrderComponent(ProdOrderComp, ProdOrderLine.\"Prod. Order No.\", ComponentItem.\"No.\");\n+\n+ // [WHEN] Getting Expected result using Component Rounding Precision\n+ ExpectedQty := Round(ProductionBOMLine.\"Quantity per\" * BaseItemUnitOfMeasure.\"Qty. Rounding Precision\" / BaseItemUnitOfMeasure.\"Qty. Rounding Precision\", ComponentItem.\"Rounding Precision\");\n+\n+ // [THEN] Expected Quantity must be Equal to Production Order Component \"Quantity per\" And \"Expected Quantity\"\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Quantity per\", StrSubstNo(RelesedProdOrderComponentQtyPerRoundingErr, ProdOrderComp.\"Quantity per\", ExpectedQty));\n+ Assert.AreEqual(ExpectedQty, ProdOrderComp.\"Expected Quantity\", StrSubstNo(RelesedProdOrderComponentExpQtyRoundingErr, ProdOrderComp.\"Expected Quantity\", ExpectedQty));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3805,6 +3874,14 @@ codeunit 137088 \"SCM Order Planning - III\"\n Assert.IsTrue(ProductionOrder.\"Starting Time\" = StartingTime, '');\n end;\n \n+ local procedure FindProdOrderLine(var ProdOrderLine: Record \"Prod. Order Line\"; ProductionOrderNo: Code[20])\n+ begin\n+ ProdOrderLine.Reset();\n+ ProdOrderLine.SetRange(Status, ProdOrderLine.Status::Released);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrderNo);\n+ ProdOrderLine.FindFirst();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure MakeSupplyOrdersPageHandler(var MakeSupplyOrders: Page \"Make Supply Orders\"; var Response: Action)\n@@ -3911,5 +3988,16 @@ codeunit 137088 \"SCM Order Planning - III\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ModalPageHandler(var CreateOrderFromSales: Page \"Create Order From Sales\"; var Response: Action)\n+ begin\n+ Response := Action::Yes;\n+ end;\n+\n+ [MessageHandler]\n+ procedure ErrorMessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 5f7a2b890fe..5b63565d0f1 100644\n--- a/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/IT/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -286,8 +287,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -323,6 +324,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -1001,6 +1003,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\nindex 36930a9e2aa..5d44df0a596 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/CalculateProdOrder.Codeunit.al\n@@ -43,6 +43,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp: Record \"Prod. Order Component\";\n ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\";\n ProdBOMLine: array[99] of Record \"Production BOM Line\";\n+ ProdLineItem: Record Item;\n UOMMgt: Codeunit \"Unit of Measure Management\";\n MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n VersionMgt: Codeunit VersionManagement;\n@@ -260,8 +261,8 @@ codeunit 99000773 \"Calculate Prod. Order\"\n \n local procedure TransferBOMProcessItem(Level: Integer; LineQtyPerUOM: Decimal; ItemQtyPerUOM: Decimal; var ErrorOccured: Boolean)\n var\n- Item2: Record Item;\n ComponentSKU: Record \"Stockkeeping Unit\";\n+ Item2: Record Item;\n IsHandled: Boolean;\n QtyRoundPrecision: Decimal;\n begin\n@@ -297,6 +298,7 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderComp.Validate(\"Unit of Measure Code\", ProdBOMLine[Level].\"Unit of Measure Code\");\n if (ProdOrderComp.\"Item No.\" <> '') and Item2.Get(ProdOrderComp.\"Item No.\") then\n QtyRoundPrecision := UOMMgt.GetQtyRoundingPrecision(Item2, ProdBOMLine[Level].\"Unit of Measure Code\");\n+ CheckingRoundingPrecision(Item2, ProdLineItem, QtyRoundPrecision, Level);\n if QtyRoundPrecision <> 0 then\n ProdOrderComp.\"Quantity per\" := Round(ProdBOMLine[Level].\"Quantity per\" * LineQtyPerUOM / ItemQtyPerUOM, QtyRoundPrecision)\n else\n@@ -975,6 +977,21 @@ codeunit 99000773 \"Calculate Prod. Order\"\n ProdOrderLineToCheck.TestField(Quantity);\n end;\n \n+ local procedure CheckingRoundingPrecision(ChildItem: Record Item; ProdLineItem: Record Item; var QtyRoundPrecision: Decimal; Level: Integer)\n+ begin\n+ if (ChildItem.\"Rounding Precision\" = 0) or (QtyRoundPrecision = 0) then\n+ exit;\n+\n+ if (not ProdLineItem.Get(ProdOrderLine.\"Item No.\")) or (ProdLineItem.\"Replenishment System\" <> ProdLineItem.\"Replenishment System\"::\"Prod. Order\") then\n+ exit;\n+\n+ if (ChildItem.\"Base Unit of Measure\" <> ProdBOMLine[Level].\"Unit of Measure Code\") then\n+ exit;\n+ QtyRoundPrecision := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision\" := ChildItem.\"Rounding Precision\";\n+ ProdOrderComp.\"Qty. Rounding Precision (Base)\" := ChildItem.\"Rounding Precision\";\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterInsertProdRoutingLine(var ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; ProdOrderLine: Record \"Prod. Order Line\")\n begin\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208851", "base_commit": "b626cb16a65cd529d91527d1d5dac501d6ecb06e", "created_at": "2025-03-04", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "problem_statement": "Title: In the Sales Price Lists, the 'Defines' field always defaults to Price & Discount when dealing with Customer Price Group/Customer Disc Group setting\nRepro Steps:\nReproduced in CRONUS GB v25.4\nEnable 'New Sales Price Experience' in Feature Management.\n1. Go to Sales Price Lists\n2. Click on New to generate a New Sales Price List.\n3. Set Assign-to-type to Customer Disc. Group\n4. View Columns for: **Discount**\n5. Insert a single item line, using only Line Discount.\n6. Set the Sales Price List to Status 'Active'\n7. Go back to the Sales Price Lists Page.\n\nYou will notice \"Defines\" has changed back to Prices & Discounts Same behavior is replicable with Price for Customer Price Group\n**Expected Result:** Defines should remain as Discounts if only discounts are in the Sales Price list\n**Actual Results:** 'Defines' Always defaults to 'Prices & Discount'\n\nDescription:\nThe issue is with the setting for the \"Defines\" field. The setting may be changed from 'Price & Discount' to 'Discount' because only Line Discounts may be used in the new Price Group configuration. However, after closing the Page, the system will always default back to the 'Price & Discount', even though only Line Discounts are defined, because the code doesn't pass the value correctly.\n\nThe Partner Developer highlighted the following code:\nThe call stack:\n- GetAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:342)\n- GetDefaultAmountType (\\ext11_packandshipchanges\\Table\\7005\\Price Source.dal:182)\n- UpdateAmountType (\\ext11_packandshipchanges\\Table\\7000\\Price List Header.dal:567)\n- OnClosePage (\\ext11_packandshipchanges\\Page\\7016\\Sales Price List.dal:600)\n\nIn the Function:`UpdateAmountType`, the following code is used:\n\"Amount Type\" := PriceSource.GetDefaultAmountType(); The code reflects it as empty. No value is passed to it, so it always defaults to 'Price & Discount'\n", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\nindex 5f586214ecb..c18252ac131 100644\n--- a/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/PriceListsUI.Codeunit.al\n@@ -4366,6 +4366,39 @@ codeunit 134117 \"Price Lists UI\"\n PurchasePriceList.Caption()));\n end;\n \n+ [Test]\n+ procedure AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList()\n+ var\n+ PriceListHeader: Record \"Price List Header\";\n+ CustomerDiscountGroup: Record \"Customer Discount Group\";\n+ SalesPriceList: TestPage \"Sales Price List\";\n+ PriceListHeaderCode: Code[20];\n+ begin\n+ // [SCENARIO 566994] Bug fix to ensure the field \"Amount Type\" does not change after closing the page \"Sales Price List\" \n+ Initialize(true);\n+\n+ // [GIVEN] Sales Price List for discount\n+ PriceListHeaderCode := LibraryUtility.GenerateGUID();\n+ SalesPriceList.OpenEdit();\n+ SalesPriceList.New();\n+ SalesPriceList.Code.SetValue(PriceListHeaderCode);\n+ SalesPriceList.Description.SetValue(LibraryUtility.GenerateGUID());\n+ SalesPriceList.SourceType.SetValue(\"Price Source Type\"::\"Customer Disc. Group\");\n+ SalesPriceList.AmountType.SetValue(\"Price Amount Type\"::Discount);\n+ CustomerDiscountGroup.Init();\n+ CustomerDiscountGroup.Code := LibraryUtility.GenerateGUID();\n+ CustomerDiscountGroup.Insert();\n+ SalesPriceList.AssignToNo.SetValue(CustomerDiscountGroup.Code);\n+ SalesPriceList.Status.SetValue(\"Price Status\"::Active);\n+\n+ // [WHEN] Close the page \"Sales Price List\"\n+ SalesPriceList.Close();\n+\n+ // [THEN] Check the field \"Amount Type\" has not reverted to Price & Discount\n+ PriceListHeader.Get(PriceListHeaderCode);\n+ Assert.IsTrue((PriceListHeader.\"Amount Type\" = PriceListHeader.\"Amount Type\"::Discount), 'The field \"Amount Type\" has changed after closing the page \"Sales Price List\"');\n+ end;\n+\n local procedure Initialize(Enable: Boolean)\n var\n PriceListHeader: Record \"Price List Header\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\nindex fb6adbb607d..9e6fd459241 100644\n--- a/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Pricing/PriceList/PriceListHeader.Table.al\n@@ -562,6 +562,7 @@ table 7000 \"Price List Header\"\n var\n xAmountType: Enum \"Price Amount Type\";\n begin\n+ CopyTo(PriceSource);\n xAmountType := \"Amount Type\";\n if \"Source Type\" in [\"Source Type\"::\"Customer Disc. Group\", \"Source Type\"::\"Customer Price Group\"] then\n \"Amount Type\" := PriceSource.GetDefaultAmountType()\n"} {"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-208320", "base_commit": "d080f087349d4713e1782f2f2630819714cb6738", "created_at": "2025-02-27", "environment_setup_version": "26.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "problem_statement": "Title: The Email and Phone No. don't update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\nRepro Steps:\n1. Go to Contacts and find CT000012 - \"Miss Patricia Doyle\" with 'Company Name' = (John Haddock Insurance Co.)\n2. Edit the contact and add any 'Phone Number' and 'Mobile Phone No.'\n3. Go to Sales Invoices and Create a new sales invoice and for Customer 10000.\n3. Go down to the Shipping and Billing tab and set 'Bill-to' = \"Another Customer\"\n Now see how more fields are introduced, including the Contact and Contact info with Phone numbers and email, should be for \"Mr. Andy Teal\" who is contact for Customer 10000.\n5. Then set Name = 30000 (John Haddock Insurance Co.) and say yes to change bill-to customer.\nNotice we have Contact = \"Miss Patricia Doyle\"....\n\n**EXPECTED RESULTS:** The Phone Number(s) and Email for \"Miss Patricia Doyle\" should pull in.\n**ACTUAL RESULTS:** The fields are the same as they were for the previous contact \"Mr. Andy Teal\" and you need to refresh the Page so it pulls in the new Phone numbers and email for \"Mr. Andy Teal\" Contact.\nDescription:\nCopied and Derived from Support Case Review", "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\nindex bc3ad2bbe5c..30e993b56af 100644\n--- a/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMSalesDocumentsII.Codeunit.al\n@@ -4462,6 +4462,51 @@ codeunit 134386 \"ERM Sales Documents II\"\n SalesOrder.SalesLines.\"Invoice Discount Amount\".AssertEquals(SalesHeader.\"Invoice Discount Value\");\n end;\n \n+ [HandlerFunctions('CustomerLookupHandler,ConfirmHandlerYes')]\n+ [Test]\n+ procedure UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice()\n+ var\n+ Contact: array[2] of Record Contact;\n+ Customer: array[2] of Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesInvoice: TestPage \"Sales Invoice\";\n+ begin\n+ // [SCENARIO 564632] The Email and Phone No. should update when selecting Another Customer in the \"Bill-to\" field of a Sales Invoice\n+ Initialize();\n+\n+ // [GIVEN] Create First Customer with First Contact with Phone = \"111111111\", Mobile Phone = \"222222222\" and Email = \"contact1@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[1], Customer[1]);\n+ UpdateContactInfo(Contact[1], '111111111', '222222222', 'contact1@mail.com');\n+ Contact[1].Modify(true);\n+\n+ // [GIVEN] Create Second Customer with Second Contact with Phone = \"333333333\", Mobile Phone = \"444444444\" and Email = \"contact2@mail.com\"\n+ LibraryMarketing.CreateContactWithCustomer(Contact[2], Customer[2]);\n+ UpdateContactInfo(Contact[2], '333333333', '444444444', 'contact2@mail.com');\n+ Contact[2].Modify(true);\n+\n+ // [GIVEN] Create Sales Invoice with First Customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer[1].\"No.\");\n+\n+ // [GIVEN] Sales Invoice Card is opened\n+ LibraryVariableStorage.Enqueue(Customer[2].\"No.\");\n+ LibraryVariableStorage.Enqueue('');\n+ LibraryVariableStorage.Enqueue(true); // yes to change \"Bill-to Customer No.\"\n+ SalesInvoice.OpenEdit();\n+ SalesInvoice.FILTER.SetFilter(\"No.\", SalesHeader.\"No.\");\n+\n+ // [WHEN] Select Second Customer when lookup \"Bill-to Customer Name\"\n+ SalesInvoice.\"Bill-to Name\".Lookup();\n+\n+ // [THEN] Verify Sales Invoice \"Phone No.\" = \"333333333\"\n+ SalesInvoice.BillToContactPhoneNo.AssertEquals(Contact[2].\"Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Mobile Phone No.\" = \"444444444\"\n+ SalesInvoice.BillToContactMobilePhoneNo.AssertEquals(Contact[2].\"Mobile Phone No.\");\n+\n+ // [THEN] Verify Sales Invoice \"Email\" = \"contact2@mail.com\"\n+ SalesInvoice.BillToContactEmail.AssertEquals(Contact[2].\"E-Mail\");\n+ end;\n+\n [Test]\n [Scope('OnPrem')]\n procedure UpdateExtendedTextTypeNotAllowed()\n@@ -6595,5 +6640,14 @@ codeunit 134386 \"ERM Sales Documents II\"\n CustomerLookup.Filter.SetFilter(Name, LibraryVariableStorage.DequeueText());\n CustomerLookup.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure CustomerLookupHandler(var CustomerLookup: TestPage \"Customer Lookup\")\n+ begin\n+ CustomerLookup.GotoKey(LibraryVariableStorage.DequeueText());\n+ Assert.AreEqual(LibraryVariableStorage.DequeueText(),\n+ CustomerLookup.Filter.GetFilter(\"Date Filter\"), 'Wrong Date Filter.');\n+ CustomerLookup.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\nindex 1dee700e044..a3b2013773f 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/BlanketSalesOrder.Page.al\n@@ -648,6 +648,23 @@ page 507 \"Blanket Sales Order\"\n Rec.SetRange(\"Bill-to Customer No.\");\n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\nindex 84ba27e1b17..3f876b15fd0 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesCreditMemo.Page.al\n@@ -552,6 +552,23 @@ page 44 \"Sales Credit Memo\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\nindex ee0d93e0f64..930047f5653 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesInvoice.Page.al\n@@ -803,6 +803,25 @@ page 43 \"Sales Invoice\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\nindex 77cf2b1863e..2a751833971 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesOrder.Page.al\n@@ -812,6 +812,25 @@ page 42 \"Sales Order\"\n CurrPage.Update();\n end;\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if not ((BillToOptions = BillToOptions::\"Custom Address\") and not ShouldSearchForCustByName) then begin\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\nindex 7827a9ece78..5851f14e04b 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesQuote.Page.al\n@@ -763,6 +763,23 @@ page 41 \"Sales Quote\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\ndiff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\nindex e9c58725477..a0e9bb787e7 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesReturnOrder.Page.al\n@@ -613,6 +613,23 @@ page 6630 \"Sales Return Order\"\n \n CurrPage.Update();\n end;\n+\n+ trigger OnLookup(var Text: Text): Boolean\n+ var\n+ Customer: Record Customer;\n+ begin\n+ if Customer.SelectCustomer(Customer) then begin\n+ xRec := Rec;\n+ Rec.\"Bill-to Name\" := Customer.Name;\n+ Rec.Validate(\"Bill-to Customer No.\", Customer.\"No.\");\n+ end;\n+\n+ if Rec.GetFilter(\"Bill-to Customer No.\") = xRec.\"Bill-to Customer No.\" then\n+ if Rec.\"Bill-to Customer No.\" <> xRec.\"Bill-to Customer No.\" then\n+ Rec.SetRange(\"Bill-to Customer No.\");\n+\n+ CurrPage.Update();\n+ end;\n }\n field(\"Bill-to Address\"; Rec.\"Bill-to Address\")\n {\n"} -{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.2", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"} +{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-202855", "base_commit": "b3bde30f9cea3f9daa0ab563b6c96a018cf3bfcb", "created_at": "2024-12-13", "environment_setup_version": "25.3", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "hints_text": "", "FAIL_TO_PASS": [{"codeunitID": 137079, "functionName": ["CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder"]}], "PASS_TO_PASS": [], "problem_statement": "Title: [ALL-E] When Changing a Planned Prod. Order that has Lot Tracking specified and \"Prospect\" Reservation Entry, into a Released Prod. Order, it is not changed to a Surplus Entry hence when Planning is run, it suggests a new Prod. Order on the P. line\nRepro Steps:\nManufacturing Setup has 'Component at Location' = BLUE Create new Item that has 'Replenishment System' = Produced, 'Reorder Policy' = Lot-for-Lot, and Item Tracking = LOTALL. Create new Sales Order for Customer 50000, for this new Item at BLUE Location for 1 qty. with 'Shipment Date' = 4/10/24 (mm/dd/yy) Create new Planned Production Order for this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Planned Prod. Order go into Item Tracking Lines and add LOT01 for 1 qty and close the Item Tracking page. Run Table 337 and see the \"Prospect\" entry. Now Change Status of the Planned Production Order to \"Released Production Order\". Run Table 337 and see the new entry:Expected Results: This would change to \"Surplus\"Actual Results: It is \"Prospect\". Now to demonstrate further, go to Planning Worksheet and go to Prepare > Calculate Regenerative Plan.... for Starting and Ending Date for Month of April, for this Item and at BLUE Location filter, run this. A new Planning line for a new Planned Production Order. If you run table 337 you can see an additional supply line that is Tracking, tracked against the Demand. Problem here is we already have a Released Production Order to satisfy this demand, but because it is still \"Prospect\" it doesn't care about it. NOW, if we were to delete the Planning Line, delete the Released Production Order, and create a new Released Production Order (not Planned Prod. Order) and it is the same as step 4 above.... with this new Item for 1 qty, Due Date = 4/10/24, at BLUE Location and then \"Refresh\" the Production Order. On the Released Prod. Order go into Item Tracking Lines and add LOT02 for 1 qty and close the Item Tracking page. Now you can see Table 337 has 'Surplus' Entry for this Supply. Now if you run Planning again like step 9, there will be no suggestion for a new Production Order. And if you review table 337, you just have the Tracking of the Released Prod. Order tracked to the Sales Demand.\nDescription:\nDerived from Support Case Review: https://dynamicssmb2.visualstudio.com/Dynamics%20SMB/_workitems/edit/506883 When changing the Planned Prod. Order (with Lot specified) to Released, it stays as \"Prospect\" and Planning generates new Production Order Planning Line to satisfy Sales Demand even though we already have released Prod. Order. If I instead create Released Prod. Order however, with Lot specified and \"Surplus\" entry, Planning will not create new Planning Line for Production and the Surplus Entry will be seen by Planning engine and create Tracking Entry for Sales Demand to the manually created Released.\n", "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\nindex 16678728c31..6d3c902f46d 100644\n--- a/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMProductionOrderIII.Codeunit.al\n@@ -5528,6 +5528,56 @@\n \n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ItemTrackingHandler,MessageHandlerWithoutValidation')]\n+ procedure CheckReservationEntryStatusWhenPlannedProdOrderConvertToReleasedProdOrder()\n+ var\n+ Item: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionOrder: Record \"Production Order\";\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesHeader: Record \"Sales Header\";\n+ PlannedProdOrder: TestPage \"Planned Production Order\";\n+ TotalQuantity: Decimal;\n+ begin\n+ // [SCENARIO 523992] Change the reservation entry status from prospect to surplus when planned prod. order convert to the released prod. order.\n+ Initialize();\n+\n+ // [GIVEN] Set location code in Manufacturing Setup.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Components at Location\", LocationBlue.Code);\n+ ManufacturingSetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Lot Tracking.\n+ CreateItemWithLotTracking(Item);\n+\n+ // [GIVEN] Create a Sales Order.\n+ TotalQuantity := CreateSalesOrderOnManufacturingLocation(SalesHeader, Item.\"No.\", LibraryRandom.RandInt(5), LocationBlue.Code);\n+\n+ // [GIVEN] Create Production Order.\n+ CreateProdOrderOnManufacturingLocation(ProductionOrder, Item.\"No.\", TotalQuantity, LocationBlue.Code);\n+\n+ // [WHEN] Refreshing released production order.\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Open Planned Prod. Order page.\n+ PlannedProdOrder.OpenEdit();\n+ PlannedProdOrder.GoToRecord(ProductionOrder);\n+\n+ // [GIVEN] Enqueue the Lot No. and Quantity value.\n+ OpenItemTrackingLinesSetValueInProdOrderLine(LibraryUtility.GenerateGUID(), '', TotalQuantity);\n+\n+ // [WHEN] Invoke the Item Tracking Page and assign the values.\n+ PlannedProdOrder.ProdOrderLines.\"Item &Tracking Lines\".Invoke();\n+\n+ // [WHEN] Change the Production Order Status.\n+ LibraryManufacturing.ChangeProuctionOrderStatus(ProductionOrder.\"No.\", ProductionOrder.Status::Planned, ProductionOrder.Status::Released);\n+\n+ // [THEN] Check Reservation Entry Status.\n+ VerifyReservationEntry(Item.\"No.\", ProductionOrder.Quantity, ReservationEntry.\"Reservation Status\"::Surplus, LocationBlue.Code);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Production Order III\");\n@@ -7784,6 +7834,64 @@\n CapacityLedgerEntry.FindLast();\n end;\n \n+ local procedure CreateItemWithLotTracking(Var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ LibraryItemTracking.CreateItemTrackingCode(ItemTrackingCode, false, true);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure CreateSalesOrderOnManufacturingLocation(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10]): Decimal;\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(\n+ SalesHeader,\n+ SalesHeader.\"Document Type\"::Order,\n+ LibrarySales.CreateCustomerNo());\n+\n+ SalesHeader.Validate(\"Shipment Date\", Today);\n+ SalesHeader.Modify(true);\n+\n+ LibrarySales.CreateSalesLine(\n+ SalesLine,\n+ SalesHeader,\n+ SalesLine.Type::Item,\n+ ItemNo,\n+ Quantity);\n+ UpdateLocationOnSalesLine(SalesLine.\"Document No.\", LocationCode);\n+\n+ exit(SalesLine.Quantity);\n+ end;\n+\n+ local procedure CreateProdOrderOnManufacturingLocation(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal; LocationCode: Code[10])\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder,\n+ ProductionOrder.Status::Planned,\n+ ProductionOrder.\"Source Type\"::Item,\n+ ItemNo,\n+ Quantity);\n+\n+ ProductionOrder.Validate(\"Location Code\", LocationCode);\n+ ProductionOrder.Validate(\"Due Date\", Today);\n+ ProductionOrder.Modify(true);\n+ end;\n+\n+ local procedure OpenItemTrackingLinesSetValueInProdOrderLine(LotNo: Code[50]; SerialNo: Code[50]; Quantity: Decimal)\n+ begin\n+ LibraryVariableStorage.Enqueue(ItemTrackingMode::SetValue);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(SerialNo);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\nindex b035840caa1..3184c076e8c 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ProdOrderLineReserve.Codeunit.al\n@@ -224,6 +224,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n if not FindReservEntry(OldProdOrderLine, OldReservationEntry) then\n exit;\n \n+ if NeedUpdateReservationStatusForProdOrderLine(OldReservationEntry.\"Source Type\", NewProdOrderLine.Status.AsInteger()) then\n+ if OldReservationEntry.\"Source Subtype\" = OldReservationEntry.\"Source Subtype\"::\"1\" then begin\n+ OldReservationEntry.\"Reservation Status\" := OldReservationEntry.\"Reservation Status\"::Surplus;\n+ OldReservationEntry.Modify();\n+ end;\n+\n OldReservationEntry.Lock();\n \n NewProdOrderLine.TestItemFields(OldProdOrderLine.\"Item No.\", OldProdOrderLine.\"Variant Code\", OldProdOrderLine.\"Location Code\");\n@@ -1146,5 +1152,12 @@ codeunit 99000837 \"Prod. Order Line-Reserve\"\n DampenerPeriod := ManufacturingSetup.\"Default Dampener Period\";\n end;\n \n+ local procedure NeedUpdateReservationStatusForProdOrderLine(SourceType: Integer; SourceSubtype: Option): Boolean\n+ begin\n+ if (SourceType <> Database::\"Prod. Order Line\") or (SourceSubtype <> 3) then\n+ exit(false);\n+\n+ exit(true);\n+ end;\n }\n \n"}