From e45a9e2101fefeaf44621f8fe45591f768a9eb69 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 12 Dec 2025 17:06:57 +0000
Subject: [PATCH 1/6] Initial plan
From c4be41d4dba6e0c0866353fbaa8448fdc3668dee Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 12 Dec 2025 17:14:12 +0000
Subject: [PATCH 2/6] Add image_count metadata field and update-metadata
command
Co-authored-by: haoranpb <27280733+haoranpb@users.noreply.github.com>
---
dataset/bcbench.jsonl | 110 +++++++++++++--------------
src/bcbench/commands/dataset.py | 62 +++++++++++++++
src/bcbench/dataset/__init__.py | 3 +-
src/bcbench/dataset/dataset_entry.py | 30 +++++++-
tests/test_image_count.py | 107 ++++++++++++++++++++++++++
5 files changed, 255 insertions(+), 57 deletions(-)
create mode 100644 tests/test_image_count.py
diff --git a/dataset/bcbench.jsonl b/dataset/bcbench.jsonl
index 811b6387d..f041a6cd9 100644
--- a/dataset/bcbench.jsonl
+++ b/dataset/bcbench.jsonl
@@ -1,55 +1,55 @@
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-210528", "base_commit": "1a672853b5e939932b2b9caff994bef826e928ff", "created_at": "2025-03-19", "environment_setup_version": "26.5", "project_paths": ["App\\Apps\\W1\\Sustainability\\app", "App\\Apps\\W1\\Sustainability\\test"], "FAIL_TO_PASS": [{"codeunitID": 148187, "functionName": ["VerifyEmissionFieldsMustBeEnabledWhenEnableValueChainTrackingIsEnabled"]}], "PASS_TO_PASS": [], "metadata": {"area": "sustainability"}, "test_patch": "diff --git a/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al b/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al\nindex ff9b7640fa2..07bfdfa1233 100644\n--- a/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al\n+++ b/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al\n@@ -5123,6 +5123,47 @@ codeunit 148187 \"Sust. Certificate Test\"\n // [THEN] Confirmation Box should not pop up as there is no confirm Handler. \n end;\n \n+ [Test]\n+ [HandlerFunctions('ConfirmHandlerYes')]\n+ procedure VerifyEmissionFieldsMustBeEnabledWhenEnableValueChainTrackingIsEnabled()\n+ var\n+ SustainabilitySetup: Record \"Sustainability Setup\";\n+ begin\n+ // [SCENARIO 569462] Verify \"Use Emissions In Purch. Doc.\", \"Item Emissions\", \"Resource Emissions\", \"Work/Machine Center Emissions\" must be enabled in Sustainability Setup.\n+ // When \"Enable Value Chain Tracking\" is enabled.\n+ LibrarySustainability.CleanUpBeforeTesting();\n+\n+ // [GIVEN] Update Sustainability Setup.\n+ SustainabilitySetup.Get();\n+ SustainabilitySetup.Validate(\"Use Emissions In Purch. Doc.\", false);\n+ SustainabilitySetup.Validate(\"Item Emissions\", false);\n+ SustainabilitySetup.Validate(\"Resource Emissions\", false);\n+ SustainabilitySetup.Validate(\"Work/Machine Center Emissions\", false);\n+ SustainabilitySetup.Validate(\"Enable Value Chain Tracking\", false);\n+ SustainabilitySetup.Modify();\n+\n+ // [WHEN] \"Enable Value Chain Tracking\" set to true in Sustainability Setup.\n+ SustainabilitySetup.Validate(\"Enable Value Chain Tracking\", true);\n+\n+ // [THEN] Verify \"Use Emissions In Purch. Doc.\", \"Item Emissions\", \"Resource Emissions\", \"Work/Machine Center Emissions\" must be enabled in Sustainability Setup.\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Use Emissions In Purch. Doc.\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Use Emissions In Purch. Doc.\"), SustainabilitySetup.TableCaption()));\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Item Emissions\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Item Emissions\"), SustainabilitySetup.TableCaption()));\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Resource Emissions\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Resource Emissions\"), SustainabilitySetup.TableCaption()));\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Work/Machine Center Emissions\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Work/Machine Center Emissions\"), SustainabilitySetup.TableCaption()));\n+ end;\n+\n local procedure CreateSustainabilityAccount(var AccountCode: Code[20]; var CategoryCode: Code[20]; var SubcategoryCode: Code[20]; i: Integer): Record \"Sustainability Account\"\n begin\n CreateSustainabilitySubcategory(CategoryCode, SubcategoryCode, i);\n", "patch": "diff --git a/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al b/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al\nindex 335c0099f4a..bf9281c17f7 100644\n--- a/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al\n+++ b/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al\n@@ -151,6 +151,8 @@ table 6217 \"Sustainability Setup\"\n if Rec.\"Enable Value Chain Tracking\" then\n if not ConfirmManagement.GetResponseOrDefault(ConfirmEnableValueChainTrackingQst, false) then\n Error('');\n+\n+ EnableEmissionsWhenValueChainTrackingIsEnabled();\n end;\n }\n }\n@@ -188,6 +190,17 @@ table 6217 \"Sustainability Setup\"\n exit(\"Enable Value Chain Tracking\");\n end;\n \n+ local procedure EnableEmissionsWhenValueChainTrackingIsEnabled()\n+ begin\n+ if not Rec.\"Enable Value Chain Tracking\" then\n+ exit;\n+\n+ Rec.Validate(\"Use Emissions In Purch. Doc.\", true);\n+ Rec.Validate(\"Item Emissions\", true);\n+ Rec.Validate(\"Resource Emissions\", true);\n+ Rec.Validate(\"Work/Machine Center Emissions\", true);\n+ end;\n+\n internal procedure GetFormat(FieldNo: Integer): Text\n begin\n GetSustainabilitySetup();\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-224009", "base_commit": "719cf1cc85730da9c59cdcb0ac18ddaf11d113fd", "created_at": "2025-08-16", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137045, "functionName": ["CheckTrackingReservationEntriesUpdatedWheLotNoAllocated"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\nindex bfcb627e6e5..f8db5ec3cf2 100644\n--- a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n@@ -1217,6 +1217,76 @@ codeunit 137045 \"SCM Bugfixes\"\n AssertReservationEntryCountForSales(SalesHeader, 3);\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandlerOrderTracking,ItemTrackingLinesPageHandler')]\n+ procedure CheckTrackingReservationEntriesUpdatedWheLotNoAllocated()\n+ var\n+ Item: Record Item;\n+ Location: Record Location;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ UnitofMeasure: Record \"Unit of Measure\";\n+ InventoryPostingSetup: Record \"Inventory Posting Setup\";\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ ReservationEntry, ReservationEntry1 : Record \"Reservation Entry\";\n+ LotNo, LotNo1, LotNo2 : Code[50];\n+ begin\n+ // [SCENARIO 580079] Wrong Decimal Rounding with Quantity in Reservation Entries, using Order Tracking Policy where tracking lines are split into 3, each ending in x.xxxx7, which results with all 3 adding up to x.00001\n+ Initialize();\n+\n+ // [GIVEN] Created Lot Tracked Item.\n+ CreateTrackedItemWithOrderTrackingPolicy(Item);\n+\n+ // [GIVEN] Create new UOM for CASE (CA), Qty 24 Per Base UOM of PCS\n+ LibraryInventory.CreateUnitOfMeasureCode(UnitofMeasure);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure, Item.\"No.\", UnitofMeasure.Code, 24);\n+\n+ // [GIVEN] Create Location\n+ LibraryWarehouse.CreateLocation(Location);\n+\n+ // [GIVEN] Create Inventory Posting Setup with Inventory Account\n+ LibraryInventory.CreateInventoryPostingSetup(InventoryPostingSetup, Location.Code, Item.\"Inventory Posting Group\");\n+ InventoryPostingSetup.Validate(\"Inventory Account\", LibraryERM.CreateGLAccountNo());\n+ InventoryPostingSetup.Modify();\n+\n+ // [GIVEN] Create Positive Adjustment for 288 Quantity with 1 Lot No\n+ LotNo := LibraryUtility.GenerateGUID();\n+ CreateItemJournalLineItemTrackingEnabled(ItemJournalLine, Item.\"No.\", Location.Code, 288);\n+ LibraryItemTracking.CreateItemJournalLineItemTracking(ReservationEntry, ItemJournalLine, '', LotNo, 288);\n+ LibraryInventory.PostItemJnlLineWithCheck(ItemJournalLine);\n+\n+ // [GIVEN] Create Positive Adjustment for 440 Quantity with 2 different Lot\n+ LotNo1 := LibraryUtility.GenerateGUID();\n+ LotNo2 := LibraryUtility.GenerateGUID();\n+ CreateItemJournalLineItemTrackingEnabled(ItemJournalLine, Item.\"No.\", Location.Code, 440);\n+ LibraryItemTracking.CreateItemJournalLineItemTracking(ReservationEntry, ItemJournalLine, '', LotNo1, 220);\n+ LibraryItemTracking.CreateItemJournalLineItemTracking(ReservationEntry1, ItemJournalLine, '', LotNo2, 220);\n+ LibraryInventory.PostItemJnlLineWithCheck(ItemJournalLine);\n+\n+ // [GIVEN] Created Sales Order with 1 Item and 3 quantity.\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, '');\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", 12);\n+ SalesLine.Validate(\"Location Code\", Location.Code);\n+ SalesLine.Validate(\"Unit of Measure Code\", UnitofMeasure.Code);\n+ SalesLine.Modify(true);\n+\n+ // [GIVEN] From Item tracking lines (Sales Order), add a Lot No to the item.\n+ LibraryVariableStorage.Enqueue(ItemTrackingHandlerAction::AssignSpecificLot);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(288);\n+ SalesLine.OpenItemTrackingLines(); // ItemTrackingLinesPageHandler required.\n+\n+ // [WHEN] Change the quantity from Item tracking lines (Sales Order), of a Lot No to 13.\n+ LibraryVariableStorage.Enqueue(ItemTrackingHandlerAction::AssignSpecificLot);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(13);\n+ SalesLine.OpenItemTrackingLines(); // ItemTrackingLinesPageHandler required.\n+\n+ // [THEN] Reservation entry Quantity field should come with -12\n+ VerifyReservationEntryQuantity(Item.\"No.\", SalesHeader.\"No.\", -12);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -1310,6 +1380,23 @@ codeunit 137045 \"SCM Bugfixes\"\n LibraryInventory.PostItemJournalLine(ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name);\n end;\n \n+ local procedure CreateItemJournalLineItemTrackingEnabled(var ItemJournalLine: Record \"Item Journal Line\"; ItemNo: Code[20]; LocationCode: Code[10]; Quantity: Decimal)\n+ var\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ begin\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, \"Item Journal Template Type\"::Item);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, \"Item Journal Template Type\"::Item, ItemJournalTemplate.Name);\n+ LibraryInventory.ClearItemJournal(ItemJournalTemplate, ItemJournalBatch);\n+ ItemJournalBatch.\"Item Tracking on Lines\" := true;\n+ ItemJournalBatch.Modify();\n+ LibraryInventory.CreateItemJournalLine(\n+ ItemJournalLine, ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name,\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", ItemNo, Quantity);\n+ ItemJournalLine.Validate(\"Location Code\", LocationCode);\n+ ItemJournalLine.Modify(true);\n+ end;\n+\n local procedure CreateCertifiedProductionBOMWithComponentStartingDate(var ProductionBOMHeader: Record \"Production BOM Header\"; UOMCode: Code[10]; ItemNo: Code[20]; QtyPer: Decimal; StartingDate: Date)\n var\n ProductionBOMLine: Record \"Production BOM Line\";\n@@ -1985,6 +2072,16 @@ codeunit 137045 \"SCM Bugfixes\"\n Assert.RecordCount(ReservationEntry, ExpectedCount);\n end;\n \n+ local procedure VerifyReservationEntryQuantity(ItemNo: Code[20]; SourceID: Code[20]; ExpectedQuantity: Decimal)\n+ var\n+ ReservEntry: Record \"Reservation Entry\";\n+ begin\n+ ReservEntry.SetRange(\"Item No.\", ItemNo);\n+ ReservEntry.SetRange(\"Source ID\", SourceID);\n+ ReservEntry.CalcSums(Quantity);\n+ ReservEntry.TestField(Quantity, ExpectedQuantity);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ContactListModalPageHandler(var ContactLookup: Page \"Contact List\"; var Response: Action)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\nindex c1b41b1585b..a37726d678f 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n@@ -914,7 +914,7 @@ table 337 \"Reservation Entry\"\n ReservEntry.SetFilter(\"Entry No.\", '<>%1', \"Entry No.\");\n ReservEntry.SetSourceFilter(\"Source Type\", \"Source Subtype\", \"Source ID\", \"Source Ref. No.\", false);\n ReservEntry.SetSourceFilter(\"Source Batch Name\", \"Source Prod. Order Line\");\n- ReservEntry.SetRange(\"Reservation Status\", \"Reservation Status\"::Reservation);\n+ ReservEntry.SetFilter(\"Reservation Status\", '%1|%2', \"Reservation Status\"::Reservation, \"Reservation Status\"::Tracking);\n ReservEntry.CalcSums(\"Quantity (Base)\", Quantity);\n exit(\n Round((ReservEntry.\"Quantity (Base)\" + \"Quantity (Base)\") / \"Qty. per Unit of Measure\", UOMMgt.QtyRndPrecision()) -\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-211710", "base_commit": "f787c24e811a24e4bd5a2d987ea406b3d2fe6ad0", "created_at": "2025-03-31", "environment_setup_version": "26.5", "project_paths": ["App\\Apps\\W1\\Shopify\\app", "App\\Apps\\W1\\Shopify\\test"], "FAIL_TO_PASS": [{"codeunitID": 139648, "functionName": ["UnitTestSuggestShopifyPaymentsFailedTransaction"]}], "PASS_TO_PASS": [{"codeunitID": 139648, "functionName": ["UnitTestSuggestShopifyPaymentsOneTransaction", "UnitTestSuggestShopifyPaymentsMultipleTransactions"]}], "metadata": {"area": "shopify"}, "test_patch": "diff --git a/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al b/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al\nindex d4318405610..cf234743596 100644\n--- a/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al\n+++ b/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al\n@@ -32,7 +32,7 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n \n // [GIVEN] Shopify transaction is imported\n- CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale);\n+ CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n \n // [WHEN] Create Shopify transactions are run\n OrderTransaction.FindFirst();\n@@ -65,8 +65,8 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n \n // [GIVEN] Shopify transactions are imported\n- CreateOrderTransaction(OrderId, Amount * 0.75, 'manual', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale);\n+ CreateOrderTransaction(OrderId, Amount * 0.75, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n \n // [WHEN] Create Shopify transactions are run\n OrderTransaction.SetRange(\"Shopify Order Id\", OrderId);\n@@ -86,6 +86,45 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n until SuggestPayment.Next() = 0;\n end;\n \n+ [HandlerFunctions('SuggestShopifyPaymentsRequestPageHandler')]\n+ [Test]\n+ procedure UnitTestSuggestShopifyPaymentsFailedTransaction()\n+ var\n+ Item: Record Item;\n+ Customer: Record Customer;\n+ OrderTransaction: Record \"Shpfy Order Transaction\";\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ CashReceiptJournal: TestPage \"Cash Receipt Journal\";\n+ OrderId: BigInteger;\n+ SuccessTransactionId: BigInteger;\n+ Amount: Decimal;\n+ begin\n+ // [SCENARIO] Suggest Shopify payments does not create Cash Receipt Journal lines for failed transactions\n+ // [GIVEN] Invoice is posted\n+ Initialize();\n+ Amount := Any.IntegerInRange(10000, 99999);\n+ OrderId := Any.IntegerInRange(10000, 99999);\n+ CreateItem(Item, Amount);\n+ LibrarySales.CreateCustomer(Customer);\n+ CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n+\n+ // [GIVEN] One failed one success Shopify transaction is imported\n+ CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Failure);\n+ SuccessTransactionId := CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ Commit();\n+\n+ // [WHEN] Report is run\n+ CashReceiptJournal.OpenView();\n+ CashReceiptJournal.SuggestShopifyPayments.Invoke();\n+\n+ // [THEN] Only one Cash Receipt Journal line is created\n+ GenJournalLine.SetRange(\"Document Type\", GenJournalLine.\"Document Type\"::Payment);\n+ GenJournalLine.SetRange(\"Account No.\", Customer.\"No.\");\n+ LibraryAssert.RecordCount(GenJournalLine, 1);\n+ GenJournalLine.FindFirst();\n+ LibraryAssert.AreEqual(GenJournalLine.\"Shpfy Transaction Id\", SuccessTransactionId, 'Transaction Ids should match');\n+ end;\n+\n [HandlerFunctions('SuggestShopifyPaymentsRequestPageHandler')]\n [Test]\n procedure UnitTestSuggestShopifyPaymentsJournalLines()\n@@ -114,10 +153,10 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesInvoice(Item, Customer, 2, OrderId3);\n \n // [GIVEN] Shopify transactions are imported\n- CreateOrderTransaction(OrderId1, Amount, 'manual', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId2, Amount * 0.75, 'manual', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId2, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId3, Amount * 2, 'bogus', OrderTransaction.Type::Sale);\n+ CreateOrderTransaction(OrderId1, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId2, Amount * 0.75, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId2, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId3, Amount * 2, 'bogus', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n Commit();\n \n // [WHEN] Report is run\n@@ -154,7 +193,7 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesCreditMemo(Item, Customer, 1, RefundId);\n \n // [GIVEN] Shopify transaction is imported\n- CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Refund);\n+ CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Refund, OrderTransaction.Status::Success);\n \n // [WHEN] Create Shopify transactions are run\n OrderTransaction.FindFirst();\n@@ -210,7 +249,7 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n Item.Modify(true);\n end;\n \n- local procedure CreateOrderTransaction(OrderId: BigInteger; Amount: Decimal; Gateway: Code[20]; TransactionType: Enum \"Shpfy Transaction Type\")\n+ local procedure CreateOrderTransaction(OrderId: BigInteger; Amount: Decimal; Gateway: Code[20]; TransactionType: Enum \"Shpfy Transaction Type\"; Status: Enum \"Shpfy Transaction Status\"): BigInteger\n var\n OrderTransaction: Record \"Shpfy Order Transaction\";\n begin\n@@ -219,7 +258,9 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n OrderTransaction.Amount := Amount;\n OrderTransaction.Gateway := Gateway;\n OrderTransaction.Type := TransactionType;\n+ OrderTransaction.Status := Status;\n OrderTransaction.Insert();\n+ exit(OrderTransaction.\"Shopify Transaction Id\");\n end;\n \n local procedure CreateRefund(OrderId: BigInteger; RefundId: BigInteger; Amount: Decimal)\n", "patch": "diff --git a/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al b/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al\nindex 773ba116023..274900e6ee5 100644\n--- a/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al\n+++ b/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al\n@@ -17,7 +17,7 @@ report 30118 \"Shpfy Suggest Payments\"\n dataitem(OrderTransaction; \"Shpfy Order Transaction\")\n {\n RequestFilterFields = \"Created At\";\n- DataItemTableView = sorting(Type) where(Type = filter(Capture | Sale | Refund));\n+ DataItemTableView = sorting(Type) where(Type = filter(Capture | Sale | Refund), Status = filter(Success));\n \n trigger OnAfterGetRecord()\n begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-220984", "base_commit": "da8aacf769f29847b57739a6db797e65057ea268", "created_at": "2025-07-15", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Manufacturing"], "FAIL_TO_PASS": [{"codeunitID": 137404, "functionName": ["ExchangeProductionBOMItemShouldSetEndingDate"]}], "PASS_TO_PASS": [], "metadata": {"area": "manufacturing"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al b/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al\nindex f6545527796..b7f7674ae29 100644\n--- a/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al\n@@ -4829,6 +4829,54 @@ codeunit 137404 \"SCM Manufacturing\"\n Assert.AreEqual(StandardTask.Code, ProdOrderLine.\"Standard Task Code\", StandardTaskFieldErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('RunExchangeProdBOMItemReportWithStartDateParameter')]\n+ procedure ExchangeProductionBOMItemShouldSetEndingDate()\n+ var\n+ Item: array[5] of Record Item;\n+ MainItem: Record Item;\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ i: Integer;\n+ begin\n+ // [SCENARIO 592157] Replacing a component in a Production BOM should set the Ending Date of the replaced component.\n+ Initialize();\n+\n+ LibraryInventory.CreateItem(MainItem);\n+ MainItem.Validate(\"Replenishment System\", MainItem.\"Replenishment System\"::\"Prod. Order\");\n+ MainItem.Modify(true);\n+\n+ // [GIVEN] Create a Production BOM Header\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, MainItem.\"Base Unit of Measure\");\n+\n+ // [GIVEN] Create Items\n+ for i := 1 to 5 do\n+ LibraryInventory.CreateItem(Item[i]);\n+\n+ // [GIVEN] Add only Items[1..4] to the BOM\n+ for i := 1 to 4 do\n+ LibraryManufacturing.CreateProductionBOMLine(\n+ ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, Item[i].\"No.\", LibraryRandom.RandIntInRange(10, 20));\n+\n+ // [GIVEN] Certify BOM and assign to Main Item\n+ ModifyStatusInProductionBOM(ProductionBOMHeader, ProductionBOMHeader.Status::Certified);\n+ MainItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ MainItem.Modify(true);\n+\n+ // [GIVEN] Enqueue parameter values for report\n+ EnqueueExchProdBOMItemReportParameter(Item[1].\"No.\", Item[5].\"No.\", Today);\n+\n+ // [WHEN] Run the Exchange Production BOM Item report\n+ RunExchangeProductionBOMItemReport();\n+\n+ // [THEN] Validate that the replaced item has an Ending Date of (StartDate - 1)\n+ ValidateEndingDateSet(ProductionBOMHeader.\"No.\", Item[1].\"No.\", Today);\n+\n+ // [AND] Ensure no test artifacts are left behind\n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -7704,6 +7752,23 @@ codeunit 137404 \"SCM Manufacturing\"\n standardTask.Modify(true);\n end;\n \n+ local procedure EnqueueExchProdBOMItemReportParameter(ExchangeItemNo: Code[20]; ReplaceItemNo: Code[20]; StartDate: Date)\n+ begin\n+ LibraryVariableStorage.Enqueue(ExchangeItemNo);\n+ LibraryVariableStorage.Enqueue(ReplaceItemNo);\n+ LibraryVariableStorage.Enqueue(StartDate);\n+ end;\n+\n+ local procedure ValidateEndingDateSet(ProdBOMHeaderNo: Code[20]; ItemNo: Code[20]; StartingDate: Date)\n+ var\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ begin\n+ ProductionBOMLine.SetRange(\"Production BOM No.\", ProdBOMHeaderNo);\n+ ProductionBOMLine.SetRange(\"No.\", ItemNo);\n+ ProductionBOMLine.FindFirst();\n+ Assert.AreEqual(StartingDate - 1, ProductionBOMLine.\"Ending Date\", 'Ending Date is not correctly set on the Production BOM line.')\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ProdBOMVersionComparisonHandlerForActionSet(var ProdBOMVersionComparison: TestPage \"Prod. BOM Version Comparison\")\n@@ -7793,5 +7858,28 @@ codeunit 137404 \"SCM Manufacturing\"\n ExchangeProductionBOMItem.WithType.AssertEquals(ProductionBOMLineType::Item);// [THEN] Verify WithType Default Type is ITEM\n ExchangeProductionBOMItem.OK().Invoke();\n end;\n+\n+ [RequestPageHandler]\n+ procedure RunExchangeProdBOMItemReportWithStartDateParameter(var ExchangeProductionBOMItem: TestRequestPage \"Exchange Production BOM Item\")\n+ var\n+ FromProductionBOMLineType: Enum \"Production BOM Line Type\";\n+ ExchangeItemNo: Variant;\n+ ReplaceItemNo: Variant;\n+ StartDate: Variant;\n+ begin\n+ ExchangeItemNo := LibraryVariableStorage.DequeueText();\n+ ReplaceItemNo := LibraryVariableStorage.DequeueText();\n+ StartDate := LibraryVariableStorage.DequeueDate();\n+ ExchangeProductionBOMItem.ExchangeType.SetValue(FromProductionBOMLineType::Item);\n+ ExchangeProductionBOMItem.ExchangeNo.SetValue(ExchangeItemNo);\n+ ExchangeProductionBOMItem.WithType.SetValue(FromProductionBOMLineType::Item);\n+ ExchangeProductionBOMItem.WithNo.SetValue(ReplaceItemNo);\n+ ExchangeProductionBOMItem.\"Create New Version\".SetValue(false);\n+ ExchangeProductionBOMItem.\"Delete Exchanged Component\".SetValue(false);\n+ ExchangeProductionBOMItem.Recertify.SetValue(true);\n+ ExchangeProductionBOMItem.CopyRoutingLink.SetValue(true);\n+ ExchangeProductionBOMItem.StartingDate.SetValue(StartDate);\n+ ExchangeProductionBOMItem.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al b/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al\nindex 83bf3f09247..fc62ac19292 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al\n@@ -157,7 +157,7 @@ report 99001043 \"Exchange Production BOM Item\"\n CopyPositionFields(ProductionBOMLine2, ProductionBOMLine3);\n ShouldModifyProductionBOMLine := true;\n OnIntegerOnPostDataItemOnBeforeModifyProductionBOMLine(ProductionBOMLine, ShouldModifyProductionBOMLine);\n- if not ShouldModifyProductionBOMLine then begin\n+ if ShouldModifyProductionBOMLine then begin\n ProductionBOMLine.\"Ending Date\" := StartingDate - 1;\n ProductionBOMLine.Modify();\n end;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-224668", "base_commit": "e99adb71b2355dc29eb398ab9ae0d59003a84d5d", "created_at": "2025-08-25", "environment_setup_version": "27.0", "project_paths": ["App\\Apps\\W1\\EssentialBusinessHeadlines\\app", "App\\Apps\\W1\\EssentialBusinessHeadlines\\test"], "FAIL_TO_PASS": [{"codeunitID": 139600, "functionName": ["TestHeadlineCanBeHidden"]}], "PASS_TO_PASS": [], "metadata": {"area": "visualization"}, "test_patch": "diff --git a/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al b/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al\nindex db731e8675d..fb82838356c 100644\n--- a/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al\n+++ b/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al\n@@ -700,6 +700,33 @@ codeunit 139600 \"Test Essential Bus. Headlines\"\n TestRecentlyOverdueInvoiceWithOverdueInvoices(5);\n end;\n \n+ [Test]\n+ procedure TestHeadlineCanBeHidden()\n+ var\n+ CustLedgerEntry: Record \"Cust. Ledger Entry\";\n+ begin\n+ // [GIVEN] Initial state when no data is present\n+ Initialize();\n+\n+ // [GIVEN] One invoice that was due yesterday\n+ CreateInvoicesWithDueDateYesterday(1);\n+\n+ // [WHEN] Run the headline computation\n+ EssentialBusHeadlineMgt.HandleRecentlyOverdueInvoices();\n+\n+ // [THEN] Recently overdue invoices headline is visible\n+ Assert.IsTrue(GetVisibility(EssentialBusinessHeadline.\"Headline Name\"::RecentlyOverdueInvoices), 'Expected recently overdue invoices headline to be visible');\n+\n+ // [WHEN] Simulate no more overdue invoices by deleting all customer ledger entries\n+ CustLedgerEntry.DeleteAll();\n+\n+ // [WHEN] Recompute the headline computation\n+ EssentialBusHeadlineMgt.HandleRecentlyOverdueInvoices();\n+\n+ // [THEN] The headline is hidden\n+ Assert.IsFalse(GetVisibility(EssentialBusinessHeadline.\"Headline Name\"::RecentlyOverdueInvoices), 'Expected recently overdue invoices headline to be not visible after recompute');\n+ end;\n+\n local procedure TestRecentlyOverdueInvoiceWithOverdueInvoices(NumberOfNewlyOverdueInvoices: Integer)\n var\n OverdueInvoicesTxt: Text;\n", "patch": "diff --git a/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al b/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al\nindex 831aa80efcd..10436a095d8 100644\n--- a/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al\n+++ b/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al\n@@ -677,7 +677,7 @@ codeunit 1437 \"Essential Bus. Headline Mgt.\"\n var\n EssentialBusinessHeadline: Record \"Ess. Business Headline Per Usr\";\n begin\n- if EssentialBusinessHeadline.Get(HeadlineName) then begin\n+ if EssentialBusinessHeadline.Get(HeadlineName, UserSecurityId()) then begin\n EssentialBusinessHeadline.Validate(\"Headline Visible\", false);\n EssentialBusinessHeadline.Modify();\n end;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218323", "base_commit": "cf24533288281b2df45cbb33654a17f430a0619f", "created_at": "2025-06-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134992, "functionName": ["PostVATSettlementWhenJournalTemplateNameMandatoryIsEnabled"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al\nindex 5c994880ad2..b8c9d7f62bd 100644\n--- a/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al\n@@ -765,6 +765,53 @@ codeunit 134992 \"ERM Financial Reports IV\"\n LibraryVariableStorage.AssertEmpty();\n end;\n \n+ [Test]\n+ [HandlerFunctions('RHCalcAndPostVATSettlementSetCountryFilter')]\n+ procedure PostVATSettlementWhenJournalTemplateNameMandatoryIsEnabled()\n+ var\n+ Customer: Record Customer;\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ VATEntry: Record \"VAT Entry\";\n+ GLEntry: Record \"G/L Entry\";\n+ MyNotifications: Record \"My Notifications\";\n+ GeneralLedgerSetup: Record \"General Ledger Setup\";\n+ InstructionMgt: Codeunit \"Instruction Mgt.\";\n+ PostingDate: Date;\n+ begin\n+ // [SCENARIO 571198] No error should appears when user try to Calculate and Post VAT Settlement when Journal Template Name Mandatory is enabled\n+ Initialize();\n+\n+ // [GIVEN] Set Journal Templ. Name Mandatory to false on General ledger Setup.\n+ GeneralLedgerSetup.Get();\n+ GeneralLedgerSetup.\"Journal Templ. Name Mandatory\" := true;\n+ GeneralLedgerSetup.Modify();\n+\n+ MyNotifications.Disable(InstructionMgt.GetPostingAfterWorkingDateNotificationId());\n+ GLEntry.SetCurrentKey(\"Posting Date\", \"G/L Account No.\", \"Dimension Set ID\");\n+ GLEntry.FindLast();\n+ PostingDate := GLEntry.\"Posting Date\" + 1;\n+\n+ // [GIVEN] Create customer and post a sales invoice\n+ LibrarySales.CreateCustomerWithCountryCodeAndVATRegNo(Customer);\n+ CreateAndPostGeneralJournalLine(\n+ VATPostingSetup, PostingDate, GenJournalLine.\"Account Type\"::Customer, Customer.\"No.\",\n+ GenJournalLine.\"Gen. Posting Type\"::Sale, 1, true);\n+\n+ LibraryVariableStorage.Enqueue(Customer.\"Country/Region Code\"); // set country/region filter for RHCalcAndPostVATSettlementSetCountryFilter\n+ Clear(LibraryReportDataset);\n+\n+ // [WHEN] Run Calculate and Post VAT Settlement report\n+ SaveCalcAndPostVATSettlementReport(VATPostingSetup, PostingDate, PostingDate, PostingDate, Format(LibraryRandom.RandInt(100)), true);\n+\n+ // [THEN] VAT Entry for the second invoice is closed\n+ // [THEN] Closing entry created with type 'Settlement'\n+ VATEntry.SetRange(\"Bill-to/Pay-to No.\", Customer.\"No.\");\n+ VATEntry.FindFirst();\n+ VATEntry.Get(VATEntry.\"Closed by Entry No.\");\n+ VATEntry.TestField(Type, VATEntry.Type::Settlement);\n+ end;\n+\n local procedure Initialize()\n var\n ObjectOptions: Record \"Object Options\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al\nindex c7ffd42ba4c..d596be8a7fd 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al\n@@ -57,6 +57,7 @@ codeunit 11 \"Gen. Jnl.-Check Line\"\n OverrideDimErr: Boolean;\n LogErrorMode: Boolean;\n IsBatchMode: Boolean;\n+ IgnoreJournalTemplNameMandatoryCheck: Boolean;\n \n #pragma warning disable AA0074\n Text000: Label 'can only be a closing date for G/L entries';\n@@ -380,6 +381,11 @@ codeunit 11 \"Gen. Jnl.-Check Line\"\n OverrideDimErr := true;\n end;\n \n+ procedure SetIgnoreJournalTemplNameMandatoryCheck()\n+ begin\n+ IgnoreJournalTemplNameMandatoryCheck := true;\n+ end;\n+\n local procedure CheckDates(GenJnlLine: Record \"Gen. Journal Line\")\n var\n AccountingPeriodMgt: Codeunit \"Accounting Period Mgt.\";\n@@ -400,8 +406,9 @@ codeunit 11 \"Gen. Jnl.-Check Line\"\n end;\n end;\n \n- if GLSetup.\"Journal Templ. Name Mandatory\" then\n- GenJnlLine.TestField(\"Journal Template Name\", ErrorInfo.Create());\n+ if not IgnoreJournalTemplNameMandatoryCheck then\n+ if GLSetup.\"Journal Templ. Name Mandatory\" then\n+ GenJnlLine.TestField(\"Journal Template Name\", ErrorInfo.Create());\n OnBeforeDateNotAllowed(GenJnlLine, DateCheckDone);\n if not DateCheckDone then\n if DateNotAllowed(GenJnlLine.\"Posting Date\", GenJnlLine.\"Journal Template Name\") then\ndiff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al\nindex da61c5f2c5d..35021399a12 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al\n@@ -138,6 +138,7 @@ codeunit 12 \"Gen. Jnl.-Post Line\"\n MultiplePostingGroups: Boolean;\n SourceCodeSetupRead: Boolean;\n IsGLRegInserted: Boolean;\n+ IgnoreJournalTemplNameMandatoryCheck: Boolean;\n \n NeedsRoundingErr: Label '%1 needs to be rounded', Comment = '%1 - amount';\n PurchaseAlreadyExistsErr: Label 'Purchase %1 %2 already exists for this vendor.', Comment = '%1 = Document Type; %2 = Document No.';\n@@ -332,6 +333,8 @@ codeunit 12 \"Gen. Jnl.-Post Line\"\n if CheckLine then begin\n if OverrideDimErr then\n GenJnlCheckLine.SetOverDimErr();\n+ if IgnoreJournalTemplNameMandatoryCheck then\n+ GenJnlCheckLine.SetIgnoreJournalTemplNameMandatoryCheck();\n OnCheckGenJnlLineOnBeforeRunCheck(GenJournalLine);\n GenJnlCheckLine.RunCheck(GenJournalLine);\n end;\n@@ -7113,6 +7116,15 @@ codeunit 12 \"Gen. Jnl.-Post Line\"\n Error(DimMgt.GetDimValuePostingErr());\n end;\n \n+ /// \n+ /// Sets the global variable IgnoreJournalTemplNameMandatoryCheck for the current instance of the codeunit.\n+ /// If IgnoreJournalTemplNameMandatoryCheck is not set \"Journal Templ. Name Mandatory\" check is performed before gen. journal line \n+ /// \n+ procedure SetIgnoreJournalTemplNameMandatoryCheck()\n+ begin\n+ IgnoreJournalTemplNameMandatoryCheck := true;\n+ end;\n+\n local procedure IsGainLossAccount(CurrencyCode: Code[10]; GLAccNo: Code[20]): Boolean\n var\n Currency: Record Currency;\ndiff --git a/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al b/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al\nindex 88068be074e..f09dab3691a 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al\n@@ -849,6 +849,7 @@ report 20 \"Calc. and Post VAT Settlement\"\n GenJnlLine, 0, DefaultDimSource, GenJnlLine.\"Source Code\",\n GenJnlLine.\"Shortcut Dimension 1 Code\", GenJnlLine.\"Shortcut Dimension 2 Code\", 0, 0);\n OnPostGenJnlLineOnBeforeGenJnlPostLineRun(GenJnlLine);\n+ GenJnlPostLine.SetIgnoreJournalTemplNameMandatoryCheck();\n GenJnlPostLine.Run(GenJnlLine);\n end;\n \n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-193853", "base_commit": "a4732079d0c963a7104d5b5c534ee87f3cd105e7", "created_at": "2024-09-09", "environment_setup_version": "25.0", "project_paths": ["App\\Apps\\W1\\EnforcedDigitalVouchers\\app", "App\\Apps\\W1\\EnforcedDigitalVouchers\\test library", "App\\Apps\\W1\\EnforcedDigitalVouchers\\test"], "FAIL_TO_PASS": [{"codeunitID": 139515, "functionName": ["PostMultipleGeneralJournalLinesSamePostingDateDocNoOnlyFirstHasIncDoc"]}], "PASS_TO_PASS": [], "metadata": {"area": "eservice"}, "test_patch": "diff --git a/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al b/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al\nindex 304e94e908f6..d917601e5a98 100644\n--- a/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al\n+++ b/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al\n@@ -912,6 +912,59 @@ codeunit 139515 \"Digital Vouchers Tests\"\n UnbindSubscription(DigVouchersDisableEnforce);\n end;\n \n+ [Test]\n+ procedure PostMultipleGeneralJournalLinesSamePostingDateDocNoOnlyFirstHasIncDoc()\n+ var\n+ GenJournalLine: array[2] of Record \"Gen. Journal Line\";\n+ GenJournalLineToPost: Record \"Gen. Journal Line\";\n+ GenJournalTemplate: Record \"Gen. Journal Template\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ IncomingDocument: Record \"Incoming Document\";\n+ DigVouchersDisableEnforce: Codeunit \"Dig. Vouchers Disable Enforce\";\n+ DocNo: Code[20];\n+ i: Integer;\n+ begin\n+ // [SCENARIO 540097] Stan can post multiple general journals lines with same posting date and document number, only the first line has incoming document\n+\n+ Initialize();\n+ BindSubscription(DigVouchersDisableEnforce);\n+ // [GIVEN] Digital voucher feature is enabled\n+ EnableDigitalVoucherFeature();\n+ // [GIVEN] Digital voucher entry setup for general journal is \"Attachment\"\n+ InitSetupCheckOnly(\"Digital Voucher Entry Type\"::\"General Journal\", \"Digital Voucher Check Type\"::Attachment);\n+ // [GIVEN] General journal lines with the same template and batch are created\n+ // [GIVEN] General journal line \"X\" with \"Posting Date\" = 01.01.2024 and \"Document No.\" = \"X\"\n+ // [GIVEN] General journal line \"Y\" with \"Posting Date\" = 01.01.2024 and \"Document No.\" = \"X\"\n+ DocNo := LibraryUtility.GenerateGUID();\n+ LibraryERM.CreateGenJournalTemplate(GenJournalTemplate);\n+ LibraryERM.CreateGenJournalBatch(GenJournalBatch, GenJournalTemplate.Name);\n+ for i := 1 to ArrayLen(GenJournalLine) do begin\n+ LibraryJournals.CreateGenJournalLine(\n+ GenJournalLine[i], GenJournalBatch.\"Journal Template Name\", GenJournalBatch.Name,\n+ GenJournalLine[i].\"Document Type\"::Invoice, GenJournalLine[i].\"Account Type\"::\"G/L Account\",\n+ LibraryERM.CreateGLAccountNo(), GenJournalLine[i].\"Bal. Account Type\"::\"G/L Account\",\n+ LibraryERM.CreateGLAccountNo(), LibraryRandom.RandDec(100, 2));\n+ GenJournalLine[i].Validate(\"Document No.\", DocNo);\n+ GenJournalLine[i].Modify(true);\n+ end;\n+ // [GIVEN] Only journal line \"X\" has incoming document attached\n+ GenJournalLine[1].\"Incoming Document Entry No.\" := MockIncomingDocument();\n+ GenJournalLine[1].Modify(true);\n+\n+ GenJournalLineToPost.SetRange(\"Journal Template Name\", GenJournalBatch.\"Journal Template Name\");\n+ GenJournalLineToPost.SetRange(\"Journal Batch Name\", GenJournalBatch.Name);\n+ GenJournalLineToPost.FindSet();\n+ // [WHEN] Post both general journal lines\n+ Codeunit.Run(Codeunit::\"Gen. Jnl.-Post Batch\", GenJournalLineToPost);\n+\n+ // [THEN] Posting is successfull and we have an incoming document with \"Posting Date\" = 01.01.2024 and \"Document No.\" = \"X\"\n+ IncomingDocument.SetRange(\"Posting Date\", GenJournalLine[1].\"Posting Date\");\n+ IncomingDocument.SetRange(\"Document No.\", GenJournalLine[1].\"Document No.\");\n+ Assert.RecordIsNotEmpty(IncomingDocument);\n+\n+ UnbindSubscription(DigVouchersDisableEnforce);\n+ end;\n+\n local procedure Initialize()\n var\n CompanyInformation: Record \"Company Information\";\n@@ -1076,6 +1129,19 @@ codeunit 139515 \"Digital Vouchers Tests\"\n exit(IncomingDocument.\"Entry No.\");\n end;\n \n+ local procedure MockIncomingDocument(): Integer\n+ var\n+ IncomingDocument: Record \"Incoming Document\";\n+ IncomingDocumentAttachment: Record \"Incoming Document Attachment\";\n+ begin\n+ IncomingDocument.\"Entry No.\" :=\n+ LibraryUtility.GetNewRecNo(IncomingDocument, IncomingDocument.FieldNo(\"Entry No.\"));\n+ IncomingDocument.Insert();\n+ IncomingDocumentAttachment.\"Incoming Document Entry No.\" := IncomingDocument.\"Entry No.\";\n+ IncomingDocumentAttachment.Insert();\n+ exit(IncomingDocument.\"Entry No.\");\n+ end;\n+\n local procedure ReceiveAndInvoicePurchaseInvoice(): Code[20]\n var\n PurchaseHeader: Record \"Purchase Header\";\n", "patch": "diff --git a/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al b/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al\nindex 72dc980e3347..5775bd7fc2b0 100644\n--- a/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al\n+++ b/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al\n@@ -224,6 +224,8 @@ codeunit 5579 \"Digital Voucher Impl.\"\n SourceCodeSetup.Get();\n if IsPaymentReconciliationJournal(DigitalVoucherEntrySetup.\"Entry Type\", RecRef) then\n exit(true);\n+ if IsGenJnlLineWithIncDocAttachedToAdjLine(DigitalVoucherEntrySetup.\"Entry Type\", RecRef) then\n+ exit(true);\n exit(false);\n end;\n \n@@ -345,6 +347,27 @@ codeunit 5579 \"Digital Voucher Impl.\"\n exit(SourceCodeValue = SourceCodeSetup.\"Payment Reconciliation Journal\");\n end;\n \n+ local procedure IsGenJnlLineWithIncDocAttachedToAdjLine(DigitalVoucherEntryType: Enum \"Digital Voucher Entry Type\"; RecRef: RecordRef): Boolean\n+ var\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ AdjacentGenJournalLine: Record \"Gen. Journal Line\";\n+ IncomingDocument: Record \"Incoming Document\";\n+ begin\n+ if DigitalVoucherEntryType <> DigitalVoucherEntryType::\"General Journal\" then\n+ exit(false);\n+ RecRef.SetTable(GenJournalLine);\n+ AdjacentGenJournalLine.ReadIsolation(IsolationLevel::ReadCommitted);\n+ AdjacentGenJournalLine.SetRange(\"Journal Template Name\", GenJournalLine.\"Journal Template Name\");\n+ AdjacentGenJournalLine.SetRange(\"Journal Batch Name\", GenJournalLine.\"Journal Batch Name\");\n+ AdjacentGenJournalLine.SetRange(\"Posting Date\", GenJournalLine.\"Posting Date\");\n+ AdjacentGenJournalLine.SetRange(\"Document No.\", GenJournalLine.\"Document No.\");\n+ AdjacentGenJournalLine.SetFilter(\"Line No.\", '<>%1', GenJournalLine.\"Line No.\");\n+ AdjacentGenJournalLine.SetFilter(\"Incoming Document Entry No.\", '<>0');\n+ if not AdjacentGenJournalLine.FindFirst() then\n+ exit(false);\n+ exit(IncomingDocument.Get(AdjacentGenJournalLine.\"Incoming Document Entry No.\"));\n+ end;\n+\n local procedure AttachDigitalVoucherFromReportPDF(ReportUsage: Enum \"Report Selection Usage\"; RecRef: RecordRef; IsInvoice: Boolean; PostingDate: Date; DocNo: Code[20]; AccountTableNo: Integer; AccountNo: Code[20]; StandardReportID: Integer)\n var\n TempAttachReportSelections: Record \"Report Selections\" temporary;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223493", "base_commit": "faff33469cd77044de7a55542cfd61531ec098ee", "created_at": "2025-08-11", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134658, "functionName": ["VerifyYourReferenceUpdatedInCustLedgerEntry"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al b/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al\nindex b2cb6ea36fb..0e345a6a6f8 100644\n--- a/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al\n@@ -27,6 +27,8 @@ codeunit 134658 \"Edit Posted Documents\"\n UnexpectedVolumeErr: Label 'Unexpected Volume shown.';\n CashFlowWorkSheetLineMustNotBeFoundErr: Label 'Cash Flow Worksheet Line must not be found.';\n YourReferenceErr: Label 'Your reference must be editable';\n+ SalesInvoiceYourReferenceErr: Label 'Sales Invoice Your Reference not updated';\n+ CustLedgerEntryYourReferenceErr: Label 'Customer Ledger Entry Your Reference not updated';\n \n [Test]\n [HandlerFunctions('PostedSalesShipmentUpdateGetEditablelModalPageHandler')]\n@@ -996,6 +998,46 @@ codeunit 134658 \"Edit Posted Documents\"\n LibraryLowerPermissions.SetOutsideO365Scope();\n end;\n \n+ [Test]\n+ [HandlerFunctions('PostedSalesInvoiceYourReferenceModalPageHandler')]\n+ procedure VerifyYourReferenceUpdatedInCustLedgerEntry()\n+ var\n+ CustLedgerEntry: Record \"Cust. Ledger Entry\";\n+ SalesInvoiceHeader: Record \"Sales Invoice Header\";\n+ YourReference: Text[35];\n+ PostedSalesInvoice: TestPage \"Posted Sales Invoice\";\n+ begin\n+ // [SCENARIO 595854] Verify Your Reference Field updated in Customer Ledger Entries,\n+ // when changed with Update document on Posted Sales Invoice.\n+ Initialize();\n+\n+ LibraryLowerPermissions.SetO365Setup();\n+ LibraryLowerPermissions.AddSalesDocsPost();\n+\n+ // [GIVEN] Create and post a Sales Order.\n+ SalesInvoiceHeader.Get(CreateAndPostSalesOrderGetInvoiceNo());\n+ YourReference := LibraryRandom.RandText(35);\n+ LibraryVariableStorage.Enqueue(YourReference);\n+\n+ // [GIVEN] Opened \"Posted Sales Invoice - Update\" page.\n+ PostedSalesInvoice.OpenView();\n+ PostedSalesInvoice.GoToRecord(SalesInvoiceHeader);\n+ PostedSalesInvoice.\"Update Document\".Invoke();\n+\n+ // [WHEN] Press OK on the page via PostedSalesInvoiceYourReferenceModalPageHandler.\n+\n+ // [THEN] Verify Your Reference field updated on Sales Invoice Header and Customer Ledger Entry.\n+ SalesInvoiceHeader.Get(SalesInvoiceHeader.\"No.\");\n+ Assert.AreEqual(YourReference, SalesInvoiceHeader.\"Your Reference\", SalesInvoiceYourReferenceErr);\n+\n+ CustLedgerEntry.SetRange(\"Document No.\", SalesInvoiceHeader.\"No.\");\n+ CustLedgerEntry.FindFirst();\n+ Assert.AreEqual(YourReference, CustLedgerEntry.\"Your Reference\", CustLedgerEntryYourReferenceErr);\n+\n+ LibraryVariableStorage.AssertEmpty();\n+ LibraryLowerPermissions.SetOutsideO365Scope();\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"Edit Posted Documents\");\n@@ -1535,6 +1577,14 @@ codeunit 134658 \"Edit Posted Documents\"\n PostedSalesInvUpdate.Cancel().Invoke();\n end;\n \n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure PostedSalesInvoiceYourReferenceModalPageHandler(var PostedSalesInvUpdate: TestPage \"Posted Sales Inv. - Update\")\n+ begin\n+ PostedSalesInvUpdate.\"Your Reference\".SetValue(LibraryVariableStorage.DequeueText());\n+ PostedSalesInvUpdate.OK().Invoke();\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerTrue(QuestionText: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al b/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al\nindex 6a5f0a883a3..626b74297f4 100644\n--- a/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al\n@@ -56,6 +56,7 @@ codeunit 1409 \"Sales Inv. Header - Edit\"\n CustLedgerEntry.Description := SalesInvoiceHeader.\"Posting Description\";\n CustLedgerEntry.\"Promised Pay Date\" := SalesInvoiceHeader.\"Promised Pay Date\";\n CustLedgerEntry.\"Due Date\" := SalesInvoiceHeader.\"Due Date\";\n+ CustLedgerEntry.\"Your Reference\" := SalesInvoiceHeader.\"Your Reference\";\n if CustLedgerEntry.\"Dispute Status\" <> '' then begin\n if DisputeStatus.get(CustLedgerEntry.\"Dispute Status\") then\n if (DisputeStatus.\"Overwrite on hold\") and ClearOnHold(SalesInvoiceHeader) then\ndiff --git a/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al\nindex c64fa944c7e..546c3b5513a 100644\n--- a/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al\n@@ -44,6 +44,7 @@ codeunit 103 \"Cust. Entry-Edit\"\n CustLedgEntry.\"Applies-to ID\" := Rec.\"Applies-to ID\";\n CustLedgEntry.Validate(\"Payment Method Code\", Rec.\"Payment Method Code\");\n CustLedgEntry.Validate(\"Payment Reference\", Rec.\"Payment Reference\");\n+ CustLedgEntry.Validate(\"Your Reference\", Rec.\"Your Reference\");\n CustLedgEntry.Validate(\"Remaining Pmt. Disc. Possible\", Rec.\"Remaining Pmt. Disc. Possible\");\n CustLedgEntry.\"Pmt. Disc. Tolerance Date\" := Rec.\"Pmt. Disc. Tolerance Date\";\n CustLedgEntry.Validate(\"Max. Payment Tolerance\", Rec.\"Max. Payment Tolerance\");\n@@ -122,7 +123,8 @@ codeunit 103 \"Cust. Entry-Edit\"\n (CurrCustLedgerEntry.\"Payment Reference\" <> NewCustLedgerEntry.\"Payment Reference\") or\n (CurrCustLedgerEntry.\"Message to Recipient\" <> NewCustLedgerEntry.\"Message to Recipient\") or\n (CurrCustLedgerEntry.\"Recipient Bank Account\" <> NewCustLedgerEntry.\"Recipient Bank Account\") or\n- (CurrCustLedgerEntry.\"On Hold\" <> NewCustLedgerEntry.\"On Hold\");\n+ (CurrCustLedgerEntry.\"On Hold\" <> NewCustLedgerEntry.\"On Hold\") or\n+ (CurrCustLedgerEntry.\"Your Reference\" <> NewCustLedgerEntry.\"Your Reference\");\n OnAfterLogFieldChanged(CurrCustLedgerEntry, NewCustLedgerEntry, Changed);\n exit(Changed);\n end;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-193649", "base_commit": "3a5cb3aed7e735e557547556f727cce66b15affe", "created_at": "2024-09-06", "environment_setup_version": "25.0", "project_paths": ["App\\Apps\\W1\\Shopify\\app", "App\\Apps\\W1\\Shopify\\test"], "FAIL_TO_PASS": [{"codeunitID": 139695, "functionName": ["UnitTestCopyInvoice"]}], "PASS_TO_PASS": [], "metadata": {"area": "shopify"}, "test_patch": "diff --git a/App/Apps/W1/Shopify/test/Invoices/ShpfyInvoicesTest.Codeunit.al b/App/Apps/W1/Shopify/test/Invoices/ShpfyInvoicesTest.Codeunit.al\nnew file mode 100644\nindex 000000000000..288b4d8039f0\n--- /dev/null\n+++ b/App/Apps/W1/Shopify/test/Invoices/ShpfyInvoicesTest.Codeunit.al\n@@ -0,0 +1,67 @@\n+codeunit 139695 \"Shpfy Invoices Test\"\n+{\n+ Subtype = Test;\n+ TestPermissions = Disabled;\n+\n+ var\n+ LibraryAssert: Codeunit \"Library Assert\";\n+ Any: Codeunit Any;\n+ LibrarySales: Codeunit \"Library - Sales\";\n+ LibraryInventory: Codeunit \"Library - Inventory\";\n+ LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n+ IsInitialized: Boolean;\n+\n+ [Test]\n+ procedure UnitTestCopyInvoice()\n+ var\n+ Item: Record Item;\n+ Customer: Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ InvoiceNo: Code[20];\n+ OrderId: BigInteger;\n+ begin\n+ // [SCENARIO] Shopify related fields are not copied to the new invoice\n+ // [GIVEN] Posted sales invoice with Shopify related fields and empty invoice\n+ Initialize();\n+ OrderId := Any.IntegerInRange(10000, 99999);\n+ LibraryInventory.CreateItem(Item);\n+ LibrarySales.CreateCustomer(Customer);\n+ InvoiceNo := CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer.\"No.\");\n+\n+ // [WHEN] Copy the invoice\n+ CopySalesDocument(SalesHeader, InvoiceNo);\n+\n+ // [THEN] Shopify related fields are not copied\n+ LibraryAssert.IsTrue(SalesHeader.\"Shpfy Order Id\" = 0, 'Shpfy Order Id is not copied');\n+ end;\n+\n+ local procedure Initialize()\n+ begin\n+ if IsInitialized then\n+ exit;\n+ IsInitialized := true;\n+ LibraryERMCountryData.CreateVATData();\n+ LibraryERMCountryData.UpdateGeneralPostingSetup();\n+ end;\n+\n+ local procedure CreateAndPostSalesInvoice(Item: Record Item; Customer: Record Customer; NumberOfLines: Integer; OrderId: BigInteger): Code[20]\n+ var\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer.\"No.\");\n+ SalesHeader.\"Shpfy Order Id\" := OrderId;\n+ SalesHeader.Modify();\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", NumberOfLines);\n+ exit(LibrarySales.PostSalesDocument(SalesHeader, true, true));\n+ end;\n+\n+ local procedure CopySalesDocument(var ToSalesHeader: Record \"Sales Header\"; DocNo: Code[20])\n+ var\n+ CopyDocumentMgt: Codeunit \"Copy Document Mgt.\";\n+ begin\n+ CopyDocumentMgt.SetProperties(true, false, false, false, false, false, false);\n+ CopyDocumentMgt.CopySalesDoc(\"Sales Document Type From\"::\"Posted Invoice\", DocNo, ToSalesHeader);\n+ end;\n+}\ndiff --git a/App/Apps/W1/Shopify/test/app.json b/App/Apps/W1/Shopify/test/app.json\nindex fad22c7daf0e..ba1deea22a10 100644\n--- a/App/Apps/W1/Shopify/test/app.json\n+++ b/App/Apps/W1/Shopify/test/app.json\n@@ -71,6 +71,10 @@\n {\n \"from\": 139645,\n \"to\": 139649\n+ },\n+ {\n+ \"from\": 139695,\n+ \"to\": 139699\n }\n ],\n \"target\": \"OnPrem\",\n", "patch": "diff --git a/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al b/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al\nindex cf03c116eaef..a6a20c46d2da 100644\n--- a/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al\n+++ b/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al\n@@ -1,6 +1,8 @@\n namespace Microsoft.Integration.Shopify;\n \n using Microsoft.Sales.History;\n+using Microsoft.Utilities;\n+using Microsoft.Sales.Document;\n \n codeunit 30364 \"Shpfy Update Sales Invoice\"\n {\n@@ -19,4 +21,12 @@ codeunit 30364 \"Shpfy Update Sales Invoice\"\n begin\n SalesInvoiceHeader.\"Shpfy Order Id\" := SalesInvoiceHeaderRec.\"Shpfy Order Id\";\n end;\n+\n+ [EventSubscriber(ObjectType::Codeunit, Codeunit::\"Copy Document Mgt.\", 'OnCopySalesDocOnAfterTransferPostedInvoiceFields', '', false, false)]\n+ local procedure OnCopySalesDocOnAfterCopySalesDocUpdateHeader(var ToSalesHeader: Record \"Sales Header\")\n+ begin\n+ Clear(ToSalesHeader.\"Shpfy Order Id\");\n+ Clear(ToSalesHeader.\"Shpfy Order No.\");\n+ Clear(ToSalesHeader.\"Shpfy Refund Id\");\n+ end;\n }\n\\ No newline at end of file\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-220036", "base_commit": "e21460ab75c1fb80ba3033e3755672cbd4ed8d9f", "created_at": "2025-07-04", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM", "App\\Layers\\W1\\Tests\\Misc"], "FAIL_TO_PASS": [{"codeunitID": 134905, "functionName": ["VerifyEmailOnReminderPageWhenCustomerHasNoContacts"]}, {"codeunitID": 134825, "functionName": ["GetPrimaryConactCustomerWithoutContact"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\nindex f8b1cf9e56e..71c12b1ce1a 100644\n--- a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n@@ -587,6 +587,55 @@ codeunit 134905 \"ERM Issued Reminder Addnl Fee\"\n Assert.AreEqual(ReminderFinChargeEntry.\"Due Date\", CustLedgerEntry.\"Due Date\", ReminderDueDateErr);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure VerifyEmailOnReminderPageWhenCustomerHasNoContacts()\n+ var\n+ Customer: Record Customer;\n+ ReminderLevel: Record \"Reminder Level\";\n+ ReminderText: Record \"Reminder Text\";\n+ ReminderHeader: Record \"Reminder Header\";\n+ ReminderPage: TestPage Reminder;\n+ CustomerCard: TestPage \"Customer Card\";\n+ EMail: Text[80];\n+ DueDate: Date;\n+ DocumentDate: Date;\n+ begin\n+ // [SCENARIO 581797] [ALL-E] Field Email on Reminder is empty when customer does not have any contacts\n+ Initialize();\n+\n+ // [GIVEN] Create Customer with E-Mail and Reminder Terms Code.\n+ CreateCustomer(Customer, '');\n+ Customer.Validate(\"Reminder Terms Code\", CreateReminderTerms());\n+ EMail := 'test1@test.com';\n+ Customer.Modify(true);\n+\n+ CustomerCard.OpenEdit();\n+ CustomerCard.GoToRecord(Customer);\n+ CustomerCard.\"E-Mail\".SetValue(EMail);\n+ CustomerCard.Close();\n+\n+ // [GIVEN] Create Reminder Level with Random Grace Period and Random Additional Fee.\n+ ReminderLevel.SetRange(\"Reminder Terms Code\", Customer.\"Reminder Terms Code\");\n+ ReminderLevel.FindFirst();\n+ LibraryERM.CreateReminderText(\n+ ReminderText, Customer.\"Reminder Terms Code\",\n+ ReminderLevel.\"No.\", ReminderText.Position::Ending, ReminderEndingText);\n+\n+ // [WHEN] Post Sales Invoice and Create Reminder.\n+ DueDate := CreateAndPostSalesInvoice(Customer.\"No.\", '');\n+ DocumentDate := CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', CalcDate(ReminderLevel.\"Grace Period\", DueDate));\n+ CreateReminder(Customer.\"No.\", DocumentDate, false);\n+\n+ // [THEN] Find Reminder Header for Customer and open Reminder Page.\n+ FindReminderHeader(ReminderHeader, Customer.\"No.\");\n+ ReminderPage.OpenEdit();\n+ ReminderPage.GoToRecord(ReminderHeader);\n+\n+ // [THEN] Verify E-Mail on Reminder Page.\n+ ReminderPage.ContactEmail.AssertEquals(EMail);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\ndiff --git a/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al b/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al\nindex 70b34d374fa..33cc3001fc3 100644\n--- a/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al\n+++ b/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al\n@@ -25,6 +25,7 @@ codeunit 134825 \"UT Customer Table\"\n DeleteCustomerSalesDocExistsErr: Label 'You cannot delete %1 %2 because there is at least one outstanding Sales %3 for this customer.';\n DialogErr: Label 'Dialog';\n PhoneNoCannotContainLettersErr: Label '%1 must not contain letters in %2 %3=''%4''.';\n+ ContactNoShouldNotBeEmpty: Label 'Contact No. should not be empty';\n \n [Test]\n [Scope('OnPrem')]\n@@ -740,8 +741,8 @@ codeunit 134825 \"UT Customer Table\"\n // [WHEN] Function GetPrimaryConact is being run with parameter \"CONT\"\n Customer.GetPrimaryContact(Customer.\"No.\", Contact);\n \n- // [THEN] Variable Contact is empty\n- Contact.TestField(\"No.\", '');\n+ // [THEN] Variable Contact exists without customer contact\n+ Assert.IsTrue(Contact.\"No.\" <> '', ContactNoShouldNotBeEmpty);\n end;\n \n [Test]\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\nindex 9fdc21c529d..de6b7a0cc2e 100644\n--- a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n+++ b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n@@ -2302,7 +2302,22 @@ table 18 Customer\n begin\n Clear(PrimaryContact);\n if Customer.Get(CustomerNo) then\n- if PrimaryContact.Get(Customer.\"Primary Contact No.\") then;\n+ if not PrimaryContact.Get(Customer.\"Primary Contact No.\") then\n+ GetContact(CustomerNo, PrimaryContact);\n+ end;\n+\n+ local procedure GetContact(CustomerNo: Code[20]; var PrimaryContact: Record Contact)\n+ var\n+ ContactBusinessRelation: Record \"Contact Business Relation\";\n+ begin\n+ ContactBusinessRelation.SetCurrentKey(\"Link to Table\", \"No.\");\n+ ContactBusinessRelation.SetRange(\"Link to Table\", ContactBusinessRelation.\"Link to Table\"::Customer);\n+ ContactBusinessRelation.SetRange(\"No.\", CustomerNo);\n+ if ContactBusinessRelation.FindSet() then\n+ repeat\n+ if PrimaryContact.Get(ContactBusinessRelation.\"Contact No.\") then\n+ exit;\n+ until ContactBusinessRelation.Next() = 0;\n end;\n \n local procedure GetCustomerPriceGroupPriceCalcMethod(): Enum \"Price Calculation Method\";\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-188438", "base_commit": "b3cff264abfbab722f8657c126f23aa07ad00056", "created_at": "2024-07-03", "environment_setup_version": "24.3", "project_paths": ["App\\Apps\\W1\\Sustainability\\app", "App\\Apps\\W1\\Sustainability\\test"], "FAIL_TO_PASS": [{"codeunitID": 148181, "functionName": ["TestCustomAmountIsPositiveForNegativeTotalOfGL"]}], "PASS_TO_PASS": [], "metadata": {"area": "sustainability"}, "test_patch": "diff --git a/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al b/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al\nindex 54ca91b65b2f..bfae0fd4c73a 100644\n--- a/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al\n+++ b/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al\n@@ -5,9 +5,13 @@ codeunit 148181 \"Sustainability Journal Test\"\n \n var\n Assert: Codeunit Assert;\n+ LibraryERM: Codeunit \"Library - ERM\";\n+ LibraryRandom: Codeunit \"Library - Random\";\n LibrarySustainability: Codeunit \"Library - Sustainability\";\n+ LibraryUtility: Codeunit \"Library - Utility\";\n OneDefaultTemplateShouldBeCreatedLbl: Label 'One default template should be created after page is opened', Locked = true;\n OneDefaultBatchShouldBeCreatedLbl: Label 'One default batch should be created after page is opened', Locked = true;\n+ CustomAmountMustBePositiveLbl: Label 'The custom amount must be positive', Locked = true;\n \n [Test]\n procedure TestDefaultTemplateAndBatchSuccessfullyInserted()\n@@ -100,4 +104,46 @@ codeunit 148181 \"Sustainability Journal Test\"\n // [THEN] The Check should fail\n asserterror SustainabilityJournalMgt.CheckScopeMatchWithBatch(SustainabilityJournalLine);\n end;\n+\n+ [Test]\n+ procedure TestCustomAmountIsPositiveForNegativeTotalOfGL()\n+ var\n+ SustainAccountCategory: Record \"Sustain. Account Category\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJouralLine: Record \"Gen. Journal Line\";\n+ SustainabilityCalcMgt: Codeunit \"Sustainability Calc. Mgt.\";\n+ GenJournalTemplateCode: Code[10];\n+ GLAccountNo: Code[20];\n+ GLAmount, CustomAmount : Decimal;\n+ begin\n+ // [SCENARIO 540221] Test that the custom amount is positive when the total of the GL is negative\n+\n+ // [GIVEN] G/L Account exists\n+ GLAccountNo := LibraryERM.CreateGLAccountNoWithDirectPosting();\n+\n+ // [GIVEN] G/L Batch and Template exist\n+ GenJournalTemplateCode := LibraryERM.SelectGenJnlTemplate();\n+ LibraryERM.CreateGenJournalBatch(GenJournalBatch, GenJournalTemplateCode);\n+\n+ // [GIVEN] G/L Entry with Amount = -1000 for the G/L Account\n+ GLAmount := -LibraryRandom.RandDec(1000, 2);\n+ LibraryERM.CreateGeneralJnlLine2WithBalAcc(GenJouralLine, GenJournalTemplateCode, GenJournalBatch.Name, GenJouralLine.\"Document Type\"::Payment, GenJouralLine.\"Account Type\"::\"G/L Account\", GLAccountNo, GenJouralLine.\"Account Type\"::\"G/L Account\", LibraryERM.CreateGLAccountNoWithDirectPosting(), GLAmount);\n+ LibraryERM.PostGeneralJnlLine(GenJouralLine);\n+\n+ // [GIVEN] Sustain Account Category with the G/L Account calculation foundation\n+ SustainAccountCategory := CreateSustAccountCategoryWithGLAccountNo(GLAccountNo);\n+\n+ // [WHEN] Getting the collectable amount for sustanability account category\n+ CustomAmount := SustainabilityCalcMgt.GetCollectableGLAmount(SustainAccountCategory, 0D, 0D);\n+\n+ // [THEN] The custom amount = 1000\n+ Assert.AreEqual(Abs(GLAmount), CustomAmount, CustomAmountMustBePositiveLbl);\n+ end;\n+\n+ local procedure CreateSustAccountCategoryWithGLAccountNo(GLAccountNo: Code[20]) SustainAccountCategory: Record \"Sustain. Account Category\"\n+ begin\n+ SustainAccountCategory := LibrarySustainability.InsertAccountCategory(LibraryUtility.GenerateGUID(), LibraryUtility.GenerateGUID(), Enum::\"Emission Scope\"::\"Scope 2\", Enum::\"Calculation Foundation\"::Custom, true, true, true, 'GL', true);\n+ SustainAccountCategory.\"G/L Account Filter\" := GLAccountNo;\n+ SustainAccountCategory.Modify(true);\n+ end;\n }\n\\ No newline at end of file\n", "patch": "diff --git a/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al b/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al\nindex 4644c8733d76..35add37418cc 100644\n--- a/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al\n+++ b/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al\n@@ -70,7 +70,7 @@ codeunit 6218 \"Sustainability Calc. Mgt.\"\n begin\n FilterGLEntry(SustainAccountCategory, FromDate, ToDate, GLEntry);\n GLEntry.CalcSums(Amount);\n- exit(GLEntry.Amount);\n+ exit(Abs(GLEntry.Amount));\n end;\n \n internal procedure CollectGeneralLedgerAmount(var SustainabilityJnlLine: Record \"Sustainability Jnl. Line\")\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-224447", "base_commit": "cc0427613cdcf235d834b83a7e69b98288686d0d", "created_at": "2025-08-21", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134979, "functionName": ["SendIssuedReminderByEmailAndEntryCreatedInEmailRelatedRecords"]}], "PASS_TO_PASS": [], "metadata": {"area": "reporting"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al b/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al\nindex 1667c4a29d8..01f9284203b 100644\n--- a/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al\n@@ -844,6 +844,53 @@ codeunit 134979 \"Reminder Automation Tests\"\n ReminderTermSetupPage.ReminderLevelSetup.CustomerCommunications.Invoke();\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ModalEmailEditorHandler,CancelMailSendingStrMenuHandler')]\n+ procedure SendIssuedReminderByEmailAndEntryCreatedInEmailRelatedRecords()\n+ var\n+ Customer: Record Customer;\n+ IssuedReminderHeader: Record \"Issued Reminder Header\";\n+ ReminderTerms: Record \"Reminder Terms\";\n+ ReminderHeader: Record \"Reminder Header\";\n+ LanguageCode: Code[10];\n+ FileName: Text;\n+ begin\n+ // [SCENARIO 591799] Issued reminder emails are not logged in sent e-mail history of a customer\n+ Initialize();\n+\n+ // [WHEN] A connector is installed and an account is added\n+ InstallConnectorAndAddAccount();\n+\n+ // [GIVEN] Create reminder term with levels\n+ CreateReminderTermsWithLevels(ReminderTerms, GetDefaultDueDatePeriodForReminderLevel(), Any.IntegerInRange(2, 5));\n+\n+ // [GIVEN] Create reminder attachment text, file name = XXX, language code = Y\n+ LanguageCode := LibraryERM.GetAnyLanguageDifferentFromCurrent();\n+ CreateReminderAttachmentText(ReminderTerms, LanguageCode);\n+\n+ // [GIVEN] Create a customer X with overdue entries\n+ CreateCustomerWithOverdueEntries(Customer, ReminderTerms, Any.IntegerInRange(2, 5));\n+\n+ // [GIVEN] Set language code Y for customer X\n+ Customer.\"Language Code\" := LanguageCode;\n+ Customer.Modify();\n+ FileName := LibraryVariableStorage.DequeueText();\n+ LibraryVariableStorage.Enqueue(Customer.\"No.\");\n+ LibraryVariableStorage.Enqueue(FileName);\n+\n+ // [GIVEN] Create and issue reminder for customer X \n+ CreateAndIssueReminder(ReminderHeader, Customer.\"No.\");\n+\n+ // [WHEN] Run action \"Send by mail\" on issued reminder\n+ IssuedReminderHeader.SetRange(\"Pre-Assigned No.\", ReminderHeader.\"No.\");\n+ IssuedReminderHeader.FindFirst();\n+ CustomReportSelectionPrint(IssuedReminderHeader, Enum::\"Report Selection Usage\"::Reminder, 1);\n+\n+ // [THEN] Verified in ModalEmailEditorHandler page\n+ LibraryVariableStorage.Clear();\n+ end;\n+\n local procedure CreateReminderAttachmentText(ReminderTerms: Record \"Reminder Terms\"; LanguageCode: Code[10])\n var\n ReminderLevel: Record \"Reminder Level\";\n@@ -1179,6 +1226,57 @@ codeunit 134979 \"Reminder Automation Tests\"\n end;\n end;\n \n+ local procedure InstallConnectorAndAddAccount()\n+ var\n+ TempAccount: Record \"Email Account\" temporary;\n+ ConnectorMock: Codeunit \"Connector Mock\";\n+ EmailScenarioMock: Codeunit \"Email Scenario Mock\";\n+ begin\n+ ConnectorMock.Initialize();\n+ ConnectorMock.AddAccount(TempAccount);\n+ EmailScenarioMock.DeleteAllMappings();\n+ EmailScenarioMock.AddMapping(Enum::\"Email Scenario\"::Default, TempAccount.\"Account Id\", TempAccount.Connector);\n+ end;\n+\n+ local procedure CustomReportSelectionPrint(Document: Variant; ReportUsage: Enum \"Report Selection Usage\"; CustomerNoFieldNo: Integer)\n+ var\n+ ReportSelections: Record \"Report Selections\";\n+ TempReportSelections: Record \"Report Selections\" temporary;\n+ RecRef: RecordRef;\n+ FieldRef: FieldRef;\n+ CustomerNo: Code[20];\n+ begin\n+ RecRef.GetTable(Document);\n+ FieldRef := RecRef.Field(CustomerNoFieldNo);\n+ CustomerNo := CopyStr(Format(FieldRef.Value), 1, MaxStrLen(CustomerNo));\n+\n+ RecRef.SetRecFilter();\n+ RecRef.SetTable(Document);\n+\n+ ReportSelections.FindEmailAttachmentUsageForCust(ReportUsage, CustomerNo, TempReportSelections);\n+ ReportSelections.SendEmailToCust(ReportUsage.AsInteger(), Document, '', '', true, CustomerNo);\n+ end;\n+\n+ [StrMenuHandler]\n+ [Scope('OnPrem')]\n+ procedure CancelMailSendingStrMenuHandler(Options: Text; var Choice: Integer; Instruction: Text)\n+ begin\n+ Choice := 1; //Save as Draft //Discard email\t\n+ end;\n+\n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ModalEmailEditorHandler(var EmailEditor: TestPage \"Email Editor\")\n+ var\n+ Customer: Record Customer;\n+ EmailRelatedRecord: Record \"Email Related Record\";\n+ begin\n+ Customer.Get(LibraryVariableStorage.DequeueText());\n+ EmailRelatedRecord.SetRange(\"Table Id\", Database::Customer);\n+ EmailRelatedRecord.SetRange(\"System Id\", Customer.SystemId);\n+ Assert.IsTrue(EmailRelatedRecord.FindFirst(), EmailRelatedRecordNotFoundErr);\n+ end;\n+\n [ModalPageHandler()]\n procedure CreateRemindersSetupModalPageHandler(var CreateRemindersSetup: TestPage \"Create Reminders Setup\")\n begin\n@@ -1271,4 +1369,5 @@ codeunit 134979 \"Reminder Automation Tests\"\n Any: Codeunit Any;\n IsInitialized: Boolean;\n FiltersAreNotSavedErr: Label 'Filters are not saved';\n+ EmailRelatedRecordNotFoundErr: Label 'Email related record not found';\n }\n\\ No newline at end of file\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\nindex 7a71bebba78..5e7b5d9c79b 100644\n--- a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n+++ b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n@@ -1269,7 +1269,8 @@ table 77 \"Report Selections\"\n Database::\"Sales Invoice Header\",\n Database::\"Sales Cr.Memo Header\",\n Database::\"Sales Shipment Header\",\n- Database::\"Return Receipt Header\"];\n+ Database::\"Return Receipt Header\",\n+ Database::\"Issued Reminder Header\"];\n \n OnAfterIsCustomerAccount(DocumentTableId, IsCustomer);\n end;\n@@ -1521,7 +1522,10 @@ table 77 \"Report Selections\"\n // Related Source - Customer or vendor receiving the document\n TableId := GetAccountTableId(DocumentRecord.Number());\n if TableId = Database::Customer then begin\n- FieldName := 'Sell-to Customer No.';\n+ if DocumentRecord.Number() = Database::\"Issued Reminder Header\" then\n+ FieldName := 'Customer No.'\n+ else\n+ FieldName := 'Sell-to Customer No.';\n OnSendEmailDirectlyOnAfterSetFieldName(DocumentRecord.Number(), FieldName);\n if DataTypeManagement.FindfieldByName(DocumentRecord, FieldRef, FieldName) and Customer.Get(Format(FieldRef.Value())) then begin\n SourceTableIDs.Add(Database::Customer);\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226875", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-15", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\General Journal"], "FAIL_TO_PASS": [{"codeunitID": 134920, "functionName": ["VendorNameFieldPopulatesOnlyForVendorAccountType"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al b/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al\nindex 9e6664f2979..0e9383fc12c 100644\n--- a/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al\n+++ b/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al\n@@ -6000,6 +6000,53 @@ codeunit 134920 \"ERM General Journal UT\"\n GenJournalLine[4].TestField(\"Document No.\", NewDocNo);\n end;\n \n+ [Test]\n+ procedure VendorNameFieldPopulatesOnlyForVendorAccountType()\n+ var\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJournalTemplate: Record \"Gen. Journal Template\";\n+ GLAccount: Record \"G/L Account\";\n+ Vendor: Record Vendor;\n+ PurchaseJournal: TestPage \"Purchase Journal\";\n+ begin\n+ // [SCENARIO 599505] Purchase Journal page validates vendor name field based on account type\n+ Initialize();\n+\n+ // [GIVEN] Create a vendor with random name\n+ LibraryPurchase.CreateVendor(Vendor);\n+ Vendor.Name := LibraryRandom.RandText(20);\n+ Vendor.Modify(true);\n+\n+ // [GIVEN] Create Purchase Journal Template and Batch\n+ LibraryERM.CreateGenJournalBatch(GenJournalBatch, LibraryJournals.SelectGenJournalTemplate(GenJournalTemplate.Type::Purchases, Page::\"Purchase Journal\"));\n+\n+ // [WHEN] Open Purchase Journal page and perform actions as per YAML recording\n+ PurchaseJournal.OpenEdit();\n+ PurchaseJournal.CurrentJnlBatchName.SetValue(GenJournalBatch.Name);\n+\n+ // [GIVEN] Set Document Type to Invoice and Document No. to random value\n+ PurchaseJournal.\"Document Type\".SetValue(\"Gen. Journal Document Type\"::Invoice);\n+ PurchaseJournal.\"Document No.\".SetValue(LibraryRandom.RandText(10));\n+\n+ // [GIVEN] Set Account Type to Vendor and Account No. to Vendor.\"No.\"\n+ PurchaseJournal.\"Account Type\".SetValue(\"Gen. Journal Account Type\"::Vendor);\n+ PurchaseJournal.\"Account No.\".SetValue(Vendor.\"No.\");\n+\n+ // [THEN] Verify Vendor Name page field is populated with Vendor.Name\n+ PurchaseJournal.\"\".AssertEquals(Vendor.Name);\n+\n+ // [WHEN] Set Account Type to G/L Account and Account No. to a new G/L Account.\"No.\"\n+ PurchaseJournal.\"Account Type\".SetValue(\"Gen. Journal Account Type\"::\"G/L Account\");\n+ LibraryERM.CreateGLAccount(GLAccount);\n+ PurchaseJournal.\"Account No.\".SetValue(GLAccount.\"No.\");\n+\n+ // [THEN] Verify Vendor Name field should be empty for G/L Account\n+ PurchaseJournal.\"\".AssertEquals('');\n+\n+ // [CLEANUP] Close Purchase Journal page\n+ PurchaseJournal.Close();\n+ end;\n+\n local procedure Initialize()\n begin\n LibrarySetupStorage.Restore();\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al\nindex fa043e01294..4d5abfe80aa 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al\n@@ -170,7 +170,7 @@ page 254 \"Purchase Journal\"\n CurrPage.SaveRecord();\n end;\n }\n- field(\"\"; AccName)\n+ field(\"\"; GetVendorName())\n {\n ApplicationArea = Basic, Suite;\n Caption = 'Vendor Name';\n@@ -1661,6 +1661,14 @@ page 254 \"Purchase Journal\"\n NumberOfRecords := Rec.Count();\n end;\n \n+ local procedure GetVendorName(): Text[100]\n+ begin\n+ if (Rec.\"Account Type\" = Rec.\"Account Type\"::Vendor) and (AccName <> '') then\n+ exit(AccName);\n+\n+ exit('');\n+ end;\n+\n local procedure EnableApplyEntriesAction()\n begin\n ApplyEntriesActionEnabled :=\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226223", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-09", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134043, "functionName": ["NoVATEntryAddCurrExchRateAdjust"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al\nindex ee712bb9f9b..26f12019b95 100644\n--- a/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al\n@@ -1192,6 +1192,38 @@ codeunit 134043 \"ERM Additional Currency\"\n StrSubstNo(AmountLCYError, GenJournalLine.\"Amount (LCY)\"));\n end;\n \n+ [Test]\n+ [HandlerFunctions('StatisticsMessageHandler')]\n+ procedure NoVATEntryAddCurrExchRateAdjust()\n+ var\n+ Currency: Record Currency;\n+ CurrencyExchangeRate: Record \"Currency Exchange Rate\";\n+ GeneralLedgerSetup: Record \"General Ledger Setup\";\n+ VATEntry: Record \"VAT Entry\";\n+ PostingDate: Date;\n+ begin\n+ // [SCENARIO 598998] \"Attempted to divide by zero\" error during Exchange Rates Adjustment if the company has no Tax/VAT Entries.\n+ Initialize();\n+ VATEntry.DeleteAll();\n+\n+ // [GIVEN] Currency FCY with exchange rates.\n+ PostingDate := WorkDate();\n+ CreateCurrencyWithExchangeRates(Currency, 1, PostingDate);\n+\n+ // [GIVEN] General Ledger Setup \"Additional Reporting Currency\" = \"FCY\"\n+ LibraryERM.SetAddReportingCurrency(Currency.Code);\n+\n+ // [GIVEN] General Ledger Setup \"VAT Exchange Rate Adjustment\" := Adjust Additional-Currency Amount\n+ UpdateGenLedgerVATExchRateAdjustment(\n+ GeneralLedgerSetup.\"VAT Exchange Rate Adjustment\"::\"Adjust Additional-Currency Amount\");\n+\n+ // [THEN] Run Adjust Exchange Rate with Adjust G/L Account and without other Adjustments\n+ CurrencyExchangeRate.Get(Currency.code, LibraryERM.FindEarliestDateForExhRate());\n+\n+ // [THEN] Report should executed without any error\n+ RunAdjustExchangeRates(CurrencyExchangeRate, Currency.Code);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al b/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al\nindex 467c235ce97..bdb56817ec5 100644\n--- a/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al\n@@ -308,6 +308,8 @@ codeunit 699 \"Exch. Rate Adjmt. Process\"\n Window.Open(AdjustingVATEntriesTxt + VATEntryProgressBarTxt);\n \n VATEntryNoTotal := VATEntry.Count();\n+ if VATEntryNoTotal = 0 then\n+ exit;\n SetVATEntryFilters(VATEntry, ExchRateAdjmtParameters.\"Start Date\", ExchRateAdjmtParameters.\"End Date\");\n if VATPostingSetup.FindSet() then\n repeat\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-221877", "base_commit": "0b60a161ce9c6976c82d811815aa974cf29181f8", "created_at": "2025-07-24", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Service"], "FAIL_TO_PASS": [{"codeunitID": 136101, "functionName": ["AutoUpdateServiceHeaderStatusOnServiceItemLineAdd"]}], "PASS_TO_PASS": [], "metadata": {"area": "service"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\nindex 5a74dfc12b9..204066e8ac0 100644\n--- a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n@@ -122,6 +122,7 @@ codeunit 136101 \"Service Orders\"\n AvailableExpectedQuantityErr: Label 'Available expected quantity must be %1.', Comment = '%1=Value';\n VATCountryRegionLbl: Label 'VAT Country/Region Code must be %1', Comment = '%1 = Country/Region Code';\n ServiceOrderErr: Label 'Service Order does not exist.';\n+ ServiceOrderStatusShouldChangedErr: Label 'Service Header Status should have changed when adding Service Item';\n \n [Test]\n [Scope('OnPrem')]\n@@ -5688,6 +5689,54 @@ codeunit 136101 \"Service Orders\"\n ServiceStatistics.SubForm.\"Amount Including VAT\".AssertEquals(0);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure AutoUpdateServiceHeaderStatusOnServiceItemLineAdd()\n+ var\n+ ServiceHeader: Record \"Service Header\";\n+ ServiceItem: Record \"Service Item\";\n+ Customer: Record Customer;\n+ ServiceOrderPage: TestPage \"Service Order\";\n+ InitialStatus: Enum \"Service Document Status\";\n+ FinalStatus: Enum \"Service Document Status\";\n+ begin\n+ // [SCENARIO 582114] Test that Service Header Status changes automatically when adding Service Item to Finished Service Order\n+\n+ // [GIVEN] Initialize and create test data\n+ Initialize();\n+ LibrarySales.CreateCustomer(Customer);\n+ LibraryService.CreateServiceItem(ServiceItem, Customer.\"No.\");\n+\n+ // [GIVEN] Create a Service Order and set status to Finished\n+ LibraryService.CreateServiceHeader(ServiceHeader, ServiceHeader.\"Document Type\"::Order, Customer.\"No.\");\n+ ServiceHeader.Validate(Status, ServiceHeader.Status::Finished);\n+ ServiceHeader.Modify(true);\n+ InitialStatus := ServiceHeader.Status;\n+\n+ // [WHEN] Open Service Order page and add Service Item Line (simulating user action)\n+ ServiceOrderPage.OpenEdit();\n+ ServiceOrderPage.Filter.SetFilter(\"No.\", ServiceHeader.\"No.\");\n+\n+ // [THEN] Verify initial status is Finished\n+ ServiceOrderPage.Status.AssertEquals(ServiceHeader.Status::Finished);\n+\n+ // [GIVEN] Add Service Item to the Service Item Lines subform\n+ ServiceOrderPage.ServItemLines.New();\n+ ServiceOrderPage.ServItemLines.ServiceItemNo.SetValue(ServiceItem.\"No.\");\n+ ServiceOrderPage.ServItemLines.Next(); // Move focus to trigger validation\n+\n+ // [THEN] Verify that Service Header Status has changed automatically\n+ ServiceOrderPage.Status.AssertEquals(ServiceHeader.Status::Pending); // Expected new status based on repair status priority\n+\n+ // [THEN] Verify the change was logged in Service Document Log\n+ ServiceHeader.Get(ServiceHeader.\"Document Type\", ServiceHeader.\"No.\");\n+ FinalStatus := ServiceHeader.Status;\n+\n+ // [THEN] Verify status actually changed\n+ Assert.AreNotEqual(InitialStatus, FinalStatus, ServiceOrderStatusShouldChangedErr);\n+ ServiceOrderPage.Close();\n+ end;\n+\n local procedure CreateServiceDocumentWithResourceWith100PctDisc(\n var ServiceHeader: Record \"Service Header\"; ServiceLine: Record \"Service Line\"; DocumentType: Enum \"Service Document Type\";\n CustomerNo: Code[20]; ResourceNo: Code[20]; Quantity: Decimal; UnitPrice: Decimal)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al b/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al\nindex 1c8fcc9eb8a..60fc813bbe7 100644\n--- a/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al\n@@ -201,6 +201,10 @@ table 5901 \"Service Item Line\"\n UseServItemLineAsxRec := true;\n Modify(true);\n end;\n+\n+ if Rec.\"Repair Status Code\" <> '' then\n+ Validate(\"Repair Status Code\", Rec.\"Repair Status Code\");\n+\n OnAfterValidateServiceItemNoOnBeforeUpdateResponseTimeHours(Rec, xRec);\n UpdateResponseTimeHours();\n CreateDimFromDefaultDim(0);\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-219082", "base_commit": "908f59111599c95d0ba5af721b5ef34d8f4aac1f", "created_at": "2025-06-25", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Service"], "FAIL_TO_PASS": [{"codeunitID": 136101, "functionName": ["PrintServiceOrderWithWorkDescription"]}], "PASS_TO_PASS": [], "metadata": {"area": "reporting"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\nindex b74fec47106..55070a77a9a 100644\n--- a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n@@ -17,6 +17,7 @@ using Microsoft.Finance.VAT.Setup;\n using Microsoft.Foundation.Address;\n using Microsoft.Foundation.ExtendedText;\n using Microsoft.Foundation.NoSeries;\n+using Microsoft.Foundation.Reporting;\n using Microsoft.Foundation.Shipping;\n using Microsoft.Foundation.UOM;\n using Microsoft.Inventory.Item;\n@@ -5620,6 +5621,39 @@ codeunit 136101 \"Service Orders\"\n Assert.AreEqual(Customer[2].\"Country/Region Code\", ServiceHeader.\"VAT Country/Region Code\", VATCountryRegionLbl);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ServiceOrderReportRequestPageHandler')]\n+ procedure PrintServiceOrderWithWorkDescription()\n+ var\n+ Item: Record Item;\n+ ServiceHeader: Record \"Service Header\";\n+ ServiceItem: Record \"Service Item\";\n+ ServiceItemLine: Record \"Service Item Line\";\n+ ServiceLine: Record \"Service Line\";\n+ ServiceOrder: TestPage \"Service Order\";\n+ begin\n+ // [SCENARIO 575369] Verify Printing Service Order with Work Description does not throw error.\n+ Initialize();\n+\n+ // [GIVEN] Create Item\n+ LibraryInventory.CreateItem(Item);\n+\n+ // [GIVEN] Create Service Order with Work Description\n+ LibraryService.CreateServiceItem(ServiceItem, LibrarySales.CreateCustomerNo());\n+ LibraryService.CreateServiceHeader(ServiceHeader, ServiceHeader.\"Document Type\"::Order, ServiceItem.\"Customer No.\");\n+ LibraryService.CreateServiceItemLine(ServiceItemLine, ServiceHeader, ServiceItem.\"No.\");\n+ LibraryService.CreateServiceLine(ServiceLine, ServiceHeader, ServiceLine.Type::Item, Item.\"No.\");\n+\n+ // [WHEN] Open Service Order Card and click Print\n+ CreateCustomReportSelectionForCustomer(ServiceHeader.\"Customer No.\", \"Report Selection Usage\"::\"SM.Order\", 5900);\n+ ServiceOrder.OpenEdit();\n+ ServiceOrder.GotoRecord(ServiceHeader);\n+ ServiceOrder.WorkDescription.SetValue(LibraryRandom.RandText(20));\n+ ServiceOrder.\"&Print\".Invoke();\n+\n+ // [THEN] Verify no transaction error should occur.\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerTRUE(Question: Text[1024]; var Reply: Boolean)\n@@ -7923,6 +7957,23 @@ codeunit 136101 \"Service Orders\"\n exit(ServiceInvoiceHeader.\"No.\");\n end;\n \n+ local procedure CreateCustomReportSelectionForCustomer(CustomerNo: Code[20]; ReportSelectionUsage: Enum \"Report Selection Usage\"; ReportID: Integer)\n+ var\n+ CustomReportSelection: Record \"Custom Report Selection\";\n+ CustomReportLayout: Record \"Custom Report Layout\";\n+ begin\n+ CustomReportSelection.Init();\n+ CustomReportSelection.Validate(\"Source Type\", Database::Customer);\n+ CustomReportSelection.Validate(\"Source No.\", CustomerNo);\n+ CustomReportSelection.Validate(Usage, ReportSelectionUsage);\n+ CustomReportSelection.Validate(Sequence, 1);\n+ CustomReportSelection.Validate(\"Report ID\", ReportID);\n+ CustomReportSelection.Validate(\"Use for Email Body\", true);\n+ CustomReportSelection.Validate(\n+ \"Email Body Layout Code\", CustomReportLayout.InitBuiltInLayout(CustomReportSelection.\"Report ID\", CustomReportLayout.Type::Word.AsInteger()));\n+ CustomReportSelection.Insert(true);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmMessageHandler(Question: Text[1024]; var Reply: Boolean)\n@@ -8256,5 +8307,11 @@ codeunit 136101 \"Service Orders\"\n LibraryVariableStorage.Enqueue(CreditLimitNotification.CreditLimitDetails.OutstandingAmtLCY.Value);\n LibraryVariableStorage.Enqueue(CreditLimitNotification.CreditLimitDetails.TotalAmountLCY.Value);\n end;\n+\n+ [RequestPageHandler]\n+ procedure ServiceOrderReportRequestPageHandler(var ServiceOrder: TestRequestPage \"Service Order\")\n+ begin\n+ ServiceOrder.Cancel().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\nindex b1515adac7d..09f7b8b3998 100644\n--- a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n+++ b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n@@ -582,8 +582,11 @@ table 77 \"Report Selections\"\n \n IsHandled := false;\n OnBeforePrintDocument(TempReportSelections, IsGUI, RecVarToPrint, IsHandled);\n- if not IsHandled then\n+ if not IsHandled then begin\n+ if IsGUI then\n+ Commit();\n REPORT.RunModal(TempReportSelections.\"Report ID\", IsGUI, false, RecVarToPrint);\n+ end;\n \n OnAfterPrintDocument(TempReportSelections, IsGUI, RecVarToPrint, IsHandled);\n \n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-216918", "base_commit": "1ea776a43bea699ee3b63beb68162372fcb1226f", "created_at": "2025-05-29", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\VAT"], "FAIL_TO_PASS": [{"codeunitID": 134284, "functionName": ["JobJnlLineWithNonDeductNormalVATInFCYFromGenJnlLine"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al b/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al\nindex be592f1e578..e6b29da63e9 100644\n--- a/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al\n+++ b/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al\n@@ -1135,6 +1135,52 @@ codeunit 134284 \"Non Ded. VAT Misc.\"\n Assert.RecordIsNotEmpty(GLEntry);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure JobJnlLineWithNonDeductNormalVATInFCYFromGenJnlLine()\n+ var\n+ Customer: Record Customer;\n+ Job: Record Job;\n+ JobTask: Record \"Job Task\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ GenJnlLine: Record \"Gen. Journal Line\";\n+ JobJnlLine: Record \"Job Journal Line\";\n+ JobTransferLine: Codeunit \"Job Transfer Line\";\n+ DeductiblePercent: Decimal;\n+ begin\n+ // [FEATURE] [Normal VAT] [UT]\n+ // [SCENARIO 575793] Job journal line with FCY built from the general journal line includes non deductible VAT in \"Unit Cost\"\n+ Initialize();\n+ LibraryNonDeductibleVAT.SetUseForJobCost();\n+ // [GIVEN] VAT Posting Setup, where \"Tax Calculation Type\"::\"Normal VAT\", 'Deductible %' is '60'\n+ DeductiblePercent := LibraryRandom.RandInt(90);\n+ CreateNonDeductibleVATPostingSetup(VATPostingSetup, \"Tax Calculation Type\"::\"Normal VAT\", '', DeductiblePercent);\n+ // [GIVEN] Job \"X\" with currency which factor is 0.5\n+ LibrarySales.CreateCustomer(Customer);\n+ LibraryJob.CreateJob(Job, Customer.\"No.\");\n+ Job.Validate(\"Currency Code\", LibraryERM.CreateCurrencyWithRandomExchRates());\n+ Job.Modify(true);\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+ // [GIVEN] General journal line where line contains \"Non-Deductible VAT Amount\" = 100, \"Job No.\" = \"X\" \"Job Line Type\" = 'Billable'\n+ // [GIVEN] \"Job Quantity\" = 2, \"Job Unit Cost\" = 50\n+ CreateJobGLJournalLine(GenJnlLine, JobTask, VATPostingSetup);\n+\n+ // [WHEN] Run FromGenJnlLineToJnlLine\n+ JobTransferLine.FromGenJnlLineToJnlLine(GenJnlLine, JobJnlLine);\n+\n+ // [THEN] JobJnlLine contains \"Unit Cost LCY\" = (\"Job Unit Cost\" + \"Non-Deductible VAT Amount\") * \"Currency Factor\" / \"Job Quantity\" = (50 + 100) * 0.5 / 2 = 37.5\n+ Assert.AreEqual(\n+ Round(JobJnlLine.\"Unit Cost (LCY)\"),\n+ Round(GenJnlLine.\"Job Total Cost (LCY)\" / GenJnlLine.\"Job Quantity\") +\n+ Round(Round(GenJnlLine.\"Non-Deductible VAT Amount\" * GenJnlLine.\"Job Currency Factor\") / GenJnlLine.\"Job Quantity\"),\n+ 'Unit Cost (LCY) with Non-Deductible VAT amount is not correct in Job Journal Line');\n+ // [THEN] JobJnlLine contains \"Total Unit Cost\" = (\"Job Unit Cost\" + \"Non-Deductible VAT Amount\") * \"Currency Factor\" = (50 + 100) * 0.5 = 75\n+ Assert.AreEqual(\n+ Round(JobJnlLine.\"Total Cost (LCY)\"),\n+ Round(GenJnlLine.\"Job Total Cost (LCY)\" + Round(GenJnlLine.\"Non-Deductible VAT Amount\" * GenJnlLine.\"Job Currency Factor\")),\n+ 'Total Cost (LCY) with Non-Deductible VAT amount is not correct in Job Journal Line');\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -1368,6 +1414,15 @@ codeunit 134284 \"Non Ded. VAT Misc.\"\n GenJournalLine.Modify(true);\n end;\n \n+ local procedure CreateJobGLJournalLine(var GenJournalLine: Record \"Gen. Journal Line\"; JobTask: Record \"Job Task\"; VATPostingSetup: Record \"VAT Posting Setup\")\n+ begin\n+ LibraryJob.CreateJobGLJournalLine(GenJournalLine.\"Job Line Type\"::Billable, JobTask, GenJournalLine);\n+ GenJournalLine.Validate(\"Gen. Posting Type\", GenJournalLine.\"Gen. Posting Type\"::Purchase);\n+ GenJournalLine.Validate(\"VAT Bus. Posting Group\", VATPostingSetup.\"VAT Bus. Posting Group\");\n+ GenJournalLine.Validate(\"VAT Prod. Posting Group\", VATPostingSetup.\"VAT Prod. Posting Group\");\n+ GenJournalLine.Modify(true);\n+ end;\n+\n local procedure FindFAPostingGroup(GenProdPostingGroup: Code[20]; VATProductPostingGroup: Code[20]): Code[20]\n var\n FAPostingGroup: Record \"FA Posting Group\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al\nindex 26f99dcabd6..f35c5e941b5 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al\n@@ -4937,16 +4937,7 @@ table 81 \"Gen. Journal Line\"\n TempJobJnlLine.Validate(\"No.\", \"Account No.\");\n TempJobJnlLine.Validate(Quantity, \"Job Quantity\");\n \n- if \"Currency Factor\" = 0 then begin\n- if \"Job Currency Factor\" = 0 then\n- TmpJobJnlOverallCurrencyFactor := 1\n- else\n- TmpJobJnlOverallCurrencyFactor := \"Job Currency Factor\";\n- end else\n- if \"Job Currency Factor\" = 0 then\n- TmpJobJnlOverallCurrencyFactor := 1 / \"Currency Factor\"\n- else\n- TmpJobJnlOverallCurrencyFactor := \"Job Currency Factor\" / \"Currency Factor\";\n+ TmpJobJnlOverallCurrencyFactor := GetGenJnlLineToJobCurrencyFactor();\n \n UpdateAmountsOnTempJobJnlLine(TmpJobJnlOverallCurrencyFactor);\n \n@@ -7628,6 +7619,22 @@ table 81 \"Gen. Journal Line\"\n RecordRestrictionMgt.RestrictRecordUsage(GenJournalLine, RestrictBatchUsageDetailsTxt);\n end;\n \n+ /// \n+ /// Calculates the currency factor for the general journal line based on the job currency factor and the journal line currency factor.\n+ /// \n+ /// Resulted currency factor\n+ procedure GetGenJnlLineToJobCurrencyFactor(): Decimal\n+ begin\n+ if \"Currency Factor\" = 0 then begin\n+ if \"Job Currency Factor\" = 0 then\n+ exit(1);\n+ exit(\"Job Currency Factor\");\n+ end;\n+ if \"Job Currency Factor\" = 0 then\n+ exit(1 / \"Currency Factor\");\n+ exit(\"Job Currency Factor\" / \"Currency Factor\");\n+ end;\n+\n /// \n /// Event triggered before creating dimensions from the Default Dimensions during the validation of the \"Account No.\" field.\n /// By subscribing to this event, developers can override the default dimension creation process for the \"Account No.\" field.\ndiff --git a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\nindex 2b5a6a4ca7e..c9d976f7272 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n@@ -17,6 +17,8 @@ using Microsoft.Foundation.Enums;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.History;\n using Microsoft.Foundation.Company;\n+using Microsoft.Projects.Project.Journal;\n+using Microsoft.Projects.Project.Job;\n \n /// \n /// Defines the implementation of Non-Deductible VAT\n@@ -436,6 +438,36 @@ codeunit 6201 \"Non-Ded. VAT Impl.\"\n FALedgEntry.\"Non-Ded. VAT FA Cost\" := GenJnlLine.\"Non-Ded. VAT FA Cost\";\n end;\n \n+ procedure CopyNonDedVATFromGenJnlLineToJobJnlLine(var JobJnlLine: Record \"Job Journal Line\"; GenJnlLine: Record \"Gen. Journal Line\")\n+ var\n+ Job: Record Job;\n+ CurrencyFactor, NonDedVATAmountLCY, UnitCost, UnitCostLCY, TotalCost, TotalCostLCY : Decimal;\n+ begin\n+ if not UseNonDeductibleVATAmountForJobCost() then\n+ exit;\n+ if not Job.Get(JobJnlLine.\"Job No.\") then\n+ exit;\n+ NonDedVATAmountLCY := GenJnlLine.\"Non-Deductible VAT Amount LCY\";\n+ if GenJnlLine.\"Currency Code\" <> Job.\"Currency Code\" then begin\n+ CurrencyFactor := GenJnlLine.GetGenJnlLineToJobCurrencyFactor();\n+ NonDedVATAmountLCY := Round(GenJnlLine.\"Non-Deductible VAT Amount\" * CurrencyFactor);\n+ end;\n+ UnitCostLCY := Round(NonDedVATAmountLCY / JobJnlLine.Quantity);\n+ UnitCost := Round(GenJnlLine.\"Non-Deductible VAT Amount\" / JobJnlLine.Quantity);\n+ TotalCostLCY := NonDedVATAmountLCY;\n+ TotalCost := GenJnlLine.\"Non-Deductible VAT Amount\";\n+ if JobJnlLine.\"Unit Cost\" > 0 then begin\n+ UnitCostLCY := Abs(UnitCostLCY);\n+ UnitCost := Abs(UnitCost);\n+ TotalCostLCY := Abs(TotalCostLCY);\n+ TotalCost := Abs(TotalCost);\n+ end;\n+ JobJnlLine.\"Unit Cost (LCY)\" += UnitCostLCY;\n+ JobJnlLine.\"Unit Cost\" += UnitCost;\n+ JobJnlLine.\"Total Cost (LCY)\" += TotalCostLCY;\n+ JobJnlLine.\"Total Cost\" += TotalCost;\n+ end;\n+\n procedure CheckPrepmtWithNonDeductubleVATInPurchaseLine(PurchaseLine: Record \"Purchase Line\")\n begin\n if (PurchaseLine.\"Prepayment %\" <> 0) and (PurchaseLine.\"Non-Deductible VAT %\" <> 0) then\ndiff --git a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al\nindex 216076f8cf0..4114e9a6815 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al\n@@ -15,6 +15,7 @@ using Microsoft.FixedAssets.Ledger;\n using Microsoft.Foundation.Enums;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.History;\n+using Microsoft.Projects.Project.Journal;\n \n /// \n /// Provides an interface of the Non-Deductible VAT functionality.\n@@ -430,6 +431,11 @@ codeunit 6200 \"Non-Deductible VAT\"\n NonDedVATImpl.CopyNonDedVATFromGenJnlLineToFALedgEntry(FALedgEntry, GenJnlLine);\n end;\n \n+ procedure CopyNonDedVATFromGenJnlLineToJobJnlLine(var JobJnlLine: Record \"Job Journal Line\"; GenJnlLine: Record \"Gen. Journal Line\")\n+ begin\n+ NonDedVATImpl.CopyNonDedVATFromGenJnlLineToJobJnlLine(JobJnlLine, GenJnlLine);\n+ end;\n+\n /// \n /// Throws an error if purchase line contains prepayment and Non-Deductible VAT\n /// \ndiff --git a/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al\nindex d541dd087c6..50866220a3f 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al\n@@ -498,18 +498,7 @@ codeunit 1004 \"Job Transfer Line\"\n JobJnlLine.\"Total Cost (LCY)\" := GenJnlLine.\"Job Total Cost (LCY)\";\n JobJnlLine.\"Total Cost\" := GenJnlLine.\"Job Total Cost\";\n \n- if NonDeductibleVAT.UseNonDeductibleVATAmountForJobCost() then\n- if JobJnlLine.\"Unit Cost\" > 0 then begin\n- JobJnlLine.\"Unit Cost (LCY)\" += Abs(Round(GenJnlLine.\"Non-Deductible VAT Amount LCY\" / JobJnlLine.Quantity));\n- JobJnlLine.\"Unit Cost\" += Abs(Round(GenJnlLine.\"Non-Deductible VAT Amount\" / JobJnlLine.Quantity));\n- JobJnlLine.\"Total Cost (LCY)\" += Abs(GenJnlLine.\"Non-Deductible VAT Amount LCY\");\n- JobJnlLine.\"Total Cost\" += Abs(GenJnlLine.\"Non-Deductible VAT Amount\");\n- end else begin\n- JobJnlLine.\"Unit Cost (LCY)\" += Round(GenJnlLine.\"Non-Deductible VAT Amount LCY\" / JobJnlLine.Quantity);\n- JobJnlLine.\"Unit Cost\" += Round(GenJnlLine.\"Non-Deductible VAT Amount\" / JobJnlLine.Quantity);\n- JobJnlLine.\"Total Cost (LCY)\" += GenJnlLine.\"Non-Deductible VAT Amount LCY\";\n- JobJnlLine.\"Total Cost\" += GenJnlLine.\"Non-Deductible VAT Amount\";\n- end;\n+ NonDeductibleVAT.CopyNonDedVATFromGenJnlLineToJobJnlLine(JobJnlLine, GenJnlLine);\n \n JobJnlLine.\"Unit Price (LCY)\" := GenJnlLine.\"Job Unit Price (LCY)\";\n JobJnlLine.\"Unit Price\" := GenJnlLine.\"Job Unit Price\";\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218856", "base_commit": "7bfa7e70c56ba44878906b722f59a492dc75f376", "created_at": "2025-06-23", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Service"], "FAIL_TO_PASS": [{"codeunitID": 136102, "functionName": ["ChangeCustomerOfTypePeronInServiceContract"]}], "PASS_TO_PASS": [], "metadata": {"area": "service"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al b/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al\nindex ad01a498eef..1b594959106 100644\n--- a/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al\n@@ -10,6 +10,8 @@ using Microsoft.Finance.Dimension;\n using Microsoft.Finance.GeneralLedger.Account;\n using Microsoft.Finance.GeneralLedger.Ledger;\n using Microsoft.Finance.VAT.Setup;\n+using Microsoft.CRM.BusinessRelation;\n+using Microsoft.CRM.Contact;\n using Microsoft.Inventory.Item;\n using Microsoft.Projects.Resources.Resource;\n using Microsoft.Sales.Customer;\n@@ -42,6 +44,7 @@ codeunit 136102 \"Service Contracts\"\n var\n ServiceContractHeader2: Record \"Service Contract Header\";\n Assert: Codeunit Assert;\n+ LibraryMarketing: Codeunit \"Library - Marketing\";\n LibraryTestInitialize: Codeunit \"Library - Test Initialize\";\n LibraryService: Codeunit \"Library - Service\";\n LibraryUtility: Codeunit \"Library - Utility\";\n@@ -3563,6 +3566,49 @@ codeunit 136102 \"Service Contracts\"\n Assert.Equal('', Format(ServiceContractHeader.\"Last Invoice Period End\"));\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandler,SignContractConfirmHandler,ServContrctTemplateListHandler')]\n+ [Scope('OnPrem')]\n+ procedure ChangeCustomerOfTypePeronInServiceContract()\n+ var\n+ ContactBusinessRelation: Record \"Contact Business Relation\";\n+ Contact: Record Contact;\n+ ServiceContractHeader: Record \"Service Contract Header\";\n+ ServiceContractLine: Record \"Service Contract Line\";\n+ ShiptoAddress: Record \"Ship-to Address\";\n+ ServContractManagement: Codeunit ServContractManagement;\n+ ContactCard: TestPage \"Contact Card\";\n+ begin\n+ // [SCENARIO 578655] Change Customer No. on Service Contract of Customer type Person.\n+ Initialize();\n+\n+ // [GIVEN] Create Contact of type Person.\n+ LibraryMarketing.CreatePersonContact(Contact);\n+\n+ // [GIVEN] Open Contact Card and invoke Create Customer.\n+ ContactCard.OpenEdit();\n+ ContactCard.Filter.SetFilter(\"No.\", Contact.\"No.\");\n+ ContactCard.CreateCustomer.Invoke();\n+\n+ // [GIVEN] Create Service Contract Header and Service Contract Line.\n+ CreateServiceContract(ServiceContractHeader, ServiceContractLine, ServiceContractHeader.\"Contract Type\"::Contract);\n+ ModifyServiceContractHeader(ServiceContractHeader, ServiceContractHeader.\"Service Period\");\n+\n+ // [GIVEN] Find Contact Business Relation of the Contact.\n+ ContactBusinessRelation.SetRange(\"Contact No.\", Contact.\"No.\");\n+ ContactBusinessRelation.SetRange(\"Link to Table\", ContactBusinessRelation.\"Link to Table\"::Customer);\n+ ContactBusinessRelation.FindFirst();\n+\n+ // [GIVEN] Create Ship to Address.\n+ LibrarySales.CreateShipToAddress(ShiptoAddress, ContactBusinessRelation.\"No.\");\n+\n+ // [WHEN] Change Customer No. in Service Contract.\n+ ServContractManagement.ChangeCustNoOnServContract(ShiptoAddress.\"Customer No.\", ShiptoAddress.Code, ServiceContractHeader);\n+\n+ // [THEN] Check Customer No. is updated.\n+ CheckChangeCustomerNo(ServiceContractHeader, ContactBusinessRelation.\"No.\");\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5358,6 +5404,11 @@ codeunit 136102 \"Service Contracts\"\n Error(MessageText);\n end;\n \n+ [MessageHandler]\n+ procedure MessageHandler(Message: Text[1024])\n+ begin\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure InvoiceConfirmHandler(ConfirmMessage: Text[1024]; var Result: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al b/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al\nindex 4f315c8f604..572b132d573 100644\n--- a/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al\n@@ -1389,7 +1389,7 @@ table 5965 \"Service Contract Header\"\n if (\"Bill-to Customer No.\" <> '') and (\"Bill-to Contact No.\" <> '') then begin\n Cont.Get(\"Bill-to Contact No.\");\n if ContBusinessRelation.FindByRelation(ContBusinessRelation.\"Link to Table\"::Customer, \"Bill-to Customer No.\") then\n- if ContBusinessRelation.\"Contact No.\" <> Cont.\"Company No.\" then\n+ if (ContBusinessRelation.\"Contact No.\" <> Cont.\"Company No.\") and (Cont.Type = Cont.Type::Company) then\n Error(Text045, Cont.\"No.\", Cont.Name, \"Bill-to Customer No.\");\n end;\n \n@@ -2240,6 +2240,7 @@ table 5965 \"Service Contract Header\"\n ContBusinessRelation: Record \"Contact Business Relation\";\n Cust: Record Customer;\n Cont: Record Contact;\n+ ContactBusinessRelationFound: Boolean;\n IsHandled: Boolean;\n begin\n IsHandled := false;\n@@ -2251,13 +2252,18 @@ table 5965 \"Service Contract Header\"\n \"Contact No.\" := Cont.\"No.\";\n \"Phone No.\" := Cont.\"Phone No.\";\n \"E-Mail\" := Cont.\"E-Mail\";\n- if Cont.Type = Cont.Type::Person then\n- \"Contact Name\" := Cont.Name\n- else\n+ if Cont.Type = Cont.Type::Person then begin\n+ \"Contact Name\" := Cont.Name;\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"No.\");\n+ end else begin\n+ if not ContactBusinessRelationFound then\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\");\n+\n if Cust.Get(\"Customer No.\") then\n \"Contact Name\" := Cust.Contact\n else\n \"Contact Name\" := ''\n+ end;\n end else begin\n \"Contact Name\" := '';\n \"Phone No.\" := '';\n@@ -2265,7 +2271,7 @@ table 5965 \"Service Contract Header\"\n exit;\n end;\n \n- if ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\") then begin\n+ if ContactBusinessRelationFound then begin\n if (\"Customer No.\" <> '') and\n (\"Customer No.\" <> ContBusinessRelation.\"No.\")\n then\n@@ -2289,23 +2295,29 @@ table 5965 \"Service Contract Header\"\n ContBusinessRelation: Record \"Contact Business Relation\";\n Cust: Record Customer;\n Cont: Record Contact;\n+ ContactBusinessRelationFound: Boolean;\n begin\n if Cont.Get(ContactNo) then begin\n \"Bill-to Contact No.\" := Cont.\"No.\";\n- if Cont.Type = Cont.Type::Person then\n- \"Bill-to Contact\" := Cont.Name\n- else\n+ if Cont.Type = Cont.Type::Person then begin\n+ \"Bill-to Contact\" := Cont.Name;\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"No.\");\n+ end else begin\n+ if not ContactBusinessRelationFound then\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\");\n+\n if Cust.Get(\"Bill-to Customer No.\") then\n \"Bill-to Contact\" := Cust.Contact\n else\n \"Bill-to Contact\" := '';\n+ end;\n end else begin\n \"Bill-to Contact\" := '';\n exit;\n end;\n \n OnUpdateBillToCustOnBeforeContBusinessRelationFindByContact(Rec, Cust, Cont);\n- if ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\") then begin\n+ if ContactBusinessRelationFound then begin\n if \"Bill-to Customer No.\" = '' then begin\n SkipBillToContact := true;\n Validate(\"Bill-to Customer No.\", ContBusinessRelation.\"No.\");\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-215225", "base_commit": "cc7b76c98d2c241ae675ae9b79fe1b634617ec36", "created_at": "2025-05-12", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136305, "functionName": ["CheckUnitCostAndPriceNotZeroInRecurringJobJnlAfterPosting"]}], "PASS_TO_PASS": [], "metadata": {"area": "project"}, "test_patch": "diff --git a/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al b/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al\nindex e427075ebd9..1a379eb28aa 100644\n--- a/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al\n@@ -2938,6 +2938,35 @@ codeunit 136305 \"Job Journal\"\n Assert.AreNotEqual(GenJournalLine.\"Job Total Cost (LCY)\", PreviousProjectTotalCostLCY, ProjectTotalCostErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ConfirmHandlerTrue,MessageHandler')]\n+ procedure CheckUnitCostAndPriceNotZeroInRecurringJobJnlAfterPosting()\n+ var\n+ Job: Record Job;\n+ JobTask: Record \"Job Task\";\n+ Resource: Record Resource;\n+ RecurringJobJnl: TestPage \"Recurring Job Jnl.\";\n+ begin\n+ // [SCENARIO 575092] Verify that the Unit Price and Unit Cost are not 0 in the recurring job journal after posting.\n+ Initialize();\n+\n+ // [GIVEN] Create a Resource.\n+ FindResource(Resource);\n+\n+ // [GIVEN] Create Job, job task & multiple Job planning line.\n+ CreateFullJob(Job, JobTask, Resource);\n+\n+ // [GIVEN] Create Recurring Job Journal.\n+ OpenRecurringJobJnl(RecurringJobJnl, JobTask, Resource.\"No.\");\n+\n+ // [WHEN] Post Recurring Job Journal.\n+ PostRecurringJobJnl(RecurringJobJnl);\n+\n+ // [THEN] Verify that the Unit Price and Unit Cost are not zero in the recurring job journal after posting.\n+ RecurringJobJnl.\"Unit Price\".AssertEquals(Resource.\"Unit Price\");\n+ RecurringJobJnl.\"Unit Cost\".AssertEquals(Resource.\"Unit Cost\");\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3917,6 +3946,51 @@ codeunit 136305 \"Job Journal\"\n JobJnlLine.TestField(\"Reserved Qty. (Base)\", 0);\n end;\n \n+ local procedure FindResource(var Resource: Record Resource)\n+ begin\n+ Resource.Get(LibraryJob.CreateConsumable(\"Job Planning Line Type\"::Resource));\n+ Resource.Validate(Type, Resource.Type::Person);\n+ Resource.Validate(\"Unit Cost\", LibraryRandom.RandIntInRange(100, 200));\n+ Resource.Validate(\"Unit Price\", LibraryRandom.RandIntInRange(300, 500));\n+ Resource.Modify(true);\n+ end;\n+\n+ local procedure CreateFullJob(var Job: Record Job; var JobTask: Record \"Job Task\"; Resource: Record Resource)\n+ var\n+ JobPlanningLine: Record \"Job Planning Line\";\n+ begin\n+ LibraryJob.CreateJob(Job);\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+\n+ LibraryJob.CreateJobPlanningLine(\n+ JobTask, JobPlanningLine.\"Line Type\"::\"Both Budget and Billable\",\n+ JobPlanningLine.Type::Resource, Resource.\"No.\", LibraryRandom.RandInt(10), JobPlanningLine);\n+ end;\n+\n+ local procedure OpenRecurringJobJnl(var RecurringJobJnl: TestPage \"Recurring Job Jnl.\"; JobTask: Record \"Job Task\"; ResourceNo: Code[20])\n+ var\n+ JobJournalLineType: Enum \"Job Journal Line Type\";\n+ RecurringMethod: Option ,Fixed,Variable;\n+ begin\n+ RecurringJobJnl.OpenEdit();\n+ RecurringJobJnl.\"Recurring Method\".SetValue(Format(RecurringMethod::Variable));\n+ RecurringJobJnl.\"Recurring Frequency\".SetValue('10D');\n+ RecurringJobJnl.\"Document No.\".SetValue(JobTask.\"Job No.\");\n+ RecurringJobJnl.\"Job No.\".SetValue(JobTask.\"Job No.\");\n+ RecurringJobJnl.\"Job Task No.\".SetValue(JobTask.\"Job Task No.\");\n+ RecurringJobJnl.Type.SetValue(Format(JobJournalLineType::Resource));\n+ RecurringJobJnl.\"No.\".SetValue(ResourceNo);\n+ RecurringJobJnl.Quantity.SetValue(Format(LibraryRandom.RandInt(5)));\n+ RecurringJobJnl.Close();\n+ end;\n+\n+ local procedure PostRecurringJobJnl(var RecurringJobJnl: TestPage \"Recurring Job Jnl.\")\n+ begin\n+ RecurringJobJnl.OpenEdit();\n+ RecurringJobJnl.\"P&ost\".Invoke();\n+ Commit();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ContactListPageHandler(var ContactList: TestPage \"Contact List\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al\nindex 9f7bd75b991..57af0bb5690 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al\n@@ -275,6 +275,7 @@ codeunit 1013 \"Job Jnl.-Post Batch\"\n \n local procedure UpdateAndDeleteLines()\n var\n+ UnitCost, UnitPrice : Decimal;\n IsHandled: Boolean;\n begin\n OnBeforeUpdateAndDeleteLines(JobJnlLine);\n@@ -295,8 +296,12 @@ codeunit 1013 \"Job Jnl.-Post Batch\"\n JobJnlLine2.Validate(\"Posting Date\", CalcDate(JobJnlLine2.\"Recurring Frequency\", JobJnlLine2.\"Posting Date\"));\n if (JobJnlLine2.\"Recurring Method\" = JobJnlLine2.\"Recurring Method\"::Variable) and\n (JobJnlLine2.\"No.\" <> '')\n- then\n+ then begin\n+ UnitCost := JobJnlLine2.\"Unit Cost\";\n+ UnitPrice := JobJnlLine2.\"Unit Price\";\n JobJnlLine2.DeleteAmounts();\n+ UpdateUnitCostAndPrice(JobJnlLine2, UnitCost, UnitPrice);\n+ end;\n JobJnlLine2.Modify();\n until JobJnlLine2.Next() = 0;\n end else begin\n@@ -339,6 +344,15 @@ codeunit 1013 \"Job Jnl.-Post Batch\"\n NoSeriesBatch.SaveState();\n end;\n \n+ local procedure UpdateUnitCostAndPrice(var JobJournalLine: Record \"Job Journal Line\"; UnitCost: Decimal; UnitPrice: Decimal)\n+ begin\n+ if (UnitCost = 0) and (UnitPrice = 0) then\n+ exit;\n+\n+ JobJournalLine.\"Unit Cost\" := UnitCost;\n+ JobJournalLine.\"Unit Price\" := UnitPrice;\n+ end;\n+\n procedure SetSuppressCommit(NewSuppressCommit: Boolean)\n begin\n SuppressCommit := NewSuppressCommit;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-213629", "base_commit": "e0211616ed03e968b987e2becd1069b217690c34", "created_at": "2025-04-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136306, "functionName": ["CopyJobAndCreateProjectJournalLineWithoutError"]}], "PASS_TO_PASS": [], "metadata": {"area": "project"}, "test_patch": "diff --git a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\nindex 36cc3d9db4a..369594bf631 100644\n--- a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n@@ -58,6 +58,7 @@ codeunit 136306 \"Job Invoicing\"\n DetailLevel: Option All,\"Per Job\",\"Per Job Task\",\"Per Job Planning Line\";\n LineDiscountPctErr: Label '%1 should be %2', Comment = '%1 = Field Caption, %2 = Field Value';\n WrongNoOfLinesLbl: Label 'Wrong number of lines created.';\n+ ValueFalseErr: Label 'Value must be equal to false';\n \n [Test]\n [HandlerFunctions('TransferToInvoiceHandler,MessageHandler')]\n@@ -4043,6 +4044,44 @@ codeunit 136306 \"Job Invoicing\"\n Assert.AreEqual(1, InvoicesList.Count, WrongNoOfLinesLbl);\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandler,ConfirmHandler')]\n+ [Scope('OnPrem')]\n+ procedure CopyJobAndCreateProjectJournalLineWithoutError()\n+ var\n+ Job: Record Job;\n+ JobPlanningLine: Record \"Job Planning Line\";\n+ JobTask: Record \"Job Task\";\n+ JobJournalLine: Record \"Job Journal Line\";\n+ CopyJob: Codeunit \"Copy Job\";\n+ JobLineType: Enum \"Job Line Type\";\n+ TargetJobNo: Code[20];\n+ begin\n+ // [SCENARIO 573397] Copy project of System-Created Entry must be equal to 'No' in Project Planning Line\n+ Initialize();\n+\n+ // [GIVEN] Create Job with Customer\n+ CreateJobWithCustomer(Job);\n+\n+ // [GIVEN] Create Job Task\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+\n+ // [GIVEN] Create Job Journal Line of type \"Both Budget and Billable\" and post it.\n+ CreateAndPostJobJournalLineWithIteAndType(JobJournalLine, JobTask, JobLineType::\"Both Budget and Billable\");\n+\n+ // [GIVEN] Create target Job Id\n+ TargetJobNo := LibraryUtility.GenerateGUID();\n+\n+ // [WHEN] Copy Job by setting Copy Quantity as true.\n+ CopyJob.SetCopyOptions(false, true, false, 0, 0, 0);\n+ CopyJob.CopyJob(Job, TargetJobNo, TargetJobNo, Job.\"Bill-to Customer No.\", '');\n+\n+ // [THEN] Find the created Job Planning Line and \"System-Created Entry\" should be set false\n+ JobPlanningLine.SetRange(\"Job No.\", TargetJobNo);\n+ JobPlanningLine.FindFirst();\n+ Assert.IsFalse(JobPlanningLine.\"System-Created Entry\", ValueFalseErr);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5676,6 +5715,20 @@ codeunit 136306 \"Job Invoicing\"\n until JobPlanningLine.Next() = 0;\n end;\n \n+ local procedure CreateAndPostJobJournalLineWithIteAndType(var JobJournalLine: Record \"Job Journal Line\"; JobTask: Record \"Job Task\"; JobLineType: Enum \"Job Line Type\")\n+ var\n+ Item: Record Item;\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+ LibraryJob.CreateJobJournalLine(JobLineType, JobTask, JobJournalLine);\n+ JobJournalLine.Validate(Type, JobJournalLine.Type::Item);\n+ JobJournalLine.Validate(\"No.\", Item.\"No.\");\n+ JobJournalLine.Validate(Quantity, LibraryRandom.RandInt(100));\n+ JobJournalLine.Modify(true);\n+\n+ LibraryJob.PostJobJournal(JobJournalLine);\n+ end;\n+\n [RequestPageHandler]\n [Scope('OnPrem')]\n procedure TransferSalesCreditMemoReportWithDatesHandler(var JobTransferToCreditMemo: TestRequestPage \"Job Transfer to Credit Memo\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al\nindex 162d6cc55e7..544c740a441 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al\n@@ -192,6 +192,7 @@ codeunit 1006 \"Copy Job\"\n TargetJobPlanningLine.\"Completely Picked\" := false;\n TargetJobPlanningLine.\"Ledger Entry No.\" := 0;\n TargetJobPlanningLine.\"Ledger Entry Type\" := TargetJobPlanningLine.\"Ledger Entry Type\"::\" \";\n+ TargetJobPlanningLine.\"System-Created Entry\" := false;\n OnCopyJobPlanningLinesOnBeforeTargetJobPlanningLineInsert(TargetJobPlanningLine, SourceJobPlanningLine);\n TargetJobPlanningLine.Insert(true);\n OnCopyJobPlanningLinesOnAfterTargetJobPlanningLineInsert(TargetJobPlanningLine, SourceJobPlanningLine);\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-213524", "base_commit": "594d5dfcee2efe390ab75b6b0e30bc5a9f13f7f0", "created_at": "2025-04-16", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134154, "functionName": ["ICNavigateFromSalesCreditMemoLine"]}], "PASS_TO_PASS": [], "metadata": {"area": "intercompany"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al\nindex 0480aea9fa6..3ca288e85d2 100644\n--- a/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al\n@@ -3408,6 +3408,40 @@ codeunit 134154 \"ERM Intercompany III\"\n Assert.AreEqual(300, SalesLine.\"Line Amount\", 'When a sales order with a discount amount and prices including VAT is received from intercompany, the line amount should be preserved');\n end;\n \n+ [Test]\n+ procedure ICNavigateFromSalesCreditMemoLine()\n+ var\n+ Customer: Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ ICOutboxTransactions: TestPage \"IC Outbox Transactions\";\n+ PostedSalesCreditMemo: TestPage \"Posted Sales Credit Memo\";\n+ begin\n+ // [SCENARIO 574577] \"Unable to navigate to the related document\" error message if you use Go to Document from the Intercompany Outbox Transactions for a Credit Memo.\n+ Initialize();\n+ LibraryApplicationArea.EnableEssentialSetup();\n+ CleanupIC(false, true, true, false);\n+ CreateCustomerWithICPartner(Customer);\n+\n+ // [GIVEN] A posted sales credit memo to an IC customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::\"Credit Memo\", Customer.\"No.\");\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, LibraryInventory.CreateItemNo(), 1);\n+ LibrarySales.PostSalesDocument(SalesHeader, true, true);\n+\n+ // [GIVEN] The posted sales credit memo IC transaction should be on the Outbox\n+ ICOutboxTransactions.OpenEdit();\n+\n+ // [WHEN] Navigating from Outbox for this transaction\n+ PostedSalesCreditMemo.Trap();\n+ ICOutboxTransactions.GoToDocument.Invoke();\n+\n+ // [THEN] It should open the Posted Sales Credit Memo\n+ PostedSalesCreditMemo.\"Pre-Assigned No.\".AssertEquals(SalesHeader.\"No.\");\n+\n+ // Cleanup\n+ CleanupIC(false, true, true, false);\n+ end;\n+\n local procedure Initialize()\n var\n ICSetup: Record \"IC Setup\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al b/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al\nindex 92bf43b1d84..944f49028e6 100644\n--- a/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al\n@@ -56,6 +56,20 @@ codeunit 437 \"IC Navigation\"\n exit(true);\n end;\n \n+ local procedure NavigateToSalesCreditMemo(DocumentNo: Code[20]): Boolean\n+ var\n+ SalesCrMemoHeader: Record \"Sales Cr.Memo Header\";\n+ PostedSalesCreditMemo: Page \"Posted Sales Credit Memo\";\n+ begin\n+ // An IC Transaction of type Sales Credit Memo can only be sent when posted.\n+ if not SalesCrMemoHeader.Get(DocumentNo) then\n+ exit(false);\n+ // The related document is a Posted Sales Credit Memo.\n+ PostedSalesCreditMemo.SetRecord(SalesCrMemoHeader);\n+ PostedSalesCreditMemo.Run();\n+ exit(true);\n+ end;\n+\n local procedure NavigateToSalesInvoice(DocumentNo: Code[20]; ICPartnerCode: Code[20]): Boolean\n var\n Customer: Record Customer;\n@@ -120,6 +134,8 @@ codeunit 437 \"IC Navigation\"\n exit(NavigateToSalesOrderDocument(DocumentNo, ICDirectionType, ICPartnerCode));\n DocumentType::Invoice:\n exit(NavigateToSalesInvoice(DocumentNo));\n+ DocumentType::\"Credit Memo\":\n+ exit(NavigateToSalesCreditMemo(DocumentNo));\n else begin\n ShouldNavigateToDoc := false;\n OnNavigateToSalesDocumentOnAfterCheckDocumentType(DocumentNo, ICDirectionType, ICPartnerCode, DocumentType, ShouldNavigateToDoc);\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-213741", "base_commit": "aba5cc540cc2ff7bfc88064b9c6728b32f120fce", "created_at": "2025-04-22", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Assembly"], "FAIL_TO_PASS": [{"codeunitID": 137911, "functionName": ["VerifyAdjustCostItemEntriesMustBeExecutedForAssemblyItem"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al b/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al\nindex 46d1c5d5be0..55f596ef397 100644\n--- a/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al\n@@ -40,6 +40,7 @@ codeunit 137911 \"SCM Calculate Assembly Cost\"\n LibraryTestInitialize: Codeunit \"Library - Test Initialize\";\n NotificationLifecycleMgt: Codeunit \"Notification Lifecycle Mgt.\";\n LibrarySetupStorage: Codeunit \"Library - Setup Storage\";\n+ LibraryManufacturing: Codeunit \"Library - Manufacturing\";\n WorkDate2: Date;\n TEXT_PARENT: Label 'Parent';\n TEXT_CHILD: Label 'Child';\n@@ -452,6 +453,54 @@ codeunit 137911 \"SCM Calculate Assembly Cost\"\n ComponentItem.\"Standard Cost\", ComponentItem.\"Standard Cost\" * CurrExchRate);\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandler')]\n+ procedure VerifyAdjustCostItemEntriesMustBeExecutedForAssemblyItem()\n+ var\n+ AssemblyItem, ComponentItem, NonInvItem : Record Item;\n+ ValueEntry: Record \"Value Entry\";\n+ begin\n+ // [SCENARIO 574360] Verify \"Adjust Cost - Item Entries\" must be executed for Assembly item which include non-Inventory item in Assembly BOM.\n+ // When \"Automatic Cost Posting\" is false in Inventory Setup and \"Inc. Non. Inv. Cost To Prod\" is true in Mfg Setup.\n+ Initialize();\n+\n+ // [GIVEN] Set Automatic Cost Posting to false.\n+ LibraryInventory.SetAutomaticCostPosting(false);\n+\n+ // [GIVEN] Update \"Inc. Non. Inv. Cost To Prod\" in Manufacturing Setup.\n+ LibraryManufacturing.UpdateNonInventoryCostToProductionInManufacturingSetup(true);\n+\n+ // [GIVEN] Create an Assembled item with \"Costing Method\"::Standard.\n+ CreateItem(AssemblyItem, AssemblyItem.\"Costing Method\"::Standard, AssemblyItem.\"Replenishment System\"::Assembly, 0);\n+\n+ // [GIVEN] Create an Component item with \"Costing Method\"::FIFO.\n+ CreateItem(ComponentItem, ComponentItem.\"Costing Method\"::FIFO, ComponentItem.\"Replenishment System\"::Purchase, LibraryRandom.RandIntInRange(100, 200));\n+\n+ // [GIVEN] Create Non-Inventory item with Unit Cost.\n+ LibraryInventory.CreateNonInventoryTypeItem(NonInvItem);\n+ NonInvItem.Validate(\"Unit Cost\", LibraryRandom.RandIntInRange(200, 500));\n+ NonInvItem.Modify();\n+\n+ // [GIVEN] Post Positive Adjustment for Component item.\n+ PostPositiveAdjustment(ComponentItem.\"No.\", LibraryRandom.RandIntInRange(200, 500));\n+\n+ // [GIVEN] Create Assembly List for Component and Non-Inventory item.\n+ CreateAssemblyListComponent(AssemblyItem.\"No.\", ComponentItem.\"No.\", 1);\n+ CreateAssemblyListComponent(AssemblyItem.\"No.\", NonInvItem.\"No.\", 1);\n+\n+ // [GIVEN] Create and post Assembly Order.\n+ CreateAndPostAssemblyHeader(AssemblyItem.\"No.\", 1, WorkDate());\n+\n+ // [WHEN] Run \"Adjust Cost - Item Entries\"\n+ LibraryCosting.AdjustCostItemEntries(AssemblyItem.\"No.\", '');\n+\n+ // [THEN] Verify \"Adjust Cost - Item Entries\" must be executed for Assembly item.\n+ ValueEntry.SetRange(\"Item Ledger Entry Type\", ValueEntry.\"Item Ledger Entry Type\"::\"Assembly Output\");\n+ ValueEntry.SetRange(\"Entry Type\", ValueEntry.\"Entry Type\"::\"Direct Cost - Non Inventory\");\n+ ValueEntry.SetRange(\"Item No.\", AssemblyItem.\"No.\");\n+ Assert.RecordCount(ValueEntry, 0);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Calculate Assembly Cost\");\n@@ -585,5 +634,10 @@ codeunit 137911 \"SCM Calculate Assembly Cost\"\n ItemLedgerEntry.TestField(\"Cost Amount (Actual)\", ExpectedCostLCY);\n ItemLedgerEntry.TestField(\"Cost Amount (Actual) (ACY)\", Round(ExpectedCostACY, Currency.\"Amount Rounding Precision\"));\n end;\n+\n+ [MessageHandler]\n+ procedure MessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al\nindex 9bc596d4312..92b2588e89d 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al\n@@ -158,10 +158,12 @@ codeunit 5896 \"Calc. Inventory Adjmt. - Order\"\n if HasNewCost(InventoryAdjmtEntryOrder.\"Indirect Cost\", InventoryAdjmtEntryOrder.\"Indirect Cost (ACY)\") then\n InventoryAdjustmentBuffer.AddCost(\n ItemLedgerEntry.\"Entry No.\", InventoryAdjustmentBuffer.\"Entry Type\"::\"Indirect Cost\", \"Cost Variance Type\"::\" \", InventoryAdjmtEntryOrder.\"Indirect Cost\", InventoryAdjmtEntryOrder.\"Indirect Cost (ACY)\");\n- if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n- if HasNewCost(InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\") then\n- InventoryAdjustmentBuffer.AddCost(\n- ItemLedgerEntry.\"Entry No.\", InventoryAdjustmentBuffer.\"Entry Type\"::\"Direct Cost - Non Inventory\", \"Cost Variance Type\"::\" \", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\");\n+\n+ if ItemLedgerEntry.\"Order Type\" = ItemLedgerEntry.\"Order Type\"::Production then\n+ if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n+ if HasNewCost(InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\") then\n+ InventoryAdjustmentBuffer.AddCost(\n+ ItemLedgerEntry.\"Entry No.\", InventoryAdjustmentBuffer.\"Entry Type\"::\"Direct Cost - Non Inventory\", \"Cost Variance Type\"::\" \", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\");\n \n if Item.\"Costing Method\" <> Item.\"Costing Method\"::Standard then\n exit;\n@@ -171,11 +173,12 @@ codeunit 5896 \"Calc. Inventory Adjmt. - Order\"\n InventoryAdjustmentBuffer.\"Entry Type\"::Variance, InventoryAdjustmentBuffer.\"Variance Type\"::Material,\n InventoryAdjmtEntryOrder.\"Single-Level Material Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Material Cost (ACY)\");\n \n- if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n- if HasNewCost(InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\") then\n- InventoryAdjustmentBuffer.AddCost(ItemLedgerEntry.\"Entry No.\",\n- InventoryAdjustmentBuffer.\"Entry Type\"::Variance, InventoryAdjustmentBuffer.\"Variance Type\"::\"Material - Non Inventory\",\n- InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\");\n+ if ItemLedgerEntry.\"Order Type\" = ItemLedgerEntry.\"Order Type\"::Production then\n+ if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n+ if HasNewCost(InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\") then\n+ InventoryAdjustmentBuffer.AddCost(ItemLedgerEntry.\"Entry No.\",\n+ InventoryAdjustmentBuffer.\"Entry Type\"::Variance, InventoryAdjustmentBuffer.\"Variance Type\"::\"Material - Non Inventory\",\n+ InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\");\n \n if HasNewCost(InventoryAdjmtEntryOrder.\"Single-Level Capacity Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Capacity Cost (ACY)\") then\n InventoryAdjustmentBuffer.AddCost(ItemLedgerEntry.\"Entry No.\",\n"}
-{"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"], "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "metadata": {"area": "manufacturing"}, "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"], "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "metadata": {"area": "pricing"}, "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"], "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "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-227219", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137038, "functionName": ["ReleaseTransferOrderWhenVariantMandatory"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al\nindex f3c55b5f7a0..c7d556a7bc7 100644\n--- a/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al\n@@ -49,6 +49,7 @@\n DerivedTransLineErr: Label 'Expected no Derived Transfer Line i.e. line with \"Derived From Line No.\" equal to original transfer line.';\n IncorrectSNUndoneErr: Label 'The Serial No. of the item on the transfer shipment line that was undone was different from the SN on the corresponding transfer line.';\n ApplToItemEntryErr: Label '%1 must be %2 in %3.', Comment = '%1 is Appl-to Item Entry, %2 is Item Ledger Entry No. and %3 is Transfer Line';\n+ VariantCodeMandatoryErr: Label '%1 must have a value in %2: Document No.=%3, Line No.=%4. It cannot be zero or empty.', Comment = '%1:Field Caption, %2: TableCaption, %3:Document No, %4: Line No.';\n \n [Test]\n [HandlerFunctions('MessageHandler')]\n@@ -4096,6 +4097,48 @@\n 'The cost amount of the undo transfer shipment entry should match the original transfer shipment entry (with opposite sign)');\n end;\n \n+ [Test]\n+ procedure ReleaseTransferOrderWhenVariantMandatory()\n+ var\n+ InTransitLocation: Record Location;\n+ Item: Record Item;\n+ ItemVariant: array[2] of Record \"Item Variant\";\n+ FromLocation: Record Location;\n+ ToLocation: Record Location;\n+ TransferHeader: Record \"Transfer Header\";\n+ TransferLine: Record \"Transfer Line\";\n+ begin\n+ // [SCENARIO 601487] Release Transfer Order when Variant Mandatory in Inventory Setup.\n+ Initialize();\n+\n+ // [GIVEN] Create From/To Locations and InTransit Location\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(FromLocation);\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(ToLocation);\n+ LibraryWarehouse.CreateInTransitLocation(InTransitLocation);\n+\n+ // [GIVEN] Create Item and two Variants\n+ LibraryInventory.CreateItem(Item);\n+ LibraryInventory.CreateItemVariant(ItemVariant[1], Item.\"No.\");\n+ LibraryInventory.CreateItemVariant(ItemVariant[2], Item.\"No.\");\n+\n+ // [GIVEN] Set Inventory Setup to require variant if exists\n+ SetVariantMandatoryInInventorySetup();\n+\n+ // [GIVEN] Create Transfer Order and Line.\n+ LibraryInventory.CreateTransferHeader(TransferHeader, FromLocation.Code, ToLocation.Code, InTransitLocation.Code);\n+ LibraryInventory.CreateTransferLine(TransferHeader, TransferLine, Item.\"No.\", LibraryRandom.RandIntInRange(10, 100));\n+\n+ // [WHEN] Try to release the transfer order\n+ asserterror LibraryWarehouse.ReleaseTransferOrder(TransferHeader);\n+\n+ // [THEN] Assert error matches expected label\n+ Assert.ExpectedError(\n+ StrSubstNo(\n+ VariantCodeMandatoryErr,\n+ TransferLine.FieldCaption(\"Variant Code\"), TransferLine.TableCaption(),\n+ TransferLine.\"Document No.\", TransferLine.\"Line No.\"));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5670,6 +5713,15 @@\n until WarehouseActivityLine.Next() = 0;\n end;\n \n+ local procedure SetVariantMandatoryInInventorySetup()\n+ var\n+ InventorySetup: Record \"Inventory Setup\";\n+ begin\n+ InventorySetup.Get();\n+ InventorySetup.Validate(\"Variant Mandatory if Exists\", true);\n+ InventorySetup.Modify(true);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al\nindex 979cdb45246..1254b0d5d0d 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al\n@@ -119,7 +119,7 @@ codeunit 5708 \"Release Transfer Document\"\n if IsHandled then\n exit;\n \n- TransLine.SetLoadFields(\"Document No.\", Quantity, \"Item No.\");\n+ TransLine.SetLoadFields(\"Document No.\", Quantity, \"Item No.\", \"Variant Code\");\n TransLine.SetRange(\"Document No.\", TransHeader.\"No.\");\n TransLine.SetFilter(Quantity, '<>0');\n if TransLine.IsEmpty() then\n@@ -131,6 +131,8 @@ codeunit 5708 \"Release Transfer Document\"\n Item.Get(TransLine.\"Item No.\");\n if Item.IsInventoriableType() then\n TransLine.TestField(\"Unit of Measure Code\");\n+ if Item.IsVariantMandatory() then\n+ TransLine.TestField(\"Variant Code\");\n until TransLine.Next() = 0;\n TransLine.SetFilter(\"Item No.\", '');\n end;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227358", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-18", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134227, "functionName": ["RecurringJournalSuccessfullyPostedWhenUnlinkIncomingDocumentOnPostingOptionIsActivated"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\nindex 82601475bc6..adef8e520c9 100644\n--- a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n@@ -1410,6 +1410,22 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n GenJournalLine[1].\"Line No.\"));\n end;\n \n+ [Test]\n+ procedure RecurringJournalSuccessfullyPostedWhenUnlinkIncomingDocumentOnPostingOptionIsActivated()\n+ var\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ RecurringFrequency: array[6] of DateFormula;\n+ begin\n+ // [SCENARIO 602441] The changes to the Gen. Journal Line record cannot be saved because some information is not up-to-date\" error when posting Recurring General Journal and the Unlink Incoming Document on Posting option is activated.\n+ Initialize();\n+\n+ // [GIVEN] Create Recurring Journal Lines.\n+ CreateRecurringJournalLineWithVariable(GenJournalLine, RecurringFrequency);\n+\n+ // [THEN] Post Recurring Journal Lines Successfully\n+ LibraryERM.PostGeneralJnlLine(GenJournalLine);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"ERM PostRecurringJournal\");\n@@ -1954,6 +1970,73 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n Assert.AreEqual(GenJnlAllocation.\"Dimension Set ID\", DimensionSetID, AllocationDimensionErr);\n end;\n \n+ local procedure CreateRecurringJournalLineWithVariable(var GenJournalLine: Record \"Gen. Journal Line\"; var RecurringFrequency: array[6] of DateFormula)\n+ var\n+ GLAccount: Record \"G/L Account\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ Vendor: Record Vendor;\n+ Counter: Integer;\n+ NoOfLines: Integer;\n+ begin\n+ // Use Random Number Generator to generate the No. of lines.\n+ NoOfLines := 2 * LibraryRandom.RandInt(3);\n+\n+ //[GIVEN] Find G/L Account\n+ FindGLAccount(GLAccount);\n+\n+ //[GIVEN] Create Vendor\n+ LibraryPurchase.CreateVendor(Vendor);\n+\n+ //[WHEN] Create Recurring Journal Lines with Allocation and with random values.\n+ CreateRecurringGenJournalTemplateAndBatch(GenJournalBatch);\n+ for Counter := 1 to NoOfLines do begin\n+ if Counter = 1 then begin\n+ CreateGeneralJournalLineWithAccountType(\n+ GenJournalLine, GenJournalBatch, GenJournalLine.\"Recurring Method\"::\"V Variable\", -1000,\n+ Vendor.\"No.\");\n+ RecurringFrequency[Counter] := GenJournalLine.\"Recurring Frequency\";\n+ GenJournalLine.\"Document No.\" := '123';\n+ GenJournalLine.Modify();\n+ end else\n+ CreateGeneralJournalLineDocType(\n+ GenJournalLine, GenJournalBatch, GenJournalLine.\"Recurring Method\"::\"V Variable\", 1000,\n+ GLAccount.\"No.\");\n+ GenJournalLine.\"Document No.\" := '123';\n+ GenJournalLine.Modify();\n+ GLAccount.Next();\n+ RecurringFrequency[Counter] := GenJournalLine.\"Recurring Frequency\";\n+ end;\n+ end;\n+\n+ local procedure CreateGeneralJournalLineWithAccountType(var GenJournalLine: Record \"Gen. Journal Line\"; GenJournalBatch: Record \"Gen. Journal Batch\"; RecurringMethod: Enum \"Gen. Journal Recurring Method\"; Amount: Decimal; AccountNo: Code[20])\n+ begin\n+ CreateGeneralJournalLineWithType(\n+ GenJournalLine, GenJournalBatch, RecurringMethod, GenJournalLine.\"Document Type\"::Invoice,\n+ GenJournalLine.\"Account Type\"::Vendor, AccountNo, Amount);\n+ end;\n+\n+ local procedure CreateGeneralJournalLineDocType(var GenJournalLine: Record \"Gen. Journal Line\"; GenJournalBatch: Record \"Gen. Journal Batch\"; RecurringMethod: Enum \"Gen. Journal Recurring Method\"; Amount: Decimal; AccountNo: Code[20])\n+ begin\n+ CreateGeneralJournalLineWithType(\n+ GenJournalLine, GenJournalBatch, RecurringMethod, GenJournalLine.\"Document Type\"::Invoice,\n+ GenJournalLine.\"Account Type\"::\"G/L Account\", AccountNo, Amount);\n+ end;\n+\n+ local procedure CreateRecurringGenJournalTemplateAndBatch(var GenJournalBatch: Record \"Gen. Journal Batch\")\n+ var\n+ GenJnlTemplate: Record \"Gen. Journal Template\";\n+ begin\n+ LibraryERM.FindRecurringTemplateName(GenJnlTemplate);\n+ GenJnlTemplate.Validate(Type, GenJnlTemplate.Type::General);\n+ GenJnlTemplate.Validate(Recurring, true);\n+ GenJnlTemplate.Validate(\"Bal. Account Type\", GenJnlTemplate.\"Bal. Account Type\"::\"G/L Account\");\n+ GenJnlTemplate.Validate(\"Force Doc. Balance\", true);\n+ GenJnlTemplate.Validate(\"Copy VAT Setup to Jnl. Lines\", true);\n+ GenJnlTemplate.Validate(\"Unlink Inc. Doc On Posting\", true);\n+ GenJnlTemplate.Modify(true);\n+ LibraryERM.CreateRecurringBatchName(GenJournalBatch, GenJnlTemplate.Name);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerYes(Question: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al\nindex 61aff663d95..72ec7e79918 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al\n@@ -1006,6 +1006,7 @@ codeunit 13 \"Gen. Jnl.-Post Batch\"\n exit;\n if not CurrGenJnlTemplate.\"Unlink Inc. Doc On Posting\" then\n exit;\n+ GenJnlLine.GET(GenJnlLine.\"Journal Template Name\", GenJnlLine.\"Journal Batch Name\", GenJnlLine.\"Line No.\");\n GenJnlLine.\"Incoming Document Entry No.\" := 0;\n GenJnlLine.Modify();\n end;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226004", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-07", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137055, "functionName": ["InventoryPickRoundingCausesResidualQuantity"]}], "PASS_TO_PASS": [], "metadata": {"area": "warehouse"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al\nindex 6e2c6a34131..8eaf3b44088 100644\n--- a/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al\n@@ -41,6 +41,8 @@ codeunit 137055 \"SCM Warehouse Pick\"\n LocationCodeMustNotOccurErr: Label 'Location code %1 must not occur. Expected value - %2', Comment = '%1 : occured location code, %2 : expected location code.';\n ReturnQtyMismatchErr: Label 'The value in the %1 field in the %2 does not match.', Comment = '%1 :FieldCaption, %2:Table Caption';\n ReservationAction: Option AutoReserve,GetQuantities;\n+ PickQuantityErr: Label 'Expected picked quantity %1 %2, but got %3 %2', Comment = '%1, %3 - Quantity; %2 - Unit of Measure Code';\n+ ShipQtyErr: Label 'Sales line should be fully shipped with no residual quantity';\n \n [Test]\n [HandlerFunctions('ReservationPageHandler')]\n@@ -1776,6 +1778,98 @@ codeunit 137055 \"SCM Warehouse Pick\"\n StrSubstNo(ReturnQtyMismatchErr, PurchaseLine.\"Return Qty. Shipped\", PurchaseLine.TableCaption));\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('CreateInvtPutAwayPickRequestPageHandler,MessageHandler')]\n+ procedure InventoryPickRoundingCausesResidualQuantity()\n+ var\n+ Item: Record Item;\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ Location: Record Location;\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ Customer: Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ UnitOfMeasure: Record \"Unit of Measure\";\n+ Bin: Record Bin;\n+ TotalPickedQty: Decimal;\n+ QtyPerUOM: Decimal;\n+ QtyRoundingPrecision: Decimal;\n+ OrderQuantity: Decimal;\n+ BinCode: Code[20];\n+ begin\n+ // [SCENARIO 579500] Inventory pick rounding causes residual quantity When picking items with non-integer UOM conversion and very small \n+ // Quantity Rounding Precision, the pick process may result in rounding residuals\n+ Initialize();\n+\n+ // [GIVEN] Setup variables for rounding test with random values within problematic ranges\n+ SetStaticValues579500(QtyPerUOM, QtyRoundingPrecision, OrderQuantity);\n+\n+ // [GIVEN] Generate random bin code\n+ BinCode := LibraryUtility.GenerateRandomCode(SalesLine.FieldNo(\"Bin Code\"), Database::\"Sales Line\"); // Random bin code\n+\n+ // [GIVEN] Create item with specific UOM configuration for rounding test and LOT tracking with expiration dates\n+ LibraryInventory.CreateItem(Item);\n+ SetupItemTrackingWithExpirationDates(Item);\n+\n+ // [GIVEN] Add secondary UOM with problematic conversion factor and very small rounding precision\n+ LibraryInventory.CreateUnitOfMeasureCode(UnitOfMeasure);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure, Item.\"No.\", UnitOfMeasure.Code, QtyPerUOM);\n+ ItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", QtyRoundingPrecision);\n+ ItemUnitOfMeasure.Modify(true);\n+\n+ // [GIVEN] Set Sales Unit of Measure to the secondary UOM\n+ Item.Validate(\"Sales Unit of Measure\", UnitOfMeasure.Code);\n+ Item.Modify(true);\n+\n+ // [GIVEN] Setup Location with Require Pick = YES and Pick According to FEFO = Yes\n+ LibraryWarehouse.CreateLocationWMS(Location, false, false, true, false, false);\n+ Location.Validate(\"Bin Mandatory\", true);\n+ Location.Validate(\"Pick According to FEFO\", true);\n+ Location.Modify(true);\n+\n+ // [GIVEN] Add Warehouse Employee for location\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, Location.Code, true);\n+\n+ // [GIVEN] Create bin for the location\n+ LibraryWarehouse.CreateBin(Bin, Location.Code, BinCode, '', '');\n+\n+ // [GIVEN] Add inventory for the item (sufficient for order quantity)\n+ CreateInventoryForLotAndExpiry579500(Item.\"No.\", Location.Code, Bin.Code);\n+\n+ // [GIVEN] Create Customer\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Create Sales Order with random quantity \n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\");\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", OrderQuantity);\n+ SalesLine.Validate(\"Location Code\", Location.Code);\n+ SalesLine.Modify(true);\n+\n+ // [GIVEN] Release Sales Order\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+\n+ // [GiVEN] Create Inventory Pick from Sales Order\n+ Commit();\n+ SalesHeader.CreateInvtPutAwayPick();\n+\n+ // [WHEN] autofill Qty. to Handle, post the pick\n+ PostInventoryActivity(WarehouseActivityHeader.\"Source Document\"::\"Sales Order\", SalesHeader.\"No.\", WarehouseActivityLine.\"Activity Type\"::\"Invt. Pick\");\n+\n+ // [GIVEN] Get total picked quantity from Item Ledger Entries\n+ GetTotalPickedQuantity(Item.\"No.\", Location.Code, QtyPerUOM, TotalPickedQty);\n+\n+ // [THEN] Assert that picked quantity equals expected with tolerance for rounding\n+ Assert.AreNearlyEqual(OrderQuantity, TotalPickedQty, QtyRoundingPrecision * 10,\n+ StrSubstNo(PickQuantityErr, OrderQuantity, UnitOfMeasure.Code, TotalPickedQty));\n+\n+ // [THEN] Validate that no residual quantity remains (no second pick is required) Check that sales line is fully shipped\n+ SalesLine.Get(SalesLine.\"Document Type\", SalesLine.\"Document No.\", SalesLine.\"Line No.\");\n+ Assert.AreEqual(SalesLine.Quantity, SalesLine.\"Quantity Shipped\", ShipQtyErr);\n+ end;\n+\n local procedure Initialize()\n var\n WarehouseActivityLine: Record \"Warehouse Activity Line\";\n@@ -2604,6 +2698,128 @@ codeunit 137055 \"SCM Warehouse Pick\"\n exit(-PurchaseLine.\"Return Qty. to Ship\");\n end;\n \n+ local procedure SetupItemTrackingWithExpirationDates(var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItemTrackingCode(ItemTrackingCode);\n+ ItemTrackingCode.Validate(\"Lot Specific Tracking\", true);\n+ ItemTrackingCode.Validate(\"Use Expiration Dates\", true);\n+ ItemTrackingCode.Validate(\"Man. Expir. Date Entry Reqd.\", true);\n+ ItemTrackingCode.Modify(true);\n+\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure SetStaticValues579500(var QtyPerUOM: Decimal; var QtyRoundingPrecision: Decimal; var OrderQuantity: Decimal)\n+ begin\n+ QtyPerUOM := 2.888;\n+ QtyRoundingPrecision := 0.00001;\n+ OrderQuantity := 248;\n+ end;\n+\n+ local procedure GetTotalPickedQuantity(ItemNo: Code[20]; LocationCode: Code[10]; QtyPerUOM: Decimal; var TotalPickedQty: Decimal)\n+ var\n+ ItemLedgerEntry: Record \"Item Ledger Entry\";\n+ begin\n+ TotalPickedQty := 0;\n+ ItemLedgerEntry.SetRange(\"Item No.\", ItemNo);\n+ ItemLedgerEntry.SetRange(\"Location Code\", LocationCode);\n+ ItemLedgerEntry.SetRange(\"Entry Type\", ItemLedgerEntry.\"Entry Type\"::Sale);\n+ if ItemLedgerEntry.FindSet() then\n+ repeat\n+ TotalPickedQty += Abs(ItemLedgerEntry.Quantity) / QtyPerUOM;\n+ until ItemLedgerEntry.Next() = 0;\n+ end;\n+\n+ local procedure PostInventoryActivity(SourceDocument: Enum \"Warehouse Activity Source Document\"; SourceNo: Code[20]; ActivityType: Enum \"Warehouse Activity Type\")\n+ var\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ begin\n+ WarehouseActivityHeader.SetRange(\"Source Document\", SourceDocument);\n+ WarehouseActivityHeader.SetRange(\"Source No.\", SourceNo);\n+ WarehouseActivityHeader.SetRange(Type, WarehouseActivityHeader.Type::\"Invt. Pick\");\n+ WarehouseActivityHeader.FindFirst();\n+\n+ // Autofill Qty. to Handle\n+ WarehouseActivityLine.SetRange(\"Activity Type\", ActivityType);\n+ WarehouseActivityLine.SetRange(\"No.\", WarehouseActivityHeader.\"No.\");\n+ WarehouseActivityLine.SetRange(\"Action Type\", WarehouseActivityLine.\"Action Type\"::Take);\n+ if WarehouseActivityLine.FindSet() then\n+ repeat\n+ WarehouseActivityLine.Validate(\"Qty. to Handle\", WarehouseActivityLine.Quantity);\n+ WarehouseActivityLine.Modify(true);\n+ until WarehouseActivityLine.Next() = 0;\n+\n+ // Post the pick (Ship)\n+ LibraryWarehouse.PostInventoryActivity(WarehouseActivityHeader, false);\n+ end;\n+\n+ local procedure CreateInventoryForLotAndExpiry579500(ItemNo: Code[20]; LocationCode: Code[10]; BinCode: Code[20])\n+ var\n+ LotNo: array[10] of Code[50];\n+ ExpiryDate: array[10] of Date;\n+ Quantity: array[10] of Decimal;\n+ i: Integer;\n+ begin\n+ LotNo[1] := 'LOT01';\n+ LotNo[2] := 'LOT03';\n+ LotNo[3] := 'LOT06';\n+ LotNo[4] := 'LOT01';\n+ LotNo[5] := 'LOT02';\n+ LotNo[6] := 'LOT03';\n+ LotNo[7] := 'LOT04';\n+ LotNo[8] := 'LOT02';\n+ LotNo[9] := 'LOT03';\n+ LotNo[10] := 'LOT05';\n+\n+ ExpiryDate[1] := 20251130D;\n+ ExpiryDate[2] := 20250925D;\n+ ExpiryDate[3] := 20250925D;\n+ ExpiryDate[4] := 20250925D;\n+ ExpiryDate[5] := 20251130D;\n+ ExpiryDate[6] := 20250925D;\n+ ExpiryDate[7] := 20250606D;\n+ ExpiryDate[8] := 20250616D;\n+ ExpiryDate[9] := 20250925D;\n+ ExpiryDate[10] := 20250713D;\n+\n+ Quantity[1] := 434.97616;\n+ Quantity[2] := 17.3126;\n+ Quantity[3] := 17.0373;\n+ Quantity[4] := 4.13394;\n+ Quantity[5] := 4.34355;\n+ Quantity[6] := 151.33333;\n+ Quantity[7] := 40.01221;\n+ Quantity[8] := 1.78787;\n+ Quantity[9] := 42.73313;\n+ Quantity[10] := 4.013;\n+\n+ for i := 1 to ArrayLen(LotNo) do\n+ UpdateItemInventoryWithLot(ItemNo, LocationCode, BinCode, Quantity[i], LotNo[i], ExpiryDate[i]);\n+ end;\n+\n+ local procedure UpdateItemInventoryWithLot(ItemNo: Code[20]; LocationCode: Code[10]; BinCode: Code[20]; Quantity: Decimal; LotNo: Code[50]; ExpiryDate: Date)\n+ var\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.ClearItemJournal(ItemJournalTemplate, ItemJournalBatch);\n+ ItemJournalBatch.Validate(\"Item Tracking on Lines\", true);\n+ ItemJournalBatch.Modify(true);\n+\n+ LibraryInventory.CreateItemJournalLine(\n+ ItemJournalLine, ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name,\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", ItemNo, Quantity);\n+ ItemJournalLine.Validate(\"Location Code\", LocationCode);\n+ ItemJournalLine.Validate(\"Bin Code\", BinCode);\n+ ItemJournalLine.\"Lot No.\" := LotNo;\n+ ItemJournalLine.\"Expiration Date\" := ExpiryDate;\n+ ItemJournalLine.Modify(true);\n+ LibraryInventory.PostItemJournalLine(ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ReservationPageHandler(var Reservation: TestPage Reservation)\n@@ -2716,5 +2932,12 @@ codeunit 137055 \"SCM Warehouse Pick\"\n ProdOrderRouting.\"No.\".SetValue(MachineCenter.\"No.\");\n ProdOrderRouting.\"Setup Time\".SetValue(100);\n end;\n+\n+ [RequestPageHandler]\n+ procedure CreateInvtPutAwayPickRequestPageHandler(var CreateInvtPutAwayPickMvmt: TestRequestPage \"Create Invt Put-away/Pick/Mvmt\")\n+ begin\n+ CreateInvtPutAwayPickMvmt.CInvtPick.SetValue(true);\n+ CreateInvtPutAwayPickMvmt.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al b/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al\nindex ee0c77f69da..dea4f3bdce6 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al\n@@ -420,7 +420,7 @@ codeunit 7322 \"Create Inventory Pick/Movement\"\n CreatePickOrMoveLine(\n NewWarehouseActivityLine, RemQtyToPickBase, SalesLine.\"Outstanding Qty. (Base)\", SalesLine.\"Reserved Quantity\" <> 0);\n OnCreatePickOrMoveFromSalesOnAfterCreatePickOrMoveLine(NewWarehouseActivityLine, SalesLine, CurrWarehouseActivityHeader, ShowError, AutoCreation, LineCreated);\n-\n+ CorrectQtyRounding(SalesLine, CurrWarehouseActivityHeader);\n if SalesHeader.\"Shipping Advice\" = SalesHeader.\"Shipping Advice\"::Complete then begin\n if RemQtyToPickBase < 0 then begin\n if AutoCreation then begin\n@@ -2313,6 +2313,36 @@ codeunit 7322 \"Create Inventory Pick/Movement\"\n exit(true);\n end;\n \n+ local procedure CorrectQtyRounding(SalesLine: Record \"Sales Line\"; WarehouseActivityHeader: Record \"Warehouse Activity Header\")\n+ var\n+ WareHouseActivityLine: Record \"Warehouse Activity Line\";\n+ TotalQtyPicked: Decimal;\n+ TotalQtyOutstanding: Decimal;\n+ TotalPickedQuantityCalculated: Decimal;\n+ TotalQtyOutStandingCalculated: Decimal;\n+ begin\n+ if WarehouseActivityHeader.Type <> WarehouseActivityHeader.Type::\"Invt. Pick\" then\n+ exit;\n+\n+ WareHouseActivityLine.SetSource(Database::\"Sales Line\", SalesLine.\"Document Type\".AsInteger(), SalesLine.\"Document No.\", SalesLine.\"Line No.\", 0);\n+ WareHouseActivityLine.SetRange(\"No.\", WarehouseActivityHeader.\"No.\");\n+ WareHouseActivityLine.CalcSums(Quantity, \"Qty. (Base)\", \"Qty. Outstanding\", \"Qty. Outstanding (Base)\");\n+ TotalQtyPicked := WareHouseActivityLine.Quantity;\n+ TotalQtyOutstanding := WareHouseActivityLine.\"Qty. Outstanding\";\n+ TotalPickedQuantityCalculated := Round(WareHouseActivityLine.\"Qty. (Base)\" / SalesLine.\"Qty. per Unit of Measure\", 0.00001);\n+ TotalQtyOutStandingCalculated := Round(WareHouseActivityLine.\"Qty. Outstanding (Base)\" / SalesLine.\"Qty. per Unit of Measure\", 0.00001);\n+ if TotalQtyPicked = TotalPickedQuantityCalculated then\n+ exit;\n+\n+ if Abs(TotalPickedQuantityCalculated - TotalQtyPicked) > SalesLine.\"Qty. Rounding Precision\" then\n+ exit;\n+\n+ WareHouseActivityLine.FindLast();\n+ WareHouseActivityLine.Quantity += (TotalPickedQuantityCalculated - TotalQtyPicked);\n+ WareHouseActivityLine.\"Qty. Outstanding\" += (TotalQtyOutStandingCalculated - TotalQtyOutstanding);\n+ WareHouseActivityLine.Modify();\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterAutoCreatePickOrMove(var WarehouseRequest: Record \"Warehouse Request\"; LineCreated: Boolean; var WarehouseActivityHeader: Record \"Warehouse Activity Header\"; Location: Record Location; HideDialog: Boolean)\n begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223202", "base_commit": "071306f0d5dbae52846a3a732e27560b476295c9", "created_at": "2025-08-07", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Manufacturing"], "FAIL_TO_PASS": [{"codeunitID": 137210, "functionName": ["FirmedProdOrderStatisticsCheckOverhead"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al b/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al\nindex 57db2703546..edc1079c082 100644\n--- a/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al\n@@ -41,6 +41,7 @@ codeunit 137210 \"SCM Copy Production BOM\"\n ProdBOMNo: Code[20];\n CountError: Label 'Version Count Must Match.';\n OverHeadCostErr: Label 'Overhead Cost must be %1 in %2.', Comment = '%1= Field Value, %2= FieldCaption.';\n+ ManufacturingOverhead: Label 'Expected Overhead = %1, but Statistics shows = %2', Comment = '%1=Expected Overhead, %2=Overhead from Statistics page.';\n \n [Normal]\n local procedure Initialize()\n@@ -609,6 +610,86 @@ codeunit 137210 \"SCM Copy Production BOM\"\n ProductionOrderStatistics.MfgOverhead_ExpectedCost.Caption()));\n end;\n \n+ [Test]\n+ procedure FirmedProdOrderStatisticsCheckOverhead()\n+ var\n+ ParentItem: Record Item;\n+ RawItem: Record Item;\n+ ProductionOrder: Record \"Production Order\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ FirmedProductionOrder: TestPage \"Firm Planned Prod. Order\";\n+ ProductionOrderStatistics: TestPage \"Production Order Statistics\";\n+ MfgOverheadExpectedCost: Decimal;\n+ MfgOverheadExpectedCost1: Decimal;\n+ Quantity: Decimal;\n+ begin\n+ // [SCENARIO 593018] Manufacturing overhead is wrong in the production order statistics page (99000816) and report (99000791).\n+ Initialize();\n+\n+ // [GIVEN] Create Raw Item with specified Unit Cost\n+ CreateItem(RawItem, 0, 0);\n+ RawItem.Validate(Type, RawItem.Type::Inventory);\n+ RawItem.Validate(\"Unit Cost\", LibraryRandom.RandIntInRange(100, 100));\n+ RawItem.Modify(true);\n+\n+ // [GIVEN] Create Production BOM and add Raw Item with Qty = 1\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, RawItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, RawItem.\"No.\", 1);\n+ ProductionBOMHeader.Validate(\"Unit of Measure Code\", RawItem.\"Base Unit of Measure\");\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify(true);\n+\n+ // [GIVEN] Create Parent Item with Indirect Cost % and link to BOM\n+ CreateItem(ParentItem, 0, 0); // No direct cost or overhead\n+ ParentItem.Validate(\"Indirect Cost %\", LibraryRandom.RandIntInRange(10, 10));\n+ ParentItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ParentItem.Modify(true);\n+\n+ // [GIVEN] Create Firm Planned Production Order for Parent Item\n+ LibraryManufacturing.CreateProductionOrder(ProductionOrder, ProductionOrder.Status::\"Firm Planned\", ProductionOrder.\"Source Type\"::Item, '', 0);\n+\n+ // [GIVEN] Store Quantity in Variable.\n+ Quantity := LibraryRandom.RandIntInRange(20, 20);\n+\n+ // [GIVEN] Create line only (do NOT populate header)\n+ LibraryManufacturing.CreateProdOrderLine(ProdOrderLine, ProductionOrder.Status, ProductionOrder.\"No.\", ParentItem.\"No.\", '', '', Quantity);\n+\n+ // [WHEN] Refresh Prod Order with Lines = false (header only)\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, false, true, true, false);\n+\n+ MfgOverheadExpectedCost := (RawItem.\"Unit Cost\" * ParentItem.\"Indirect Cost %\" / 100 * Quantity);\n+\n+ // [GIVEN] Create Firm Planned Production Order for Parent Item\n+ LibraryManufacturing.CreateProductionOrder(ProductionOrder, ProductionOrder.Status::\"Firm Planned\", ProductionOrder.\"Source Type\"::Item, '', 0);\n+\n+ // [GIVEN] Create multiple lines (do NOT populate header)\n+ LibraryManufacturing.CreateProdOrderLine(ProdOrderLine, ProductionOrder.Status, ProductionOrder.\"No.\", ParentItem.\"No.\", '', '', LibraryRandom.RandIntInRange(10, 10));\n+ LibraryManufacturing.CreateProdOrderLine(ProdOrderLine, ProductionOrder.Status, ProductionOrder.\"No.\", ParentItem.\"No.\", '', '', LibraryRandom.RandIntInRange(10, 10));\n+\n+ // [WHEN] Refresh Prod Order with Lines = false (header only)\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, false, true, true, false);\n+\n+ // [WHEN] Open Firmed Prod Order Statistics page\n+ FirmedProductionOrder.OpenEdit();\n+ FirmedProductionOrder.GoToRecord(ProductionOrder);\n+ ProductionOrderStatistics.Trap();\n+ FirmedProductionOrder.Statistics.Invoke();\n+\n+ // [THEN] Get Mfg Overhead Expected Cost\n+ Evaluate(MfgOverheadExpectedCost1, ProductionOrderStatistics.MfgOverhead_ExpectedCost.Value());\n+\n+ // [ASSERT] Overhead in statistics equals expected overhead\n+ Assert.AreEqual(\n+ MfgOverheadExpectedCost,\n+ MfgOverheadExpectedCost1,\n+ StrSubstNo(ManufacturingOverhead,\n+ Format(MfgOverheadExpectedCost),\n+ Format(MfgOverheadExpectedCost1)));\n+ \n+ end;\n+\n [Normal]\n local procedure CreateProductionBOM(var ProductionBOMHeader: Record \"Production BOM Header\")\n var\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al\nindex 84769ae059d..aad60ef36b9 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al\n@@ -305,9 +305,12 @@ codeunit 99000758 \"Mfg. Cost Calculation Mgt.\"\n ExpSubDirCost := ExpSubDirCost + Round(ExpSubDirCostRtng * ShareOfTotalCapCost);\n ExpCapOvhdCost := ExpCapOvhdCost + Round(ExpCapOvhdCostRtng * ShareOfTotalCapCost);\n ExpMfgDirCost := ExpMatCost + ExpCapDirCost + ExpSubDirCost + ExpCapOvhdCost;\n- ExpOvhdCost := ExpMfgOvhdCost + ProdOrderLine.\"Overhead Rate\" * ProdOrderLine.\"Quantity (Base)\";\n- ExpMfgOvhdCost := ExpOvhdCost +\n- Round(CostCalculationMgt.CalcOvhdCost(ExpMfgDirCost, ProdOrderLine.\"Indirect Cost %\", 0, 0));\n+ ExpOvhdCost := ExpMfgOvhdCost;\n+ if ExpMfgDirCost = 0 then\n+ ExpMfgOvhdCost := ExpOvhdCost +\n+ Round(CostCalculationMgt.CalcOvhdCost(ExpMfgDirCost, ProdOrderLine.\"Indirect Cost %\", ProdOrderLine.\"Overhead Rate\", ProdOrderLine.\"Quantity (Base)\"))\n+ else\n+ ExpMfgOvhdCost := Round(CostCalculationMgt.CalcOvhdCost(ExpMfgDirCost, ProdOrderLine.\"Indirect Cost %\", ProdOrderLine.\"Overhead Rate\", ProdOrderLine.\"Quantity (Base)\"));\n \n OnAfterCalcProdOrderLineExpCost(ProdOrderLine, ShareOfTotalCapCost, ExpMatCost, ExpCapDirCost, ExpSubDirCost, ExpCapOvhdCost, ExpMfgOvhdCost);\n #if not CLEAN26\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226448", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-10", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\VAT"], "FAIL_TO_PASS": [{"codeunitID": 134282, "functionName": ["CheckVATEntryNonDeductibleVATPurchaseInvoicePosting"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al b/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al\nindex 6d22cda27cb..2ddbcc070b0 100644\n--- a/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al\n+++ b/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al\n@@ -285,6 +285,62 @@ codeunit 134282 \"Non-Deductible UT\"\n PurchaseLine.TestField(\"Non-Deductible VAT Amount\", 0);\n end;\n \n+ [Test]\n+ procedure CheckVATEntryNonDeductibleVATPurchaseInvoicePosting()\n+ var\n+ GenPostingSetup: Record \"General Posting Setup\";\n+ GLAccount: Record \"G/L Account\";\n+ PurchHeader: Record \"Purchase Header\";\n+ PurchLine: Record \"Purchase Line\";\n+ VATEntry: Record \"VAT Entry\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ Vendor: Record Vendor;\n+ GLAccountNo: Code[20];\n+ PostedDocumentNo: Code[20];\n+ VATRate: Decimal;\n+ begin\n+ // [SCENARIO 595966] Check VAT Entry Non-Deductible VAT on Purchase Invoice Posting with G/L Account Line.\n+ Initialize();\n+\n+ // [GIVEN] Create Vendor and set Prices Including VAT\n+ LibraryPurchase.CreateVendor(Vendor);\n+ Vendor.Validate(\"Prices Including VAT\", true);\n+ Vendor.Modify(true);\n+\n+ // [GIVEN] Enable Non-Deductible VAT in VAT Setup (with confirm handler)\n+ LibraryNonDeductibleVAT.EnableNonDeductibleVAT();\n+\n+ // [GIVEN] Create G/L Account and set posting groups/categories\n+ VATRate := 20.0;\n+ GLAccountNo := CreateGLAccountWithVATPostingSetup(VATRate);\n+ GLAccount.Get(GLAccountNo);\n+\n+ // [GIVEN] Create/Modify VAT Product Posting Group and VAT Posting Setup.\n+ LibraryERM.CreateVATPostingSetup(VATPostingSetup, Vendor.\"VAT Bus. Posting Group\", GLAccount.\"VAT Prod. Posting Group\");\n+ VATPostingSetup.Validate(\"VAT Calculation Type\", VATPostingSetup.\"VAT Calculation Type\"::\"Normal VAT\");\n+ VATPostingSetup.Validate(\"Allow Non-Deductible VAT\", VATPostingSetup.\"Allow Non-Deductible VAT\"::Allow);\n+ VATPostingSetup.Validate(\"VAT %\", 20);\n+ VATPostingSetup.Validate(\"Non-Deductible VAT %\", 100);\n+ VATPostingSetup.Modify(true);\n+\n+ // [WHEN] Create and post Purchase Invoice for the vendor with G/L Account line\n+ LibraryPurchase.CreatePurchHeader(PurchHeader, PurchHeader.\"Document Type\"::Invoice, Vendor.\"No.\");\n+ LibraryPurchase.CreatePurchaseLine(PurchLine, PurchHeader, PurchLine.Type::\"G/L Account\", GLAccountNo, 1);\n+ PurchLine.Validate(\"Direct Unit Cost\", 14.19);\n+ PurchLine.Modify(true);\n+ PurchHeader.Validate(\"Vendor Invoice No.\", 'Test-1001');\n+ PurchHeader.Modify(true);\n+ LibraryERM.CreateGeneralPostingSetup(GenPostingSetup, PurchLine.\"Gen. Bus. Posting Group\", PurchLine.\"Gen. Prod. Posting Group\");\n+ PostedDocumentNo := LibraryPurchase.PostPurchaseDocument(PurchHeader, false, true);\n+\n+ // [THEN] verify that Purchase Invoice is posted with 0 VAT Amount and 0 Non-Deductible VAT Amount\n+ VATEntry.SetRange(\"Document No.\", PostedDocumentNo);\n+ VATEntry.SetRange(\"Document Type\", VATEntry.\"Document Type\"::Invoice);\n+ VATEntry.FindFirst();\n+ Assert.AreEqual(0, VATEntry.Base, 'Vat Base should be 0.');\n+ Assert.AreEqual(0, VATEntry.Amount, 'Vat Amount should be 0.');\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"Non-Deductible UT\");\n@@ -383,4 +439,33 @@ codeunit 134282 \"Non-Deductible UT\"\n Assert.AreEqual(ExpectedAmount, VATEntry.\"Non-Deductible VAT Base\", StrSubstNo(AmountErrorLbl, VATEntry.FieldCaption(\"Non-Deductible VAT Base\"), ExpectedAmount));\n Assert.AreEqual(ExpectedAmount, VATEntry.\"Non-Deductible VAT Amount\", StrSubstNo(AmountErrorLbl, VATEntry.FieldCaption(\"Non-Deductible VAT Amount\"), ExpectedAmount));\n end;\n+\n+ local procedure CreateGLAccountWithVATPostingSetup(var VATRate: Decimal) GLAccountNo: Code[20]\n+ var\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ begin\n+ VATRate := LibraryRandom.RandIntInRange(2, 5);\n+ LibraryERM.CreateVATPostingSetupWithAccounts(VATPostingSetup,\n+ VATPostingSetup.\"VAT Calculation Type\"::\"Normal VAT\", VATRate);\n+ GLAccountNo := VATPostingSetup.\"Purchase VAT Account\";\n+ UpdateGLAccountPostingGroups(GLAccountNo,\n+ VATPostingSetup.\"VAT Prod. Posting Group\", VATPostingSetup.\"VAT Bus. Posting Group\");\n+ end;\n+\n+ local procedure UpdateGLAccountPostingGroups(GLAccountNo: Code[20]; VATProdPostingGroup: Code[20]; VATBusPostingGroup: Code[20])\n+ var\n+ GLAccount: Record \"G/L Account\";\n+ GenProductPostingGroup: Record \"Gen. Product Posting Group\";\n+ begin\n+ GLAccount.Get(GLAccountNo);\n+ LibraryERM.CreateGenProdPostingGroup(GenProductPostingGroup);\n+ GLAccount.\"Gen. Posting Type\" := GLAccount.\"Gen. Posting Type\"::Purchase;\n+ GLAccount.Validate(\"Account Category\", GLAccount.\"Account Category\"::Expense);\n+ GLAccount.Validate(\"Account Type\", GLAccount.\"Account Type\"::Posting);\n+ GLAccount.Validate(\"Direct Posting\", true);\n+ GLAccount.\"Gen. Prod. Posting Group\" := GenProductPostingGroup.Code;\n+ GLAccount.\"VAT Prod. Posting Group\" := VATProdPostingGroup;\n+ GLAccount.\"VAT Bus. Posting Group\" := VATBusPostingGroup;\n+ GLAccount.Modify(true);\n+ end;\n }\n\\ No newline at end of file\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\nindex c9d976f7272..a9f725ac966 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n@@ -16,6 +16,7 @@ using Microsoft.FixedAssets.Ledger;\n using Microsoft.Foundation.Enums;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.History;\n+using Microsoft.Purchases.Vendor;\n using Microsoft.Foundation.Company;\n using Microsoft.Projects.Project.Journal;\n using Microsoft.Projects.Project.Job;\n@@ -951,6 +952,8 @@ codeunit 6201 \"Non-Ded. VAT Impl.\"\n GeneralLedgerSetup.GetRecordOnce();\n UpdateNonDeductibleAmounts(GenJournalLine.\"Non-Deductible VAT Base ACY\", GenJournalLine.\"Non-Deductible VAT Amount ACY\", BaseAmountACY, VATAmountACY, GetNonDedVATPctFromGenJournalLine(GenJournalLine), GeneralLedgerSetup.\"Amount Rounding Precision\");\n AdjustVATAmounts(VATAmountACY, BaseAmountACY, GenJournalLine.\"Non-Deductible VAT Amount ACY\", GenJournalLine.\"Non-Deductible VAT Base ACY\");\n+ if IsNormalVATInvoiceForVendor(GenJournalLine) then\n+ UpdateNonDeductibleAmounts(GenJournalLine.\"Non-Deductible VAT Base LCY\", GenJournalLine.\"Non-Deductible VAT Amount LCY\", BaseAmount, VATAmount, GetNonDedVATPctFromGenJournalLine(GenJournalLine), GeneralLedgerSetup.\"Amount Rounding Precision\");\n AdjustVATAmounts(VATAmount, BaseAmount, GenJournalLine.\"Non-Deductible VAT Amount LCY\", GenJournalLine.\"Non-Deductible VAT Base LCY\");\n end;\n \n@@ -1152,6 +1155,17 @@ codeunit 6201 \"Non-Ded. VAT Impl.\"\n exit(DocAmountRoundingPrecision);\n end;\n \n+ local procedure IsNormalVATInvoiceForVendor(GenJournalLine: Record \"Gen. Journal Line\"): Boolean\n+ var\n+ Vendor: Record Vendor;\n+ begin\n+ if (GenJournalLine.\"Document Type\" = GenJournalLine.\"Document Type\"::Invoice) and\n+ (GenJournalLine.\"VAT Calculation Type\" = GenJournalLine.\"VAT Calculation Type\"::\"Normal VAT\") and\n+ (Vendor.Get(GenJournalLine.\"Bill-to/Pay-to No.\") and (Vendor.\"Prices Including VAT\")) then\n+ exit(true);\n+ exit(false);\n+ end;\n+\n [EventSubscriber(ObjectType::Codeunit, Codeunit::\"Company-Initialize\", 'OnCompanyInitialize', '', false, false)]\n local procedure CreateVATSetupOnCompanyInitialize()\n var\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227153", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-16", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Report"], "FAIL_TO_PASS": [{"codeunitID": 134982, "functionName": ["ReconcileCustVendAccounts_MultiplePostingGroups"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al b/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al\nindex 073ba04a94f..03f6e89bb23 100644\n--- a/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al\n+++ b/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al\n@@ -1498,6 +1498,93 @@ codeunit 134982 \"ERM Financial Reports\"\n Assert.AreNotEqual(0, GLEntry.\"Source Currency Amount\", SourceCurrencyCodeErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('RHReconcileCustandVendAccs')]\n+ procedure ReconcileCustVendAccounts_MultiplePostingGroups()\n+ var\n+ SalesReceivablesSetup: Record \"Sales & Receivables Setup\";\n+ CustomerPostingGroup: array[2] of Record \"Customer Posting Group\";\n+ Customer: Record Customer;\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ GLAccount: array[3] of Record \"G/L Account\";\n+ ReconcileCustAndVendAccs: Report \"Reconcile Cust. and Vend. Accs\";\n+ Amount1, Amount2 : Decimal;\n+ WorkdateTxt: Text[30];\n+ begin\n+ // [SCENARIO 601857] Report Reconcile Customer and Vendor Accounts shows wrong amounts when multiple posting groups are used\n+ Initialize();\n+\n+ // [GIVEN] Enable Allow Multiple Posting Groups\n+ SalesReceivablesSetup.Get();\n+ SalesReceivablesSetup.Validate(\"Allow Multiple Posting Groups\", true);\n+ SalesReceivablesSetup.Modify(true);\n+\n+ // [GIVEN] Create two Customer Posting Groups with different Receivables Accounts\n+ LibrarySales.CreateCustomerPostingGroup(CustomerPostingGroup[1]);\n+ LibrarySales.CreateCustomerPostingGroup(CustomerPostingGroup[2]);\n+ LibrarySales.CreateAltCustomerPostingGroup(CustomerPostingGroup[1].Code, CustomerPostingGroup[2].Code);\n+\n+ // [GIVEN] Create a customer with one of the posting groups and enable multiple posting groups\n+ LibrarySales.CreateCustomer(Customer);\n+ Customer.Validate(\"Customer Posting Group\", CustomerPostingGroup[1].Code);\n+ Customer.Validate(\"Allow Multiple Posting Groups\", true);\n+ Customer.Modify(true);\n+\n+ // [GIVEN] Create General Journal Batch\n+ LibraryJournals.CreateGenJournalBatch(GenJournalBatch);\n+\n+ // [GIVEN] Post payment 1 with first posting group\n+ Amount1 := -1 * LibraryRandom.RandDec(1000, 2);\n+ LibraryERM.CreateGLAccount(GLAccount[1]);\n+ LibraryJournals.CreateGenJournalLine(\n+ GenJournalLine,\n+ GenJournalBatch.\"Journal Template Name\",\n+ GenJournalBatch.Name,\n+ GenJournalLine.\"Document Type\"::Payment,\n+ GenJournalLine.\"Account Type\"::Customer,\n+ Customer.\"No.\",\n+ GenJournalLine.\"Bal. Account Type\"::\"G/L Account\",\n+ GLAccount[1].\"No.\",\n+ Amount1);\n+ GenJournalLine.Validate(\"Posting Group\", CustomerPostingGroup[1].Code);\n+ GenJournalLine.Modify(true);\n+ LibraryERM.PostGeneralJnlLine(GenJournalLine);\n+\n+ // [GIVEN] Post payment 2 with second posting group\n+ Amount2 := -1 * LibraryRandom.RandDec(2000, 2);\n+ LibraryERM.CreateGLAccount(GLAccount[2]);\n+ LibraryJournals.CreateGenJournalLine(\n+ GenJournalLine,\n+ GenJournalBatch.\"Journal Template Name\",\n+ GenJournalBatch.Name,\n+ GenJournalLine.\"Document Type\"::Payment,\n+ GenJournalLine.\"Account Type\"::Customer,\n+ Customer.\"No.\",\n+ GenJournalLine.\"Bal. Account Type\"::\"G/L Account\",\n+ GLAccount[2].\"No.\",\n+ Amount2);\n+ GenJournalLine.Validate(\"Posting Group\", CustomerPostingGroup[2].Code);\n+ GenJournalLine.Modify(true);\n+ LibraryERM.PostGeneralJnlLine(GenJournalLine);\n+\n+ // [WHEN] Run the Reconcile Cust. And Vend. Accounts report with DateFilter as Workdate\n+ WorkdateTxt := Format(WorkDate());\n+ Clear(ReconcileCustAndVendAccs);\n+ GLAccount[3].SetRange(\"Date Filter\", WorkDate());\n+ GLAccount[3].FindFirst();\n+ ReconcileCustAndVendAccs.SetTableView(GLAccount[3]);\n+ Commit();\n+ ReconcileCustAndVendAccs.Run();\n+\n+ // [THEN] Verify: Amounts are distributed to correct G/L accounts\n+ LibraryReportDataset.LoadDataSetFile();\n+ LibraryReportDataset.AssertElementWithValueExists('No_GLAccount', CustomerPostingGroup[1].\"Receivables Account\");\n+ LibraryReportDataset.AssertElementWithValueExists('No_GLAccount', CustomerPostingGroup[2].\"Receivables Account\");\n+ LibraryReportDataset.AssertElementWithValueExists('Amount', Amount1);\n+ LibraryReportDataset.AssertElementWithValueExists('Amount', Amount2);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al\nindex e033f91eb0b..2153bcde821 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al\n@@ -472,130 +472,88 @@ report 33 \"Reconcile Cust. and Vend. Accs\"\n \n local procedure CalcCustAccAmount(PostingGr: Code[20]): Decimal\n var\n- Cust: Record Customer;\n DtldCustLedgEntry: Record \"Detailed Cust. Ledg. Entry\";\n CustAccAmount: Decimal;\n begin\n- Cust.SetCurrentKey(\"Customer Posting Group\");\n- Cust.SetRange(\"Customer Posting Group\", PostingGr);\n-\n- if Cust.Find('-') then\n- repeat\n- DtldCustLedgEntry.SetCurrentKey(\"Customer No.\", \"Posting Date\");\n- DtldCustLedgEntry.SetRange(\"Customer No.\", Cust.\"No.\");\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n- DtldCustLedgEntry.CalcSums(\"Amount (LCY)\");\n- CustAccAmount := CustAccAmount + DtldCustLedgEntry.\"Amount (LCY)\";\n- until Cust.Next() = 0;\n+ DtldCustLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\");\n+ DtldCustLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n+ DtldCustLedgEntry.CalcSums(\"Amount (LCY)\");\n+ CustAccAmount := CustAccAmount + DtldCustLedgEntry.\"Amount (LCY)\";\n \n exit(CustAccAmount);\n end;\n \n local procedure CalcCustCreditAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Cust: Record Customer;\n DtldCustLedgEntry: Record \"Detailed Cust. Ledg. Entry\";\n CustCreditAmount: Decimal;\n begin\n- Cust.SetCurrentKey(\"Customer Posting Group\");\n- Cust.SetRange(\"Customer Posting Group\", PostingGr);\n-\n- if Cust.Find('-') then\n- repeat\n- DtldCustLedgEntry.SetCurrentKey(\"Customer No.\", \"Posting Date\", \"Entry Type\");\n- DtldCustLedgEntry.SetRange(\"Customer No.\", Cust.\"No.\");\n- DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n- DtldCustLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n- CustCreditAmount := CustCreditAmount + DtldCustLedgEntry.\"Credit Amount (LCY)\";\n- until Cust.Next() = 0;\n+ DtldCustLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldCustLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n+ DtldCustLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n+ CustCreditAmount := CustCreditAmount + DtldCustLedgEntry.\"Credit Amount (LCY)\";\n \n exit(CustCreditAmount);\n end;\n \n local procedure CalcCustDebitAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Cust: Record Customer;\n DtldCustLedgEntry: Record \"Detailed Cust. Ledg. Entry\";\n CustDebitAmount: Decimal;\n begin\n- Cust.SetCurrentKey(\"Customer Posting Group\");\n- Cust.SetRange(\"Customer Posting Group\", PostingGr);\n-\n- if Cust.Find('-') then\n- repeat\n- DtldCustLedgEntry.SetCurrentKey(\"Customer No.\", \"Posting Date\", \"Entry Type\");\n- DtldCustLedgEntry.SetRange(\"Customer No.\", Cust.\"No.\");\n- DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n- DtldCustLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n- CustDebitAmount := CustDebitAmount + DtldCustLedgEntry.\"Debit Amount (LCY)\";\n- until Cust.Next() = 0;\n+ DtldCustLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldCustLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n+ DtldCustLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n+ CustDebitAmount := CustDebitAmount + DtldCustLedgEntry.\"Debit Amount (LCY)\";\n \n exit(-CustDebitAmount);\n end;\n \n local procedure CalcVendAccAmount(PostingGr: Code[20]): Decimal\n var\n- Vend: Record Vendor;\n DtldVendLedgEntry: Record \"Detailed Vendor Ledg. Entry\";\n VendAccAmount: Decimal;\n begin\n- Vend.SetCurrentKey(\"Vendor Posting Group\");\n- Vend.SetRange(\"Vendor Posting Group\", PostingGr);\n-\n- if Vend.Find('-') then\n- repeat\n- DtldVendLedgEntry.SetCurrentKey(\"Vendor No.\", \"Posting Date\");\n- DtldVendLedgEntry.SetRange(\"Vendor No.\", Vend.\"No.\");\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n- DtldVendLedgEntry.CalcSums(\"Amount (LCY)\");\n- VendAccAmount := VendAccAmount + DtldVendLedgEntry.\"Amount (LCY)\";\n- until Vend.Next() = 0;\n+ DtldVendLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\");\n+ DtldVendLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n+ DtldVendLedgEntry.CalcSums(\"Amount (LCY)\");\n+ VendAccAmount := VendAccAmount + DtldVendLedgEntry.\"Amount (LCY)\";\n \n exit(VendAccAmount);\n end;\n \n local procedure CalcVendCreditAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Vend: Record Vendor;\n DtldVendLedgEntry: Record \"Detailed Vendor Ledg. Entry\";\n VendCreditAmount: Decimal;\n begin\n- Vend.SetCurrentKey(\"Vendor Posting Group\");\n- Vend.SetRange(\"Vendor Posting Group\", PostingGr);\n-\n- if Vend.Find('-') then\n- repeat\n- DtldVendLedgEntry.SetCurrentKey(\"Vendor No.\", \"Posting Date\", \"Entry Type\");\n- DtldVendLedgEntry.SetRange(\"Vendor No.\", Vend.\"No.\");\n- DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n- DtldVendLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n- VendCreditAmount := VendCreditAmount + DtldVendLedgEntry.\"Credit Amount (LCY)\";\n- until Vend.Next() = 0;\n+ DtldVendLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldVendLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n+ DtldVendLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n+ VendCreditAmount := VendCreditAmount + DtldVendLedgEntry.\"Credit Amount (LCY)\";\n \n exit(VendCreditAmount);\n end;\n \n local procedure CalcVendDebitAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Vend: Record Vendor;\n DtldVendLedgEntry: Record \"Detailed Vendor Ledg. Entry\";\n VendDebitAmount: Decimal;\n begin\n- Vend.SetCurrentKey(\"Vendor Posting Group\");\n- Vend.SetRange(\"Vendor Posting Group\", PostingGr);\n-\n- if Vend.Find('-') then\n- repeat\n- DtldVendLedgEntry.SetCurrentKey(\"Vendor No.\", \"Posting Date\", \"Entry Type\");\n- DtldVendLedgEntry.SetRange(\"Vendor No.\", Vend.\"No.\");\n- DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n- DtldVendLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n- VendDebitAmount := VendDebitAmount + DtldVendLedgEntry.\"Debit Amount (LCY)\";\n- until Vend.Next() = 0;\n+ DtldVendLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldVendLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n+ DtldVendLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n+ VendDebitAmount := VendDebitAmount + DtldVendLedgEntry.\"Debit Amount (LCY)\";\n \n exit(-VendDebitAmount);\n end;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227240", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134905, "functionName": ["VerifyDueDateAfterUpdateDueDateInCustLedgerEntry"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\nindex 71c12b1ce1a..6d8f4aaca9e 100644\n--- a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n@@ -636,6 +636,68 @@ codeunit 134905 \"ERM Issued Reminder Addnl Fee\"\n ReminderPage.ContactEmail.AssertEquals(EMail);\n end;\n \n+ [Test]\n+ procedure VerifyDueDateAfterUpdateDueDateInCustLedgerEntry()\n+ var\n+ CustLedgerEntry: Record \"Cust. Ledger Entry\";\n+ Customer: Record Customer;\n+ CustomerPostingGroup: Record \"Customer Posting Group\";\n+ GLAccount: Record \"G/L Account\";\n+ ReminderFinChargeEntry: Record \"Reminder/Fin. Charge Entry\";\n+ ReminderLevel: Record \"Reminder Level\";\n+ VATProductPostingGroup: Record \"VAT Product Posting Group\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ DueDate: Date;\n+ DocumentDate: Date;\n+ IssuedReminderNo: Code[20];\n+ begin\n+ // [SCENARIO 598460] The Due date in created Reminder is updated incorrectly when changing the Due date in the Customer Ledger Entry.\n+ Initialize();\n+\n+ // [GIVEN] Create Customer and VAT Posting Setup. \n+ CreateCustomer(Customer, '');\n+ CustomerPostingGroup.Get(Customer.\"Customer Posting Group\");\n+ GLAccount.Get(CustomerPostingGroup.\"Additional Fee Account\");\n+ LibraryERM.CreateVATProductPostingGroup(VATProductPostingGroup);\n+ GLAccount.Validate(\"VAT Prod. Posting Group\", VATProductPostingGroup.Code);\n+ GLAccount.Modify(true);\n+\n+ LibraryERM.CreateVATPostingSetup(VATPostingSetup, Customer.\"VAT Bus. Posting Group\", VATProductPostingGroup.Code);\n+\n+ //[GIVEN] Create and post Sales Invoice.\n+ DueDate := CreateAndPostSalesInvoice(Customer.\"No.\", '');\n+ GetReminderLevel(ReminderLevel, Customer.\"Reminder Terms Code\");\n+ DocumentDate := CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', CalcDate(ReminderLevel.\"Grace Period\", DueDate));\n+\n+ // [GIVEN] Create and Issue Reminder.\n+ CreateReminder(Customer.\"No.\", DocumentDate, false);\n+ IssuedReminderNo := IssueReminder(DocumentDate);\n+\n+ // [WHEN] Update Due Date in forward direction for Customer Ledger Entry.\n+ DueDate := DocumentDate + LibraryRandom.RandIntInRange(16, 17);\n+ CustLedgerEntry.SetRange(\"Customer No.\", Customer.\"No.\");\n+ CustLedgerEntry.FindLast();\n+ CustLedgerEntry.Validate(\"Due Date\", DueDate);\n+ CustLedgerEntry.Modify(true);\n+\n+ // [VERIFY] Verify Due Date in Reminder/Fin. Charge Entry should be equal to Cust. Ledger Entry - Due Date.\n+ ReminderFinChargeEntry.SetRange(Type, ReminderFinChargeEntry.Type::Reminder);\n+ ReminderFinChargeEntry.SetRange(\"No.\", IssuedReminderNo);\n+ ReminderFinChargeEntry.FindFirst();\n+ Assert.AreEqual(ReminderFinChargeEntry.\"Due Date\", CustLedgerEntry.\"Due Date\", ReminderDueDateErr);\n+\n+ // [WHEN] Update Due Date in backward direction for Customer Ledger Entry.\n+ DueDate := DocumentDate - LibraryRandom.RandIntInRange(16, 17);\n+ CustLedgerEntry.Validate(\"Due Date\", DueDate);\n+ CustLedgerEntry.Modify(true);\n+\n+ // [VERIFY] Verify Due Date in Reminder/Fin. Charge Entry should be equal to Cust. Ledger Entry - Due Date.\n+ ReminderFinChargeEntry.SetRange(Type, ReminderFinChargeEntry.Type::Reminder);\n+ ReminderFinChargeEntry.SetRange(\"No.\", IssuedReminderNo);\n+ ReminderFinChargeEntry.FindFirst();\n+ Assert.AreEqual(ReminderFinChargeEntry.\"Due Date\", CustLedgerEntry.\"Due Date\", ReminderDueDateErr);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\nindex 9ff59101df2..ff238e73dcf 100644\n--- a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n@@ -409,9 +409,6 @@ codeunit 393 \"Reminder-Issue\"\n if IsHandled then\n exit;\n \n- if NewDueDate < ReminderEntry2.\"Due Date\" then\n- exit;\n-\n ReminderEntry2.Validate(\"Due Date\", NewDueDate);\n ReminderEntry2.Modify();\n end;\n"}
-{"repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-5633", "base_commit": "260795201c277427aa3bb70bc24672bb8d60c87b", "created_at": "2025-11-26T21:22:42Z", "environment_setup_version": "27.2", "project_paths": ["src\\Apps\\W1\\Shopify\\App", "src\\Apps\\W1\\Shopify\\Test"], "FAIL_TO_PASS": [{"codeunitID": 139606, "functionName": ["UnitTestExportShipmentThirdParty"]}], "PASS_TO_PASS": [], "metadata": {"area": "shopify"}, "test_patch": "diff --git a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al\nindex 87c4a69e3a..2aa63a294f 100644\n--- a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al\n+++ b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al\n@@ -154,6 +154,36 @@ codeunit 139606 \"Shpfy Shipping Test\"\n LibraryAssert.IsTrue(FulfillmentRequest.Contains(StrSubstNo(QuantityLbl, SalesShipmentLine.Quantity)), 'quantity check');\n end;\n \n+ [Test]\n+ procedure UnitTestExportShipmentThirdParty()\n+ var\n+ SalesShipmentHeader: Record \"Sales Shipment Header\";\n+ FulfillmentOrderHeader: Record \"Shpfy FulFillment Order Header\";\n+ ExportShipments: Codeunit \"Shpfy Export Shipments\";\n+ ShippingHelper: Codeunit \"Shpfy Shipping Helper\";\n+ DeliveryMethodType: Enum \"Shpfy Delivery Method Type\";\n+ FulfillmentRequests: List of [Text];\n+ AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]];\n+ ShopifyOrderId: BigInteger;\n+ LocationId: BigInteger;\n+ begin\n+ // [SCENARIO] Export a Sales Shipment record into a Json token that contains the shipping info for a third-party fulfillment service\n+ // [GIVEN] A random Sales Shipment, a random LocationId for a third-party fulfillment location, a random Shop\n+ Initialize();\n+ LocationId := Any.IntegerInRange(10000, 99999);\n+ CreateThirdPartyFulfillmentLocation(Shop, LocationId);\n+ DeliveryMethodType := DeliveryMethodType::Shipping;\n+ ShopifyOrderId := ShippingHelper.CreateRandomShopifyOrder(LocationId, DeliveryMethodType);\n+ FulfillmentOrderHeader := ShippingHelper.CreateShopifyFulfillmentOrder(ShopifyOrderId, DeliveryMethodType);\n+ ShippingHelper.CreateRandomSalesShipment(SalesShipmentHeader, ShopifyOrderId);\n+\n+ // [WHEN] Invoke the function CreateFulfillmentOrderRequest()\n+ FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds);\n+\n+ // [THEN] We must find no fulfilment data in the json token as the location is for a third-party fulfillment service\n+ LibraryAssert.AreEqual(0, FulfillmentRequests.Count, 'FulfillmentRequest count check');\n+ end;\n+\n local procedure Initialize()\n var\n CommunicationMgt: Codeunit \"Shpfy Communication Mgt.\";\n@@ -188,6 +218,17 @@ codeunit 139606 \"Shpfy Shipping Test\"\n LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::\"Shpfy Shipping Test\");\n end;\n \n+ local procedure CreateThirdPartyFulfillmentLocation(ShopifyShop: Record \"Shpfy Shop\"; LocationId: BigInteger)\n+ var\n+ ShopLocation: Record \"Shpfy Shop Location\";\n+ begin\n+ ShopLocation.\"Shop Code\" := ShopifyShop.Code;\n+ ShopLocation.Id := LocationId;\n+ ShopLocation.Name := 'Third-Party Fulfillment Service';\n+ ShopLocation.\"Is Fulfillment Service\" := true;\n+ ShopLocation.Insert();\n+ end;\n+\n [HttpClientHandler]\n internal procedure HttpSubmitHandler(Request: TestHttpRequestMessage; var Response: TestHttpResponseMessage): Boolean\n begin\n", "patch": "diff --git a/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al b/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al\nindex 1f790f98d1..6160dcd402 100644\n--- a/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al\n+++ b/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al\n@@ -90,11 +90,13 @@ codeunit 30190 \"Shpfy Export Shipments\"\n TrackingCompany: Enum \"Shpfy Tracking Companies\";\n PrevFulfillmentOrderId: BigInteger;\n IsHandled: Boolean;\n+ EmptyFulfillment: Boolean;\n TrackingUrl: Text;\n GraphQueryStart: Text;\n GraphQuery: TextBuilder;\n LineCount: Integer;\n GraphQueries: List of [Text];\n+ UnfulfillableOrders: List of [BigInteger];\n begin\n Clear(PrevFulfillmentOrderId);\n \n@@ -165,11 +167,17 @@ codeunit 30190 \"Shpfy Export Shipments\"\n end;\n GraphQuery.Append('lineItemsByFulfillmentOrder: [');\n GraphQueryStart := GraphQuery.ToText();\n+ EmptyFulfillment := true;\n repeat\n // Skip fulfillment orders that are assigned and not accepted\n if AssignedFulfillmentOrderIds.ContainsKey(TempFulfillmentOrderLine.\"Shopify Fulfillment Order Id\") then\n continue;\n \n+ if not CanFulfillOrder(TempFulfillmentOrderLine, Shop, UnfulfillableOrders) then\n+ continue;\n+\n+ EmptyFulfillment := false;\n+\n if PrevFulfillmentOrderId <> TempFulfillmentOrderLine.\"Shopify Fulfillment Order Id\" then begin\n if PrevFulfillmentOrderId <> 0 then\n GraphQuery.Append(']},');\n@@ -202,7 +210,8 @@ codeunit 30190 \"Shpfy Export Shipments\"\n until TempFulfillmentOrderLine.Next() = 0;\n GraphQuery.Append(']}]})');\n GraphQuery.Append('{fulfillment { legacyResourceId name createdAt updatedAt deliveredAt displayStatus estimatedDeliveryAt status totalQuantity location { legacyResourceId } trackingInfo { number url company } service { serviceName type } fulfillmentLineItems(first: 10) { pageInfo { endCursor hasNextPage } nodes { id quantity originalTotalSet { presentmentMoney { amount } shopMoney { amount }} lineItem { id isGiftCard }}}}, userErrors {field,message}}}\"}');\n- GraphQueries.Add(GraphQuery.ToText());\n+ if not EmptyFulfillment then\n+ GraphQueries.Add(GraphQuery.ToText());\n end;\n exit(GraphQueries);\n end;\n@@ -225,6 +234,27 @@ codeunit 30190 \"Shpfy Export Shipments\"\n end;\n end;\n \n+ local procedure CanFulfillOrder(FulfillmentOrderLine: Record \"Shpfy FulFillment Order Line\"; Shop: Record \"Shpfy Shop\"; var UnfulfillableOrders: List of [BigInteger]): Boolean\n+ var\n+ ShopLocation: Record \"Shpfy Shop Location\";\n+ SyncLocations: Codeunit \"Shpfy Sync Shop Locations\";\n+ begin\n+ if UnfulfillableOrders.Contains(FulfillmentOrderLine.\"Shopify Fulfillment Order Id\") then\n+ exit(false);\n+\n+ if not ShopLocation.Get(Shop.Code, FulfillmentOrderLine.\"Shopify Location Id\") then\n+ exit(true);\n+\n+ if not ShopLocation.\"Is Fulfillment Service\" then\n+ exit(true);\n+\n+ if ShopLocation.Name = SyncLocations.GetFulfillmentServiceName() then\n+ exit(true);\n+\n+ UnfulfillableOrders.Add(FulfillmentOrderLine.\"Shopify Fulfillment Order Id\");\n+ exit(false);\n+ end;\n+\n local procedure GetNotifyCustomer(Shop: Record \"Shpfy Shop\"; SalesShipmmentHeader: Record \"Sales Shipment Header\"; LocationId: BigInteger): Boolean\n var\n IsHandled: Boolean;\n"}
-{"repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-4822", "base_commit": "f0b7291eb64a17df19a536e44be37380b2e4203d", "created_at": "2025-09-19T13:01:33Z", "environment_setup_version": "27.0", "project_paths": ["src\\Apps\\W1\\Shopify\\App", "src\\Apps\\W1\\Shopify\\Test"], "FAIL_TO_PASS": [{"codeunitID": 139539, "functionName": ["TestCreateCompanyLocationSellToBillTo"]}], "PASS_TO_PASS": [], "metadata": {"area": "shopify"}, "test_patch": "diff --git a/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al\nindex be8c01cb17..d27dba8d65 100644\n--- a/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al\n+++ b/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al\n@@ -23,6 +23,7 @@ codeunit 139539 \"Shpfy Company Locations Test\"\n Customer: Record Customer;\n InitializeTest: Codeunit \"Shpfy Initialize Test\";\n OutboundHttpRequests: Codeunit \"Library - Variable Storage\";\n+ Assert: Codeunit \"Library Assert\";\n IsInitialized: Boolean;\n ResponseResourceUrl: Text;\n UnexpectedAPICallsErr: Label 'More than expected API calls to Shopify detected.';\n@@ -57,6 +58,37 @@ codeunit 139539 \"Shpfy Company Locations Test\"\n ShopifyCompanies.OpenEdit();\n ShopifyCompanies.GoToRecord(ShopifyCompany);\n ShopifyCompanies.Locations.GoToRecord(CompanyLocation);\n+\n+ // Cleanup\n+ CompanyLocation.Delete();\n+ end;\n+\n+ [Test]\n+ [HandlerFunctions('HttpSubmitHandler')]\n+ procedure TestCreateCompanyLocationSellToBillTo()\n+ var\n+ ShopifyCustomer: Record \"Shpfy Customer\";\n+ CompanyAPI: Codeunit \"Shpfy Company API\";\n+ begin\n+ // [GIVEN] A valid customer and company location setup\n+ RegExpectedOutboundHttpRequests();\n+ Initialize();\n+ ShopifyCompany.GetBySystemId(CompanyLocation.\"Company SystemId\");\n+ Customer.\"Bill-to Customer No.\" := 'BILLTO';\n+ Customer.Modify(true);\n+\n+ // [WHEN] CreateCompanyLocation is called\n+ CompanyAPI.SetCompany(ShopifyCompany);\n+ CompanyAPI.SetShop(Shop);\n+ CompanyAPI.CreateCustomerAsCompanyLocation(Customer, ShopifyCompany, ShopifyCustomer);\n+\n+ // [THEN] Company location should be created successfully\n+#pragma warning disable AA0210\n+ CompanyLocation.SetRange(\"Customer Id\", Customer.SystemId);\n+#pragma warning restore AA0210\n+ CompanyLocation.FindFirst();\n+ Assert.AreEqual(Customer.\"No.\", CompanyLocation.\"Sell-to Customer No.\", 'Sell-to Customer No. mismatch');\n+ Assert.AreEqual(Customer.\"Bill-to Customer No.\", CompanyLocation.\"Bill-to Customer No.\", 'Bill-to Customer No. mismatch');\n end;\n \n [Test]\n", "patch": "diff --git a/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al b/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al\nindex 2d2014446c..d09ff272d8 100644\n--- a/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al\n+++ b/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al\n@@ -523,7 +523,7 @@ codeunit 30286 \"Shpfy Company API\"\n JResponse := CommunicationMgt.ExecuteGraphQL(GraphQuery.ToText());\n if JResponse.SelectToken('$.data.companyLocationCreate.companyLocation', JCompanyLocation) then\n if not JsonHelper.IsTokenNull(JCompanyLocation) then begin\n- LocationId := CreateCustomerLocation(JCompanyLocation.AsObject(), ShopifyCompany, Customer.SystemId);\n+ LocationId := CreateCustomerLocation(JCompanyLocation.AsObject(), ShopifyCompany, Customer);\n if JsonHelper.GetJsonArray(JCompanyLocation, JContactRoles, 'company.contactRoles.edges') then begin\n foreach JItem in JContactRoles do\n CompanyContactRoles.Add(JsonHelper.GetValueAsText(JItem, 'node.name'), CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JItem, 'node.id')));\n@@ -540,7 +540,7 @@ codeunit 30286 \"Shpfy Company API\"\n /// \n /// JSON object containing the company location data from Shopify API response.\n /// The parent Shopify company record.\n- /// The GUID of the Business Central customer that was exported.\n+ /// The Business Central customer record used to populate additional fields.\n /// \n /// This procedure:\n /// - Extracts the Shopify-generated ID and creates the initial record\n@@ -552,7 +552,7 @@ codeunit 30286 \"Shpfy Company API\"\n /// The procedure assumes the JSON structure matches Shopify's companyLocationCreate response format.\n /// All text fields are properly truncated to match the field lengths in the table definition.\n /// \n- local procedure CreateCustomerLocation(JCompanyLocation: JsonObject; ShopifyCompany: Record \"Shpfy Company\"; CustomerId: Guid): BigInteger\n+ local procedure CreateCustomerLocation(JCompanyLocation: JsonObject; ShopifyCompany: Record \"Shpfy Company\"; Customer: Record Customer): BigInteger\n var\n CompanyLocation: Record \"Shpfy Company Location\";\n CompanyLocationId: BigInteger;\n@@ -580,7 +580,10 @@ codeunit 30286 \"Shpfy Company API\"\n #pragma warning restore AA0139\n CompanyLocation.Recipient := CopyStr(JsonHelper.GetValueAsText(JCompanyLocation, 'billingAddress.recipient', MaxStrLen(CompanyLocation.Recipient)), 1, MaxStrLen(CompanyLocation.Recipient));\n CompanyLocation.\"Shpfy Payment Terms Id\" := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JCompanyLocation, 'buyerExperienceConfiguration.paymentTermsTemplate.id'));\n- CompanyLocation.\"Customer Id\" := CustomerId;\n+ CompanyLocation.\"Customer Id\" := Customer.SystemId;\n+ CompanyLocation.\"Sell-to Customer No.\" := Customer.\"No.\";\n+ if Customer.\"Bill-to Customer No.\" <> '' then\n+ CompanyLocation.\"Bill-to Customer No.\" := Customer.\"Bill-to Customer No.\";\n CompanyLocation.Modify(true);\n exit(CompanyLocationId);\n end;\n"}
-{"repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-4699", "base_commit": "effc43e8f96bc2b06545bcf81b9579bd08542747", "created_at": "2025-09-05T11:48:36Z", "environment_setup_version": "27.0", "project_paths": ["src\\Apps\\W1\\Shopify\\App", "src\\Apps\\W1\\Shopify\\Test"], "FAIL_TO_PASS": [{"codeunitID": 139567, "functionName": ["UnitTestCreateItemFCYToLCYConversion"]}], "PASS_TO_PASS": [], "metadata": {"area": "shopify"}, "test_patch": "diff --git a/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al\nindex a352529aba..f626c18258 100644\n--- a/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al\n+++ b/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al\n@@ -22,6 +22,7 @@ codeunit 139567 \"Shpfy Create Item Test\"\n \n var\n LibraryAssert: Codeunit \"Library Assert\";\n+ LibraryERM: Codeunit \"Library - ERM\";\n LibraryRandom: Codeunit \"Library - Random\";\n \n [Test]\n@@ -487,4 +488,42 @@ codeunit 139567 \"Shpfy Create Item Test\"\n LibraryAssert.RecordIsNotEmpty(ItemReference);\n until ShopifyVariant.Next() = 0;\n end;\n+\n+ [Test]\n+ procedure UnitTestCreateItemFCYToLCYConversion()\n+ var\n+ Item: Record Item;\n+ Shop: Record \"Shpfy Shop\";\n+ ShopifyVariant: Record \"Shpfy Variant\";\n+ ProductInitTest: Codeunit \"Shpfy Product Init Test\";\n+ InitializeTest: Codeunit \"Shpfy Initialize Test\";\n+ begin\n+ // [SCENARIO] Create a Item from a Shopify Product with the SKU value containing the Item No.\n+\n+ // [GIVEN] The Shop with the setting \"SKU Mapping\" = \"Item No.\";\n+ Shop := InitializeTest.CreateShop();\n+ Shop.\"SKU Mapping\" := \"Shpfy SKU Mapping\"::\"Item No.\";\n+ Shop.\"Currency Code\" := CreateCurrencyAndExchangeRate(2, 2);\n+ Shop.Modify();\n+\n+ // [GIVEN] A Shopify variant record of a standard shopify product. (The variant record always exists, even if the products don't have any variants.)\n+ ShopifyVariant := ProductInitTest.CreateStandardProduct(Shop);\n+ ShopifyVariant.Price := 10;\n+ ShopifyVariant.\"Unit Cost\" := 6;\n+ ShopifyVariant.Modify();\n+ ShopifyVariant.SetRecFilter();\n+\n+ // [WHEN] Executing the report \"Shpfy Create Item\" with the \"Shpfy Variant\" Record.\n+ Codeunit.Run(Codeunit::\"Shpfy Create Item\", ShopifyVariant);\n+\n+ // [THEN] Check Item fields\n+ LibraryAssert.IsTrue(Item.GetBySystemId(ShopifyVariant.\"Item SystemId\"), 'Get Item');\n+ LibraryAssert.AreNearlyEqual(ShopifyVariant.\"Unit Cost\" / 2, Item.\"Unit Cost\", 0.1, 'Unit Cost');\n+ LibraryAssert.AreNearlyEqual(ShopifyVariant.Price / 2, Item.\"Unit Price\", 0.1, 'Unit Price');\n+ end;\n+\n+ local procedure CreateCurrencyAndExchangeRate(ExchangeRateAmount: Decimal; AdjustmentExchangeRateAmount: Decimal): Code[10]\n+ begin\n+ exit(LibraryERM.CreateCurrencyWithExchangeRate(WorkDate() - 1, ExchangeRateAmount, AdjustmentExchangeRateAmount));\n+ end;\n }\n", "patch": "diff --git a/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al b/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al\nindex 4e6ffd2866..717c4f204b 100644\n--- a/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al\n+++ b/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al\n@@ -8,6 +8,7 @@ namespace Microsoft.Integration.Shopify;\n using Microsoft.Inventory.Item;\n using Microsoft.Foundation.UOM;\n using Microsoft.Purchases.Vendor;\n+using Microsoft.Finance.Currency;\n using Microsoft.Inventory.Item.Catalog;\n \n /// \n@@ -230,6 +231,7 @@ codeunit 30171 \"Shpfy Create Item\"\n ItemCategory: Record \"Item Category\";\n ItemVariant: Record \"Item Variant\";\n Vendor: Record Vendor;\n+ CurrencyExchangeRate: Record \"Currency Exchange Rate\";\n CurrentTemplateCode: Code[20];\n ItemNo: Code[20];\n Code: Text;\n@@ -258,10 +260,16 @@ codeunit 30171 \"Shpfy Create Item\"\n CreateItemUnitOfMeasure(ShopifyVariant, Item);\n \n if ShopifyVariant.\"Unit Cost\" <> 0 then\n- Item.Validate(\"Unit Cost\", ShopifyVariant.\"Unit Cost\");\n+ if Shop.\"Currency Code\" = '' then\n+ Item.Validate(\"Unit Cost\", ShopifyVariant.\"Unit Cost\")\n+ else\n+ Item.Validate(\"Unit Cost\", Round(CurrencyExchangeRate.ExchangeAmtFCYToLCY(WorkDate(), Shop.\"Currency Code\", ShopifyVariant.\"Unit Cost\", CurrencyExchangeRate.ExchangeRate(WorkDate(), Shop.\"Currency Code\"))));\n \n if ShopifyVariant.Price <> 0 then\n- Item.Validate(\"Unit Price\", ShopifyVariant.Price);\n+ if Shop.\"Currency Code\" = '' then\n+ Item.Validate(\"Unit Price\", ShopifyVariant.Price)\n+ else\n+ Item.Validate(\"Unit Price\", Round(CurrencyExchangeRate.ExchangeAmtFCYToLCY(WorkDate(), Shop.\"Currency Code\", ShopifyVariant.Price, CurrencyExchangeRate.ExchangeRate(WorkDate(), Shop.\"Currency Code\"))));\n \n if ShopifyProduct.\"Product Type\" <> '' then begin\n ItemCategory.SetFilter(Description, FilterMgt.CleanFilterValue(ShopifyProduct.\"Product Type\", MaxStrLen(ItemCategory.Description)));\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223790", "base_commit": "e33326f4a8f7341c0857ef5a7013a3fe593d8146", "created_at": "2025-08-13", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137035, "functionName": ["CheckPlanningWorksheetPlanComponentwhenStockkeepingUnitsSetup"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al\nindex cd0d28c59b88..9867c364a8cb 100644\n--- a/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137035 \"SCM PS Bugs-I\"\n QuantityErr: Label 'Quantity update should be possible in %1.', Comment = '%1= Table Name.';\n DueDateErr: Label 'Planned production order due date not match with planning worksheet due date';\n SKUInventoryErr: Label 'Expected inventory to be blank for non-inventory item';\n+ MainItemErr: Label 'New planning worksheet line not created for main item';\n+ CompoItemErr: Label 'New planning worksheet line not created for component item';\n \n [Test]\n [Scope('OnPrem')]\n@@ -1320,6 +1322,97 @@ codeunit 137035 \"SCM PS Bugs-I\"\n LibraryVariableStorage.AssertEmpty();\n end;\n \n+ [Test]\n+ [HandlerFunctions('SKURequestPageHandler')]\n+ procedure CheckPlanningWorksheetPlanComponentwhenStockkeepingUnitsSetup()\n+ var\n+ CompItem: Record Item;\n+ InventorySetup: Record \"Inventory Setup\";\n+ Location: Record Location;\n+ MainItem: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ Requisitionline: Record \"Requisition Line\";\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ Itemcard: TestPage \"Item Card\";\n+ SKUCardPage: TestPage \"Stockkeeping Unit Card\";\n+ ActualCount: Integer;\n+ begin\n+ // [SCENARIO 579977] Check Planning Worksheet Plan Component when Stockkeeping Units Setup for Items.\n+ Initialize();\n+\n+ // [GIVEN] Set Manufacturing Setup for Dynamic Low-Level Code and Inventory Setup for ombined MPS/MRP Calculation.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Dynamic Low-Level Code\", true);\n+ ManufacturingSetup.Modify(true);\n+ InventorySetup.Get();\n+ InventorySetup.Validate(\"Combined MPS/MRP Calculation\", true);\n+ InventorySetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Replenishment System as Production Order.\n+ LibraryInventory.CreateItem(CompItem);\n+\n+ // [GIVEN] Create Location.\n+ LibraryWarehouse.CreateLocation(Location);\n+\n+ // [GIVEN] Create Stockkeeping Unit for Item and Location.\n+ Commit();\n+ LibraryVariableStorage.Enqueue(Location.Code);\n+ ItemCard.OpenView();\n+ ItemCard.GotoRecord(CompItem);\n+ ItemCard.\"&Create Stockkeeping Unit\".Invoke();\n+ ItemCard.OK().Invoke();\n+\n+ // [GIVEN] Modify Stockkeeping Unit for Item.\n+ SKUCardPage.OpenView();\n+ SKUCardPage.Filter.SetFilter(\"Item No.\", CompItem.\"No.\");\n+ SKUCardPage.Filter.SetFilter(\"Location Code\", Location.\"Code\");\n+ SKUCardPage.\"Replenishment System\".SetValue(\"Replenishment System\"::Purchase);\n+ SKUCardPage.\"Reordering Policy\".SetValue(\"Reordering Policy\"::\"Order\");\n+ SKUCardPage.Close();\n+\n+ // [GIVEN] Create BOM for the item.\n+ LibraryManufacturing.CreateCertifiedProductionBOM(ProductionBOMHeader, CompItem.\"No.\", 1);\n+\n+ // [GIVEN] Create Main Item with Replenishment System as Production Order.\n+ LibraryInventory.CreateItem(MainItem);\n+\n+ // [GIVEN] Create Stockkeeping Unit for Main Item and Location.\n+ Commit();\n+ LibraryVariableStorage.Enqueue(Location.Code);\n+ ItemCard.OpenView();\n+ ItemCard.GotoRecord(MainItem);\n+ ItemCard.\"&Create Stockkeeping Unit\".Invoke();\n+ ItemCard.OK().Invoke();\n+\n+ // [GIVEN] Modify Stockkeeping Unit Created for Main Item.\n+ SKUCardPage.OpenView();\n+ SKUCardPage.Filter.SetFilter(\"Item No.\", MainItem.\"No.\");\n+ SKUCardPage.Filter.SetFilter(\"Location Code\", Location.\"Code\");\n+ SKUCardPage.\"Replenishment System\".SetValue(\"Replenishment System\"::\"Prod. Order\");\n+ SKUCardPage.\"Reordering Policy\".SetValue(\"Reordering Policy\"::\"Lot-for-Lot\");\n+ SKUCardPage.\"Manufacturing Policy\".SetValue(\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ SKUCardPage.\"Production BOM No.\".SetValue(ProductionBOMHeader.\"No.\");\n+ SKUCardPage.Close();\n+\n+ // [WHEN] Create Sales order for Item and Location.\n+ Librarysales.CreateSalesDocumentWithItem(\n+ SalesHeader, SalesLine, SalesHeader.\"Document Type\"::Order, '', MainItem.\"No.\", 10, Location.\"Code\", WorkDate());\n+\n+ // [WHEN] Calculate regenerative plan in planning worksheet update Planning Worksheet.\n+ CalculateRegenerativePlanningWorksheet(CompItem, MainItem, WorkDate(), CalcDate('<1Y>', WorkDate()), true, false);\n+\n+ // [THEN] Verify Actual Count Match with Expected Result for Main Item Planning Worksheet Line.\n+ CountPlanningWorksheetLine(Requisitionline, ActualCount, MainItem.\"No.\", Location.\"Code\");\n+ Assert.AreEqual(1, ActualCount, MainItemErr);\n+\n+ // [THEN] Verify Actual Count Match with Expected Result for Component Item Planning Worksheet Line.\n+ CountPlanningWorksheetLine(Requisitionline, ActualCount, CompItem.\"No.\", Location.\"Code\");\n+ Assert.AreEqual(1, ActualCount, CompoItemErr);\n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -2143,6 +2236,32 @@ codeunit 137035 \"SCM PS Bugs-I\"\n Assert.AreEqual(DueDate, ProductionOrder.\"Due Date\", DueDateErr);\n end;\n \n+ local procedure CountPlanningWorksheetLine(Requisitionline: Record \"Requisition Line\"; var ActualCount: Integer; ItemNo: Code[20]; LocationCode: Code[10])\n+ begin\n+ Clear(ActualCount);\n+ Requisitionline.Reset();\n+ Requisitionline.SetRange(\"No.\", ItemNo);\n+ Requisitionline.SetRange(\"Location Code\", LocationCode);\n+ if Requisitionline.FindSet() then\n+ ActualCount := Requisitionline.Count;\n+ end;\n+\n+ local procedure CalculateRegenerativePlanningWorksheet(var CompItemRec: Record Item; var MainItemRec: Record Item; OrderDate: Date; ToDate: Date; RespectPlanningParameters: Boolean; Regenerative: Boolean)\n+ var\n+ TmpItemRec: Record Item;\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ CalculatePlanPlanWksh: Report \"Calculate Plan - Plan. Wksh.\";\n+ begin\n+ LibraryPlanning.SelectRequisitionWkshName(RequisitionWkshName, RequisitionWkshName.\"Template Type\"::Planning); // Find Requisition Worksheet Name to Calculate Plan.\n+ Commit();\n+ CalculatePlanPlanWksh.InitializeRequest(OrderDate, ToDate, RespectPlanningParameters, true, true, '', 0D, false);\n+ CalculatePlanPlanWksh.SetTemplAndWorksheet(RequisitionWkshName.\"Worksheet Template Name\", RequisitionWkshName.Name, Regenerative);\n+ TmpItemRec.SetFilter(\"No.\", '%1..%2', CompItemRec.\"No.\", MainItemRec.\"No.\");\n+ CalculatePlanPlanWksh.SetTableView(TmpItemRec);\n+ CalculatePlanPlanWksh.UseRequestPage(false);\n+ CalculatePlanPlanWksh.RunModal();\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandler(Question: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al\nindex e6df0fd1150e..bd56f5d829d5 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al\n@@ -8,6 +8,7 @@ using Microsoft.Inventory.Item;\n using Microsoft.Manufacturing.Document;\n using Microsoft.Manufacturing.ProductionBOM;\n using Microsoft.Manufacturing.Routing;\n+using Microsoft.Manufacturing.Setup;\n \n tableextension 99000759 \"Mfg. Stockkeeping Unit\" extends \"Stockkeeping Unit\"\n {\n@@ -62,6 +63,27 @@ tableextension 99000759 \"Mfg. Stockkeeping Unit\" extends \"Stockkeeping Unit\"\n Caption = 'Production BOM No.';\n DataClassification = CustomerContent;\n TableRelation = \"Production BOM Header\";\n+ trigger OnValidate()\n+ var\n+ Item: Record Item;\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ MfgSetup: Record \"Manufacturing Setup\";\n+ ProdBOMHeader: Record \"Production BOM Header\";\n+ CalculateLowLevelCode: Codeunit \"Calculate Low-Level Code\";\n+ begin\n+ if (\"Production BOM No.\" <> '') and (\"Production BOM No.\" <> xRec.\"Production BOM No.\") then begin\n+ ProdBOMHeader.Get(\"Production BOM No.\");\n+ ItemUnitOfMeasure.Get(\"Item No.\", ProdBOMHeader.\"Unit of Measure Code\");\n+ if ProdBOMHeader.Status = ProdBOMHeader.Status::Certified then begin\n+ MfgSetup.Get();\n+ Item.Get(\"Item No.\");\n+ if MfgSetup.\"Dynamic Low-Level Code\" then begin\n+ Item.\"Low-Level Code\" := CalculateLowLevelCode.CalcLevels(1, Item.\"No.\", 0, 0);\n+ CalculateLowLevelCode.SetRecursiveLevelsOnBOM(ProdBOMHeader, Item.\"Low-Level Code\" + 1, false);\n+ end;\n+ end;\n+ end;\n+ end;\n }\n field(99000765; \"Planned Order Receipt (Qty.)\"; Decimal)\n {\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223819", "base_commit": "61943a7dd68306f6b3913043e73e4654232a9476", "created_at": "2025-08-14", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Dimension"], "FAIL_TO_PASS": [{"codeunitID": 134474, "functionName": ["OverrideDimWithNewLocationsAndSalespersonOnItemJournalLine"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al b/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al\nindex 8e58207a24d3..3a47bcf8819f 100644\n--- a/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al\n+++ b/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al\n@@ -1232,6 +1232,64 @@ codeunit 134474 \"ERM Dimension Locations\"\n Assert.AreNotEqual(TransferHeader.\"Shortcut Dimension 2 Code\", TransferLine.\"Shortcut Dimension 2 Code\", DimensionsNotEqualErr);\n end;\n \n+ [Test]\n+ procedure OverrideDimWithNewLocationsAndSalespersonOnItemJournalLine()\n+ var\n+ DimensionValue: array[2] of Record \"Dimension Value\";\n+ Item: Record Item;\n+ LocationFrom: Record Location;\n+ LocationTo: Record Location;\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ SalespersonPurchaser: Record \"Salesperson/Purchaser\";\n+ begin\n+ // [SCENARIO 596687] In the Item Reclassification Journal is the Dimension value wrongly updated by adding a Sales Person to the line\n+ Initialize();\n+\n+ // [GIVEN] Global dimension 1 values \"V1\" and \"V2\".\n+ LibraryDimension.CreateDimensionValue(DimensionValue[1], LibraryERM.GetGlobalDimensionCode(1));\n+ LibraryDimension.CreateDimensionValue(DimensionValue[2], LibraryERM.GetGlobalDimensionCode(1));\n+\n+ // [GIVEN] Assign value \"V1\" to location \"BLUE\".\n+ // [GIVEN] Assign value \"V2\" to location \"RED\".\n+ LibraryInventory.CreateItem(Item);\n+ CreateLocationWithDefaultDimension(LocationFrom, DimensionValue[1]);\n+ CreateLocationWithDefaultDimension(LocationTo, DimensionValue[2]);\n+\n+ // [GIVEN] Create item reclassification journal line.\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, ItemJournalTemplate.Type::Transfer);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, ItemJournalTemplate.Type, ItemJournalTemplate.Name);\n+ LibraryInventory.CreateItemJnlLineWithNoItem(\n+ ItemJournalLine, ItemJournalBatch, ItemJournalTemplate.Name, ItemJournalBatch.Name, \"Item Ledger Entry Type\"::Transfer);\n+ ItemJournalline.Validate(\"Item No.\", Item.\"No.\");\n+\n+ // [GIVEN] Set \"Location Code\" = \"BLUE\" on the item journal line.\n+ // [GIVEN] Verify that \"Shortcut Dimension 1 Code\" = \"V1\".\n+ // [GIVEN] Verify that \"Dimension Set ID\" includes value \"V1\".\n+ ItemJournalLine.Validate(\"Location Code\", LocationFrom.Code);\n+ ItemJournalLine.TestField(\"Shortcut Dimension 1 Code\", DimensionValue[1].Code);\n+ VerifyDimensionValue(ItemJournalLine.\"Dimension Set ID\", DimensionValue[1]);\n+\n+ // [WHEN] Set \"New Location Code\" = \"RED\".\n+ ItemJournalLine.Validate(\"New Location Code\", LocationTo.Code);\n+\n+ // [WHEN] Set \"Sales Person Purchaser\" = \"RED\".\n+ LibrarySales.CreateSalesperson(SalespersonPurchaser);\n+ CreateDefaultDimensionWithSpecCode(SalespersonPurchaser.Code, DATABASE::\"Salesperson/Purchaser\");\n+ ItemJournalLine.Validate(\"Salespers./Purch. Code\", SalespersonPurchaser.Code);\n+\n+ // [THEN] \"New Shortcut Dimension 1 Code\" = \"V2\".\n+ // [THEN] \"New Dimension Set ID\" includes value \"V2\".\n+ ItemJournalLine.TestField(\"New Shortcut Dimension 1 Code\", DimensionValue[2].Code);\n+ VerifyDimensionValue(ItemJournalLine.\"New Dimension Set ID\", DimensionValue[2]);\n+\n+ // [THEN] \"Shortcut Dimension 1 Code\" remains \"V1\".\n+ // [THEN] \"Dimension Set ID\" is not changed.\n+ ItemJournalLine.TestField(\"Shortcut Dimension 1 Code\", DimensionValue[1].Code);\n+ VerifyDimensionValue(ItemJournalLine.\"Dimension Set ID\", DimensionValue[1]);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"ERM Dimension Locations\");\n@@ -1340,6 +1398,25 @@ codeunit 134474 \"ERM Dimension Locations\"\n DefaultDimensionPriority.Modify(true);\n end;\n \n+ local procedure CreateDefaultDimensionWithSpecCode(AccountNo: Code[20]; TableID: Integer)\n+ var\n+ Dimension: Record Dimension;\n+ DimensionValue: Record \"Dimension Value\";\n+ DefaultDimension: Record \"Default Dimension\";\n+ begin\n+ LibraryDimension.CreateDimension(Dimension);\n+ CreateDimensionValueWithSpecCode(DimensionValue, AccountNo, Dimension.Code);\n+ LibraryDimension.CreateDefaultDimension(DefaultDimension, TableID, AccountNo, Dimension.Code, DimensionValue.Code);\n+ end;\n+\n+ local procedure CreateDimensionValueWithSpecCode(var DimensionValue: Record \"Dimension Value\"; DimensionValueCode: Code[20]; DimensionCode: Code[20])\n+ begin\n+ DimensionValue.Init();\n+ DimensionValue.Validate(\"Dimension Code\", DimensionCode);\n+ DimensionValue.Validate(Code, DimensionValueCode);\n+ DimensionValue.Insert(true);\n+ end;\n+\n [ModalPageHandler]\n procedure DefaultDimensionsMultipleModalPageHandler(var DefaultDimensionsMultiple: TestPage \"Default Dimensions-Multiple\")\n begin\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\nindex 7fc2d9853602..c0a52d871c5d 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n@@ -2375,11 +2375,14 @@ table 83 \"Item Journal Line\"\n OnCreateDimOnBeforeUpdateGlobalDimFromDimSetID(Rec, xRec, CurrFieldNo, OldDimSetID, DefaultDimSource, InheritFromDimSetID, InheritFromTableNo);\n DimMgt.UpdateGlobalDimFromDimSetID(\"Dimension Set ID\", \"Shortcut Dimension 1 Code\", \"Shortcut Dimension 2 Code\");\n \n- if \"Entry Type\" = \"Entry Type\"::Transfer then begin\n- \"New Dimension Set ID\" := \"Dimension Set ID\";\n- \"New Shortcut Dimension 1 Code\" := \"Shortcut Dimension 1 Code\";\n- \"New Shortcut Dimension 2 Code\" := \"Shortcut Dimension 2 Code\";\n- end;\n+ if \"Entry Type\" = \"Entry Type\"::Transfer then\n+ if Rec.\"New Location Code\" <> '' then\n+ CreateNewDimFromDefaultDim(Rec.FieldNo(\"New Location Code\"))\n+ else begin\n+ \"New Dimension Set ID\" := \"Dimension Set ID\";\n+ \"New Shortcut Dimension 1 Code\" := \"Shortcut Dimension 1 Code\";\n+ \"New Shortcut Dimension 2 Code\" := \"Shortcut Dimension 2 Code\";\n+ end;\n end;\n \n /// \n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-222092", "base_commit": "d4b9caabb22e77ab18779535aa89967bb58f89d9", "created_at": "2025-07-27", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134904, "functionName": ["DimensionsInGeneralLedgerEntriesWhenDimensionsModifiedInReminderBeforeIssuing"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al\nindex 47f98eaf54a8..99b8ac6fb838 100644\n--- a/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al\n@@ -324,6 +324,86 @@ codeunit 134904 \"ERM Reminder For Additinal Fee\"\n Assert.AreEqual(Dim2CodeValue, ShortcutDimCode[2], StrSubstNo(DimensionValueErr, Dim2CodeValue));\n end;\n \n+ [Test]\n+ procedure DimensionsInGeneralLedgerEntriesWhenDimensionsModifiedInReminderBeforeIssuing();\n+ var\n+ Customer: Record Customer;\n+ CustomerPostingGroup: Record \"Customer Posting Group\";\n+ DefaultDimension: array[2] of Record \"Default Dimension\";\n+ DimensionValue: Record \"Dimension Value\";\n+ GLAccount: Record \"G/L Account\";\n+ GLEntry: Record \"G/L Entry\";\n+ ReminderHeader: Record \"Reminder Header\";\n+ ReminderLevel: Record \"Reminder Level\";\n+ ReminderTerms: Record \"Reminder Terms\";\n+ SalesHeader: Record \"Sales Header\";\n+ GetShortcutDimValues: Codeunit \"Get Shortcut Dimension Values\";\n+ Dim1CodeValue: array[2] of Code[20];\n+ Dim2CodeValue: Code[20];\n+ IssuedReminderNo: Code[20];\n+ ShortcutDimCode: array[8] of Code[20];\n+ begin\n+ // [SCENARIO 590674] Dimensions assigned to General Ledger Entries when the Dimensions are modified in the Reminder before issuing it.\n+ Initialize();\n+\n+ // [GIVEN] Create two Dimension Values for Global Dimension 1 Code.\n+ Dim1CodeValue[1] := LibraryUtility.GenerateGUID();\n+ Dim1CodeValue[2] := Dim1CodeValue[1] + '1';\n+ LibraryDimension.CreateDimensionValueWithCode(DimensionValue, Dim1CodeValue[1], LibraryERM.GetGlobalDimensionCode(1));\n+ LibraryDimension.CreateDimensionValueWithCode(DimensionValue, Dim1CodeValue[2], LibraryERM.GetGlobalDimensionCode(1));\n+\n+ // [GIVEN] Create Dimension Value for Global Dimension 2 Code and assign it.\n+ Dim2CodeValue := LibraryUtility.GenerateGUID();\n+ LibraryDimension.CreateDimensionValueWithCode(DimensionValue, Dim2CodeValue, LibraryERM.GetGlobalDimensionCode(2));\n+\n+ // [GIVEN] Create Reminder Terms with Post Additional Fee = True.\n+ CreateReminderTerms(ReminderLevel, '');\n+ ReminderTerms.Get(ReminderLevel.\"Reminder Terms Code\");\n+ ReminderTerms.\"Post Additional Fee\" := true;\n+ ReminderTerms.Modify(true);\n+\n+ // [GIVEN] Create Customer with Reminder Terms and Customer Posting Group.\n+ Customer.Get(CreateCustomer(ReminderLevel.\"Reminder Terms Code\", ''));\n+ LibrarySales.CreateCustomerPostingGroup(CustomerPostingGroup);\n+\n+ // [GIVEN] Create Default Dimension for Customer with global Dimension 1 Code.\n+ LibraryDimension.CreateDefaultDimensionWithNewDimValue(\n+ DefaultDimension[1], DATABASE::Customer, Customer.\"No.\",\n+ DefaultDimension[1].\"Value Posting\"::\"Code Mandatory\");\n+\n+ // [GIVEN] Find GL Account for Additional Fee Account and assign Global Dimension 1 Code and Global Dimension 2 Code.\n+ GLAccount.Get(CustomerPostingGroup.\"Additional Fee Account\");\n+ GLAccount.ValidateShortcutDimCode(1, Dim1CodeValue[1]);\n+ GLAccount.ValidateShortcutDimCode(2, Dim2CodeValue);\n+ GLAccount.Modify(true);\n+\n+ // [GIVEN] Validate Customer Posting Group in Customer.\n+ Customer.Validate(\"Customer Posting Group\", CustomerPostingGroup.Code);\n+ Customer.Modify(true);\n+\n+ // [GIVEN] Posted Sales Invoice and Run Suggested Reminder with Additional Fee line.\n+ CreateAndPostSalesInvoice(SalesHeader, Customer.\"No.\");\n+ ReminderHeader.Get(\n+ CreateAndSuggestReminder(\n+ SalesHeader.\"Sell-to Customer No.\",\n+ CalcDate('<1D>', CalcDate(ReminderLevel.\"Grace Period\", SalesHeader.\"Due Date\"))));\n+ ReminderHeader.Validate(\"Shortcut Dimension 1 Code\", Dim1CodeValue[2]);\n+ ReminderHeader.Modify(true);\n+\n+ // [WHEN] Reminder is issued\n+ IssuedReminderNo := IssueReminderAndGetIssuedNo(ReminderHeader.\"No.\");\n+\n+ // [THEN] Find G/L Entry for Reminder with GL Account.\n+ GLEntry.SetRange(\"Document Type\", GLEntry.\"Document Type\"::Reminder);\n+ GLEntry.SetRange(\"Document No.\", IssuedReminderNo);\n+ GLEntry.SetRange(\"G/L Account No.\", GLAccount.\"No.\");\n+ GLEntry.FindFirst();\n+\n+ // [THEN] G/L Entry contains Global Dimension 1 Code as updated in Reminder Header.\n+ GetShortcutDimValues.GetShortcutDimensions(GLEntry.\"Dimension Set ID\", ShortcutDimCode);\n+ Assert.AreEqual(Dim1CodeValue[2], ShortcutDimCode[1], StrSubstNo(DimensionValueErr, Dim1CodeValue[2]));\n+ end;\n+\n [Scope('OnPrem')]\n procedure InterestAmountWithBeginningText()\n var\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\nindex 825eb23c9503..9ff59101df20 100644\n--- a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n@@ -270,8 +270,8 @@ codeunit 393 \"Reminder-Issue\"\n begin\n GenJnlLine2.\"Shortcut Dimension 1 Code\" := GlobalReminderHeader.\"Shortcut Dimension 1 Code\";\n GenJnlLine2.\"Shortcut Dimension 2 Code\" := GlobalReminderHeader.\"Shortcut Dimension 2 Code\";\n- DimSetIDArr[1] := GlobalReminderHeader.\"Dimension Set ID\";\n- DimSetIDArr[2] := TempGenJnlLine.\"Dimension Set ID\";\n+ DimSetIDArr[1] := TempGenJnlLine.\"Dimension Set ID\";\n+ DimSetIDArr[2] := GlobalReminderHeader.\"Dimension Set ID\";\n GenJnlLine2.\"Dimension Set ID\" :=\n DimMgt.GetCombinedDimensionSetID(\n DimSetIDArr, GenJnlLine2.\"Shortcut Dimension 1 Code\", GenJnlLine2.\"Shortcut Dimension 2 Code\");\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218062", "base_commit": "226d490962047079ac9870319a3690af8959e6ad", "created_at": "2025-06-15", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137294, "functionName": ["NoErrorOfAvailabilityWhenCreatePickFromPickWorkSheetForProductionOrder"]}], "PASS_TO_PASS": [], "metadata": {"area": "warehouse"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al\nindex eaf731a270b2..178112c70e63 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al\n@@ -49,6 +49,7 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n NoOfPicksCreatedMsg: Label 'Number of Invt. Pick activities created';\n WhseHandlingRequiredErr: Label 'Warehouse handling is required';\n InventoryMovementIsNotRegisteredErr: Label 'Inventory Movement is not registered.';\n+ InventoryPickNotFoundErr: Label 'Warehouse Activity Header not found for Production Order Components.';\n \n [Test]\n [Scope('OnPrem')]\n@@ -2132,6 +2133,88 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n Assert.IsTrue(RegisteredInvMovementHdr.Count > 0, InventoryMovementIsNotRegisteredErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('DummyMessageHandler,ReservationPageHandler,PickSelectionPageHandlerSingleDoc,CreatePickPageHandlerForPerWhsDoc')]\n+ [Scope('OnPrem')]\n+ procedure NoErrorOfAvailabilityWhenCreatePickFromPickWorkSheetForProductionOrder()\n+ var\n+ Bin, Bin2, Bin3 : Record Bin;\n+ CompItem, ProdItem : Record Item;\n+ Location: Record Location;\n+ ProductionOrder: array[2] of Record \"Production Order\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ WareHouseActivityHeader: Record \"Warehouse Activity Header\";\n+ begin\n+ // [SCENARIO 575862] No availability error when creating pick from pick worksheet with location setup Bin mandatory and the item reserved on the related production order\n+ Initialize();\n+\n+ // [GIVEN] Reset Warehouse Employee Default Location.\n+ ResetWarehouseEmployeeDefaultLocation();\n+\n+ // [GIVEN] Create Location with WMS enabled Bin mandatory\n+ LibraryWarehouse.CreateLocationWMS(Location, true, false, false, false, false);\n+\n+ // [GIVEN] Create Warehouse Employee for Location.\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, Location.Code, true);\n+\n+ // [GIVEN] Create Bins for Location.\n+ LibraryWarehouse.CreateBin(Bin, Location.Code, Bin.Code, '', '');\n+ LibraryWarehouse.CreateBin(Bin2, Location.Code, Bin2.Code, '', '');\n+ LibraryWarehouse.CreateBin(Bin3, Location.Code, Bin3.Code, '', '');\n+\n+ // [GIVEN] Set \"Prod. Consump. Whse. Handling\" = \"Warehouse Pick (mandatory)\" and assign Bins to \"To-Production Bin Code\" and \"From-Production Bin Code\".\n+ Location.Validate(\"Prod. Consump. Whse. Handling\", Location.\"Prod. Consump. Whse. Handling\"::\"Warehouse Pick (mandatory)\");\n+ Location.Validate(\"To-Production Bin Code\", Bin.Code);\n+ Location.Validate(\"From-Production Bin Code\", Bin2.Code);\n+ Location.Modify(true);\n+\n+ // [GIVEN] Create Component Item with \"Replenishment System\" = \"Purchase\" and \"Flushing Method\" = \"Manual\".\n+ LibraryInventory.CreateItem(CompItem);\n+ CompItem.Validate(\"Replenishment System\", CompItem.\"Replenishment System\"::Purchase);\n+ CompItem.Validate(\"Flushing Method\", CompItem.\"Flushing Method\"::Manual);\n+ CompItem.Modify();\n+\n+ // [GIVEN] Create Production BOM for Component Item.\n+ LibraryInventory.CreateItem(ProdItem);\n+ ProdItem.Validate(\"Replenishment System\", ProdItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProdItem.Validate(\"Manufacturing Policy\", ProdItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ ProdItem.Validate(\"Flushing Method\", ProdItem.\"Flushing Method\"::Manual);\n+ ProdItem.Validate(\"Production BOM No.\", LibraryManufacturing.CreateCertifiedProductionBOM(ProductionBOMHeader, CompItem.\"No.\", 1));\n+ ProdItem.Modify();\n+\n+ // [GIVEN] Create Inventory for Component Item.\n+ CreateInventory(CompItem, 3, Location.Code, Bin3.Code, 0);\n+\n+ // [GIVEN] Create first Production Orders for Production Item of quantity 2\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder[1], ProductionOrder[1].Status::Released, ProductionOrder[1].\"Source Type\"::Item, ProdItem.\"No.\", 2);\n+ ProductionOrder[1].Validate(\"Location Code\", Location.Code);\n+ ProductionOrder[1].Modify(true);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder[1], false, true, true, true, false);\n+\n+ // [GIVEN] Reserve Component Item on Production Order 1\n+ ReserveQuantityOnComponent(CompItem.\"No.\", ProductionOrder[1].\"No.\");\n+\n+ // [GIVEN] Create second Production Order for Production Item of quantity 1\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder[2], ProductionOrder[2].Status::Released, ProductionOrder[2].\"Source Type\"::Item, ProdItem.\"No.\", 1);\n+ ProductionOrder[2].Validate(\"Location Code\", Location.Code);\n+ ProductionOrder[2].Modify(true);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder[2], false, true, true, true, false);\n+\n+ // [GIVEN] Reserve Component Item on Production Order 2\n+ ReserveQuantityOnComponent(CompItem.\"No.\", ProductionOrder[2].\"No.\");\n+\n+ // [WHEN] Create Pick Worksheet for Production Order Components.\n+ GetWarehouseDocumentFromPickWorksheet(ProductionOrder);\n+\n+ // [THEN] Verify Warehouse Activity Header for Production Order Components.\n+ WarehouseActivityHeader.SetRange(\"Location Code\", Location.Code);\n+ WareHouseActivityHeader.FindSet();\n+ Assert.IsTrue(WareHouseActivityHeader.Count = 2, InventoryPickNotFoundErr);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3796,6 +3879,50 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n VerifyInventoryPickLine(SalesOrderNo, LotNos[2], Lot2Qty);\n end;\n \n+ local procedure GetWarehouseDocumentFromPickWorksheet(ProductionOrder: array[2] of Record \"Production Order\")\n+ var\n+ PickWorksheet: TestPage \"Pick Worksheet\";\n+ begin\n+ LibraryVariableStorage.Enqueue(ProductionOrder[1].\"No.\"); // Enqueue for PickSelectionPageHandler.\n+ LibraryVariableStorage.Enqueue(ProductionOrder[1].\"Location Code\"); // Enqueue PickSelectionPageHandler.\n+ PickWorksheet.OpenEdit();\n+ PickWorksheet.\"Get Warehouse Documents\".Invoke();\n+\n+ LibraryVariableStorage.Enqueue(ProductionOrder[2].\"No.\"); // Enqueue for PickSelectionPageHandler.\n+ LibraryVariableStorage.Enqueue(ProductionOrder[2].\"Location Code\"); // Enqueue PickSelectionPageHandler.\n+ PickWorksheet.\"Get Warehouse Documents\".Invoke();\n+ Commit();\n+\n+ PickWorksheet.CreatePick.Invoke();\n+ PickWorksheet.OK().Invoke();\n+ end;\n+\n+ local procedure ReserveQuantityOnComponent(ItemNo: code[20]; ProdOrderno: Code[20])\n+ var\n+ ProdOrderComponents: TestPage \"Prod. Order Components\";\n+ begin\n+ ProdOrderComponents.OpenEdit();\n+ ProdOrderComponents.FILTER.SetFilter(\"Item No.\", ItemNo);\n+ ProdOrderComponents.FILTER.SetFilter(\"Prod. Order No.\", ProdOrderno);\n+ ProdOrderComponents.Reserve.Invoke();\n+ ProdOrderComponents.Close();\n+ end;\n+\n+ local procedure CreateInventory(Item: Record Item; Quantity: Decimal; LocationCode: Code[10]; BinCode: Code[20]; UnitAmount: Decimal)\n+ var\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.CreateItemJournalBatchByType(ItemJournalBatch, ItemJournalBatch.\"Template Type\"::Item);\n+\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJournalBatch, Item, LocationCode, '', WorkDate(),\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Quantity, UnitAmount);\n+ ItemJournalLine.Validate(\"Bin Code\", BinCode);\n+ ItemJournalLine.Modify();\n+\n+ LibraryInventory.PostItemJournalBatch(ItemJournalBatch);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure DummyMessageHandler(Message: Text[1024])\n@@ -3817,5 +3944,36 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ReservationPageHandler(var Reservation: TestPage Reservation)\n+ begin\n+ Reservation.\"Reserve from Current Line\".Invoke();\n+ Reservation.OK().Invoke();\n+ end;\n+\n+ [RequestPageHandler]\n+ [Scope('OnPrem')]\n+ procedure CreatePickPageHandlerForPerWhsDoc(var CreatePick: TestRequestPage \"Create Pick\")\n+ begin\n+ CreatePick.PerWhseDoc.SetValue(true);\n+ CreatePick.OK().Invoke();\n+ end;\n+\n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure PickSelectionPageHandlerSingleDoc(var PickSelection: TestPage \"Pick Selection\")\n+ var\n+ DocumentNo: Variant;\n+ LocationCode: Variant;\n+ begin\n+ LibraryVariableStorage.Dequeue(DocumentNo); // Dequeue Variable.\n+ LibraryVariableStorage.Dequeue(LocationCode); // Dequeue Variable.\n+ PickSelection.Filter.SetFilter(\"Document No.\", DocumentNo);\n+ PickSelection.\"Document No.\".AssertEquals(DocumentNo);\n+ PickSelection.\"Location Code\".AssertEquals(LocationCode);\n+ PickSelection.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al b/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al\nindex 0b63877adb3b..32239d687e93 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al\n@@ -870,7 +870,9 @@ codeunit 7314 \"Warehouse Availability Mgt.\"\n end else\n AvailQtyBase := CalcInvtAvailQty(Item, Location, WhseWorksheetLine.\"Variant Code\", TempWhseActivLine);\n \n- if Location.\"Require Pick\" then\n+ if Location.\"Require Pick\" or\n+ (Location.\"Prod. Consump. Whse. Handling\" = Location.\"Prod. Consump. Whse. Handling\"::\"Warehouse Pick (mandatory)\")\n+ then\n QtyReservedOnPickShip := CalcReservQtyOnPicksShips(WhseWorksheetLine.\"Location Code\", WhseWorksheetLine.\"Item No.\", WhseWorksheetLine.\"Variant Code\", TempWhseActivLine);\n \n QtyReservedForCurrLine :=\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218253", "base_commit": "db3b5298f26de0882a366877931e512984bb1001", "created_at": "2025-06-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134389, "functionName": ["QuantityReducedInSalesInvoiceAfterGenShipmentLineReservesTrackingInformation"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\nindex a4fa97f4520d..bc57ae20d22e 100644\n--- a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n@@ -17,6 +17,7 @@ codeunit 134389 \"ERM Customer Statistics\"\n LibraryERM: Codeunit \"Library - ERM\";\n LibraryRandom: Codeunit \"Library - Random\";\n LibraryApplicationArea: Codeunit \"Library - Application Area\";\n+ LibraryVariableStorage: Codeunit \"Library - Variable Storage\";\n LibraryUtility: Codeunit \"Library - Utility\";\n IsInitialized: Boolean;\n OverDueBalanceErr: Label 'Customer OverDue Balance is not correct';\n@@ -29,6 +30,7 @@ codeunit 134389 \"ERM Customer Statistics\"\n EntryNoMustMatchErr: Label 'Entry No. must match.';\n PaymentsLCYAndAmountLCYMustMatchErr: Label 'Payemnts (LCY) and Amount (LCY) must match.';\n CustomerCardFactboxTotalErr: Label 'Customer card factbox total is not Correct';\n+ LotNoErr: Label 'Lot No. should have value.';\n \n [Test]\n [Scope('OnPrem')]\n@@ -1003,6 +1005,83 @@ codeunit 134389 \"ERM Customer Statistics\"\n Assert.AreEqual(SalesLine.\"Amount Including VAT\", Customer.GetTotalAmountLCY(), CustomerCardFactboxTotalErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemTrackingLinesPageHandler,EnterQuantityToCreatePageHandler,GetShipmentLinesPageHandler')]\n+ procedure QuantityReducedInSalesInvoiceAfterGenShipmentLineReservesTrackingInformation()\n+ var\n+ Customer: Record Customer;\n+ Item: Record Item;\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ Quantity: Integer;\n+ begin\n+ // [SCENARIO 576049] When the quantity in a Sales Invoices was changed after using 'Get Shipment lines' and an item with item tracking lines and reserve always has the tracking information.\n+ Initialize();\n+\n+ // [GIVEN] Created New Customer.\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Create Item Tracking Code and Validate Trackings.\n+ LibraryInventory.CreateItemTrackingCode(ItemTrackingCode);\n+ ItemTrackingCode.Validate(\"Lot Specific Tracking\", false);\n+ ItemTrackingCode.Validate(\"SN Specific Tracking\", false);\n+ ItemTrackingCode.Validate(\"SN Sales Inbound Tracking\", true);\n+ ItemTrackingCode.Validate(\"SN Sales Outbound Tracking\", true);\n+ ItemTrackingCode.Validate(\"Lot Sales Inbound Tracking\", true);\n+ ItemTrackingCode.Validate(\"Lot Sales Outbound Tracking\", true);\n+ ItemTrackingCode.Modify(true);\n+\n+ // [GIVEN] Created New Item and Validate Item Tracking Code, Serial Nos, Reserve.\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Validate(\"Lot Nos.\", LibraryERM.CreateNoSeriesCode());\n+ Item.Validate(\"Serial Nos.\", LibraryERM.CreateNoSeriesCode());\n+ Item.Validate(Reserve, Item.Reserve::Always);\n+ Item.Modify(true);\n+\n+ // [GIVEN] Store quantity in Variable.\n+ Quantity := LibraryRandom.RandIntInRange(10, 10);\n+\n+ // [GIVEN] Created Item Inventory By Posting Item Journal.\n+ CreateItemInventory(Item, Quantity);\n+\n+ // [GIVEN] Create new Sales Header.\n+ CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\", WorkDate());\n+\n+ // [GIVEN] Create Sales line and Validate Unit Price.\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", Quantity);\n+ SalesLine.Validate(\"Unit Price\", LibraryRandom.RandDec(1000, 0));\n+ SalesLine.Modify(true);\n+\n+ // [GIVEN] Enqueue Quantity and assign Tracking Lines\n+ LibraryVariableStorage.Enqueue(true);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ SalesLine.OpenItemTrackingLines();\n+\n+ // [GIVEN] Post Sales Order invoked with \"Shipped\" selected.\n+ LibrarySales.PostSalesDocument(SalesHeader, true, false);\n+\n+ // [GIVEN] Create New Sales Invoice And Get Shipment Line Through GetShipmentLines.\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer.\"No.\");\n+ SalesLine.Validate(\"Document Type\", SalesHeader.\"Document Type\");\n+ SalesLine.Validate(\"Document No.\", SalesHeader.\"No.\");\n+ LibrarySales.GetShipmentLines(SalesLine);\n+\n+ // [GIVEN] Find the Sales Line.\n+ SalesLine.SetRange(\"Document No.\", SalesHeader.\"No.\");\n+ SalesLine.SetRange(Type, SalesLine.Type::Item);\n+ SalesLine.FindFirst();\n+\n+ // [WHEN] Validate Quantity with random integer less than previous quanitity.\n+ SalesLine.Validate(Quantity, LibraryRandom.RandInt(5));\n+ SalesLine.Modify(true);\n+\n+ // [THEN] Tracking Lines is not deleted.\n+ LibraryVariableStorage.Enqueue(false);\n+ SalesLine.OpenItemTrackingLines();\n+ end;\n+\n local procedure Initialize()\n var\n Currency: Record Currency;\n@@ -1506,4 +1585,26 @@ codeunit 134389 \"ERM Customer Statistics\"\n begin\n GetShipmentLines.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure ItemTrackingLinesPageHandler(var ItemTrackingLines: TestPage \"Item Tracking Lines\")\n+ var\n+ AssignSerial: Boolean;\n+ begin\n+ AssignSerial := LibraryVariableStorage.DequeueBoolean();\n+ if AssignSerial then\n+ ItemTrackingLines.\"Assign Serial No.\".Invoke();\n+\n+ if not AssignSerial then\n+ Assert.IsTrue(ItemTrackingLines.\"Lot No.\".Value() <> '', LotNoErr);\n+ ItemTrackingLines.OK().Invoke();\n+ end;\n+\n+ [ModalPageHandler]\n+ procedure EnterQuantityToCreatePageHandler(var EnterQuantitytoCreate: TestPage \"Enter Quantity to Create\")\n+ begin\n+ EnterQuantitytoCreate.QtyToCreate.SetValue(LibraryVariableStorage.DequeueInteger());\n+ EnterQuantitytoCreate.CreateNewLotNo.SetValue(true);\n+ EnterQuantitytoCreate.OK().Invoke();\n+ end;\n }\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al\nindex 15a14be1bfcb..b95b0aa54eb2 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al\n@@ -1304,6 +1304,9 @@ codeunit 99000832 \"Sales Line-Reserve\"\n if (NewSalesLine.Type <> NewSalesLine.Type::Item) or (NewSalesLine.Quantity = 0) or (NewSalesLine.Reserve <> NewSalesLine.Reserve::Always) then\n exit(false);\n \n+ if ShipmentExists(NewSalesLine) then\n+ exit(false);\n+\n Item.SetLoadFields(\"Costing Method\");\n Item.Get(NewSalesLine.\"No.\");\n \n@@ -1313,6 +1316,15 @@ codeunit 99000832 \"Sales Line-Reserve\"\n exit(NewSalesLine.Quantity < OldSalesLine.Quantity);\n end;\n \n+ local procedure ShipmentExists(SalesLine: Record \"Sales Line\"): Boolean\n+ var\n+ SalesShipmentLine: Record \"Sales Shipment Line\";\n+ begin\n+ SalesShipmentLine.SetRange(\"Document No.\", SalesLine.\"Shipment No.\");\n+ SalesShipmentLine.SetRange(\"Line No.\", SalesLine.\"Shipment Line No.\");\n+ exit(not SalesShipmentLine.IsEmpty());\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterReservQuantity(SalesLine: Record \"Sales Line\"; var QtyToReserve: Decimal; var QtyToReserveBase: Decimal)\n begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218995", "base_commit": "26bcb2715129beebf0d07da7f19e06fe66636119", "created_at": "2025-06-24", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136306, "functionName": ["PostPurchaseCreditMemoWithNonInventoryItemLinkedToProject"]}], "PASS_TO_PASS": [], "metadata": {"area": "project"}, "test_patch": "diff --git a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\nindex 3f5a305f277c..8683b7e13047 100644\n--- a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n@@ -4082,6 +4082,47 @@ codeunit 136306 \"Job Invoicing\"\n Assert.IsFalse(JobPlanningLine.\"System-Created Entry\", ValueFalseErr);\n end;\n \n+ [Test]\n+ procedure PostPurchaseCreditMemoWithNonInventoryItemLinkedToProject()\n+ var\n+ Item: Record Item;\n+ Job: Record Job;\n+ JobTask: Record \"Job Task\";\n+ PurchaseHeader: Record \"Purchase Header\";\n+ PurchaseLine: Record \"Purchase Line\";\n+ Vendor: Record Vendor;\n+ begin\n+ // [SCENARIO 580434] Error when posting a Purchase Credit Memo for 'Non-Inventory' item with Project No. selected\n+ Initialize();\n+\n+ // [GIVEN] Create Non-Inventory Item\n+ LibraryInventory.CreateNonInventoryTypeItem(Item);\n+\n+ // [GIVEN] Create Job with Customer\n+ CreateJobWithCustomer(Job);\n+\n+ // [GIVEN] Create Job Task\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+\n+ // [GIVEN] Create Vendor\n+ LibraryPurchase.CreateVendor(Vendor);\n+\n+ // [GIVEN] Create Purchase Credit Memo\n+ LibraryPurchase.CreatePurchHeader(PurchaseHeader, PurchaseHeader.\"Document Type\"::\"Credit Memo\", Vendor.\"No.\");\n+ LibraryPurchase.CreatePurchaseLine(PurchaseLine, PurchaseHeader, PurchaseLine.Type::Item, Item.\"No.\", 1);\n+\n+ // [GIVEN] Set Job No., Job Task No. and Job Line Type as Billable\n+ PurchaseLine.Validate(\"Job No.\", Job.\"No.\");\n+ PurchaseLine.Validate(\"Job Task No.\", JobTask.\"Job Task No.\");\n+ PurchaseLine.Validate(\"Job Line Type\", PurchaseLine.\"Job Line Type\"::Billable);\n+ PurchaseLine.Modify(true);\n+\n+ // [WHEN] Post Purchase Credit Memo\n+ LibraryPurchase.PostPurchaseDocument(PurchaseHeader, true, true);\n+\n+ // [THEN] No error should come, as posting for Non-Inventory Item.\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al\nindex a913f1c1ea1b..bd54e22b3b45 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al\n@@ -478,6 +478,9 @@ codeunit 1001 \"Job Post-Line\"\n if IsHandled then\n exit;\n \n+ if PurchaseLine.IsNonInventoriableItem() then\n+ exit;\n+\n Job.Get(PurchaseLine.\"Job No.\");\n if Job.GetQuantityAvailable(PurchaseLine.\"No.\", PurchaseLine.\"Location Code\", PurchaseLine.\"Variant Code\", 0, 2) <\n -PurchaseLine.\"Return Qty. to Ship (Base)\"\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218786", "base_commit": "a0daccc2bd96d0bd4269d1b5eae4cc44ddd34673", "created_at": "2025-06-21", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137065, "functionName": ["WarehousePickUpdateQuantityInOrder"]}], "PASS_TO_PASS": [], "metadata": {"area": "warehouse"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al\nindex 9251a2965f1f..fda235875212 100644\n--- a/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al\n@@ -58,6 +58,7 @@ codeunit 137065 \"SCM Reservation II\"\n PostJnlLinesMsg: Label 'Do you want to post the journal lines';\n SuggestedBackGroundRunQst: Label 'Would you like to run the low-level code calculation as a background job?';\n ActionMessageEntryExistErr: Label 'Action Message Entry exist for item %1', Comment = '%1 = Item No.';\n+ QuantityErr: Label 'Quantity must be equal to %1', Comment = '%1 = Quantity';\n \n [Test]\n [HandlerFunctions('ProdOrderComponentsHandler')]\n@@ -2997,6 +2998,84 @@ codeunit 137065 \"SCM Reservation II\"\n VerifyThereIsNoDamagedReservationEntryForSurplus(Database::\"Sales Line\", SalesHeader[2].\"No.\", ReservationEntry.\"Reservation Status\"::Surplus);//, -SalesLine[2].\"Quantity (Base)\");\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure WarehousePickUpdateQuantityInOrder()\n+ var\n+ Bin: array[8] of Record Bin;\n+ CompItem, ProdItem : Record Item;\n+ Location: Record Location;\n+ ProductionOrder: Record \"Production Order\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ Quantity: Decimal;\n+ UpdatedQuantity: Decimal;\n+ begin\n+ // [SCENARIO 581104] Manually change quantity of \"Take Line\" in Warehouse Pick changes the quantity of the correct \"Place Lines\"\n+ Initialize();\n+\n+ // [GIVEN] Set Quantity and UpdatedQuantity.\n+ Quantity := LibraryRandom.RandIntInRange(900, 1000);\n+ UpdatedQuantity := LibraryRandom.RandIntInRange(400, 500);\n+\n+ // [GIVEN] Reset Warehouse Employee Default Location.\n+ ResetWarehouseEmployeeDefaultLocation();\n+\n+ // [GIVEN] Create Location with WMS enabled Bin mandatory\n+ LibraryWarehouse.CreateLocationWMS(Location, true, false, true, false, false);\n+\n+ // [GIVEN] Create Warehouse Employee for Location.\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, Location.Code, true);\n+\n+ // [GIVEN] Create Bins for Location.\n+ CreateBin(Bin, Location.Code);\n+\n+ // [GIVEN] Set \"Prod. Consump. Whse. Handling\" = \"Warehouse Pick (mandatory)\" and assign Bins to \"To-Production Bin Code\" and \"From-Production Bin Code\".\n+ Location.Validate(\"Prod. Consump. Whse. Handling\", Location.\"Prod. Consump. Whse. Handling\"::\"Warehouse Pick (mandatory)\");\n+ Location.Validate(\"To-Production Bin Code\", Bin[1].Code);\n+ Location.Validate(\"From-Production Bin Code\", Bin[2].Code);\n+ Location.Validate(\"Open Shop Floor Bin Code\", Bin[3].Code);\n+ Location.Modify(true);\n+\n+ // [GIVEN] Create Component Item with \"Replenishment System\" = \"Purchase\" and \"Flushing Method\" = \"Manual\".\n+ LibraryInventory.CreateItem(CompItem);\n+ CompItem.Validate(\"Replenishment System\", CompItem.\"Replenishment System\"::Purchase);\n+ CompItem.Validate(\"Flushing Method\", CompItem.\"Flushing Method\"::\"Pick + Manual\");\n+ CompItem.Validate(\"Allow Whse. Overpick\", true);\n+ CompItem.Modify();\n+\n+ // [GIVEN] Create Production BOM for Component Item.\n+ LibraryInventory.CreateItem(ProdItem);\n+ ProdItem.Validate(\"Replenishment System\", ProdItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProdItem.Validate(\"Manufacturing Policy\", ProdItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ ProdItem.Validate(\"Flushing Method\", ProdItem.\"Flushing Method\"::Manual);\n+ ProdItem.Validate(\"Production BOM No.\", LibraryManufacturing.CreateCertifiedProductionBOM(ProductionBOMHeader, CompItem.\"No.\", 1));\n+ ProdItem.Modify();\n+\n+ // [GIVEN] Create Inventory for Component Item for five different Bins.\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[4].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[5].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[6].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[7].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[8].Code, 0);\n+\n+ // [GIVEN] Create Production Orders for Production Item of quantity Quantity * 5.\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder, ProductionOrder.Status::Released, ProductionOrder.\"Source Type\"::Item, ProdItem.\"No.\", Quantity * 5);\n+ ProductionOrder.Validate(\"Location Code\", Location.Code);\n+ ProductionOrder.Modify(true);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Create Warehouse Pick from Production Order.\n+ LibraryWarehouse.CreateWhsePickFromProduction(ProductionOrder);\n+\n+ // [WHEN] Update quantity in Warehouse Pick Lines.\n+ UpdateQuantityWarehousePickFromPage(ProductionOrder.\"No.\", Location.Code, UpdatedQuantity);\n+\n+ // [THEN] Verify that the Warehouse Activity Lines are updated correctly.\n+ VerifyWareHouseActivityLinesForQuantity(ProductionOrder.\"No.\", Location, Quantity, UpdatedQuantity);\n+ end;\n+\n local procedure Initialize()\n var\n AllProfile: Record \"All Profile\";\n@@ -4693,6 +4772,72 @@ codeunit 137065 \"SCM Reservation II\"\n asserterror ReservationEntry.FindFirst();\n end;\n \n+ local procedure ResetWarehouseEmployeeDefaultLocation()\n+ var\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ begin\n+ WarehouseEmployee.SetRange(\"User ID\", UserId());\n+ WarehouseEmployee.SetRange(Default, true);\n+ WarehouseEmployee.ModifyAll(Default, false);\n+ end;\n+\n+ local procedure VerifyWareHouseActivityLinesForQuantity(ProductionOrderNo: Code[20]; Location: Record Location; Quantity: Decimal; UpdatedQuantity: Decimal)\n+ var\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ begin\n+ FindWarehouseActivityLine(WarehouseActivityLine, ProductionOrderNo, WarehouseActivityLine.\"Source Document\"::\"Prod. Consumption\", WarehouseActivityLine.\"Action Type\"::Place);\n+ WarehouseActivityLine.SetRange(\"Bin Code\", Location.\"To-Production Bin Code\");\n+ WarehouseActivityLine.FindFirst();\n+ Assert.IsTrue(WarehouseActivityLine.\"Qty. (Base)\" = Quantity, StrSubstNo(QuantityErr, Quantity));\n+\n+ WarehouseActivityLine.Reset();\n+ FindWarehouseActivityLine(WarehouseActivityLine, ProductionOrderNo, WarehouseActivityLine.\"Source Document\"::\"Prod. Consumption\", WarehouseActivityLine.\"Action Type\"::Place);\n+ WarehouseActivityLine.SetRange(\"Bin Code\", Location.\"To-Production Bin Code\");\n+ WarehouseActivityLine.FindLast();\n+ Assert.IsTrue(WarehouseActivityLine.\"Qty. (Base)\" = UpdatedQuantity, StrSubstNo(QuantityErr, UpdatedQuantity));\n+ end;\n+\n+ local procedure UpdateQuantityWarehousePickFromPage(ProductionOrderNo: Code[20]; LocationCode: Code[10]; Quantity: Decimal)\n+ var\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ WarehousePickPage: TestPage \"Warehouse Pick\";\n+ begin\n+ WarehouseActivityLine.SetRange(\"Source Document\", WarehouseActivityHeader.\"Source Document\"::\"Prod. Consumption\");\n+ WarehouseActivityLine.SetRange(\"Source No.\", ProductionOrderNo);\n+ WarehouseActivityLine.SetRange(\"Location Code\", LocationCode);\n+ WarehouseActivityLine.FindFirst();\n+ WarehouseActivityHeader.Get(WarehouseActivityHeader.Type::Pick, WarehouseActivityLine.\"No.\");\n+ WarehousePickPage.OpenEdit();\n+ WarehousePickPage.GoToRecord(WarehouseActivityHeader);\n+ WarehousePickPage.WhseActivityLines.Last();\n+ WarehousePickPage.WhseActivityLines.Previous();\n+ WarehousePickPage.WhseActivityLines.Quantity.SetValue(Quantity);\n+ end;\n+\n+ local procedure CreateInventoryWithBin(Item: Record Item; Quantity: Decimal; LocationCode: Code[10]; BinCode: Code[20]; UnitAmount: Decimal)\n+ var\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.CreateItemJournalBatchByType(ItemJournalBatch, ItemJournalBatch.\"Template Type\"::Item);\n+\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJournalBatch, Item, LocationCode, '', WorkDate(),\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Quantity, UnitAmount);\n+ ItemJournalLine.Validate(\"Bin Code\", BinCode);\n+ ItemJournalLine.Modify();\n+\n+ LibraryInventory.PostItemJournalBatch(ItemJournalBatch);\n+ end;\n+\n+ local procedure CreateBin(var Bin: array[8] of Record Bin; LocationCode: Code[10])\n+ var\n+ i: Integer;\n+ begin\n+ for i := 1 to arraylen(Bin) do\n+ LibraryWarehouse.CreateBin(Bin[i], LocationCode, Bin[i].Code, '', '');\n+ end;\n+\n [PageHandler]\n [Scope('OnPrem')]\n procedure ProdOrderComponentsHandler(var ProdOrderComponents: TestPage \"Prod. Order Components\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al b/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al\nindex 0b806569d9b4..a4b3f3fb5f23 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al\n@@ -3102,6 +3102,7 @@ table 5767 \"Warehouse Activity Line\"\n var\n Item: Record Item;\n WhseActivityLine: Record \"Warehouse Activity Line\";\n+ QuantityUpdated: Boolean;\n begin\n if CurrFieldNo = 0 then\n exit;\n@@ -3125,10 +3126,21 @@ table 5767 \"Warehouse Activity Line\"\n Item.Get(FromWhseActivityLine.\"Item No.\");\n Item.TestField(\"Allow Whse. Overpick\");\n \n+ SetFilterFromWhseActivityLineToUpdateQty(WhseActivityLine, FromWhseActivityLine, xWhseActivityLine, QuantityUpdated);\n+ if QuantityUpdated then\n+ WhseActivityLine.Modify(true);\n+ end;\n+\n+ local procedure SetFilterFromWhseActivityLineToUpdateQty(\n+ var WhseActivityLine: Record \"Warehouse Activity Line\";\n+ FromWhseActivityLine: Record \"Warehouse Activity Line\";\n+ xWhseActivityLine: Record \"Warehouse Activity Line\";\n+ var QuantityUpdated: Boolean)\n+ begin\n WhseActivityLine.SetLoadFields(\"Activity Type\", \"No.\", \"Line No.\", \"Item No.\", \"Variant Code\", \"Location Code\", \"Action Type\", Quantity, \"Lot No.\", \"Serial No.\", \"Source No.\", \"Source Line No.\", \"Source Document\");\n WhseActivityLine.SetRange(\"Activity Type\", FromWhseActivityLine.\"Activity Type\");\n WhseActivityLine.SetRange(\"No.\", FromWhseActivityLine.\"No.\");\n- WhseActivityLine.SetFilter(\"Line No.\", '<>%1', FromWhseActivityLine.\"Line No.\");\n+ WhseActivityLine.SetFilter(\"Line No.\", '>%1', FromWhseActivityLine.\"Line No.\");\n WhseActivityLine.SetRange(\"Item No.\", FromWhseActivityLine.\"Item No.\");\n WhseActivityLine.SetRange(\"Variant Code\", FromWhseActivityLine.\"Variant Code\");\n WhseActivityLine.SetRange(\"Location Code\", FromWhseActivityLine.\"Location Code\");\n@@ -3139,11 +3151,18 @@ table 5767 \"Warehouse Activity Line\"\n WhseActivityLine.SetRange(\"Source Document\", FromWhseActivityLine.\"Source Document\");\n WhseActivityLine.SetRange(\"Source No.\", FromWhseActivityLine.\"Source No.\");\n WhseActivityLine.SetRange(\"Source Line No.\", FromWhseActivityLine.\"Source Line No.\");\n+ if WhseActivityLine.FindFirst() then begin\n+ WhseActivityLine.Validate(Quantity, FromWhseActivityLine.Quantity);\n+ QuantityUpdated := true;\n+ exit;\n+ end;\n \n- WhseActivityLine.FindFirst();\n-\n- WhseActivityLine.Validate(Quantity, FromWhseActivityLine.Quantity);\n- WhseActivityLine.Modify(true);\n+ WhseActivityLine.SetRange(\"Line No.\");\n+ WhseActivityLine.SetFilter(\"Line No.\", '<>%1', FromWhseActivityLine.\"Line No.\");\n+ if WhseActivityLine.FindFirst() then begin\n+ WhseActivityLine.Validate(Quantity, FromWhseActivityLine.Quantity);\n+ QuantityUpdated := true;\n+ end\n end;\n \n [IntegrationEvent(false, false)]\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-217974", "base_commit": "645334f664bea223d7a58bdcd730164852241728", "created_at": "2025-06-13", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137156, "functionName": ["MoveNegativeLines_SetsReturnOrderShipToAddressToCompany"]}], "PASS_TO_PASS": [], "metadata": {"area": "utilities"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al\nindex 670a87576340..2c5a96d5e372 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al\n@@ -72,6 +72,7 @@ codeunit 137156 \"SCM Orders IV\"\n DocumentLineSourceNoErr: label 'Expected source on document line is %1 but found %2.', Comment = '%1 = Expected Source No., %2 = Actual Source No.';\n ReservationFromStockErr: Label 'Reservation from Stock must be %1 in %2.', Comment = '%1= Field Value, %2 =Table Caption.';\n PurchasingCodeOnSalesInvoiceErr: Label 'The Purchasing Code should be blank for item %1 on the sales invoice because it is used only for the drop shipment process.', Comment = '%1= Item No.';\n+ ShipToAddressErr: Label 'Ship-to Address on Return Order should be company address';\n \n #if not CLEAN25\n [Test]\n@@ -3553,6 +3554,43 @@ codeunit 137156 \"SCM Orders IV\"\n Assert.ExpectedError(StrSubstNo(PurchasingCodeOnSalesInvoiceErr, Item.\"No.\"));\n end;\n \n+ [Test]\n+ procedure MoveNegativeLines_SetsReturnOrderShipToAddressToCompany()\n+ var\n+ Customer: Record Customer;\n+ Item: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ CompanyInfo: Record \"Company Information\";\n+ begin\n+ // [SCENARIO 580640] Verify Ship to Address of Return Order when Move Negative Lines on the Sales Order.\n+ Initialize();\n+\n+ // [GIVEN] Create Customer.\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Create Sales Header with Document Type as Order.\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\");\n+\n+ // [GIVEN] Create SalesLine with Negative Quantity.\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, LibraryInventory.CreateItem(Item), LibraryRandom.RandIntInRange(-5, -10));\n+\n+ // [WHEN] Move Negative Lines\n+ MoveNegativeLinesOnSalesOrder(SalesHeader);\n+\n+ // [GIVEN] Get company address\n+ CompanyInfo.Get();\n+\n+ // [THEN] Sales Return Order is created with Ship to Address as Company Address.\n+ SalesHeader.SetRange(\"Document Type\", SalesHeader.\"Document Type\"::\"Return Order\");\n+ SalesHeader.SetRange(\"Sell-to Customer No.\", Customer.\"No.\");\n+ SalesHeader.FindFirst();\n+ Assert.AreEqual(\n+ CompanyInfo.\"Ship-to Address\", SalesHeader.\"Ship-to Address\", ShipToAddressErr);\n+ Assert.AreEqual(\n+ CompanyInfo.\"Ship-to City\", SalesHeader.\"Ship-to City\", ShipToAddressErr);\n+ end;\n+\n local procedure Initialize()\n var\n PriceListLine: Record \"Price List Line\";\n@@ -5405,8 +5443,8 @@ codeunit 137156 \"SCM Orders IV\"\n begin\n WarehouseActivityLine.SetRange(\"Action Type\", ActionType);\n FindWarehouseActivityLine(\n- WarehouseActivityLine, WarehouseActivityLine.\"Source Document\"::\"Purchase Order\", SourceNo,\n- WarehouseActivityLine.\"Activity Type\"::\"Put-away\");\n+WarehouseActivityLine, WarehouseActivityLine.\"Source Document\"::\"Purchase Order\", SourceNo,\n+WarehouseActivityLine.\"Activity Type\"::\"Put-away\");\n WarehouseActivityLine.ModifyAll(\"Zone Code\", ZoneCode, true);\n WarehouseActivityLine.ModifyAll(\"Bin Code\", BinCode, true);\n end;\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al b/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al\nindex 780de254f475..452e82783b47 100644\n--- a/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al\n@@ -747,6 +747,7 @@ codeunit 6620 \"Copy Document Mgt.\"\n begin\n FromSalesHeader.CalcFields(\"Work Description\");\n ToSalesHeader.TransferFields(FromSalesHeader, false);\n+ UpdateShipToAddress(ToSalesHeader);\n UpdateSalesHeaderWhenCopyFromSalesHeader(ToSalesHeader, OldSalesHeader, FromDocType);\n SetReceivedFromCountryCode(FromDocType, ToSalesHeader);\n OnAfterCopySalesHeader(ToSalesHeader, OldSalesHeader, FromSalesHeader, FromDocType);\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-222488", "base_commit": "34f4bd6914204e9f211b9f09a3b0c3a09954da33", "created_at": "2025-07-30", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137152, "functionName": ["RegisterPutAwayWithBreakBulkFilterShouldRegisterAllLines"]}], "PASS_TO_PASS": [], "metadata": {"area": "warehouse"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al\nindex d40ac8d858c1..e83bdf59b1cc 100644\n--- a/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al\n@@ -4302,6 +4302,63 @@ codeunit 137152 \"SCM Warehouse - Receiving\"\n VerifyWarehouseActivityLineWithBin(Item.\"No.\", Bin[3].Code, Bin[1].Code);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ConfirmHandlerTrue')]\n+ procedure RegisterPutAwayWithBreakBulkFilterShouldRegisterAllLines()\n+ var\n+ Item: Record Item;\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ PurchaseHeader: Record \"Purchase Header\";\n+ UOM: Record \"Unit of Measure\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ WarehouseEntry: Record \"Warehouse Entry\";\n+ PutAwayPage: TestPage \"Warehouse Put-away\";\n+ ExpectedLinesCount: Integer;\n+ begin\n+ // [SCENARIO 592107] Verify all put away lines are registered, when register a warehouse put away with the break bulk filter set to yes\n+ Initialize();\n+\n+ // [GIVEN] Create Warehouse Employee for location WHITE.\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, LocationWhite.Code, true);\n+\n+ // [GIVEN] Create an Item and assign Put-away Unit of Measure Code.\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(\"Put-away Unit of Measure Code\", Item.\"Base Unit of Measure\");\n+ Item.Modify(true);\n+\n+ // [GIVEN] Create Unit of Measure and Item Unit of Measure with Qty. per Unit of Measure as 48.\n+ LibraryInventory.CreateUnitOfMeasureCode(UOM);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure, Item.\"No.\", UOM.Code, 48);\n+\n+ // [GIVEN] Create Purchase Order and Post Warehouse Receipt.\n+ CreatePurchaseOrderAndPostWarehouseReceipt(\n+ PurchaseHeader, LocationWhite.Code, Item.\"No.\", LibraryRandom.RandDec(10, 2), UOM.Code);\n+\n+ // [GIVEN] Find Warehouse Put-away\n+ WarehouseActivityLine.SetRange(\"Activity Type\", WarehouseActivityLine.\"Activity Type\"::\"Put-away\");\n+ WarehouseActivityLine.SetRange(\"Source Document\", WarehouseActivityLine.\"Source Document\"::\"Purchase Order\");\n+ WarehouseActivityLine.SetRange(\"Source No.\", PurchaseHeader.\"No.\");\n+ WarehouseActivityLine.FindSet();\n+ ExpectedLinesCount := WarehouseActivityLine.Count();\n+\n+ // [GIVEN] Open Warehouse Put-away page\n+ PutAwayPage.OpenEdit();\n+ PutAwayPage.FILTER.SetFilter(\"No.\", WarehouseActivityLine.\"No.\");\n+\n+ // [GIVEN] Set Break Bulk filter = Yes\n+ PutAwayPage.\"Breakbulk Filter\".SetValue(true);\n+\n+ // [WHEN] Register Warehouse Put-Away.\n+ PutAwayPage.\"&Register Put-away\".Invoke();\n+\n+ // [THEN] Verify Put-Away should be registered and all lines should be posted in Warehouse Entry table\n+ WarehouseEntry.SetRange(\"Entry Type\", WarehouseEntry.\"Entry Type\"::Movement);\n+ WarehouseEntry.SetRange(\"Source Document\", WarehouseEntry.\"Source Document\"::\"P. Order\");\n+ WarehouseEntry.SetRange(\"Source No.\", PurchaseHeader.\"No.\");\n+ Assert.RecordCount(WarehouseEntry, ExpectedLinesCount);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al b/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al\nindex 07db37f9fc83..680830c4c772 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al\n@@ -482,9 +482,17 @@ page 5771 \"Whse. Put-away Subform\"\n \n procedure RegisterPutAwayYesNo()\n var\n+ WhseActivityHeader: Record \"Warehouse Activity Header\";\n WhseActivLine: Record \"Warehouse Activity Line\";\n begin\n- WhseActivLine.Copy(Rec);\n+ WhseActivityHeader.Get(Rec.\"Activity Type\", Rec.\"No.\");\n+ if (Rec.\"Activity Type\"::\"Put-away\" = Rec.\"Activity Type\"::\"Put-away\") and WhseActivityHeader.\"Breakbulk Filter\" then begin\n+ WhseActivLine.SetRange(\"Activity Type\", WhseActivLine.\"Activity Type\"::\"Put-away\");\n+ WhseActivLine.SetRange(\"No.\", Rec.\"No.\");\n+ WhseActivLine.FindSet();\n+ end\n+ else\n+ WhseActivLine.Copy(Rec);\n WhseActivLine.FilterGroup(3);\n WhseActivLine.SetRange(Breakbulk);\n WhseActivLine.FilterGroup(0);\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-222484", "base_commit": "a60a6b56b858f370ae21d8d0241ed67f72d6202c", "created_at": "2025-07-30", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137260, "functionName": ["RegisterPickWithNoErrorForFEFOLocation"]}], "PASS_TO_PASS": [], "metadata": {"area": "warehouse"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al\nindex df8ad3bb4d4b..de51c3ce8532 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al\n@@ -47,6 +47,7 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n JournalPostedMsg: Label 'The journal lines were successfully posted.';\n CouldNotRegisterWhseActivityErr: Label 'Could not register Warehouse Activity.';\n OrderToOrderBindingOnSalesLineQst: Label 'Registering the pick will remove the existing order-to-order reservation for the sales order.\\Do you want to continue?';\n+ ILELotNotMatchedErr: Label 'Item Ledger Entry Lot No. %1 should be equal to the first lot with FEFO.', Comment = '%1 - Lot No.';\n \n [Test]\n [HandlerFunctions('WhseItemTrackingLinesPageHandler,RegisterWhseMessageHandler,ConfirmHandler')]\n@@ -2080,6 +2081,77 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n Assert.ExpectedError(StrSubstNo(CannotMatchItemTrackingErr, SalesLine.\"Document No.\", SalesLine.\"Line No.\", SalesLine.\"No.\", SalesLine.Description));\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemTrackingLinesPageHandler,ReservationFromCurrentLineHandler')]\n+ [Scope('OnPrem')]\n+ procedure RegisterPickWithNoErrorForFEFOLocation()\n+ var\n+ Location: Record Location;\n+ Bin: Record Bin;\n+ Item: Record Item;\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemLedgerEntry: Record \"Item Ledger Entry\";\n+ SalesHeader: array[2] of Record \"Sales Header\";\n+ WarehouseShipmentHeader: Record \"Warehouse Shipment Header\";\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ ExpirationDate: Date;\n+ ShipmentBinCode: Code[20];\n+ LotNo: array[2] of Code[10];\n+ begin\n+\n+ // [SCENARIO 572962] No Error when Lot No. LOT0001 is available on inventory, when trying to register pick for item with reservation and item tracking with location set up FEFO\n+ Initialize();\n+\n+ // [GIVEN] Set up Expiration Date for the Lot No.\n+ ExpirationDate := CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', WorkDate());\n+\n+ // [GIVEN] Create Location with pick according to FEFO.\n+ CreateLocationWithPostingSetupAndPickAccordingTOFEFO(Location, ShipmentBinCode);\n+\n+ // [GIVEN] Item with Lot No. tracking.\n+ LibraryInventory.CreateTrackedItem(Item, '', '', CreateItemTrackingCode(false, true, true, false, true));\n+\n+ // [GIVEN] Positive adjustment with Lot = \"X\" and ExpirationDate = D1 , Lot = \"Y\" and ExpirationDate = D2 and D2 > D1.\n+ LibraryWarehouse.CreateBin(Bin, Location.Code, LibraryUtility.GenerateGUID(), '', '');\n+ SelectItemJournalAndPostItemJournalLine(\n+ LotNo[1], Bin.Code, '', Item.\"No.\", Location.Code, '', 1, ExpirationDate,\n+ ItemJournalBatch.\"Template Type\"::Item, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", false);\n+ SelectItemJournalAndPostItemJournalLine(\n+ LotNo[2], Bin.Code, '', Item.\"No.\", Location.Code, '', 1,\n+ CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', ExpirationDate),\n+ ItemJournalBatch.\"Template Type\"::Item, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", false);\n+\n+ // [GIVEN] Create Sales order and reserve the first Lot No. \"LOT0001\" with Expiration Date = D1.\n+ CreateSOAndTrackInventory(SalesHeader[1], Item.\"No.\", Location.Code, 1);\n+\n+ // Create seconf sales order and reserve the second Lot No. \"LOT0002\" with Expiration Date = D2.\n+ CreateSOAndTrackInventory(SalesHeader[2], Item.\"No.\", Location.Code, 1);\n+\n+ // [GIVEN] Create Warehouse Shipment from Sales Order second.\n+ CreateWhseShipmentFromSO(WarehouseShipmentHeader, SalesHeader[2]);\n+\n+ // [WHEN] CreatePick From Warehouse Shipment.\n+ LibraryWarehouse.CreatePick(WarehouseShipmentHeader);\n+\n+ // [WHEN] Register Pick should not fail with error \"Lot No. is not available on inventory\" for the first Lot No. \"LOT0001\" with Expiration Date = D1.\n+ WarehouseActivityLine.SetRange(\"Item No.\", Item.\"No.\");\n+ WarehouseActivityLine.SetRange(\"Action Type\", WarehouseActivityLine.\"Action Type\"::Take);\n+ WarehouseActivityLine.FindFirst();\n+ WarehouseActivityHeader.Get(WarehouseActivityLine.\"Activity Type\", WarehouseActivityLine.\"No.\");\n+ LibraryWarehouse.RegisterWhseActivity(WarehouseActivityHeader);\n+\n+ // [WHEN] Post Warehouse Shipment.\n+ LibraryWarehouse.PostWhseShipment(WarehouseShipmentHeader, false);\n+\n+ // [THEN] Item Ledger Entry for the first Lot No. \"LOT0001\" with Expiration Date = D1 should be created.\n+ ItemLedgerEntry.SetRange(\"Entry Type\", ItemLedgerEntry.\"Entry Type\"::Sale);\n+ ItemLedgerEntry.SetRange(\"Item No.\", Item.\"No.\");\n+ ItemLedgerEntry.FindFirst();\n+ Assert.AreEqual(LotNo[1], ItemLedgerEntry.\"Lot No.\", StrSubstNo(ILELotNotMatchedErr, LotNo[1]));\n+ end;\n+\n local procedure Initialize()\n var\n InventorySetup: Record \"Inventory Setup\";\n@@ -3485,6 +3557,19 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n LibrarySales.UndoSalesShipmentLine(SalesShipmentLine);\n end;\n \n+ local procedure CreateSOAndTrackInventory(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; LocationCode: Code[10]; Quantity: Decimal)\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, LibrarySales.CreateCustomerNo());\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, ItemNo, Quantity);\n+ SalesLine.Validate(\"Location Code\", LocationCode);\n+ LibraryVariableStorage.Enqueue(SalesLine.Quantity);\n+ SalesLine.Modify(true);\n+ SalesLine.ShowReservation();\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandler(ConfirmMessage: Text[1024]; var Reply: Boolean)\n@@ -3687,6 +3772,14 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n ProductionJournal.Post.Invoke();\n end;\n \n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ReservationFromCurrentLineHandler(var Reservation: TestPage Reservation)\n+ begin\n+ Reservation.\"Reserve from Current Line\".Invoke();\n+ Reservation.OK().Invoke();\n+ end;\n+\n local procedure AssignLotNos(var ItemTrackingLines: TestPage \"Item Tracking Lines\")\n var\n LinesToProcess: Integer;\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al b/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al\nindex 06bc64083218..cc14d68c515b 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al\n@@ -2044,6 +2044,7 @@ codeunit 7307 \"Whse.-Activity-Register\"\n if Item.\"Reserved Qty. on Inventory\" > 0 then begin\n xReservedQty := Item.\"Reserved Qty. on Inventory\";\n WhseActivityItemTrackingSetup.CopyTrackingFromWhseActivityLine(WhseActivLine);\n+ RemoveNonSpecificreservations(WhseActivLine, WhseItemTrackingSetup, QtyToRelease);\n LateBindingMgt.ReleaseForReservation(\n WhseActivLine.\"Item No.\", WhseActivLine.\"Variant Code\", WhseActivLine.\"Location Code\",\n WhseActivityItemTrackingSetup, QtyToRelease);\n@@ -2127,6 +2128,40 @@ codeunit 7307 \"Whse.-Activity-Register\"\n until WarehouseActivityLine.Next() = 0;\n end;\n \n+ local procedure RemoveNonSpecificreservations(WhseActivLine: Record \"Warehouse Activity Line\"; WhseItemTrackingSetup: Record \"Item Tracking Setup\"; QtyToRelease: Decimal)\n+ var\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesLine: Record \"Sales Line\";\n+ QtyToPick: Decimal;\n+ begin\n+ if not WhseItemTrackingSetup.TrackingRequired() then\n+ exit;\n+ if not (WhseActivLine.\"Source Type\" = Database::\"Sales Line\") then\n+ exit;\n+\n+ QtyToPick := QtyToRelease;\n+ SalesLine.Get(WhseActivLine.\"Source Subtype\", WhseActivLine.\"Source No.\", WhseActivLine.\"Source Line No.\");\n+ ReservationEntry.SetSourceFilter(WhseActivLine.\"Source Type\", WhseActivLine.\"Source Subtype\", WhseActivLine.\"Source No.\", WhseActivLine.\"Source Line No.\", true);\n+ ReservationEntry.SetRange(Positive, false);\n+ if ReservationEntry.FindSet() then\n+ repeat\n+ DeleteNonSpecificReservationEntries(ReservationEntry, SalesLine, QtyToPick);\n+ until (ReservationEntry.Next() = 0) or (QtyToPick >= 0);\n+ end;\n+\n+ local procedure DeleteNonSpecificReservationEntries(ReservationEntry: Record \"Reservation Entry\"; SalesLine: Record \"Sales Line\"; var QtyToPick: Decimal)\n+ var\n+ ReservationManagement: Codeunit \"Reservation Management\";\n+ begin\n+ if ReservationEntry.TrackingExists() then\n+ exit;\n+\n+ ReservationManagement.SetReservSource(SalesLine);\n+ ReservationManagement.DeleteReservEntries(false, ReservationEntry.\"Quantity (Base)\");\n+ QtyToPick += ReservationEntry.\"Quantity (Base)\"\n+ end;\n+\n+\n [IntegrationEvent(false, false)]\n local procedure OnBeforeCode(var WarehouseActivityLine: Record \"Warehouse Activity Line\")\n begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-220314", "base_commit": "96c641e94b94056dda25b90907bef9b77622e31d", "created_at": "2025-07-08", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137275, "functionName": ["ItemReclassJournalUnitOfMeasureUpdatedWhenItemChanged"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al\nindex 436478abba92..b3bf0372e39c 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al\n@@ -1800,6 +1800,54 @@ codeunit 137275 \"SCM Inventory Journals\"\n Codeunit.Run(Codeunit::\"Item Jnl.-Post Batch\", ItemJournalLine);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure ItemReclassJournalUnitOfMeasureUpdatedWhenItemChanged()\n+ var\n+ Item: array[2] of Record Item;\n+ UnitOfMeasure: array[2] of Record \"Unit of Measure\";\n+ ItemUnitOfMeasure: array[2] of Record \"Item Unit of Measure\";\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemReclassJournal: TestPage \"Item Reclass. Journal\";\n+ i: Integer;\n+ begin\n+ // [SCENARIO 581983] Unit of Measure Code should be updated automatically when Item No. is changed in Item Reclassification Journal\n+ Initialize();\n+\n+ // [GIVEN] Create two items with different base unit of measure codes\n+ for i := 1 to 2 do begin\n+ LibraryInventory.CreateUnitOfMeasureCode(UnitOfMeasure[i]);\n+ LibraryInventory.CreateItem(Item[i]);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure[i], Item[i].\"No.\", UnitOfMeasure[i].Code, 1);\n+ Item[i].Validate(\"Base Unit of Measure\", UnitOfMeasure[i].Code);\n+ Item[i].Modify(true);\n+ end;\n+\n+ // [GIVEN] Setup Item Reclassification Journal template and batch\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, ItemJournalTemplate.Type::Transfer);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, ItemJournalTemplate.Type::Transfer, ItemJournalTemplate.Name);\n+ LibraryInventory.ClearItemJournal(ItemJournalTemplate, ItemJournalBatch);\n+\n+ // [WHEN] Open Item Reclassification Journal page\n+ ItemReclassJournal.OpenEdit();\n+ ItemReclassJournal.CurrentJnlBatchName.SetValue(ItemJournalBatch.Name);\n+\n+ // [WHEN] Enter first item no. and verify unit of measure is set\n+ ItemReclassJournal.\"Item No.\".SetValue(Item[1].\"No.\");\n+ ItemReclassJournal.\"Unit of Measure Code\".AssertEquals(UnitOfMeasure[1].Code);\n+\n+ // [WHEN] Change item no. to second item\n+ ItemReclassJournal.\"Item No.\".SetValue(Item[2].\"No.\");\n+\n+ // [THEN] Verify unit of measure code is updated to second item's base unit of measure\n+ ItemReclassJournal.\"Unit of Measure Code\".AssertEquals(UnitOfMeasure[2].Code);\n+\n+ // [THEN] Verify no error occurs when changing item number\n+ // This test verifies the fix for the bug where changing Item No. with different Unit of Measure Codes caused validation errors\n+ ItemReclassJournal.Close();\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\nindex fb9253b7ae77..ad41ac368015 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n@@ -76,6 +76,7 @@ table 83 \"Item Journal Line\"\n if \"Item No.\" <> xRec.\"Item No.\" then begin\n \"Variant Code\" := '';\n \"Bin Code\" := '';\n+ \"Unit of Measure Code\" := '';\n if CurrFieldNo <> 0 then begin\n GetItem();\n if Item.IsInventoriableType() then\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-214926", "base_commit": "2ed9a2df09bf29573bbaf9e087313bec188ce69b", "created_at": "2025-05-07", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134389, "functionName": ["CheckCustomerCardStatisticsTotalOnFactBox"]}], "PASS_TO_PASS": [], "metadata": {"area": "sales"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\nindex 12e3e3ea3927..4ddc570573df 100644\n--- a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n@@ -28,6 +28,7 @@ codeunit 134389 \"ERM Customer Statistics\"\n FieldIsNotHiddenErr: Label 'Field is hidden';\n EntryNoMustMatchErr: Label 'Entry No. must match.';\n PaymentsLCYAndAmountLCYMustMatchErr: Label 'Payemnts (LCY) and Amount (LCY) must match.';\n+ CustomerCardFactboxTotalErr: Label 'Customer card factbox total is not Correct';\n \n [Test]\n [Scope('OnPrem')]\n@@ -964,6 +965,44 @@ codeunit 134389 \"ERM Customer Statistics\"\n CustomerCard.Close();\n end;\n \n+ [Test]\n+ [HandlerFunctions('GetShipmentLinesPageHandler')]\n+ procedure CheckCustomerCardStatisticsTotalOnFactBox()\n+ var\n+ Customer: Record Customer;\n+ Item: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ // [SCENARIO 574648] Check Customer Card Statistics Total On FactBox When Sales Order Only Shiped and Sales Invoice \n+ // Created By GetShipmentLines without Posting.\n+ Initialize();\n+\n+ // [GIVEN] Created New Customer.\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Created New Item.\n+ LibraryInventory.CreateItem(Item);\n+\n+ // [GIVEN] Created Item Inventory By Posting Item Journal With Qty 10.\n+ CreateItemInventory(Item, 10);\n+\n+ // [WHEN] Created New Sales Order With Qty 10.\n+ CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\", WorkDate());\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", 10);\n+ SalesLine.Validate(\"Unit Price\", LibraryRandom.RandDec(1000, 0));\n+ SalesLine.Modify(true);\n+\n+ // [WHEN] \"SO\" Post invoked with \"Shipped\" selected.\n+ LibrarySales.PostSalesDocument(SalesHeader, true, false);\n+\n+ // [WHEN] Create New Sales Invoice And Get Shipment Line Through GetShipmentLines.\n+ CreateAndReleaseSalesInvoiceUsingGetShipmentLines(SalesHeader.\"Sell-to Customer No.\");\n+\n+ // [THEN] Check Customer Card Statistics Total is Equal To SalesLine.\"Amount Including VAT\" and Not Multiply.\n+ Assert.AreEqual(SalesLine.\"Amount Including VAT\", Customer.GetTotalAmountLCY(), CustomerCardFactboxTotalErr);\n+ end;\n+\n local procedure Initialize()\n var\n Currency: Record Currency;\n@@ -1400,6 +1439,31 @@ codeunit 134389 \"ERM Customer Statistics\"\n DetailedCustLedgEntry.Insert();\n end;\n \n+ local procedure CreateAndReleaseSalesInvoiceUsingGetShipmentLines(CustomerNo: Code[20])\n+ var\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, CustomerNo);\n+ SalesLine.Validate(\"Document Type\", SalesHeader.\"Document Type\");\n+ SalesLine.Validate(\"Document No.\", SalesHeader.\"No.\");\n+ LibrarySales.GetShipmentLines(SalesLine);\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+ end;\n+\n+ local procedure CreateItemInventory(var Item: Record Item; Qty: Decimal)\n+ var\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, ItemJournalTemplate.Type::Item);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, ItemJournalTemplate.Type::Item, ItemJournalTemplate.Name);\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJournalBatch.\"Journal Template Name\",\n+ ItemJournalBatch.Name, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Item.\"No.\", Qty);\n+ LibraryInventory.PostItemJournalLine(ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerYes(Message: Text; var Response: Boolean)\n@@ -1450,5 +1514,11 @@ codeunit 134389 \"ERM Customer Statistics\"\n CreditLimitNotification.CreditLimitDetails.OverdueBalance.AssertEquals(Customer.\"Balance Due (LCY)\");\n CreditLimitNotification.CreditLimitDetails.\"Credit Limit (LCY)\".AssertEquals(Customer.\"Credit Limit (LCY)\");\n end;\n+\n+ [ModalPageHandler]\n+ procedure GetShipmentLinesPageHandler(var GetShipmentLines: TestPage \"Get Shipment Lines\")\n+ begin\n+ GetShipmentLines.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\nindex ebeb6ca13f79..1fcc2d218ab3 100644\n--- a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n+++ b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n@@ -2353,6 +2353,8 @@ table 18 Customer\n AdditionalAmountLCY: Decimal;\n IsHandled: Boolean;\n TotalAmountLCY: Decimal;\n+ ShippedFromOrderLCY: Decimal;\n+ ShippedOutstandingInvoicesLCY: Decimal;\n begin\n IsHandled := false;\n OnBeforeGetTotalAmountLCYCommon(Rec, AdditionalAmountLCY, IsHandled);\n@@ -2362,10 +2364,13 @@ table 18 Customer\n SalesOutstandingAmountFromShipment := SalesLine.OutstandingInvoiceAmountFromShipment(\"No.\");\n InvoicedPrepmtAmountLCY := GetInvoicedPrepmtAmountLCY();\n RetRcdNotInvAmountLCY := GetReturnRcdNotInvAmountLCY();\n+ ShippedFromOrderLCY := GetShippedFromOrderLCYAmountLCY();\n+ ShippedOutstandingInvoicesLCY := GetShippedOutstandingInvoicesAmountLCY();\n \n TotalAmountLCY :=\n- \"Balance (LCY)\" + \"Outstanding Orders (LCY)\" + \"Shipped Not Invoiced (LCY)\" + \"Outstanding Invoices (LCY)\" +\n- SalesOutstandingAmountFromShipment - InvoicedPrepmtAmountLCY - RetRcdNotInvAmountLCY + AdditionalAmountLCY;\n+ \"Balance (LCY)\" + \"Outstanding Orders (LCY)\" + (\"Shipped Not Invoiced (LCY)\" - ShippedFromOrderLCY) +\n+ (\"Outstanding Invoices (LCY)\" - ShippedOutstandingInvoicesLCY) + SalesOutstandingAmountFromShipment -\n+ InvoicedPrepmtAmountLCY - RetRcdNotInvAmountLCY + AdditionalAmountLCY;\n \n OnAfterGetTotalAmountLCYCommon(Rec, TotalAmountLCY);\n exit(TotalAmountLCY);\n@@ -3451,6 +3456,33 @@ table 18 Customer\n OnAfterGetVATRegistrationNo(Rec, VATRegNo);\n end;\n \n+ procedure GetShippedOutstandingInvoicesAmountLCY(): Decimal\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ SalesLine.SetRange(\"Bill-to Customer No.\", \"No.\");\n+ SalesLine.SetRange(\"Document Type\", SalesLine.\"Document Type\"::Invoice);\n+ SalesLine.SetFilter(\"Shipment No.\", '<>%1', '');\n+ SalesLine.SetFilter(\"Shipment Line No.\", '<>%1', 0);\n+ SalesLine.CalcSums(\"Outstanding Amount (LCY)\");\n+ exit(SalesLine.\"Outstanding Amount (LCY)\");\n+ end;\n+\n+ procedure GetShippedFromOrderLCYAmountLCY(): Decimal\n+ var\n+ SalesShippedNotInvoicedLCY: Query \"Sales Shipped Not Invoiced LCY\";\n+ ShippedFromOrderLCY: Decimal;\n+ begin\n+ ShippedFromOrderLCY := 0;\n+ SalesShippedNotInvoicedLCY.SetRange(BillToCustomerNo, \"No.\");\n+ SalesShippedNotInvoicedLCY.SetFilter(OrderNo, '<>%1', '');\n+ SalesShippedNotInvoicedLCY.SetFilter(OrderLineNo, '<>%1', 0);\n+ if SalesShippedNotInvoicedLCY.Open() then\n+ while SalesShippedNotInvoicedLCY.Read() do\n+ ShippedFromOrderLCY += SalesShippedNotInvoicedLCY.ShippedNotInvoicedLCY;\n+ exit(ShippedFromOrderLCY);\n+ end;\n+\n [InherentPermissions(PermissionObjectType::TableData, Database::\"My Customer\", 'rm')]\n local procedure UpdateMyCustomer(CallingFieldNo: Integer)\n var\ndiff --git a/App/Layers/W1/BaseApp/Sales/Customer/SalesShippedNotInvoicedLCY.Query.al b/App/Layers/W1/BaseApp/Sales/Customer/SalesShippedNotInvoicedLCY.Query.al\nnew file mode 100644\nindex 000000000000..3640fed3530f\n--- /dev/null\n+++ b/App/Layers/W1/BaseApp/Sales/Customer/SalesShippedNotInvoicedLCY.Query.al\n@@ -0,0 +1,31 @@\n+namespace Microsoft.Sales.Customer;\n+\n+using Microsoft.Sales.Document;\n+using Microsoft.Sales.History;\n+\n+query 115 \"Sales Shipped Not Invoiced LCY\"\n+{\n+ Caption = 'Sales Shipped Not Invoiced (LCY)';\n+ QueryType = Normal;\n+ DataAccessIntent = ReadOnly;\n+\n+ elements\n+ {\n+ dataitem(SalesShipmentLine; \"Sales Shipment Line\")\n+ {\n+ column(BillToCustomerNo; \"Bill-to Customer No.\") { }\n+ column(OrderNo; \"Order No.\") { }\n+ column(OrderLineNo; \"Order Line No.\") { }\n+ filter(BillToCustomerNoFilter; \"Bill-to Customer No.\") { }\n+ filter(OrderNoFilter; \"Order No.\") { }\n+ filter(OrderLineNoFilter; \"Order Line No.\") { }\n+ dataitem(SalesLine; \"Sales Line\")\n+ {\n+ DataItemTableFilter = \"Document Type\" = const(Order);\n+ DataItemLink = \"Document No.\" = SalesShipmentLine.\"Order No.\",\n+ \"Line No.\" = SalesShipmentLine.\"Order Line No.\";\n+ column(ShippedNotInvoicedLCY; \"Shipped Not Invoiced (LCY)\") { }\n+ }\n+ }\n+ }\n+}\n\\ No newline at end of file\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-215972", "base_commit": "09f92492d0cfe5dbba4cebef931acf5b33578799", "created_at": "2025-05-19", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137140, "functionName": ["ReservationShouldNotPossibleOnTransferOrderIfItemReserveSetAsNever"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al\nindex 6e9a6abd3cd6..3253f5221abc 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al\n@@ -41,6 +41,7 @@ codeunit 137140 \"SCM Inventory Documents\"\n SpecialEquipmentCodeShouldBeVisibleErr: Label 'Special Equipment Code should be visible.';\n DueDateBeforeWorkDateMsg: Label 'is before work date';\n TransferOrderErr: Label 'Transfer Order has not been posted successfully.';\n+ ReserveMustNotBeNeverErr: Label 'Reserve must not be Never';\n \n [Test]\n [Scope('OnPrem')]\n@@ -2069,6 +2070,44 @@ codeunit 137140 \"SCM Inventory Documents\"\n Assert.IsTrue(DirectTransHeader.FindFirst(), TransferOrderErr);\n end;\n \n+ [Test]\n+ procedure ReservationShouldNotPossibleOnTransferOrderIfItemReserveSetAsNever()\n+ var\n+ Item: Record Item;\n+ LocationA: Record Location;\n+ LocationB: Record Location;\n+ TransferHeader: Record \"Transfer Header\";\n+ TransferLine: Record \"Transfer Line\";\n+ begin\n+ // [SCENARIO 578318] Reservation of an Item possible with in a Transfer order if the item is set to reserve=never\n+ Initialize();\n+\n+ // [GIVEN] Create Two locations: \"A\" and \"B\" without Warehouse Setup\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(LocationA);\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(LocationB);\n+\n+ // [GIVEN] Create an Item with Reserve = Never\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(Reserve, Item.Reserve::Never);\n+ Item.Modify();\n+\n+ // [GIVEN] Create and Post Item Journal Line\n+ CreateAndPostItemJournalLine(Item.\"No.\", LocationA.Code, '');\n+\n+ // [GIVEN] Create a Direct Transfer Order from Location \"A\" to location \"B\" and Reserve From Inventory\n+ CreateDirectTransferHeader(TransferHeader, LocationA.code, LocationB.Code);\n+ TransferHeader.Validate(\"Posting Date\", WorkDate());\n+ TransferHeader.Modify(true);\n+\n+ // [WHEN] Create transfer line with Item with Reserve set as Never and Show Reservation\n+ LibraryWarehouse.CreateTransferLine(TransferHeader, TransferLine, Item.\"No.\", 10);\n+ asserterror TransferLine.ShowReservation();\n+\n+ // [THEN] Verify Reserve must not be Never error\n+ Assert.ExpectedErrorCode('TestField');\n+ Assert.ExpectedError(ReserveMustNotBeNeverErr);\n+ end;\n+\n local procedure PostWhseShipmentFromTO(DocumentNo: Code[20])\n var\n WhseShipmentLine: Record \"Warehouse Shipment Line\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al b/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al\nindex 9ab054c5f5c3..d012f240926e 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al\n@@ -1592,6 +1592,8 @@ table 5741 \"Transfer Line\"\n exit;\n \n TestField(\"Item No.\");\n+ Item.Get(\"Item No.\");\n+ Item.TestField(Reserve);\n Clear(Reservation);\n OptionNumber := StrMenu(Text011);\n if OptionNumber > 0 then begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-216057", "base_commit": "eb4658a742a755d408f23b5f96668caaba44842b", "created_at": "2025-05-20", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137045, "functionName": ["NoDuplicateSurplusReservationEntriesOnRecalculateRequisitionWorksheet"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\nindex 70fa87435bd0..c841fa564264 100644\n--- a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n@@ -1038,6 +1038,62 @@ codeunit 137045 \"SCM Bugfixes\"\n Assert.AreEqual(4, ActualCount, AssemblyCommentLineErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemTrackingLinesModalPageHandler')]\n+ procedure NoDuplicateSurplusReservationEntriesOnRecalculateRequisitionWorksheet()\n+ var\n+ Item: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ Vendor: Record Vendor;\n+ RequisitionLine: Record \"Requisition Line\";\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ PurchaseHeader: Record \"Purchase Header\";\n+ NewPurchOrderChoice: Option \" \",\"Make Purch. Orders\",\"Make Purch. Orders & Print\",\"Copy to Req. Wksh\";\n+ Qty: Decimal;\n+ begin\n+ // [SCENARIO 575040] When recalculating an item in a requisition or planning worksheet with no planning results lead to wrong surplus entries in the reservation table whic are added to the item tracking page.\n+ Initialize();\n+\n+ // [GIVEN] Created Lot Tracked Item with Reordering Policy:Lot-for-Lot.\n+ CreateTrackedItem(Item);\n+\n+ // [GIVEN] Created Sales Order with 1 Item and 100 quantity.\n+ Qty := 100;\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, '');\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", Qty);\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+\n+ // [GIVEN] Calculate requisition plan\n+ CalculateRequisitionPlan(RequisitionWkshName, Item);\n+\n+ // [GIVEN] Find Requisition Line\n+ FindRequisitionLine(RequisitionLine, RequisitionWkshName, RequisitionLine.\"Action Message\"::New);\n+\n+ // [GIVEN] Update Vendor No., Planning Flexibility with None and change the quantity to 150\n+ RequisitionLine.Validate(\"Vendor No.\", LibraryPurchase.CreateVendor(Vendor));\n+ RequisitionLine.Validate(\"Planning Flexibility\", RequisitionLine.\"Planning Flexibility\"::None);\n+ RequisitionLine.Validate(Quantity, 150);\n+ RequisitionLine.Modify(true);\n+\n+ // [GIVEN] Assign the Lot On Item tracking Line\n+ RequisitionLine.OpenItemTrackingLines();\n+\n+ // [GIVEN] Set \"Accept Action Message\" on all Requisition lines.\n+ LibraryPlanning.CarryOutPlanWksh(RequisitionLine, 0, NewPurchOrderChoice::\"Make Purch. Orders\", 0, 0, '', '', '', '');\n+\n+ // [GIVEN] Check at reservation entries for Purchase Order created, only 2 reservation entries should exist for the PO\n+ PurchaseHeader.SetRange(\"Buy-from Vendor No.\", Vendor.\"No.\");\n+ PurchaseHeader.FindLast();\n+ AssertReservationEntryCount(PurchaseHeader, 2);\n+\n+ // [WHEN] Calculate Plan again for same item from requisition worksheet\n+ CalculateRequisitionPlan(RequisitionWkshName, Item);\n+\n+ // [THEN] After recalculation, a new reservation entry should NOT be created for the PO\n+ AssertReservationEntryCount(PurchaseHeader, 2);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -1740,6 +1796,15 @@ codeunit 137045 \"SCM Bugfixes\"\n CalculatePlanPlanWksh.RunModal();\n end;\n \n+ local procedure AssertReservationEntryCount(PurchaseHeader: Record \"Purchase Header\"; ExpectedCount: Integer)\n+ var\n+ ReservationEntry: Record \"Reservation Entry\";\n+ begin\n+ ReservationEntry.SetRange(\"Source Type\", Database::\"Purchase Line\");\n+ ReservationEntry.SetRange(\"Source ID\", PurchaseHeader.\"No.\");\n+ Assert.RecordCount(ReservationEntry, ExpectedCount);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ContactListModalPageHandler(var ContactLookup: Page \"Contact List\"; var Response: Action)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\nindex ca1799815e42..c1b41b1585bc 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n@@ -11,6 +11,7 @@ using Microsoft.Inventory.Journal;\n using Microsoft.Inventory.Ledger;\n using Microsoft.Inventory.Location;\n using Microsoft.Inventory.Requisition;\n+using Microsoft.Purchases.Document;\n using Microsoft.Sales.Document;\n using Microsoft.Utilities;\n using Microsoft.Warehouse.Activity;\n@@ -1021,6 +1022,10 @@ table 337 \"Reservation Entry\"\n CreateReservEntry.TransferReservEntry(\n SourceType, SourceSubtype, SourceID, SourceBatchName, SourceProdOrderLine, SourceRefNo,\n QtyPerUOM, OldReservEntry, TransferQty);\n+\n+ if (OldReservEntry.\"Reservation Status\" = OldReservEntry.\"Reservation Status\"::Prospect) and (SourceType = Database::\"Purchase Line\") and (SourceSubtype in [1, 2]) then\n+ ChangeReservationStatusToSurplus(SourceType, SourceSubtype, SourceID, SourceRefNo);\n+\n OnTransferReservationsOnAfterSecondOldReservEntryLoop(OldReservEntry, NewReservEntry, SourceType, SourceSubtype, SourceID);\n until (OldReservEntry.Next() = 0) or (TransferQty = 0);\n end;\n@@ -1125,6 +1130,18 @@ table 337 \"Reservation Entry\"\n OnUpdateSourceCost(Rec, UnitCost);\n end;\n \n+ local procedure ChangeReservationStatusToSurplus(SourceType: Integer; SourceSubtype: Option; SourceID: Code[20]; SourceRefNo: Integer)\n+ var\n+ NewReservationEntry: Record \"Reservation Entry\";\n+ begin\n+ NewReservationEntry.SetSourceFilter(SourceType, SourceSubtype, SourceID, SourceRefNo, true);\n+ NewReservationEntry.SetRange(\"Reservation Status\", NewReservationEntry.\"Reservation Status\"::Prospect);\n+ if NewReservationEntry.FindFirst() then begin\n+ NewReservationEntry.\"Reservation Status\" := NewReservationEntry.\"Reservation Status\"::Surplus;\n+ NewReservationEntry.Modify(true);\n+ end;\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterCopyTrackingFromItemLedgEntry(var ReservationEntry: Record \"Reservation Entry\"; ItemLedgerEntry: Record \"Item Ledger Entry\")\n begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-216572", "base_commit": "74df6483b659ca304abb6f7adda003cda1424db7", "created_at": "2025-05-26", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134227, "functionName": ["CheckDimensionOfRecurringJournalImportAllocationFromAllocationAccount"]}], "PASS_TO_PASS": [], "metadata": {"area": "finance"}, "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\nindex ff710ce5b0e2..aa89a458bd93 100644\n--- a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n@@ -19,6 +19,7 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n LibrarySetupStorage: Codeunit \"Library - Setup Storage\";\n LibraryPurchase: Codeunit \"Library - Purchase\";\n LibrarySales: Codeunit \"Library - Sales\";\n+ LibraryDimension: Codeunit \"Library - Dimension\";\n LibraryTestInitialize: Codeunit \"Library - Test Initialize\";\n GenJnlDocType: Enum \"Gen. Journal Document Type\";\n GenJnlAccountType: Enum \"Gen. Journal Account Type\";\n@@ -31,6 +32,7 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n SkippedLineMsg: Label 'One or more lines has not been posted because the amount is zero.';\n DocumentOutOfBalanceErr: Label 'Document No. %1 is out of balance', Locked = true;\n AllocAccountImportWrongAccTypeErr: Label 'Import from Allocation Account is only allowed for G/L Account Destination account type.', Locked = true;\n+ AllocationDimensionErr: Label 'Allocation dimension is not correct';\n \n [Test]\n [Scope('OnPrem')]\n@@ -1298,6 +1300,48 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n \n end;\n \n+ [Test]\n+ [HandlerFunctions('HandleEditDimensionSetEntriesPage,AllocationAccountListPageHandler,ConfirmHandlerYes')]\n+ procedure CheckDimensionOfRecurringJournalImportAllocationFromAllocationAccount()\n+ var\n+ AllocationAccount: Record \"Allocation Account\";\n+ FirstDimensionValue: Record \"Dimension Value\";\n+ GenJnlAllocation: Record \"Gen. Jnl. Allocation\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ SecondDimensionValue: Record \"Dimension Value\";\n+ GLAccounts: array[2] of Record \"G/L Account\";\n+ AllocationShares: array[2] of Decimal;\n+ DimensionSetID: array[2] of Integer;\n+ begin\n+ // [SCENARIO 579186] In Recurring General Journals Import from Allocation Accounts does not import dimensions.\n+ Initialize();\n+\n+ // [GIVEN] Create Recurring General Journal Batch.\n+ CreateRecurringGenJournalBatch(GenJournalBatch);\n+\n+ // [GIVEN] Create Recurring Journal with a line.\n+ CreateRecurringJnlLine(GenJournalLine, GenJournalBatch, WorkDate(), 0D, LibraryRandom.RandInt(10));\n+\n+ // [GIVEN] Create allocation for general journal line.\n+ LibraryERM.CreateGenJnlAllocation(GenJnlAllocation, GenJournalLine.\"Journal Template Name\", GenJournalLine.\"Journal Batch Name\", GenJournalLine.\"Line No.\");\n+\n+ // [GIVEN] Dimension With Value.\n+ CreateDimensionsWithValues(FirstDimensionValue, SecondDimensionValue);\n+\n+ // [GIVEN] Allocation Account \"XXX\" with 2 lines exists for different G/L Accounts and different Allocation Shares with Dimension.\n+ CreateAllocationAccountWithTwoGLAccLines(AllocationAccount, GLAccounts, AllocationShares, FirstDimensionValue, SecondDimensionValue, DimensionSetID);\n+\n+ // [WHEN] Invoke Import from Allocation Account. Handler chooses Allocation Account \"XXX\" in lookup\n+ LibraryVariableStorage.Enqueue(AllocationAccount.\"No.\");\n+ GenJnlAllocation.ChooseAndImportFromAllocationAccount();\n+ // UI Handled by handler\n+\n+ // [THEN] There are 2 Gen Journal Allocations with the same Dimension as in Allocation Account\n+ VerifyGenJnlAllocationDimension(GenJnlAllocation, GenJournalLine, GLAccounts[1], DimensionSetID[1]);\n+ VerifyGenJnlAllocationDimension(GenJnlAllocation, GenJournalLine, GLAccounts[2], DimensionSetID[2]);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"ERM PostRecurringJournal\");\n@@ -1769,6 +1813,79 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n VendorLedgerEntry.TestField(\"Due Date\", PostingDate + 1);\n end;\n \n+ local procedure CreateDimensionsWithValues(var FirstDimensionValue: Record \"Dimension Value\"; var SecondDimensionValue: Record \"Dimension Value\")\n+ var\n+ Dimension: Record Dimension;\n+ begin\n+ LibraryDimension.CreateDimension(Dimension);\n+ LibraryDimension.CreateDimensionValue(FirstDimensionValue, Dimension.Code);\n+ LibraryDimension.CreateDimensionValue(SecondDimensionValue, Dimension.Code);\n+ end;\n+\n+ local procedure CreateAllocationAccountWithTwoGLAccLines(var AllocationAccount: Record \"Allocation Account\"; var GLAccounts: array[2] of Record \"G/L Account\"; var AllocationShares: array[2] of Decimal; FirstDimensionValue: Record \"Dimension Value\"; SecondDimensionValue: Record \"Dimension Value\"; var DimensionSetID: array[2] of Integer)\n+ var\n+ AllocAccountDistribution: Record \"Alloc. Account Distribution\";\n+ AllocationAccountPage: TestPage \"Allocation Account\";\n+ FixedAllocationAccountCode: Code[20];\n+ begin\n+ FixedAllocationAccountCode := CreateAllocationAccountWithFixedDistribution(AllocationAccountPage);\n+ AddGLDestinationAccountForFixedDistributionWithDimension(AllocationAccountPage, GLAccounts[1]);\n+ AllocationShares[1] := LibraryRandom.RandDecInRange(1, 100, 2);\n+ AllocationAccountPage.FixedAccountDistribution.Share.SetValue(AllocationShares[1]);\n+ SetDimensionToCurrentVariableLine(AllocationAccountPage, FirstDimensionValue);\n+\n+ AllocAccountDistribution.SetRange(\"Allocation Account No.\", FixedAllocationAccountCode);\n+ AllocAccountDistribution.SetRange(\"Account Type\", AllocAccountDistribution.\"Account Type\"::Fixed);\n+ AllocAccountDistribution.SetRange(\"Destination Account Number\", GLAccounts[1].\"No.\");\n+ AllocAccountDistribution.FindFirst();\n+ DimensionSetID[1] := AllocAccountDistribution.\"Dimension Set ID\";\n+\n+ AllocationAccountPage.FixedAccountDistribution.New();\n+ AddGLDestinationAccountForFixedDistributionWithDimension(AllocationAccountPage, GLAccounts[2]);\n+ AllocationShares[2] := LibraryRandom.RandDecInRange(1, 100, 2);\n+ AllocationAccountPage.FixedAccountDistribution.Share.SetValue(AllocationShares[2]);\n+ SetDimensionToCurrentVariableLine(AllocationAccountPage, SecondDimensionValue);\n+\n+ AllocAccountDistribution.Reset();\n+ AllocAccountDistribution.SetRange(\"Allocation Account No.\", FixedAllocationAccountCode);\n+ AllocAccountDistribution.SetRange(\"Account Type\", AllocAccountDistribution.\"Account Type\"::Fixed);\n+ AllocAccountDistribution.SetRange(\"Destination Account Number\", GLAccounts[2].\"No.\");\n+ AllocAccountDistribution.FindFirst();\n+ AllocationAccountPage.FixedAccountDistribution.GoToRecord(AllocAccountDistribution);\n+ DimensionSetID[2] := AllocAccountDistribution.\"Dimension Set ID\";\n+\n+ AllocationAccountPage.Close();\n+\n+ AllocationAccount.Get(FixedAllocationAccountCode);\n+ end;\n+\n+ local procedure SetDimensionToCurrentVariableLine(var AllocationAcccount: TestPage \"Allocation Account\"; var DimensionValue: Record \"Dimension Value\")\n+ begin\n+ LibraryVariableStorage.Enqueue(DimensionValue.SystemId);\n+ AllocationAcccount.FixedAccountDistribution.Dimensions.Invoke();\n+ end;\n+\n+ local procedure AddGLDestinationAccountForFixedDistributionWithDimension(var AllocationAccountPage: TestPage \"Allocation Account\"; var GLAccount: Record \"G/L Account\")\n+ var\n+ DummyAllocAccountDistribution: Record \"Alloc. Account Distribution\";\n+ begin\n+ if GLAccount.\"No.\" = '' then\n+ GLAccount.Get(LibraryERM.CreateGLAccountNoWithDirectPosting());\n+\n+ AllocationAccountPage.FixedAccountDistribution.\"Destination Account Type\".SetValue(DummyAllocAccountDistribution.\"Destination Account Type\"::\"G/L Account\");\n+ AllocationAccountPage.FixedAccountDistribution.\"Destination Account Number\".SetValue(GLAccount.\"No.\");\n+ end;\n+\n+ local procedure VerifyGenJnlAllocationDimension(GenJnlAllocation: Record \"Gen. Jnl. Allocation\"; GenJournalLine: Record \"Gen. Journal Line\"; GLAccount: Record \"G/L Account\"; DimensionSetID: Integer)\n+ begin\n+ GenJnlAllocation.SetRange(\"Journal Template Name\", GenJournalLine.\"Journal Template Name\");\n+ GenJnlAllocation.SetRange(\"Journal Batch Name\", GenJournalLine.\"Journal Batch Name\");\n+ GenJnlAllocation.SetRange(\"Journal Line No.\", GenJournalLine.\"Line No.\");\n+ GenJnlAllocation.SetRange(\"Account No.\", GLAccount.\"No.\");\n+ GenJnlAllocation.FindFirst();\n+ Assert.AreEqual(GenJnlAllocation.\"Dimension Set ID\", DimensionSetID, AllocationDimensionErr);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerYes(Question: Text[1024]; var Reply: Boolean)\n@@ -1821,5 +1938,19 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n NameValueBuffer.ID := LibraryUtility.GetNewRecNo(NameValueBuffer, NameValueBuffer.FieldNo(ID));\n NameValueBuffer.Insert();\n end;\n+\n+ [ModalPageHandler]\n+ procedure HandleEditDimensionSetEntriesPage(var EditDimensionSetEntriesPage: TestPage \"Edit Dimension Set Entries\")\n+ var\n+ DimensionValue: Record \"Dimension Value\";\n+ DimensionValueSystemId: Text;\n+ begin\n+ DimensionValueSystemId := LibraryVariableStorage.DequeueText();\n+ DimensionValue.GetBySystemId(DimensionValueSystemId);\n+ EditDimensionSetEntriesPage.New();\n+ EditDimensionSetEntriesPage.\"Dimension Code\".SetValue(DimensionValue.\"Dimension Code\");\n+ EditDimensionSetEntriesPage.DimensionValueCode.SetValue(DimensionValue.Code);\n+ EditDimensionSetEntriesPage.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al\nindex 130b3e0f3456..7a287e4fb7f1 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al\n@@ -669,6 +669,10 @@ table 221 \"Gen. Jnl. Allocation\"\n begin\n Rec.Validate(\"Account No.\", AllocAccountDistribution.\"Destination Account Number\");\n Rec.Validate(\"Allocation %\", AllocAccountDistribution.Percent);\n+ Rec.Validate(\"Shortcut Dimension 1 Code\", AllocAccountDistribution.\"Global Dimension 1 Code\");\n+ Rec.Validate(\"Shortcut Dimension 2 Code\", AllocAccountDistribution.\"Global Dimension 2 Code\");\n+ Rec.Validate(\"Dimension Set ID\", AllocAccountDistribution.\"Dimension Set ID\");\n+ Rec.Modify(true);\n end;\n \n local procedure CheckGLAccount(var GLAccount: Record \"G/L Account\")\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-217797", "base_commit": "055fbb3433b4edcc3fc5709cf9b0cf7e48a372ac", "created_at": "2025-06-11", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137009, "functionName": ["LookupItemAvailabilityByEventOnItemCardOpenTheCorrectPlanningWorksheetBatch"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al\nindex 63f145ed7b95..cce6dab13ec0 100644\n--- a/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al\n@@ -24,6 +24,7 @@ codeunit 137009 \"SCM Availability by Event\"\n LibraryPurchase: Codeunit \"Library - Purchase\";\n LibraryAssembly: Codeunit \"Library - Assembly\";\n LibraryPatterns: Codeunit \"Library - Patterns\";\n+ LibraryPlanning: Codeunit \"Library - Planning\";\n LibraryRandom: Codeunit \"Library - Random\";\n LibraryVariableStorage: Codeunit \"Library - Variable Storage\";\n LibrarySetupStorage: Codeunit \"Library - Setup Storage\";\n@@ -531,6 +532,62 @@ codeunit 137009 \"SCM Availability by Event\"\n TempInvtPageData.TestField(\"Remaining Forecast\", -ForecastQty + SalesQty);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemAvailabilityByEventPageHandler,PlanningWorksheetModalPageHandler')]\n+ procedure LookupItemAvailabilityByEventOnItemCardOpenTheCorrectPlanningWorksheetBatch()\n+ var\n+ Item: Record Item;\n+ NewPlanningWorkSheetBatchName: Code[10];\n+ OldPlanningWorkSheetBatchName: Code[10];\n+ ItemCard: TestPage \"Item Card\";\n+ PlanningWorksheet: TestPage \"Planning Worksheet\";\n+ begin\n+ // [SCENARIO 575726] Verify that the 'Lookup Item Availability by Event' on the item card opens the correct planning worksheet batch.\n+ Initialize();\n+\n+ // [GIVEN] Create a Item.\n+ LibraryInventory.CreateItem(Item);\n+ LibraryVariableStorage.Enqueue(Item.\"No.\");\n+\n+ // [GIEVN] Get old planning worksheet batch name.\n+ OldPlanningWorkSheetBatchName := GetRequisitionWkshBatch();\n+\n+ // [GIVEN] Open planning worksheet batch.\n+ PlanningWorksheet.OpenEdit();\n+ PlanningWorksheet.New();\n+\n+ // [GIVEN] Set the old planning worksheet batch name.\n+ PlanningWorksheet.CurrentWkshBatchName.SetValue(OldPlanningWorkSheetBatchName);\n+ LibraryVariableStorage.Enqueue(OldPlanningWorkSheetBatchName);\n+\n+ // [GIVEN] Set the item number and quantity in the planning worksheet.\n+ PlanningWorksheet.\"No.\".SetValue(Item.\"No.\");\n+ PlanningWorksheet.Quantity.SetValue(LibraryRandom.RandIntInRange(10, 20));\n+ PlanningWorksheet.Close();\n+\n+ // [GIVEN] Set new planning worksheet batch.\n+ NewPlanningWorkSheetBatchName := CreateRequisitionWkshBatch();\n+ PlanningWorksheet.OpenEdit();\n+ PlanningWorksheet.CurrentWkshBatchName.SetValue(NewPlanningWorkSheetBatchName);\n+ PlanningWorksheet.Close();\n+\n+ // [THEN] Verify the current planning worksheet batch name.\n+ PlanningWorksheet.OpenView();\n+ Assert.Equal(NewPlanningWorkSheetBatchName, PlanningWorksheet.CurrentWkshBatchName.Value);\n+\n+ // [GIVEN] Open Item Card.\n+ ItemCard.OpenEdit();\n+ ItemCard.GoToRecord(Item);\n+\n+ // [WHEN] Invoke Item Availability by Event Action.\n+ ItemCard.\"\".Invoke();\n+ ItemCard.Close();\n+\n+ // [THEN] Verify Lookup Item Availability by Event on the item card opens the correct planning worksheet batch.\n+ // It was verified on the PlanningWorksheetModalPageHandler. \n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n local procedure AutoReservePurchaseLine(PurchaseLine: Record \"Purchase Line\")\n var\n ReservMgt: Codeunit \"Reservation Management\";\n@@ -671,6 +728,35 @@ codeunit 137009 \"SCM Availability by Event\"\n ProdOrderComponent.Insert();\n end;\n \n+ local procedure GetRequisitionWkshBatch(): Code[10]\n+ var\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ begin\n+ RequisitionWkshName.SetRange(\"Template Type\", RequisitionWkshName.\"Template Type\"::Planning);\n+ RequisitionWkshName.FindFirst();\n+\n+ exit(RequisitionWkshName.Name);\n+ end;\n+\n+ local procedure GetRequisitionWkshTemplate(): Code[10]\n+ var\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ begin\n+ RequisitionWkshName.SetRange(\"Template Type\", RequisitionWkshName.\"Template Type\"::Planning);\n+ RequisitionWkshName.FindFirst();\n+\n+ exit(RequisitionWkshName.\"Worksheet Template Name\");\n+ end;\n+\n+ local procedure CreateRequisitionWkshBatch(): Code[10]\n+ var\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ begin\n+ LibraryPlanning.CreateRequisitionWkshName(RequisitionWkshName, GetRequisitionWkshTemplate());\n+\n+ exit(RequisitionWkshName.Name);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ItemAvailabilityByLocationPageHandler(var ItemAvailabilitybyLocation: TestPage \"Item Availability by Location\")\n@@ -722,5 +808,28 @@ codeunit 137009 \"SCM Availability by Event\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ItemAvailabilityByEventPageHandler(var ItemAvailabilitybyEvent: TestPage \"Item Availability by Event\")\n+ var\n+ InventoryPageDataType: Enum \"Inventory Page Data Type\";\n+ begin\n+ ItemAvailabilitybyEvent.IncludePlanningSuggestions.SetValue(true);\n+ ItemAvailabilitybyEvent.Filter.SetFilter(Type, Format(InventoryPageDataType::Plan));\n+ ItemAvailabilitybyEvent.\"Show Document\".Invoke();\n+ ItemAvailabilitybyEvent.OK().Invoke();\n+ end;\n+\n+ [ModalPageHandler]\n+ procedure PlanningWorksheetModalPageHandler(var PlanningWorksheet: TestPage \"Planning Worksheet\")\n+ var\n+ CurrentWkshBatchName: Variant;\n+ ItemNo: Variant;\n+ begin\n+ ItemNo := LibraryVariableStorage.DequeueText();\n+ CurrentWkshBatchName := LibraryVariableStorage.DequeueText();\n+ PlanningWorksheet.CurrentWkshBatchName.AssertEquals(CurrentWkshBatchName);\n+ PlanningWorksheet.\"No.\".AssertEquals(ItemNo);\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al b/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al\nindex 2eaf3fe58c79..986790155380 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al\n@@ -953,7 +953,7 @@ page 99000852 \"Planning Worksheet\"\n // if called from API (such as edit-in-excel), do not filter \n if ClientTypeManagement.GetCurrentClientType() = CLIENTTYPE::ODataV4 then\n exit;\n- OpenedFromBatch := (Rec.\"Journal Batch Name\" <> '') and (Rec.\"Worksheet Template Name\" = '');\n+ OpenedFromBatch := (Rec.\"Journal Batch Name\" <> '') and (Rec.\"Worksheet Template Name\" <> '');\n if OpenedFromBatch then begin\n CurrentWkshBatchName := Rec.\"Journal Batch Name\";\n ReqJnlManagement.OpenJnl(CurrentWkshBatchName, Rec);\ndiff --git a/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al\nindex a2b07ee7538a..033dc48d99c5 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al\n@@ -98,7 +98,10 @@ codeunit 330 ReqJnlManagement\n begin\n OnBeforeOpenJnl(CurrentJnlBatchName, ReqLine);\n \n- CheckTemplateName(ReqLine.GetRangeMax(\"Worksheet Template Name\"), CurrentJnlBatchName);\n+ if (ReqLine.\"Worksheet Template Name\" <> '') and (ReqLine.GetFilter(\"Journal Batch Name\") = '') then\n+ CheckTemplateName(ReqLine.\"Worksheet Template Name\", CurrentJnlBatchName)\n+ else\n+ CheckTemplateName(ReqLine.GetRangeMax(\"Worksheet Template Name\"), CurrentJnlBatchName);\n ReqLine.FilterGroup := 2;\n ReqLine.SetRange(\"Journal Batch Name\", CurrentJnlBatchName);\n ReqLine.FilterGroup := 0;\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-214557", "base_commit": "72ed0651950681ae8b8c302d37d00d3b6f32692b", "created_at": "2025-05-01", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137075, "functionName": ["ReqLineIsNotCreatedWhenCalcRegenPlanForCompItemPresentInRelProdOrder"]}], "PASS_TO_PASS": [], "metadata": {"area": "inventory"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al\nindex 66bf5a9fce6e..d5d73bcc3bcc 100644\n--- a/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al\n@@ -861,6 +861,69 @@\n // [THEN] Order Tracking page is opened with 2 lines for Item \"I\" and quantity = 1(checked in OrderTrackingWithLinesModalPageHandler handler)\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure ReqLineIsNotCreatedWhenCalcRegenPlanForCompItemPresentInRelProdOrder()\n+ var\n+ Item: array[4] of Record Item;\n+ ProductionBOMHeader: array[2] of Record \"Production BOM Header\";\n+ productionBOMLine: array[3] of Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ RequisitionLine: Record \"Requisition Line\";\n+ begin\n+ // [SCENARIO 563946] Requition Line is not created when Stan runs Calculate Regenerative \n+ // Plan action for Component Item if the that Item is present in a Released Production Order \n+ // with required Quantity in its Prod. Order Line.\n+ Initialize();\n+\n+ // [GIVEN] Create four Items.\n+ CreateItem(Item[1]);\n+ CreateItem(Item[2]);\n+ CreateItem(Item[3]);\n+ CreateItem(Item[4]);\n+\n+ // [GIVEN] Create a Production BOM for Item [2] and Item [3].\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader[1], Item[2].\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader[1], ProductionBOMLine[1], '', ProductionBOMLine[1].Type::Item, Item[2].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader[1], ProductionBOMLine[2], '', ProductionBOMLine[2].Type::Item, Item[3].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+\n+ // [GIVEN] Validate \"Status\" in Production BOM Header [1].\n+ ProductionBOMHeader[1].Validate(\"Status\", ProductionBOMHeader[1].Status::Certified);\n+ ProductionBOMHeader[1].Modify(true);\n+\n+ // [GIVEN] Create a Production BOM for Item [4].\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader[2], Item[4].\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader[2], ProductionBOMLine[3], '', ProductionBOMLine[3].Type::Item, Item[4].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+\n+ // [GIVEN] Validate \"Status\" in Production BOM Header [2].\n+ ProductionBOMHeader[2].Validate(\"Status\", ProductionBOMHeader[2].Status::Certified);\n+ ProductionBOMHeader[2].Modify(true);\n+\n+ // [GIVEN] Validate \"Production BOM No.\" in Item [1].\n+ Item[1].Validate(\"Production BOM No.\", ProductionBOMHeader[1].\"No.\");\n+ Item[1].Modify(true);\n+\n+ // [GIVEN] Validate \"Production BOM No.\" in Item [2].\n+ Item[2].Validate(\"Production BOM No.\", ProductionBOMHeader[2].\"No.\");\n+ Item[2].Modify(true);\n+\n+ // [GIVEN] Validate \"Production BOM No.\" in Item [3].\n+ Item[3].Validate(\"Production BOM No.\", ProductionBOMHeader[2].\"No.\");\n+ Item[3].Modify(true);\n+\n+ // [GIVEN] Create and Refresh Released Production Order.\n+ CreateAndRefreshReleasedProductionOrder(ProductionOrder, Item[1].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+\n+ // [GIVEN] Calculate Regenerative Plan for Planning Worksheet.\n+ CalculateRegenPlanForPlanningWorksheet(Item[4]);\n+\n+ // [WHEN] Find Requisition Line.\n+ RequisitionLine.SetRange(\"No.\", Item[4].\"No.\");\n+\n+ // [THEN] Requisition Line is not found.\n+ Assert.IsTrue(RequisitionLine.IsEmpty(), StrSubstNo(ReqLineShouldNotExistErr, ''));\n+ end;\n+\n local procedure Initialize()\n var\n RequisitionLine: Record \"Requisition Line\";\n@@ -1597,6 +1660,15 @@\n ReservationEntry.Insert();\n end;\n \n+ local procedure CreateItem(var Item: Record Item)\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ Item.Validate(\"Manufacturing Policy\", Item.\"Manufacturing Policy\"::\"Make-to-Order\");\n+ Item.Modify(true);\n+ end;\n+\n [RequestPageHandler]\n [Scope('OnPrem')]\n procedure CalculatePlanPlanWkshRequestPageHandler(var CalculatePlanPlanWksh: TestRequestPage \"Calculate Plan - Plan. Wksh.\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al\nindex e3a6cf2ff5fb..2acbb26614e2 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al\n@@ -15,6 +15,7 @@ using Microsoft.Inventory.Planning;\n using Microsoft.Inventory.Requisition;\n using Microsoft.Inventory.Setup;\n using Microsoft.Inventory.Transfer;\n+using Microsoft.Manufacturing.Document;\n using Microsoft.Pricing.Calculation;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.Vendor;\n@@ -982,6 +983,9 @@ codeunit 99000854 \"Inventory Profile Offsetting\"\n CanBeRescheduled: Boolean;\n ItemInventoryExists: Boolean;\n begin\n+ if CheckDemandAndSupplyQuantityAreEqual(SupplyInvtProfile, DemandInvtProfile) then\n+ exit;\n+\n xDemandInvtProfile.CopyFilters(DemandInvtProfile);\n xSupplyInvtProfile.CopyFilters(SupplyInvtProfile);\n ItemInventoryExists := CheckItemInventoryExists(SupplyInvtProfile);\n@@ -1097,6 +1101,28 @@ codeunit 99000854 \"Inventory Profile Offsetting\"\n OnAfterMatchAttributes(SupplyInvtProfile, DemandInvtProfile, TempTrkgReservEntry);\n end;\n \n+ local procedure CheckDemandAndSupplyQuantityAreEqual(var SupplyInvtProfile: Record \"Inventory Profile\"; var DemandInvtProfile: Record \"Inventory Profile\"): Boolean\n+ var\n+ TotalDemandQty: Decimal;\n+ TotalSupplyQty: Decimal;\n+ begin\n+ if (SupplyInvtProfile.\"Source Type\" <> Database::\"Prod. Order Line\") or (DemandInvtProfile.\"Source Type\" <> Database::\"Prod. Order Component\") then\n+ exit(false);\n+\n+ if DemandInvtProfile.FindSet() then\n+ repeat\n+ TotalDemandQty += DemandInvtProfile.Quantity;\n+ until DemandInvtProfile.Next() = 0;\n+\n+ if SupplyInvtProfile.FindSet() then\n+ repeat\n+ TotalSupplyQty += SupplyInvtProfile.Quantity;\n+ until SupplyInvtProfile.Next() = 0;\n+\n+ if TotalSupplyQty = TotalDemandQty then\n+ exit(true);\n+ end;\n+\n local procedure DecreaseQtyForMaxQty(var SupplyInvtProfile: Record \"Inventory Profile\"; ReduceQty: Decimal)\n begin\n if ReduceQty > 0 then begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-212355", "base_commit": "a7de1e6b1a271e60b86657a69a98e863b2b85d33", "created_at": "2025-04-06", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137154, "functionName": ["InputQtyAndStartingDateTimeIsRecalculatedWhenReplanProdOrder"]}], "PASS_TO_PASS": [], "metadata": {"area": "manufacturing"}, "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al\nindex 972aa5e52834..c2e1e71567ec 100644\n--- a/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al\n@@ -64,6 +64,8 @@ codeunit 137154 \"SCM Warehouse Management II\"\n ReceiptLinesNotCreatedErr: Label 'There are no warehouse receipt lines created.';\n ItemTrackingMode: Option \" \",\"Assign Lot No.\",\"Assign Multiple Lot No.\",\"Assign Serial No.\",\"Assign Lot And Serial\",\"Select Entries\",\"Blank Quantity Base\",\"Assign Lot No. & Expiration Date\",\"Assign Manual Lot Nos\",\"Show Entries\";\n DescriptionMustBeSame: Label 'Description must be same.';\n+ InputQtyErr: Label 'Input Quantity Must be %1 in %2', Comment = '1% = Remaining Quanity value, %2 = Prod. Order Routing Line';\n+ StartingDateTimeErr: Label 'Starting Date-Time must not be %1 in %2', Comment = '%1 = StartingDateTime value, %2 = Prod. Order Routing Line.';\n \n [Test]\n [HandlerFunctions('ReservationPageHandler')]\n@@ -3447,6 +3449,97 @@ codeunit 137154 \"SCM Warehouse Management II\"\n LibraryWarehouse.PostWhseShipment(WarehouseShipmentHeader, false);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ProductionJournalPageHandler,ConfirmHandlerYes,MessageHandlerNotext')]\n+ procedure InputQtyAndStartingDateTimeIsRecalculatedWhenReplanProdOrder()\n+ var\n+ CompItem, ProdItem : Record Item;\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ RoutingHeader: Record \"Routing Header\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProdOrderRoutingLine: Record \"Prod. Order Routing Line\";\n+ WorkCenter: Record \"Work Center\";\n+ Direction: Option Forward,Backward;\n+ CalcMethod: Option \"No Levels\",\"One level\",\"All levels\";\n+ StartingDateTime: DateTime;\n+ begin\n+ // [SCENARIO 565975] \"Input Quantity\" and \"Starting Date-Time\" in Prod. Order Routing Line is \n+ // recalculated when Production Journal is posted and Stan runs Replan Production Order Report.\n+ Initialize();\n+\n+ // [GIVEN] Create a Component Item and Validate \"Replenishment System\", \n+ // \"Manufacturing Policy\" and \"Flushing Method\".\n+ LibraryInventory.CreateItem(CompItem);\n+ CompItem.Validate(\"Replenishment System\", CompItem.\"Replenishment System\"::Purchase);\n+ CompItem.Validate(\"Manufacturing Policy\", CompItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ CompItem.Validate(\"Flushing Method\", CompItem.\"Flushing Method\"::\"Pick + Manual\");\n+ CompItem.Modify(true);\n+\n+ // [GIVEN] Create a Work Center.\n+ CreateWorkCenter(WorkCenter);\n+\n+ // [GIVEN] Create and Certify Routing.\n+ CreateAndCertifyRouting(RoutingHeader, WorkCenter);\n+\n+ // [GIVEN] Create and Certify Production BOM.\n+ CreateAndCertifyProductionBOM(ProductionBOMLine, CompItem, LibraryRandom.RandIntInRange(10, 10));\n+\n+ // [GIVEN] Create a Production Item and Validate \"Replenishment System\", \n+ // \"Manufacturing Policy\", \"Routing No.\" and \"Production BOM No.\".\n+ LibraryInventory.CreateItem(ProdItem);\n+ ProdItem.Validate(\"Replenishment System\", ProdItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProdItem.Validate(\"Manufacturing Policy\", ProdItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ ProdItem.Validate(\"Routing No.\", RoutingHeader.\"No.\");\n+ ProdItem.Validate(\"Production BOM No.\", ProductionBOMLine.\"Production BOM No.\");\n+ ProdItem.Modify(true);\n+\n+ // [GIVEN] Set Item Inventory.\n+ SetItemInventory(CompItem, LibraryRandom.RandIntInRange(500, 500));\n+\n+ // [GIVEN] Create and Refresh Production Order.\n+ CreateAndRefreshProductionOrder(ProductionOrder, ProdItem.\"No.\", LibraryRandom.RandIntInRange(50, 50));\n+\n+ // [GIVEN] Find Prod. Order Routing Line.\n+ ProdOrderRoutingLine.SetRange(\"Routing No.\", RoutingHeader.\"No.\");\n+ ProdOrderRoutingLine.FindFirst();\n+\n+ // [GIVEN] Generate and save Starting Date-Time in a Variable.\n+ StartingDateTime := ProdOrderRoutingLine.\"Starting Date-Time\";\n+\n+ // [GIVEN] Open Production Journal.\n+ OpenProductionJournal(ProductionOrder.\"No.\");\n+\n+ // [GIVEN] Run Replan Production Order Report.\n+ LibraryManufacturing.RunReplanProductionOrder(ProductionOrder, Direction::Backward, CalcMethod::\"No Levels\");\n+\n+ // [GIVEN] Find Prod. Order Line.\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrder.\"No.\");\n+ ProdOrderLine.FindFirst();\n+\n+ // [WHEN] Find Prod. Order Routing Line.\n+ ProdOrderRoutingLine.SetRange(\"Routing No.\", RoutingHeader.\"No.\");\n+ ProdOrderRoutingLine.FindFirst();\n+\n+ // [THEN] \"Input Quantity\" in Prod. Order Routing Line is equal to \"Remaining Quantity\" of Prod. Order Line.\n+ Assert.AreEqual(\n+ ProdOrderLine.\"Remaining Quantity\",\n+ ProdOrderRoutingLine.\"Input Quantity\",\n+ StrSubstNo(\n+ InputQtyErr,\n+ ProdOrderLine.\"Remaining Quantity\",\n+ ProdOrderRoutingLine.TableCaption()));\n+\n+ // [THEN] \"Starting Date-Time\" in Prod. Order Routing Line is equal to StartingDateTime.\n+ Assert.AreNotEqual(\n+ StartingDateTime,\n+ ProdOrderRoutingLine.\"Starting Date-Time\",\n+ StrSubstNo(\n+ StartingDateTimeErr,\n+ StartingDateTime,\n+ ProdOrderRoutingLine.TableCaption()));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5174,6 +5267,71 @@ codeunit 137154 \"SCM Warehouse Management II\"\n LibraryInventory.PostItemJournalBatch(ItemJournalBatch);\n end;\n \n+ local procedure CreateAndRefreshProductionOrder(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal)\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder, ProductionOrder.Status::Released, ProductionOrder.\"Source Type\"::Item, ItemNo, Quantity);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+ end;\n+\n+ local procedure SetItemInventory(Item: Record Item; Quantity: Decimal)\n+ var\n+ ItemJnlTemplate: Record \"Item Journal Template\";\n+ ItemJnlBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ Item.TestField(\"No.\");\n+\n+ LibraryInventory.CreateItemJournalTemplate(ItemJnlTemplate);\n+ LibraryInventory.CreateItemJournalBatch(ItemJnlBatch, ItemJnlTemplate.Name);\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJnlTemplate.Name, ItemJnlBatch.Name, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Item.\"No.\", Quantity);\n+\n+ LibraryInventory.PostItemJournalLine(ItemJnlTemplate.Name, ItemJnlBatch.Name);\n+ end;\n+\n+ local procedure OpenProductionJournal(No: Code[20])\n+ var\n+ ReleasedProductionOrder: TestPage \"Released Production Order\";\n+ begin\n+ ReleasedProductionOrder.OpenEdit();\n+ ReleasedProductionOrder.FILTER.SetFilter(\"No.\", No);\n+ ReleasedProductionOrder.ProdOrderLines.ProductionJournal.Invoke();\n+ end;\n+\n+ local procedure CreateWorkCenter(var WorkCenter: Record \"Work Center\")\n+ begin\n+ LibraryManufacturing.CreateWorkCenterWithCalendar(WorkCenter);\n+ WorkCenter.Validate(\"Unit Cost\", LibraryRandom.RandDec(100, 2));\n+ WorkCenter.Validate(Capacity, LibraryRandom.RandIntInRange(3, 3));\n+ WorkCenter.Validate(Efficiency, LibraryRandom.RandIntInRange(100, 100));\n+ WorkCenter.Modify(true);\n+ end;\n+\n+ local procedure CreateAndCertifyRouting(var RoutingHeader: Record \"Routing Header\"; WorkCenter: Record \"Work Center\")\n+ var\n+ RoutingLine: Record \"Routing Line\";\n+ begin\n+ LibraryManufacturing.CreateRoutingHeader(RoutingHeader, RoutingHeader.Type::Serial);\n+ LibraryManufacturing.CreateRoutingLine(RoutingHeader, RoutingLine, '', Format(LibraryRandom.RandIntInRange(10, 10)), RoutingLine.Type::\"Work Center\", WorkCenter.\"No.\");\n+ RoutingLine.Validate(\"Setup Time\", LibraryRandom.RandIntInRange(10, 10));\n+ RoutingLine.Validate(\"Run Time\", LibraryRandom.RandIntInRange(10, 10));\n+ RoutingLine.Modify(true);\n+\n+ RoutingHeader.Validate(Status, RoutingHeader.Status::Certified);\n+ RoutingHeader.Modify(true);\n+ end;\n+\n+ local procedure CreateAndCertifyProductionBOM(var ProductionBOMLine: Record \"Production BOM Line\"; Item: Record Item; Qty: Decimal)\n+ var\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ begin\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, Item.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(\n+ ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, Item.\"No.\", Qty);\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify(true);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure EnterQuantityToCreatePageHandler(var EnterQuantityToCreate: TestPage \"Enter Quantity to Create\")\n@@ -5347,6 +5505,19 @@ codeunit 137154 \"SCM Warehouse Management II\"\n SourceDocumentFilterCard.Run.Invoke();\n end;\n \n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ProductionJournalPageHandler(var ProductionJournal: TestPage \"Production Journal\")\n+ begin\n+ ProductionJournal.First();\n+ ProductionJournal.Quantity.SetValue(LibraryRandom.RandIntInRange(200, 200));\n+ ProductionJournal.Next();\n+ ProductionJournal.\"Setup Time\".SetValue(LibraryRandom.RandIntInRange(10, 10));\n+ ProductionJournal.\"Run Time\".SetValue(LibraryRandom.RandIntInRange(10, 10));\n+ ProductionJournal.\"Output Quantity\".SetValue(LibraryRandom.RandIntInRange(20, 20));\n+ ProductionJournal.Post.Invoke();\n+ end;\n+\n [PageHandler]\n [Scope('OnPrem')]\n procedure GLPostingPreviewPageHandler(var ShowAllEntries: TestPage \"G/L Posting Preview\")\n@@ -5372,6 +5543,11 @@ codeunit 137154 \"SCM Warehouse Management II\"\n Assert.IsTrue(StrPos(Message, LocalMessage) > 0, Message);\n end;\n \n+ [MessageHandler]\n+ procedure MessageHandlerNotext(Message: Text[1024])\n+ begin\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandler(ConfirmMessage: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al\nindex 33305adaa10c..25cb5cb00d64 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al\n@@ -65,7 +65,7 @@ report 99001026 \"Replan Production Order\"\n \"Ending Time\" := \"Prod. Order Line\".\"Ending Time\";\n Modify();\n end;\n- CalcProdOrderRtngLine.CalculateRoutingLine(\"Prod. Order Routing Line\", Direction, true);\n+ CalcProdOrderRtngLine.ReplanRoutingLine(\"Prod. Order Routing Line\", Direction, true);\n end;\n Modify();\n end;\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al\nindex c46c8c20688a..1481dab83903 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al\n@@ -1261,6 +1261,7 @@ codeunit 99000774 \"Calculate Routing Line\"\n OnCalculateRoutingLineOnBeforeProdOrderCapNeedReset(ProdOrderRoutingLine, ProdOrderRoutingLine2);\n \n ProdOrderCapNeed.Reset();\n+ ProdOrderCapNeed.SetLoadFields(Status, \"Prod. Order No.\", \"Requested Only\", \"Routing No.\", \"Routing Reference No.\", \"Operation No.\");\n ProdOrderCapNeed.SetRange(Status, ProdOrderRoutingLine.Status);\n ProdOrderCapNeed.SetRange(\"Prod. Order No.\", ProdOrderRoutingLine.\"Prod. Order No.\");\n ProdOrderCapNeed.SetRange(\"Requested Only\", false);\n@@ -2114,6 +2115,118 @@ codeunit 99000774 \"Calculate Routing Line\"\n CalendarEntry.SetRange(\"Ending Date-Time\", 0DT, CreateDateTime(DateValue + 1, TimeValue));\n end;\n \n+ procedure ReplanRoutingLine(var ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\"; Direction: Option Forward,Backward; CalcStartEndDate: Boolean)\n+ var\n+ ProdOrderCapacityNeed: Record \"Prod. Order Capacity Need\";\n+ MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n+ ExpectedOperOutput: Decimal;\n+ ActualOperOutput: Decimal;\n+ TotalQtyPerOperation: Decimal;\n+ TotalCapacityPerOperation: Decimal;\n+ begin\n+ MfgSetup.Get();\n+\n+ ProdOrderRoutingLine := ProdOrderRoutingLine2;\n+\n+ WaitTimeOnly :=\n+ (ProdOrderRoutingLine.\"Setup Time\" = 0) and (ProdOrderRoutingLine.\"Run Time\" = 0) and\n+ (ProdOrderRoutingLine.\"Move Time\" = 0);\n+\n+ if ProdOrderRoutingLine.\"Ending Time\" = 0T then\n+ ProdOrderRoutingLine.\"Ending Time\" := 000000T;\n+\n+ if ProdOrderRoutingLine.\"Starting Time\" = 0T then\n+ ProdOrderRoutingLine.\"Starting Time\" := 000000T;\n+\n+ ProdOrderRoutingLine.\"Expected Operation Cost Amt.\" := 0;\n+ ProdOrderRoutingLine.\"Expected Capacity Ovhd. Cost\" := 0;\n+ ProdOrderRoutingLine.\"Expected Capacity Need\" := 0;\n+\n+ ProdOrderCapacityNeed.Reset();\n+ ProdOrderCapacityNeed.SetRange(Status, ProdOrderRoutingLine.Status);\n+ ProdOrderCapacityNeed.SetRange(\"Prod. Order No.\", ProdOrderRoutingLine.\"Prod. Order No.\");\n+ ProdOrderCapacityNeed.SetRange(\"Requested Only\", false);\n+ ProdOrderCapacityNeed.SetRange(\"Routing No.\", ProdOrderRoutingLine.\"Routing No.\");\n+ ProdOrderCapacityNeed.SetRange(\"Routing Reference No.\", ProdOrderRoutingLine.\"Routing Reference No.\");\n+ ProdOrderCapacityNeed.SetRange(\"Operation No.\", ProdOrderRoutingLine.\"Operation No.\");\n+ ProdOrderCapacityNeed.DeleteAll();\n+\n+ NextCapNeedLineNo := 1;\n+\n+ ProdOrderRoutingLine.TestField(\"Work Center No.\");\n+\n+ CurrentWorkCenterNo := '';\n+ Workcenter.Get(ProdOrderRoutingLine.\"Work Center No.\");\n+ if ProdOrderRoutingLine.Type = ProdOrderRoutingLine.Type::\"Machine Center\" then begin\n+ MachineCenter.Get(ProdOrderRoutingLine.\"No.\");\n+ Workcenter.\"Queue Time\" := MachineCenter.\"Queue Time\";\n+ Workcenter.\"Queue Time Unit of Meas. Code\" := MachineCenter.\"Queue Time Unit of Meas. Code\";\n+ end;\n+ if not CalcStartEndDate then\n+ Clear(Workcenter.\"Queue Time\");\n+ ProdOrder.Get(ProdOrderRoutingLine.Status, ProdOrderRoutingLine.\"Prod. Order No.\");\n+\n+ ProdOrderQty := 0;\n+ TotalScrap := 0;\n+ TotalLotSize := 0;\n+ ProdOrderLine.SetRange(Status, ProdOrderRoutingLine.Status);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProdOrderRoutingLine.\"Prod. Order No.\");\n+ ProdOrderLine.SetRange(\"Routing Reference No.\", ProdOrderRoutingLine.\"Routing Reference No.\");\n+ ProdOrderLine.SetRange(\"Routing No.\", ProdOrderRoutingLine.\"Routing No.\");\n+ ProdOrderLine.SetLoadFields(\"Quantity (Base)\", \"Scrap %\", \"Prod. Order No.\", \"Line No.\", Status, \"Routing No.\", \"Routing Version Code\", \"Ending Date\", \"Ending Time\");\n+ if ProdOrderLine.Find('-') then begin\n+ ExpectedOperOutput := 0;\n+ repeat\n+ ExpectedOperOutput := ExpectedOperOutput + ProdOrderLine.\"Quantity (Base)\";\n+ TotalScrap := TotalScrap + ProdOrderLine.\"Scrap %\";\n+ until ProdOrderLine.Next() = 0;\n+ ActualOperOutput := MfgCostCalcMgt.CalcActOutputQtyBase(ProdOrderLine, ProdOrderRoutingLine);\n+ ProdOrderQty := ExpectedOperOutput - ActualOperOutput;\n+ if ProdOrderQty < 0 then\n+ ProdOrderQty := 0;\n+ end;\n+\n+ MaxLotSize :=\n+ ProdOrderQty *\n+ (1 + ProdOrderRoutingLine.\"Scrap Factor % (Accumulated)\") *\n+ (1 + TotalScrap / 100) +\n+ ProdOrderRoutingLine.\"Fixed Scrap Qty. (Accum.)\";\n+\n+ ProdOrderRoutingLine.\"Input Quantity\" := MaxLotSize;\n+\n+ if ActualOperOutput > 0 then\n+ TotalQtyPerOperation :=\n+ ExpectedOperOutput *\n+ (1 + ProdOrderRoutingLine.\"Scrap Factor % (Accumulated)\") *\n+ (1 + TotalScrap / 100) +\n+ ProdOrderRoutingLine.\"Fixed Scrap Qty. (Accum.)\"\n+ else\n+ TotalQtyPerOperation := MaxLotSize;\n+\n+ TotalCapacityPerOperation :=\n+ Round(\n+ TotalQtyPerOperation *\n+ ProdOrderRoutingLine.RunTimePer() *\n+ CalendarMgt.QtyperTimeUnitofMeasure(\n+ ProdOrderRoutingLine.\"Work Center No.\", ProdOrderRoutingLine.\"Run Time Unit of Meas. Code\"),\n+ UOMMgt.QtyRndPrecision());\n+\n+ if MfgSetup.\"Cost Incl. Setup\" then\n+ CalcCostInclSetup(ProdOrderRoutingLine, TotalCapacityPerOperation);\n+\n+ CalcExpectedCost(ProdOrderRoutingLine, TotalQtyPerOperation, TotalCapacityPerOperation);\n+\n+ if ProdOrderRoutingLine.\"Schedule Manually\" then\n+ CalculateRoutingLineFixed()\n+ else\n+ if Direction = Direction::Backward then\n+ CalcRoutingLineBack(CalcStartEndDate)\n+ else\n+ CalcRoutingLineForward(CalcStartEndDate);\n+\n+ ProdOrderRoutingLine2 := ProdOrderRoutingLine;\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterCalcCostInclSetup(ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; var TotalCapacityPerOperation: Decimal)\n begin\n"}
-{"repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-214825", "base_commit": "9a03d309156dd751b1a508767c678093c9516506", "created_at": "2025-05-06", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136350, "functionName": ["CheckUnavailableItemQtyWhenAddProjectPlanningLinesBeforeThePreviousOne"]}], "PASS_TO_PASS": [], "metadata": {"area": "project"}, "test_patch": "diff --git a/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al b/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al\nindex bb7f40e246dc..8aac1963c2d5 100644\n--- a/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al\n@@ -2248,6 +2248,36 @@ codeunit 136350 \"UT T Job\"\n Assert.IsFalse(PurchaseLine.IsEmpty, 'Purchase Line not created for Job Task' + JobTask.\"Job Task No.\");\n end;\n \n+ [Test]\n+ [HandlerFunctions('CheckPurchOrderFromJobModalPageHandlerHaveLines')]\n+ procedure CheckUnavailableItemQtyWhenAddProjectPlanningLinesBeforeThePreviousOne()\n+ var\n+ Item, Item2 : Record Item;\n+ JobPlanningLines: TestPage \"Job Planning Lines\";\n+ begin\n+ // [SCENARIO 574938] Create Purchase Order from Project not working as expected if we add Project Planning Lines before the previous ones.\n+ Initialize();\n+\n+ // [GIVEN] Create 2 New Item.\n+ LibraryInventory.CreateItem(Item);\n+ LibraryInventory.CreateItem(Item2);\n+\n+ // [GIVEN] Create Job X with Job Task and 2 Job Planning Lines.\n+ CreateJobAndJobTask();\n+ CreateJobPlanningLineWithItem(JobPlanningLine.\"Line Type\"::\"Both Budget and Billable\", Item.\"No.\", LibraryRandom.RandInt(100));\n+ CreateJobPlanningLineBeforePreviousLine(JobPlanningLine.\"Line Type\"::\"Both Budget and Billable\", Item2.\"No.\", LibraryRandom.RandInt(100));\n+\n+ // [WHEN] Open Job Planning Lines.\n+ JobPlanningLines.OpenEdit();\n+ JobPlanningLines.GoToRecord(JobPlanningLine);\n+ LibraryVariableStorage.Clear();\n+ LibraryVariableStorage.Enqueue(Item.\"No.\");\n+\n+ // [WHEN] Create Purchase Order from Job Planning Lines.\n+ JobPlanningLines.CreatePurchaseOrder.Invoke();//assert check\n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -2617,6 +2647,30 @@ codeunit 136350 \"UT T Job\"\n until DefaultDimension.Next() = 0;\n end;\n \n+ local procedure CreateJobPlanningLineBeforePreviousLine(LineType: Enum \"Job Planning Line Line Type\"; ItemNo: Code[20]; Quantity: Decimal)\n+ var\n+ JobPlanLine: Record \"Job Planning Line\";\n+ LineNo: Integer;\n+ begin\n+ JobPlanLine.SetRange(\"Job No.\", JobTask.\"Job No.\");\n+ JobPlanLine.SetRange(\"Job Task No.\", JobTask.\"Job Task No.\");\n+ if JobPlanLine.FindFirst() then;\n+ LineNo := JobPlanLine.\"Line No.\" / 2;\n+ JobPlanningLine.Init();\n+ JobPlanningLine.Validate(\"Job No.\", JobTask.\"Job No.\");\n+ JobPlanningLine.Validate(\"Job Task No.\", JobTask.\"Job Task No.\");\n+ JobPlanningLine.Validate(\"Line No.\", LineNo);\n+ JobPlanningLine.Insert(true);\n+\n+ JobPlanningLine.Validate(\"Planning Date\", WorkDate());\n+ JobPlanningLine.Validate(\"Line Type\", LineType);\n+ JobPlanningLine.Validate(Type, JobPlanningLine.Type::Item);\n+ JobPlanningLine.Validate(Description, LibraryUtility.GenerateGUID());\n+ JobPlanningLine.Validate(\"No.\", ItemNo);\n+ JobPlanningLine.Validate(Quantity, Quantity);\n+ JobPlanningLine.Modify(true);\n+ end;\n+\n [EventSubscriber(ObjectType::Table, Database::\"Job\", 'OnAfterModifyEvent', '', false, false)]\n local procedure InsertNameValueBufferOnJobModify(var Rec: Record Job; var xRec: Record Job; RunTrigger: Boolean)\n var\n@@ -2730,6 +2784,13 @@ codeunit 136350 \"UT T Job\"\n PurchOrderFromSalesOrder.OK().Invoke();\n end;\n \n+ [ModalPageHandler]\n+ procedure CheckPurchOrderFromJobModalPageHandlerHaveLines(var PurchOrderFromSalesOrder: TestPage \"Purch. Order From Sales Order\")\n+ begin\n+ //[THEN] Check Purch. Order From Sales Order Page have Record.\n+ PurchOrderFromSalesOrder.\"No.\".AssertEquals(LibraryVariableStorage.DequeueText());\n+ end;\n+\n [MessageHandler]\n procedure MessageHandler(Message: Text[1024])\n var\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al\nindex 604bb9158a26..2da4897165fb 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al\n@@ -78,6 +78,7 @@ codeunit 1018 \"Purchase Doc. From Job\"\n JobPlanningLine.SetRange(\"Job Task No.\", JobTask.\"Job Task No.\");\n if JobPlanningLine.IsEmpty() then\n exit;\n+ JobPlanningLine.SetCurrentKey(\"Job Contract Entry No.\");\n JobPlanningLine.FindSet();\n RecRef.GetTable(JobPlanningLine);\n ContractEntryNoFilter := SelectionFilterMgt.GetSelectionFilter(RecRef, JobPlanningLine.FieldNo(\"Job Contract Entry No.\"));\n"}
-{"repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-4766", "base_commit": "700d04453d3f0851ce7b7e34eb50b283f7c10e52", "created_at": "2025-09-15T15:39:32Z", "environment_setup_version": "27.0", "project_paths": ["src\\Apps\\W1\\Subscription Billing\\App", "src\\Apps\\W1\\Subscription Billing\\Test"], "FAIL_TO_PASS": [{"codeunitID": 148155, "functionName": ["ContractLineDisconnectServiceOnNoChange"]}, {"codeunitID": 148154, "functionName": ["ContractLineDisconnectServiceOnNoChange"]}], "PASS_TO_PASS": [], "metadata": {"area": "subscription billing"}, "test_patch": "diff --git a/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al\nindex 7e485c8c43..e945075fa8 100644\n--- a/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al\n+++ b/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al\n@@ -613,23 +613,62 @@ codeunit 148155 \"Contracts Test\"\n CustomerContractLine: Record \"Cust. Sub. Contract Line\";\n ServiceCommitment: Record \"Subscription Line\";\n ServiceObject: Record \"Subscription Header\";\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after Type has changed.', Locked = true;\n EntryNo: Integer;\n begin\n- // Test: Subscription Line should be disconnected from the contract when the line type changes\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the line type changes\n Initialize();\n \n+ // [GIVEN] A customer contract with a connected Subscription Line\n SetupNewContract(false, ServiceObject, CustomerContract);\n \n- CustomerContractLine.Reset();\n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n CustomerContractLine.SetRange(\"Subscription Contract No.\", CustomerContract.\"No.\");\n CustomerContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n CustomerContractLine.SetFilter(\"Subscription Header No.\", '<>%1', '');\n CustomerContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n CustomerContractLine.FindFirst();\n EntryNo := CustomerContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The contract line type is changed from Item to Comment\n CustomerContractLine.Validate(\"Contract Line Type\", CustomerContractLine.\"Contract Line Type\"::Comment);\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n+ ServiceCommitment.Get(EntryNo);\n+ Assert.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n+ end;\n+\n+ [Test]\n+ [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]\n+ procedure ContractLineDisconnectServiceOnNoChange()\n+ var\n+ CustomerContract: Record \"Customer Subscription Contract\";\n+ CustomerContractLine: Record \"Cust. Sub. Contract Line\";\n+ ServiceCommitment: Record \"Subscription Line\";\n+ ServiceObject: Record \"Subscription Header\";\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after No. has changed.', Locked = true;\n+ EntryNo: Integer;\n+ begin\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the Item No. is cleared\n+ Initialize();\n+\n+ // [GIVEN] A customer contract with a connected Subscription Line\n+ SetupNewContract(false, ServiceObject, CustomerContract);\n+\n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n+ CustomerContractLine.SetRange(\"Subscription Contract No.\", CustomerContract.\"No.\");\n+ CustomerContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n+ CustomerContractLine.SetFilter(\"Subscription Header No.\", '<>%1', '');\n+ CustomerContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n+ CustomerContractLine.FindFirst();\n+ EntryNo := CustomerContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The Item No. is cleared on the contract line\n+ CustomerContractLine.Validate(\"No.\", '');\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n ServiceCommitment.Get(EntryNo);\n- ServiceCommitment.TestField(\"Subscription Contract No.\", '');\n+ Assert.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n end;\n \n [Test]\ndiff --git a/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al\nindex c47f577102..b827f99217 100644\n--- a/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al\n+++ b/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al\n@@ -338,11 +338,15 @@ codeunit 148154 \"Vendor Contracts Test\"\n procedure ContractLineDisconnectServiceOnTypeChange()\n var\n EntryNo: Integer;\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after Type has changed.', Locked = true;\n begin\n- // Test: Subscription Line should be disconnected from the contract when the line type changes\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the line type changes\n Initialize();\n+\n+ // [GIVEN] A vendor contract with a connected Subscription Line\n SetupNewContract(false);\n \n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n VendorContractLine.Reset();\n VendorContractLine.SetRange(\"Subscription Contract No.\", VendorContract.\"No.\");\n VendorContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n@@ -350,9 +354,43 @@ codeunit 148154 \"Vendor Contracts Test\"\n VendorContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n VendorContractLine.FindFirst();\n EntryNo := VendorContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The contract line type is changed from Item to Comment\n VendorContractLine.Validate(\"Contract Line Type\", VendorContractLine.\"Contract Line Type\"::Comment);\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n+ ServiceCommitment.Get(EntryNo);\n+ AssertThat.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n+ end;\n+\n+ [Test]\n+ [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]\n+ procedure ContractLineDisconnectServiceOnNoChange()\n+ var\n+ EntryNo: Integer;\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after No. has changed.', Locked = true;\n+ begin\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the Item No. is cleared\n+ Initialize();\n+\n+ // [GIVEN] A vendor contract with a connected Subscription Line\n+ SetupNewContract(false);\n+\n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n+ VendorContractLine.Reset();\n+ VendorContractLine.SetRange(\"Subscription Contract No.\", VendorContract.\"No.\");\n+ VendorContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n+ VendorContractLine.SetFilter(\"Subscription Header No.\", '<>%1', '');\n+ VendorContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n+ VendorContractLine.FindFirst();\n+ EntryNo := VendorContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The Item No. is cleared on the contract line\n+ VendorContractLine.Validate(\"No.\", '');\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n ServiceCommitment.Get(EntryNo);\n- ServiceCommitment.TestField(\"Subscription Contract No.\", '');\n+ AssertThat.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n end;\n \n [Test]\n", "patch": "diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al\nindex 91f83b18b3..a092d10f19 100644\n--- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al\n+++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al\n@@ -49,23 +49,25 @@ table 8062 \"Cust. Sub. Contract Line\"\n GLAccount: Record \"G/L Account\";\n TempCustomerContractLine: Record \"Cust. Sub. Contract Line\" temporary;\n begin\n- case \"Contract Line Type\" of\n- \"Contract Line Type\"::Item:\n- begin\n- if not Item.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n- if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n- Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n- end;\n- \"Contract Line Type\"::\"G/L Account\":\n- begin\n- if not GLAccount.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n- if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n- Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n- end;\n- end;\n+ if \"No.\" <> '' then\n+ case \"Contract Line Type\" of\n+ \"Contract Line Type\"::Item:\n+ begin\n+ if not Item.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n+ if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n+ Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n+ end;\n+ \"Contract Line Type\"::\"G/L Account\":\n+ begin\n+ if not GLAccount.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n+ if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n+ Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n+ end;\n+ end;\n \n+ CheckAndDisconnectContractLine();\n TempCustomerContractLine := Rec;\n Init();\n SystemId := TempCustomerContractLine.SystemId;\n@@ -170,6 +172,8 @@ table 8062 \"Cust. Sub. Contract Line\"\n ServiceObject: Record \"Subscription Header\";\n ServiceCommitment: Record \"Subscription Line\";\n begin\n+ if \"No.\" = '' then\n+ exit;\n CustomerContract.Get(\"Subscription Contract No.\");\n ServiceObject.InitForSourceNo(\"Contract Line Type\", \"No.\");\n ServiceObject.UpdateCustomerDataFromCustomerContract(CustomerContract);\ndiff --git a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al\nindex 533581b5a2..38ecf0e9c3 100644\n--- a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al\n+++ b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al\n@@ -46,23 +46,25 @@ table 8065 \"Vend. Sub. Contract Line\"\n GLAccount: Record \"G/L Account\";\n TempVendorContractLine: Record \"Vend. Sub. Contract Line\" temporary;\n begin\n- case \"Contract Line Type\" of\n- \"Contract Line Type\"::Item:\n- begin\n- if not Item.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n- if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n- Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n- end;\n- \"Contract Line Type\"::\"G/L Account\":\n- begin\n- if not GLAccount.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n- if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n- Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n- end;\n- end;\n+ if \"No.\" <> '' then\n+ case \"Contract Line Type\" of\n+ \"Contract Line Type\"::Item:\n+ begin\n+ if not Item.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n+ if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n+ Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n+ end;\n+ \"Contract Line Type\"::\"G/L Account\":\n+ begin\n+ if not GLAccount.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n+ if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n+ Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n+ end;\n+ end;\n \n+ CheckAndDisconnectContractLine();\n TempVendorContractLine := Rec;\n Init();\n SystemId := TempVendorContractLine.SystemId;\n@@ -161,6 +163,8 @@ table 8065 \"Vend. Sub. Contract Line\"\n ServiceObject: Record \"Subscription Header\";\n ServiceCommitment: Record \"Subscription Line\";\n begin\n+ if \"No.\" = '' then\n+ exit;\n VendorContract.Get(\"Subscription Contract No.\");\n ServiceObject.InitForSourceNo(\"Contract Line Type\", \"No.\");\n ServiceObject.\"Created in Contract line\" := true;\n"}
+{"metadata": {"area": "sustainability", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-210528", "base_commit": "1a672853b5e939932b2b9caff994bef826e928ff", "created_at": "2025-03-19", "environment_setup_version": "26.5", "project_paths": ["App\\Apps\\W1\\Sustainability\\app", "App\\Apps\\W1\\Sustainability\\test"], "FAIL_TO_PASS": [{"codeunitID": 148187, "functionName": ["VerifyEmissionFieldsMustBeEnabledWhenEnableValueChainTrackingIsEnabled"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al b/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al\nindex ff9b7640fa2..07bfdfa1233 100644\n--- a/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al\n+++ b/App/Apps/W1/Sustainability/test/src/SustCertificateTest.Codeunit.al\n@@ -5123,6 +5123,47 @@ codeunit 148187 \"Sust. Certificate Test\"\n // [THEN] Confirmation Box should not pop up as there is no confirm Handler. \n end;\n \n+ [Test]\n+ [HandlerFunctions('ConfirmHandlerYes')]\n+ procedure VerifyEmissionFieldsMustBeEnabledWhenEnableValueChainTrackingIsEnabled()\n+ var\n+ SustainabilitySetup: Record \"Sustainability Setup\";\n+ begin\n+ // [SCENARIO 569462] Verify \"Use Emissions In Purch. Doc.\", \"Item Emissions\", \"Resource Emissions\", \"Work/Machine Center Emissions\" must be enabled in Sustainability Setup.\n+ // When \"Enable Value Chain Tracking\" is enabled.\n+ LibrarySustainability.CleanUpBeforeTesting();\n+\n+ // [GIVEN] Update Sustainability Setup.\n+ SustainabilitySetup.Get();\n+ SustainabilitySetup.Validate(\"Use Emissions In Purch. Doc.\", false);\n+ SustainabilitySetup.Validate(\"Item Emissions\", false);\n+ SustainabilitySetup.Validate(\"Resource Emissions\", false);\n+ SustainabilitySetup.Validate(\"Work/Machine Center Emissions\", false);\n+ SustainabilitySetup.Validate(\"Enable Value Chain Tracking\", false);\n+ SustainabilitySetup.Modify();\n+\n+ // [WHEN] \"Enable Value Chain Tracking\" set to true in Sustainability Setup.\n+ SustainabilitySetup.Validate(\"Enable Value Chain Tracking\", true);\n+\n+ // [THEN] Verify \"Use Emissions In Purch. Doc.\", \"Item Emissions\", \"Resource Emissions\", \"Work/Machine Center Emissions\" must be enabled in Sustainability Setup.\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Use Emissions In Purch. Doc.\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Use Emissions In Purch. Doc.\"), SustainabilitySetup.TableCaption()));\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Item Emissions\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Item Emissions\"), SustainabilitySetup.TableCaption()));\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Resource Emissions\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Resource Emissions\"), SustainabilitySetup.TableCaption()));\n+ Assert.AreEqual(\n+ true,\n+ SustainabilitySetup.\"Work/Machine Center Emissions\",\n+ StrSubstNo(FieldShouldBeEnabledErr, SustainabilitySetup.FieldCaption(\"Work/Machine Center Emissions\"), SustainabilitySetup.TableCaption()));\n+ end;\n+\n local procedure CreateSustainabilityAccount(var AccountCode: Code[20]; var CategoryCode: Code[20]; var SubcategoryCode: Code[20]; i: Integer): Record \"Sustainability Account\"\n begin\n CreateSustainabilitySubcategory(CategoryCode, SubcategoryCode, i);\n", "patch": "diff --git a/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al b/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al\nindex 335c0099f4a..bf9281c17f7 100644\n--- a/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al\n+++ b/App/Apps/W1/Sustainability/app/src/Setup/SustainabilitySetup.Table.al\n@@ -151,6 +151,8 @@ table 6217 \"Sustainability Setup\"\n if Rec.\"Enable Value Chain Tracking\" then\n if not ConfirmManagement.GetResponseOrDefault(ConfirmEnableValueChainTrackingQst, false) then\n Error('');\n+\n+ EnableEmissionsWhenValueChainTrackingIsEnabled();\n end;\n }\n }\n@@ -188,6 +190,17 @@ table 6217 \"Sustainability Setup\"\n exit(\"Enable Value Chain Tracking\");\n end;\n \n+ local procedure EnableEmissionsWhenValueChainTrackingIsEnabled()\n+ begin\n+ if not Rec.\"Enable Value Chain Tracking\" then\n+ exit;\n+\n+ Rec.Validate(\"Use Emissions In Purch. Doc.\", true);\n+ Rec.Validate(\"Item Emissions\", true);\n+ Rec.Validate(\"Resource Emissions\", true);\n+ Rec.Validate(\"Work/Machine Center Emissions\", true);\n+ end;\n+\n internal procedure GetFormat(FieldNo: Integer): Text\n begin\n GetSustainabilitySetup();\n"}
+{"metadata": {"area": "inventory", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-224009", "base_commit": "719cf1cc85730da9c59cdcb0ac18ddaf11d113fd", "created_at": "2025-08-16", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137045, "functionName": ["CheckTrackingReservationEntriesUpdatedWheLotNoAllocated"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\nindex bfcb627e6e5..f8db5ec3cf2 100644\n--- a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n@@ -1217,6 +1217,76 @@ codeunit 137045 \"SCM Bugfixes\"\n AssertReservationEntryCountForSales(SalesHeader, 3);\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandlerOrderTracking,ItemTrackingLinesPageHandler')]\n+ procedure CheckTrackingReservationEntriesUpdatedWheLotNoAllocated()\n+ var\n+ Item: Record Item;\n+ Location: Record Location;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ UnitofMeasure: Record \"Unit of Measure\";\n+ InventoryPostingSetup: Record \"Inventory Posting Setup\";\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ ReservationEntry, ReservationEntry1 : Record \"Reservation Entry\";\n+ LotNo, LotNo1, LotNo2 : Code[50];\n+ begin\n+ // [SCENARIO 580079] Wrong Decimal Rounding with Quantity in Reservation Entries, using Order Tracking Policy where tracking lines are split into 3, each ending in x.xxxx7, which results with all 3 adding up to x.00001\n+ Initialize();\n+\n+ // [GIVEN] Created Lot Tracked Item.\n+ CreateTrackedItemWithOrderTrackingPolicy(Item);\n+\n+ // [GIVEN] Create new UOM for CASE (CA), Qty 24 Per Base UOM of PCS\n+ LibraryInventory.CreateUnitOfMeasureCode(UnitofMeasure);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure, Item.\"No.\", UnitofMeasure.Code, 24);\n+\n+ // [GIVEN] Create Location\n+ LibraryWarehouse.CreateLocation(Location);\n+\n+ // [GIVEN] Create Inventory Posting Setup with Inventory Account\n+ LibraryInventory.CreateInventoryPostingSetup(InventoryPostingSetup, Location.Code, Item.\"Inventory Posting Group\");\n+ InventoryPostingSetup.Validate(\"Inventory Account\", LibraryERM.CreateGLAccountNo());\n+ InventoryPostingSetup.Modify();\n+\n+ // [GIVEN] Create Positive Adjustment for 288 Quantity with 1 Lot No\n+ LotNo := LibraryUtility.GenerateGUID();\n+ CreateItemJournalLineItemTrackingEnabled(ItemJournalLine, Item.\"No.\", Location.Code, 288);\n+ LibraryItemTracking.CreateItemJournalLineItemTracking(ReservationEntry, ItemJournalLine, '', LotNo, 288);\n+ LibraryInventory.PostItemJnlLineWithCheck(ItemJournalLine);\n+\n+ // [GIVEN] Create Positive Adjustment for 440 Quantity with 2 different Lot\n+ LotNo1 := LibraryUtility.GenerateGUID();\n+ LotNo2 := LibraryUtility.GenerateGUID();\n+ CreateItemJournalLineItemTrackingEnabled(ItemJournalLine, Item.\"No.\", Location.Code, 440);\n+ LibraryItemTracking.CreateItemJournalLineItemTracking(ReservationEntry, ItemJournalLine, '', LotNo1, 220);\n+ LibraryItemTracking.CreateItemJournalLineItemTracking(ReservationEntry1, ItemJournalLine, '', LotNo2, 220);\n+ LibraryInventory.PostItemJnlLineWithCheck(ItemJournalLine);\n+\n+ // [GIVEN] Created Sales Order with 1 Item and 3 quantity.\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, '');\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", 12);\n+ SalesLine.Validate(\"Location Code\", Location.Code);\n+ SalesLine.Validate(\"Unit of Measure Code\", UnitofMeasure.Code);\n+ SalesLine.Modify(true);\n+\n+ // [GIVEN] From Item tracking lines (Sales Order), add a Lot No to the item.\n+ LibraryVariableStorage.Enqueue(ItemTrackingHandlerAction::AssignSpecificLot);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(288);\n+ SalesLine.OpenItemTrackingLines(); // ItemTrackingLinesPageHandler required.\n+\n+ // [WHEN] Change the quantity from Item tracking lines (Sales Order), of a Lot No to 13.\n+ LibraryVariableStorage.Enqueue(ItemTrackingHandlerAction::AssignSpecificLot);\n+ LibraryVariableStorage.Enqueue(LotNo);\n+ LibraryVariableStorage.Enqueue(13);\n+ SalesLine.OpenItemTrackingLines(); // ItemTrackingLinesPageHandler required.\n+\n+ // [THEN] Reservation entry Quantity field should come with -12\n+ VerifyReservationEntryQuantity(Item.\"No.\", SalesHeader.\"No.\", -12);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -1310,6 +1380,23 @@ codeunit 137045 \"SCM Bugfixes\"\n LibraryInventory.PostItemJournalLine(ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name);\n end;\n \n+ local procedure CreateItemJournalLineItemTrackingEnabled(var ItemJournalLine: Record \"Item Journal Line\"; ItemNo: Code[20]; LocationCode: Code[10]; Quantity: Decimal)\n+ var\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ begin\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, \"Item Journal Template Type\"::Item);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, \"Item Journal Template Type\"::Item, ItemJournalTemplate.Name);\n+ LibraryInventory.ClearItemJournal(ItemJournalTemplate, ItemJournalBatch);\n+ ItemJournalBatch.\"Item Tracking on Lines\" := true;\n+ ItemJournalBatch.Modify();\n+ LibraryInventory.CreateItemJournalLine(\n+ ItemJournalLine, ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name,\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", ItemNo, Quantity);\n+ ItemJournalLine.Validate(\"Location Code\", LocationCode);\n+ ItemJournalLine.Modify(true);\n+ end;\n+\n local procedure CreateCertifiedProductionBOMWithComponentStartingDate(var ProductionBOMHeader: Record \"Production BOM Header\"; UOMCode: Code[10]; ItemNo: Code[20]; QtyPer: Decimal; StartingDate: Date)\n var\n ProductionBOMLine: Record \"Production BOM Line\";\n@@ -1985,6 +2072,16 @@ codeunit 137045 \"SCM Bugfixes\"\n Assert.RecordCount(ReservationEntry, ExpectedCount);\n end;\n \n+ local procedure VerifyReservationEntryQuantity(ItemNo: Code[20]; SourceID: Code[20]; ExpectedQuantity: Decimal)\n+ var\n+ ReservEntry: Record \"Reservation Entry\";\n+ begin\n+ ReservEntry.SetRange(\"Item No.\", ItemNo);\n+ ReservEntry.SetRange(\"Source ID\", SourceID);\n+ ReservEntry.CalcSums(Quantity);\n+ ReservEntry.TestField(Quantity, ExpectedQuantity);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ContactListModalPageHandler(var ContactLookup: Page \"Contact List\"; var Response: Action)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\nindex c1b41b1585b..a37726d678f 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n@@ -914,7 +914,7 @@ table 337 \"Reservation Entry\"\n ReservEntry.SetFilter(\"Entry No.\", '<>%1', \"Entry No.\");\n ReservEntry.SetSourceFilter(\"Source Type\", \"Source Subtype\", \"Source ID\", \"Source Ref. No.\", false);\n ReservEntry.SetSourceFilter(\"Source Batch Name\", \"Source Prod. Order Line\");\n- ReservEntry.SetRange(\"Reservation Status\", \"Reservation Status\"::Reservation);\n+ ReservEntry.SetFilter(\"Reservation Status\", '%1|%2', \"Reservation Status\"::Reservation, \"Reservation Status\"::Tracking);\n ReservEntry.CalcSums(\"Quantity (Base)\", Quantity);\n exit(\n Round((ReservEntry.\"Quantity (Base)\" + \"Quantity (Base)\") / \"Qty. per Unit of Measure\", UOMMgt.QtyRndPrecision()) -\n"}
+{"metadata": {"area": "shopify", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-211710", "base_commit": "f787c24e811a24e4bd5a2d987ea406b3d2fe6ad0", "created_at": "2025-03-31", "environment_setup_version": "26.5", "project_paths": ["App\\Apps\\W1\\Shopify\\app", "App\\Apps\\W1\\Shopify\\test"], "FAIL_TO_PASS": [{"codeunitID": 139648, "functionName": ["UnitTestSuggestShopifyPaymentsFailedTransaction"]}], "PASS_TO_PASS": [{"codeunitID": 139648, "functionName": ["UnitTestSuggestShopifyPaymentsMultipleTransactions", "UnitTestSuggestShopifyPaymentsOneTransaction"]}], "test_patch": "diff --git a/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al b/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al\nindex d4318405610..cf234743596 100644\n--- a/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al\n+++ b/App/Apps/W1/Shopify/test/Payments/ShpfySuggestPaymentTest.Codeunit.al\n@@ -32,7 +32,7 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n \n // [GIVEN] Shopify transaction is imported\n- CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale);\n+ CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n \n // [WHEN] Create Shopify transactions are run\n OrderTransaction.FindFirst();\n@@ -65,8 +65,8 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n \n // [GIVEN] Shopify transactions are imported\n- CreateOrderTransaction(OrderId, Amount * 0.75, 'manual', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale);\n+ CreateOrderTransaction(OrderId, Amount * 0.75, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n \n // [WHEN] Create Shopify transactions are run\n OrderTransaction.SetRange(\"Shopify Order Id\", OrderId);\n@@ -86,6 +86,45 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n until SuggestPayment.Next() = 0;\n end;\n \n+ [HandlerFunctions('SuggestShopifyPaymentsRequestPageHandler')]\n+ [Test]\n+ procedure UnitTestSuggestShopifyPaymentsFailedTransaction()\n+ var\n+ Item: Record Item;\n+ Customer: Record Customer;\n+ OrderTransaction: Record \"Shpfy Order Transaction\";\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ CashReceiptJournal: TestPage \"Cash Receipt Journal\";\n+ OrderId: BigInteger;\n+ SuccessTransactionId: BigInteger;\n+ Amount: Decimal;\n+ begin\n+ // [SCENARIO] Suggest Shopify payments does not create Cash Receipt Journal lines for failed transactions\n+ // [GIVEN] Invoice is posted\n+ Initialize();\n+ Amount := Any.IntegerInRange(10000, 99999);\n+ OrderId := Any.IntegerInRange(10000, 99999);\n+ CreateItem(Item, Amount);\n+ LibrarySales.CreateCustomer(Customer);\n+ CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n+\n+ // [GIVEN] One failed one success Shopify transaction is imported\n+ CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Failure);\n+ SuccessTransactionId := CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ Commit();\n+\n+ // [WHEN] Report is run\n+ CashReceiptJournal.OpenView();\n+ CashReceiptJournal.SuggestShopifyPayments.Invoke();\n+\n+ // [THEN] Only one Cash Receipt Journal line is created\n+ GenJournalLine.SetRange(\"Document Type\", GenJournalLine.\"Document Type\"::Payment);\n+ GenJournalLine.SetRange(\"Account No.\", Customer.\"No.\");\n+ LibraryAssert.RecordCount(GenJournalLine, 1);\n+ GenJournalLine.FindFirst();\n+ LibraryAssert.AreEqual(GenJournalLine.\"Shpfy Transaction Id\", SuccessTransactionId, 'Transaction Ids should match');\n+ end;\n+\n [HandlerFunctions('SuggestShopifyPaymentsRequestPageHandler')]\n [Test]\n procedure UnitTestSuggestShopifyPaymentsJournalLines()\n@@ -114,10 +153,10 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesInvoice(Item, Customer, 2, OrderId3);\n \n // [GIVEN] Shopify transactions are imported\n- CreateOrderTransaction(OrderId1, Amount, 'manual', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId2, Amount * 0.75, 'manual', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId2, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale);\n- CreateOrderTransaction(OrderId3, Amount * 2, 'bogus', OrderTransaction.Type::Sale);\n+ CreateOrderTransaction(OrderId1, Amount, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId2, Amount * 0.75, 'manual', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId2, Amount * 0.25, 'gift_card', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n+ CreateOrderTransaction(OrderId3, Amount * 2, 'bogus', OrderTransaction.Type::Sale, OrderTransaction.Status::Success);\n Commit();\n \n // [WHEN] Report is run\n@@ -154,7 +193,7 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n CreateAndPostSalesCreditMemo(Item, Customer, 1, RefundId);\n \n // [GIVEN] Shopify transaction is imported\n- CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Refund);\n+ CreateOrderTransaction(OrderId, Amount, 'manual', OrderTransaction.Type::Refund, OrderTransaction.Status::Success);\n \n // [WHEN] Create Shopify transactions are run\n OrderTransaction.FindFirst();\n@@ -210,7 +249,7 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n Item.Modify(true);\n end;\n \n- local procedure CreateOrderTransaction(OrderId: BigInteger; Amount: Decimal; Gateway: Code[20]; TransactionType: Enum \"Shpfy Transaction Type\")\n+ local procedure CreateOrderTransaction(OrderId: BigInteger; Amount: Decimal; Gateway: Code[20]; TransactionType: Enum \"Shpfy Transaction Type\"; Status: Enum \"Shpfy Transaction Status\"): BigInteger\n var\n OrderTransaction: Record \"Shpfy Order Transaction\";\n begin\n@@ -219,7 +258,9 @@ codeunit 139648 \"Shpfy Suggest Payment Test\"\n OrderTransaction.Amount := Amount;\n OrderTransaction.Gateway := Gateway;\n OrderTransaction.Type := TransactionType;\n+ OrderTransaction.Status := Status;\n OrderTransaction.Insert();\n+ exit(OrderTransaction.\"Shopify Transaction Id\");\n end;\n \n local procedure CreateRefund(OrderId: BigInteger; RefundId: BigInteger; Amount: Decimal)\n", "patch": "diff --git a/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al b/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al\nindex 773ba116023..274900e6ee5 100644\n--- a/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al\n+++ b/App/Apps/W1/Shopify/app/src/Transactions/Reports/ShpfySuggestPayments.Report.al\n@@ -17,7 +17,7 @@ report 30118 \"Shpfy Suggest Payments\"\n dataitem(OrderTransaction; \"Shpfy Order Transaction\")\n {\n RequestFilterFields = \"Created At\";\n- DataItemTableView = sorting(Type) where(Type = filter(Capture | Sale | Refund));\n+ DataItemTableView = sorting(Type) where(Type = filter(Capture | Sale | Refund), Status = filter(Success));\n \n trigger OnAfterGetRecord()\n begin\n"}
+{"metadata": {"area": "manufacturing", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-220984", "base_commit": "da8aacf769f29847b57739a6db797e65057ea268", "created_at": "2025-07-15", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Manufacturing"], "FAIL_TO_PASS": [{"codeunitID": 137404, "functionName": ["ExchangeProductionBOMItemShouldSetEndingDate"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al b/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al\nindex f6545527796..b7f7674ae29 100644\n--- a/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Manufacturing/SCMManufacturing.Codeunit.al\n@@ -4829,6 +4829,54 @@ codeunit 137404 \"SCM Manufacturing\"\n Assert.AreEqual(StandardTask.Code, ProdOrderLine.\"Standard Task Code\", StandardTaskFieldErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('RunExchangeProdBOMItemReportWithStartDateParameter')]\n+ procedure ExchangeProductionBOMItemShouldSetEndingDate()\n+ var\n+ Item: array[5] of Record Item;\n+ MainItem: Record Item;\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ i: Integer;\n+ begin\n+ // [SCENARIO 592157] Replacing a component in a Production BOM should set the Ending Date of the replaced component.\n+ Initialize();\n+\n+ LibraryInventory.CreateItem(MainItem);\n+ MainItem.Validate(\"Replenishment System\", MainItem.\"Replenishment System\"::\"Prod. Order\");\n+ MainItem.Modify(true);\n+\n+ // [GIVEN] Create a Production BOM Header\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, MainItem.\"Base Unit of Measure\");\n+\n+ // [GIVEN] Create Items\n+ for i := 1 to 5 do\n+ LibraryInventory.CreateItem(Item[i]);\n+\n+ // [GIVEN] Add only Items[1..4] to the BOM\n+ for i := 1 to 4 do\n+ LibraryManufacturing.CreateProductionBOMLine(\n+ ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, Item[i].\"No.\", LibraryRandom.RandIntInRange(10, 20));\n+\n+ // [GIVEN] Certify BOM and assign to Main Item\n+ ModifyStatusInProductionBOM(ProductionBOMHeader, ProductionBOMHeader.Status::Certified);\n+ MainItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ MainItem.Modify(true);\n+\n+ // [GIVEN] Enqueue parameter values for report\n+ EnqueueExchProdBOMItemReportParameter(Item[1].\"No.\", Item[5].\"No.\", Today);\n+\n+ // [WHEN] Run the Exchange Production BOM Item report\n+ RunExchangeProductionBOMItemReport();\n+\n+ // [THEN] Validate that the replaced item has an Ending Date of (StartDate - 1)\n+ ValidateEndingDateSet(ProductionBOMHeader.\"No.\", Item[1].\"No.\", Today);\n+\n+ // [AND] Ensure no test artifacts are left behind\n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -7704,6 +7752,23 @@ codeunit 137404 \"SCM Manufacturing\"\n standardTask.Modify(true);\n end;\n \n+ local procedure EnqueueExchProdBOMItemReportParameter(ExchangeItemNo: Code[20]; ReplaceItemNo: Code[20]; StartDate: Date)\n+ begin\n+ LibraryVariableStorage.Enqueue(ExchangeItemNo);\n+ LibraryVariableStorage.Enqueue(ReplaceItemNo);\n+ LibraryVariableStorage.Enqueue(StartDate);\n+ end;\n+\n+ local procedure ValidateEndingDateSet(ProdBOMHeaderNo: Code[20]; ItemNo: Code[20]; StartingDate: Date)\n+ var\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ begin\n+ ProductionBOMLine.SetRange(\"Production BOM No.\", ProdBOMHeaderNo);\n+ ProductionBOMLine.SetRange(\"No.\", ItemNo);\n+ ProductionBOMLine.FindFirst();\n+ Assert.AreEqual(StartingDate - 1, ProductionBOMLine.\"Ending Date\", 'Ending Date is not correctly set on the Production BOM line.')\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ProdBOMVersionComparisonHandlerForActionSet(var ProdBOMVersionComparison: TestPage \"Prod. BOM Version Comparison\")\n@@ -7793,5 +7858,28 @@ codeunit 137404 \"SCM Manufacturing\"\n ExchangeProductionBOMItem.WithType.AssertEquals(ProductionBOMLineType::Item);// [THEN] Verify WithType Default Type is ITEM\n ExchangeProductionBOMItem.OK().Invoke();\n end;\n+\n+ [RequestPageHandler]\n+ procedure RunExchangeProdBOMItemReportWithStartDateParameter(var ExchangeProductionBOMItem: TestRequestPage \"Exchange Production BOM Item\")\n+ var\n+ FromProductionBOMLineType: Enum \"Production BOM Line Type\";\n+ ExchangeItemNo: Variant;\n+ ReplaceItemNo: Variant;\n+ StartDate: Variant;\n+ begin\n+ ExchangeItemNo := LibraryVariableStorage.DequeueText();\n+ ReplaceItemNo := LibraryVariableStorage.DequeueText();\n+ StartDate := LibraryVariableStorage.DequeueDate();\n+ ExchangeProductionBOMItem.ExchangeType.SetValue(FromProductionBOMLineType::Item);\n+ ExchangeProductionBOMItem.ExchangeNo.SetValue(ExchangeItemNo);\n+ ExchangeProductionBOMItem.WithType.SetValue(FromProductionBOMLineType::Item);\n+ ExchangeProductionBOMItem.WithNo.SetValue(ReplaceItemNo);\n+ ExchangeProductionBOMItem.\"Create New Version\".SetValue(false);\n+ ExchangeProductionBOMItem.\"Delete Exchanged Component\".SetValue(false);\n+ ExchangeProductionBOMItem.Recertify.SetValue(true);\n+ ExchangeProductionBOMItem.CopyRoutingLink.SetValue(true);\n+ ExchangeProductionBOMItem.StartingDate.SetValue(StartDate);\n+ ExchangeProductionBOMItem.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al b/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al\nindex 83bf3f09247..fc62ac19292 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/ProductionBOM/ExchangeProductionBOMItem.Report.al\n@@ -157,7 +157,7 @@ report 99001043 \"Exchange Production BOM Item\"\n CopyPositionFields(ProductionBOMLine2, ProductionBOMLine3);\n ShouldModifyProductionBOMLine := true;\n OnIntegerOnPostDataItemOnBeforeModifyProductionBOMLine(ProductionBOMLine, ShouldModifyProductionBOMLine);\n- if not ShouldModifyProductionBOMLine then begin\n+ if ShouldModifyProductionBOMLine then begin\n ProductionBOMLine.\"Ending Date\" := StartingDate - 1;\n ProductionBOMLine.Modify();\n end;\n"}
+{"metadata": {"area": "visualization", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-224668", "base_commit": "e99adb71b2355dc29eb398ab9ae0d59003a84d5d", "created_at": "2025-08-25", "environment_setup_version": "27.0", "project_paths": ["App\\Apps\\W1\\EssentialBusinessHeadlines\\app", "App\\Apps\\W1\\EssentialBusinessHeadlines\\test"], "FAIL_TO_PASS": [{"codeunitID": 139600, "functionName": ["TestHeadlineCanBeHidden"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al b/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al\nindex db731e8675d..fb82838356c 100644\n--- a/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al\n+++ b/App/Apps/W1/EssentialBusinessHeadlines/test/src/codeunits/TestEssentialBusHeadlines.Codeunit.al\n@@ -700,6 +700,33 @@ codeunit 139600 \"Test Essential Bus. Headlines\"\n TestRecentlyOverdueInvoiceWithOverdueInvoices(5);\n end;\n \n+ [Test]\n+ procedure TestHeadlineCanBeHidden()\n+ var\n+ CustLedgerEntry: Record \"Cust. Ledger Entry\";\n+ begin\n+ // [GIVEN] Initial state when no data is present\n+ Initialize();\n+\n+ // [GIVEN] One invoice that was due yesterday\n+ CreateInvoicesWithDueDateYesterday(1);\n+\n+ // [WHEN] Run the headline computation\n+ EssentialBusHeadlineMgt.HandleRecentlyOverdueInvoices();\n+\n+ // [THEN] Recently overdue invoices headline is visible\n+ Assert.IsTrue(GetVisibility(EssentialBusinessHeadline.\"Headline Name\"::RecentlyOverdueInvoices), 'Expected recently overdue invoices headline to be visible');\n+\n+ // [WHEN] Simulate no more overdue invoices by deleting all customer ledger entries\n+ CustLedgerEntry.DeleteAll();\n+\n+ // [WHEN] Recompute the headline computation\n+ EssentialBusHeadlineMgt.HandleRecentlyOverdueInvoices();\n+\n+ // [THEN] The headline is hidden\n+ Assert.IsFalse(GetVisibility(EssentialBusinessHeadline.\"Headline Name\"::RecentlyOverdueInvoices), 'Expected recently overdue invoices headline to be not visible after recompute');\n+ end;\n+\n local procedure TestRecentlyOverdueInvoiceWithOverdueInvoices(NumberOfNewlyOverdueInvoices: Integer)\n var\n OverdueInvoicesTxt: Text;\n", "patch": "diff --git a/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al b/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al\nindex 831aa80efcd..10436a095d8 100644\n--- a/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al\n+++ b/App/Apps/W1/EssentialBusinessHeadlines/app/src/codeunits/EssentialBusHeadlineMgt.Codeunit.al\n@@ -677,7 +677,7 @@ codeunit 1437 \"Essential Bus. Headline Mgt.\"\n var\n EssentialBusinessHeadline: Record \"Ess. Business Headline Per Usr\";\n begin\n- if EssentialBusinessHeadline.Get(HeadlineName) then begin\n+ if EssentialBusinessHeadline.Get(HeadlineName, UserSecurityId()) then begin\n EssentialBusinessHeadline.Validate(\"Headline Visible\", false);\n EssentialBusinessHeadline.Modify();\n end;\n"}
+{"metadata": {"area": "finance", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218323", "base_commit": "cf24533288281b2df45cbb33654a17f430a0619f", "created_at": "2025-06-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134992, "functionName": ["PostVATSettlementWhenJournalTemplateNameMandatoryIsEnabled"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al\nindex 5c994880ad2..b8c9d7f62bd 100644\n--- a/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMFinancialReportsIV.Codeunit.al\n@@ -765,6 +765,53 @@ codeunit 134992 \"ERM Financial Reports IV\"\n LibraryVariableStorage.AssertEmpty();\n end;\n \n+ [Test]\n+ [HandlerFunctions('RHCalcAndPostVATSettlementSetCountryFilter')]\n+ procedure PostVATSettlementWhenJournalTemplateNameMandatoryIsEnabled()\n+ var\n+ Customer: Record Customer;\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ VATEntry: Record \"VAT Entry\";\n+ GLEntry: Record \"G/L Entry\";\n+ MyNotifications: Record \"My Notifications\";\n+ GeneralLedgerSetup: Record \"General Ledger Setup\";\n+ InstructionMgt: Codeunit \"Instruction Mgt.\";\n+ PostingDate: Date;\n+ begin\n+ // [SCENARIO 571198] No error should appears when user try to Calculate and Post VAT Settlement when Journal Template Name Mandatory is enabled\n+ Initialize();\n+\n+ // [GIVEN] Set Journal Templ. Name Mandatory to false on General ledger Setup.\n+ GeneralLedgerSetup.Get();\n+ GeneralLedgerSetup.\"Journal Templ. Name Mandatory\" := true;\n+ GeneralLedgerSetup.Modify();\n+\n+ MyNotifications.Disable(InstructionMgt.GetPostingAfterWorkingDateNotificationId());\n+ GLEntry.SetCurrentKey(\"Posting Date\", \"G/L Account No.\", \"Dimension Set ID\");\n+ GLEntry.FindLast();\n+ PostingDate := GLEntry.\"Posting Date\" + 1;\n+\n+ // [GIVEN] Create customer and post a sales invoice\n+ LibrarySales.CreateCustomerWithCountryCodeAndVATRegNo(Customer);\n+ CreateAndPostGeneralJournalLine(\n+ VATPostingSetup, PostingDate, GenJournalLine.\"Account Type\"::Customer, Customer.\"No.\",\n+ GenJournalLine.\"Gen. Posting Type\"::Sale, 1, true);\n+\n+ LibraryVariableStorage.Enqueue(Customer.\"Country/Region Code\"); // set country/region filter for RHCalcAndPostVATSettlementSetCountryFilter\n+ Clear(LibraryReportDataset);\n+\n+ // [WHEN] Run Calculate and Post VAT Settlement report\n+ SaveCalcAndPostVATSettlementReport(VATPostingSetup, PostingDate, PostingDate, PostingDate, Format(LibraryRandom.RandInt(100)), true);\n+\n+ // [THEN] VAT Entry for the second invoice is closed\n+ // [THEN] Closing entry created with type 'Settlement'\n+ VATEntry.SetRange(\"Bill-to/Pay-to No.\", Customer.\"No.\");\n+ VATEntry.FindFirst();\n+ VATEntry.Get(VATEntry.\"Closed by Entry No.\");\n+ VATEntry.TestField(Type, VATEntry.Type::Settlement);\n+ end;\n+\n local procedure Initialize()\n var\n ObjectOptions: Record \"Object Options\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al\nindex c7ffd42ba4c..d596be8a7fd 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlCheckLine.Codeunit.al\n@@ -57,6 +57,7 @@ codeunit 11 \"Gen. Jnl.-Check Line\"\n OverrideDimErr: Boolean;\n LogErrorMode: Boolean;\n IsBatchMode: Boolean;\n+ IgnoreJournalTemplNameMandatoryCheck: Boolean;\n \n #pragma warning disable AA0074\n Text000: Label 'can only be a closing date for G/L entries';\n@@ -380,6 +381,11 @@ codeunit 11 \"Gen. Jnl.-Check Line\"\n OverrideDimErr := true;\n end;\n \n+ procedure SetIgnoreJournalTemplNameMandatoryCheck()\n+ begin\n+ IgnoreJournalTemplNameMandatoryCheck := true;\n+ end;\n+\n local procedure CheckDates(GenJnlLine: Record \"Gen. Journal Line\")\n var\n AccountingPeriodMgt: Codeunit \"Accounting Period Mgt.\";\n@@ -400,8 +406,9 @@ codeunit 11 \"Gen. Jnl.-Check Line\"\n end;\n end;\n \n- if GLSetup.\"Journal Templ. Name Mandatory\" then\n- GenJnlLine.TestField(\"Journal Template Name\", ErrorInfo.Create());\n+ if not IgnoreJournalTemplNameMandatoryCheck then\n+ if GLSetup.\"Journal Templ. Name Mandatory\" then\n+ GenJnlLine.TestField(\"Journal Template Name\", ErrorInfo.Create());\n OnBeforeDateNotAllowed(GenJnlLine, DateCheckDone);\n if not DateCheckDone then\n if DateNotAllowed(GenJnlLine.\"Posting Date\", GenJnlLine.\"Journal Template Name\") then\ndiff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al\nindex da61c5f2c5d..35021399a12 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al\n@@ -138,6 +138,7 @@ codeunit 12 \"Gen. Jnl.-Post Line\"\n MultiplePostingGroups: Boolean;\n SourceCodeSetupRead: Boolean;\n IsGLRegInserted: Boolean;\n+ IgnoreJournalTemplNameMandatoryCheck: Boolean;\n \n NeedsRoundingErr: Label '%1 needs to be rounded', Comment = '%1 - amount';\n PurchaseAlreadyExistsErr: Label 'Purchase %1 %2 already exists for this vendor.', Comment = '%1 = Document Type; %2 = Document No.';\n@@ -332,6 +333,8 @@ codeunit 12 \"Gen. Jnl.-Post Line\"\n if CheckLine then begin\n if OverrideDimErr then\n GenJnlCheckLine.SetOverDimErr();\n+ if IgnoreJournalTemplNameMandatoryCheck then\n+ GenJnlCheckLine.SetIgnoreJournalTemplNameMandatoryCheck();\n OnCheckGenJnlLineOnBeforeRunCheck(GenJournalLine);\n GenJnlCheckLine.RunCheck(GenJournalLine);\n end;\n@@ -7113,6 +7116,15 @@ codeunit 12 \"Gen. Jnl.-Post Line\"\n Error(DimMgt.GetDimValuePostingErr());\n end;\n \n+ /// \n+ /// Sets the global variable IgnoreJournalTemplNameMandatoryCheck for the current instance of the codeunit.\n+ /// If IgnoreJournalTemplNameMandatoryCheck is not set \"Journal Templ. Name Mandatory\" check is performed before gen. journal line \n+ /// \n+ procedure SetIgnoreJournalTemplNameMandatoryCheck()\n+ begin\n+ IgnoreJournalTemplNameMandatoryCheck := true;\n+ end;\n+\n local procedure IsGainLossAccount(CurrencyCode: Code[10]; GLAccNo: Code[20]): Boolean\n var\n Currency: Record Currency;\ndiff --git a/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al b/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al\nindex 88068be074e..f09dab3691a 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Reporting/CalcandPostVATSettlement.Report.al\n@@ -849,6 +849,7 @@ report 20 \"Calc. and Post VAT Settlement\"\n GenJnlLine, 0, DefaultDimSource, GenJnlLine.\"Source Code\",\n GenJnlLine.\"Shortcut Dimension 1 Code\", GenJnlLine.\"Shortcut Dimension 2 Code\", 0, 0);\n OnPostGenJnlLineOnBeforeGenJnlPostLineRun(GenJnlLine);\n+ GenJnlPostLine.SetIgnoreJournalTemplNameMandatoryCheck();\n GenJnlPostLine.Run(GenJnlLine);\n end;\n \n"}
+{"metadata": {"area": "eservice", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-193853", "base_commit": "a4732079d0c963a7104d5b5c534ee87f3cd105e7", "created_at": "2024-09-09", "environment_setup_version": "25.0", "project_paths": ["App\\Apps\\W1\\EnforcedDigitalVouchers\\app", "App\\Apps\\W1\\EnforcedDigitalVouchers\\test library", "App\\Apps\\W1\\EnforcedDigitalVouchers\\test"], "FAIL_TO_PASS": [{"codeunitID": 139515, "functionName": ["PostMultipleGeneralJournalLinesSamePostingDateDocNoOnlyFirstHasIncDoc"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al b/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al\nindex 304e94e908f6..d917601e5a98 100644\n--- a/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al\n+++ b/App/Apps/W1/EnforcedDigitalVouchers/test/src/DigitalVouchersTests.Codeunit.al\n@@ -912,6 +912,59 @@ codeunit 139515 \"Digital Vouchers Tests\"\n UnbindSubscription(DigVouchersDisableEnforce);\n end;\n \n+ [Test]\n+ procedure PostMultipleGeneralJournalLinesSamePostingDateDocNoOnlyFirstHasIncDoc()\n+ var\n+ GenJournalLine: array[2] of Record \"Gen. Journal Line\";\n+ GenJournalLineToPost: Record \"Gen. Journal Line\";\n+ GenJournalTemplate: Record \"Gen. Journal Template\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ IncomingDocument: Record \"Incoming Document\";\n+ DigVouchersDisableEnforce: Codeunit \"Dig. Vouchers Disable Enforce\";\n+ DocNo: Code[20];\n+ i: Integer;\n+ begin\n+ // [SCENARIO 540097] Stan can post multiple general journals lines with same posting date and document number, only the first line has incoming document\n+\n+ Initialize();\n+ BindSubscription(DigVouchersDisableEnforce);\n+ // [GIVEN] Digital voucher feature is enabled\n+ EnableDigitalVoucherFeature();\n+ // [GIVEN] Digital voucher entry setup for general journal is \"Attachment\"\n+ InitSetupCheckOnly(\"Digital Voucher Entry Type\"::\"General Journal\", \"Digital Voucher Check Type\"::Attachment);\n+ // [GIVEN] General journal lines with the same template and batch are created\n+ // [GIVEN] General journal line \"X\" with \"Posting Date\" = 01.01.2024 and \"Document No.\" = \"X\"\n+ // [GIVEN] General journal line \"Y\" with \"Posting Date\" = 01.01.2024 and \"Document No.\" = \"X\"\n+ DocNo := LibraryUtility.GenerateGUID();\n+ LibraryERM.CreateGenJournalTemplate(GenJournalTemplate);\n+ LibraryERM.CreateGenJournalBatch(GenJournalBatch, GenJournalTemplate.Name);\n+ for i := 1 to ArrayLen(GenJournalLine) do begin\n+ LibraryJournals.CreateGenJournalLine(\n+ GenJournalLine[i], GenJournalBatch.\"Journal Template Name\", GenJournalBatch.Name,\n+ GenJournalLine[i].\"Document Type\"::Invoice, GenJournalLine[i].\"Account Type\"::\"G/L Account\",\n+ LibraryERM.CreateGLAccountNo(), GenJournalLine[i].\"Bal. Account Type\"::\"G/L Account\",\n+ LibraryERM.CreateGLAccountNo(), LibraryRandom.RandDec(100, 2));\n+ GenJournalLine[i].Validate(\"Document No.\", DocNo);\n+ GenJournalLine[i].Modify(true);\n+ end;\n+ // [GIVEN] Only journal line \"X\" has incoming document attached\n+ GenJournalLine[1].\"Incoming Document Entry No.\" := MockIncomingDocument();\n+ GenJournalLine[1].Modify(true);\n+\n+ GenJournalLineToPost.SetRange(\"Journal Template Name\", GenJournalBatch.\"Journal Template Name\");\n+ GenJournalLineToPost.SetRange(\"Journal Batch Name\", GenJournalBatch.Name);\n+ GenJournalLineToPost.FindSet();\n+ // [WHEN] Post both general journal lines\n+ Codeunit.Run(Codeunit::\"Gen. Jnl.-Post Batch\", GenJournalLineToPost);\n+\n+ // [THEN] Posting is successfull and we have an incoming document with \"Posting Date\" = 01.01.2024 and \"Document No.\" = \"X\"\n+ IncomingDocument.SetRange(\"Posting Date\", GenJournalLine[1].\"Posting Date\");\n+ IncomingDocument.SetRange(\"Document No.\", GenJournalLine[1].\"Document No.\");\n+ Assert.RecordIsNotEmpty(IncomingDocument);\n+\n+ UnbindSubscription(DigVouchersDisableEnforce);\n+ end;\n+\n local procedure Initialize()\n var\n CompanyInformation: Record \"Company Information\";\n@@ -1076,6 +1129,19 @@ codeunit 139515 \"Digital Vouchers Tests\"\n exit(IncomingDocument.\"Entry No.\");\n end;\n \n+ local procedure MockIncomingDocument(): Integer\n+ var\n+ IncomingDocument: Record \"Incoming Document\";\n+ IncomingDocumentAttachment: Record \"Incoming Document Attachment\";\n+ begin\n+ IncomingDocument.\"Entry No.\" :=\n+ LibraryUtility.GetNewRecNo(IncomingDocument, IncomingDocument.FieldNo(\"Entry No.\"));\n+ IncomingDocument.Insert();\n+ IncomingDocumentAttachment.\"Incoming Document Entry No.\" := IncomingDocument.\"Entry No.\";\n+ IncomingDocumentAttachment.Insert();\n+ exit(IncomingDocument.\"Entry No.\");\n+ end;\n+\n local procedure ReceiveAndInvoicePurchaseInvoice(): Code[20]\n var\n PurchaseHeader: Record \"Purchase Header\";\n", "patch": "diff --git a/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al b/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al\nindex 72dc980e3347..5775bd7fc2b0 100644\n--- a/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al\n+++ b/App/Apps/W1/EnforcedDigitalVouchers/app/src/Implementation/DigitalVoucherImpl.Codeunit.al\n@@ -224,6 +224,8 @@ codeunit 5579 \"Digital Voucher Impl.\"\n SourceCodeSetup.Get();\n if IsPaymentReconciliationJournal(DigitalVoucherEntrySetup.\"Entry Type\", RecRef) then\n exit(true);\n+ if IsGenJnlLineWithIncDocAttachedToAdjLine(DigitalVoucherEntrySetup.\"Entry Type\", RecRef) then\n+ exit(true);\n exit(false);\n end;\n \n@@ -345,6 +347,27 @@ codeunit 5579 \"Digital Voucher Impl.\"\n exit(SourceCodeValue = SourceCodeSetup.\"Payment Reconciliation Journal\");\n end;\n \n+ local procedure IsGenJnlLineWithIncDocAttachedToAdjLine(DigitalVoucherEntryType: Enum \"Digital Voucher Entry Type\"; RecRef: RecordRef): Boolean\n+ var\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ AdjacentGenJournalLine: Record \"Gen. Journal Line\";\n+ IncomingDocument: Record \"Incoming Document\";\n+ begin\n+ if DigitalVoucherEntryType <> DigitalVoucherEntryType::\"General Journal\" then\n+ exit(false);\n+ RecRef.SetTable(GenJournalLine);\n+ AdjacentGenJournalLine.ReadIsolation(IsolationLevel::ReadCommitted);\n+ AdjacentGenJournalLine.SetRange(\"Journal Template Name\", GenJournalLine.\"Journal Template Name\");\n+ AdjacentGenJournalLine.SetRange(\"Journal Batch Name\", GenJournalLine.\"Journal Batch Name\");\n+ AdjacentGenJournalLine.SetRange(\"Posting Date\", GenJournalLine.\"Posting Date\");\n+ AdjacentGenJournalLine.SetRange(\"Document No.\", GenJournalLine.\"Document No.\");\n+ AdjacentGenJournalLine.SetFilter(\"Line No.\", '<>%1', GenJournalLine.\"Line No.\");\n+ AdjacentGenJournalLine.SetFilter(\"Incoming Document Entry No.\", '<>0');\n+ if not AdjacentGenJournalLine.FindFirst() then\n+ exit(false);\n+ exit(IncomingDocument.Get(AdjacentGenJournalLine.\"Incoming Document Entry No.\"));\n+ end;\n+\n local procedure AttachDigitalVoucherFromReportPDF(ReportUsage: Enum \"Report Selection Usage\"; RecRef: RecordRef; IsInvoice: Boolean; PostingDate: Date; DocNo: Code[20]; AccountTableNo: Integer; AccountNo: Code[20]; StandardReportID: Integer)\n var\n TempAttachReportSelections: Record \"Report Selections\" temporary;\n"}
+{"metadata": {"area": "sales", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223493", "base_commit": "faff33469cd77044de7a55542cfd61531ec098ee", "created_at": "2025-08-11", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134658, "functionName": ["VerifyYourReferenceUpdatedInCustLedgerEntry"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al b/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al\nindex b2cb6ea36fb..0e345a6a6f8 100644\n--- a/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/EditPostedDocuments.Codeunit.al\n@@ -27,6 +27,8 @@ codeunit 134658 \"Edit Posted Documents\"\n UnexpectedVolumeErr: Label 'Unexpected Volume shown.';\n CashFlowWorkSheetLineMustNotBeFoundErr: Label 'Cash Flow Worksheet Line must not be found.';\n YourReferenceErr: Label 'Your reference must be editable';\n+ SalesInvoiceYourReferenceErr: Label 'Sales Invoice Your Reference not updated';\n+ CustLedgerEntryYourReferenceErr: Label 'Customer Ledger Entry Your Reference not updated';\n \n [Test]\n [HandlerFunctions('PostedSalesShipmentUpdateGetEditablelModalPageHandler')]\n@@ -996,6 +998,46 @@ codeunit 134658 \"Edit Posted Documents\"\n LibraryLowerPermissions.SetOutsideO365Scope();\n end;\n \n+ [Test]\n+ [HandlerFunctions('PostedSalesInvoiceYourReferenceModalPageHandler')]\n+ procedure VerifyYourReferenceUpdatedInCustLedgerEntry()\n+ var\n+ CustLedgerEntry: Record \"Cust. Ledger Entry\";\n+ SalesInvoiceHeader: Record \"Sales Invoice Header\";\n+ YourReference: Text[35];\n+ PostedSalesInvoice: TestPage \"Posted Sales Invoice\";\n+ begin\n+ // [SCENARIO 595854] Verify Your Reference Field updated in Customer Ledger Entries,\n+ // when changed with Update document on Posted Sales Invoice.\n+ Initialize();\n+\n+ LibraryLowerPermissions.SetO365Setup();\n+ LibraryLowerPermissions.AddSalesDocsPost();\n+\n+ // [GIVEN] Create and post a Sales Order.\n+ SalesInvoiceHeader.Get(CreateAndPostSalesOrderGetInvoiceNo());\n+ YourReference := LibraryRandom.RandText(35);\n+ LibraryVariableStorage.Enqueue(YourReference);\n+\n+ // [GIVEN] Opened \"Posted Sales Invoice - Update\" page.\n+ PostedSalesInvoice.OpenView();\n+ PostedSalesInvoice.GoToRecord(SalesInvoiceHeader);\n+ PostedSalesInvoice.\"Update Document\".Invoke();\n+\n+ // [WHEN] Press OK on the page via PostedSalesInvoiceYourReferenceModalPageHandler.\n+\n+ // [THEN] Verify Your Reference field updated on Sales Invoice Header and Customer Ledger Entry.\n+ SalesInvoiceHeader.Get(SalesInvoiceHeader.\"No.\");\n+ Assert.AreEqual(YourReference, SalesInvoiceHeader.\"Your Reference\", SalesInvoiceYourReferenceErr);\n+\n+ CustLedgerEntry.SetRange(\"Document No.\", SalesInvoiceHeader.\"No.\");\n+ CustLedgerEntry.FindFirst();\n+ Assert.AreEqual(YourReference, CustLedgerEntry.\"Your Reference\", CustLedgerEntryYourReferenceErr);\n+\n+ LibraryVariableStorage.AssertEmpty();\n+ LibraryLowerPermissions.SetOutsideO365Scope();\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"Edit Posted Documents\");\n@@ -1535,6 +1577,14 @@ codeunit 134658 \"Edit Posted Documents\"\n PostedSalesInvUpdate.Cancel().Invoke();\n end;\n \n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure PostedSalesInvoiceYourReferenceModalPageHandler(var PostedSalesInvUpdate: TestPage \"Posted Sales Inv. - Update\")\n+ begin\n+ PostedSalesInvUpdate.\"Your Reference\".SetValue(LibraryVariableStorage.DequeueText());\n+ PostedSalesInvUpdate.OK().Invoke();\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerTrue(QuestionText: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al b/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al\nindex 6a5f0a883a3..626b74297f4 100644\n--- a/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/History/SalesInvHeaderEdit.Codeunit.al\n@@ -56,6 +56,7 @@ codeunit 1409 \"Sales Inv. Header - Edit\"\n CustLedgerEntry.Description := SalesInvoiceHeader.\"Posting Description\";\n CustLedgerEntry.\"Promised Pay Date\" := SalesInvoiceHeader.\"Promised Pay Date\";\n CustLedgerEntry.\"Due Date\" := SalesInvoiceHeader.\"Due Date\";\n+ CustLedgerEntry.\"Your Reference\" := SalesInvoiceHeader.\"Your Reference\";\n if CustLedgerEntry.\"Dispute Status\" <> '' then begin\n if DisputeStatus.get(CustLedgerEntry.\"Dispute Status\") then\n if (DisputeStatus.\"Overwrite on hold\") and ClearOnHold(SalesInvoiceHeader) then\ndiff --git a/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al\nindex c64fa944c7e..546c3b5513a 100644\n--- a/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Receivables/CustEntryEdit.Codeunit.al\n@@ -44,6 +44,7 @@ codeunit 103 \"Cust. Entry-Edit\"\n CustLedgEntry.\"Applies-to ID\" := Rec.\"Applies-to ID\";\n CustLedgEntry.Validate(\"Payment Method Code\", Rec.\"Payment Method Code\");\n CustLedgEntry.Validate(\"Payment Reference\", Rec.\"Payment Reference\");\n+ CustLedgEntry.Validate(\"Your Reference\", Rec.\"Your Reference\");\n CustLedgEntry.Validate(\"Remaining Pmt. Disc. Possible\", Rec.\"Remaining Pmt. Disc. Possible\");\n CustLedgEntry.\"Pmt. Disc. Tolerance Date\" := Rec.\"Pmt. Disc. Tolerance Date\";\n CustLedgEntry.Validate(\"Max. Payment Tolerance\", Rec.\"Max. Payment Tolerance\");\n@@ -122,7 +123,8 @@ codeunit 103 \"Cust. Entry-Edit\"\n (CurrCustLedgerEntry.\"Payment Reference\" <> NewCustLedgerEntry.\"Payment Reference\") or\n (CurrCustLedgerEntry.\"Message to Recipient\" <> NewCustLedgerEntry.\"Message to Recipient\") or\n (CurrCustLedgerEntry.\"Recipient Bank Account\" <> NewCustLedgerEntry.\"Recipient Bank Account\") or\n- (CurrCustLedgerEntry.\"On Hold\" <> NewCustLedgerEntry.\"On Hold\");\n+ (CurrCustLedgerEntry.\"On Hold\" <> NewCustLedgerEntry.\"On Hold\") or\n+ (CurrCustLedgerEntry.\"Your Reference\" <> NewCustLedgerEntry.\"Your Reference\");\n OnAfterLogFieldChanged(CurrCustLedgerEntry, NewCustLedgerEntry, Changed);\n exit(Changed);\n end;\n"}
+{"metadata": {"area": "shopify", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-193649", "base_commit": "3a5cb3aed7e735e557547556f727cce66b15affe", "created_at": "2024-09-06", "environment_setup_version": "25.0", "project_paths": ["App\\Apps\\W1\\Shopify\\app", "App\\Apps\\W1\\Shopify\\test"], "FAIL_TO_PASS": [{"codeunitID": 139695, "functionName": ["UnitTestCopyInvoice"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Apps/W1/Shopify/test/Invoices/ShpfyInvoicesTest.Codeunit.al b/App/Apps/W1/Shopify/test/Invoices/ShpfyInvoicesTest.Codeunit.al\nnew file mode 100644\nindex 000000000000..288b4d8039f0\n--- /dev/null\n+++ b/App/Apps/W1/Shopify/test/Invoices/ShpfyInvoicesTest.Codeunit.al\n@@ -0,0 +1,67 @@\n+codeunit 139695 \"Shpfy Invoices Test\"\n+{\n+ Subtype = Test;\n+ TestPermissions = Disabled;\n+\n+ var\n+ LibraryAssert: Codeunit \"Library Assert\";\n+ Any: Codeunit Any;\n+ LibrarySales: Codeunit \"Library - Sales\";\n+ LibraryInventory: Codeunit \"Library - Inventory\";\n+ LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n+ IsInitialized: Boolean;\n+\n+ [Test]\n+ procedure UnitTestCopyInvoice()\n+ var\n+ Item: Record Item;\n+ Customer: Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ InvoiceNo: Code[20];\n+ OrderId: BigInteger;\n+ begin\n+ // [SCENARIO] Shopify related fields are not copied to the new invoice\n+ // [GIVEN] Posted sales invoice with Shopify related fields and empty invoice\n+ Initialize();\n+ OrderId := Any.IntegerInRange(10000, 99999);\n+ LibraryInventory.CreateItem(Item);\n+ LibrarySales.CreateCustomer(Customer);\n+ InvoiceNo := CreateAndPostSalesInvoice(Item, Customer, 1, OrderId);\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer.\"No.\");\n+\n+ // [WHEN] Copy the invoice\n+ CopySalesDocument(SalesHeader, InvoiceNo);\n+\n+ // [THEN] Shopify related fields are not copied\n+ LibraryAssert.IsTrue(SalesHeader.\"Shpfy Order Id\" = 0, 'Shpfy Order Id is not copied');\n+ end;\n+\n+ local procedure Initialize()\n+ begin\n+ if IsInitialized then\n+ exit;\n+ IsInitialized := true;\n+ LibraryERMCountryData.CreateVATData();\n+ LibraryERMCountryData.UpdateGeneralPostingSetup();\n+ end;\n+\n+ local procedure CreateAndPostSalesInvoice(Item: Record Item; Customer: Record Customer; NumberOfLines: Integer; OrderId: BigInteger): Code[20]\n+ var\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer.\"No.\");\n+ SalesHeader.\"Shpfy Order Id\" := OrderId;\n+ SalesHeader.Modify();\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", NumberOfLines);\n+ exit(LibrarySales.PostSalesDocument(SalesHeader, true, true));\n+ end;\n+\n+ local procedure CopySalesDocument(var ToSalesHeader: Record \"Sales Header\"; DocNo: Code[20])\n+ var\n+ CopyDocumentMgt: Codeunit \"Copy Document Mgt.\";\n+ begin\n+ CopyDocumentMgt.SetProperties(true, false, false, false, false, false, false);\n+ CopyDocumentMgt.CopySalesDoc(\"Sales Document Type From\"::\"Posted Invoice\", DocNo, ToSalesHeader);\n+ end;\n+}\ndiff --git a/App/Apps/W1/Shopify/test/app.json b/App/Apps/W1/Shopify/test/app.json\nindex fad22c7daf0e..ba1deea22a10 100644\n--- a/App/Apps/W1/Shopify/test/app.json\n+++ b/App/Apps/W1/Shopify/test/app.json\n@@ -71,6 +71,10 @@\n {\n \"from\": 139645,\n \"to\": 139649\n+ },\n+ {\n+ \"from\": 139695,\n+ \"to\": 139699\n }\n ],\n \"target\": \"OnPrem\",\n", "patch": "diff --git a/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al b/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al\nindex cf03c116eaef..a6a20c46d2da 100644\n--- a/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al\n+++ b/App/Apps/W1/Shopify/app/src/Invoicing/Codeunits/ShpfyUpdateSalesInvoice.Codeunit.al\n@@ -1,6 +1,8 @@\n namespace Microsoft.Integration.Shopify;\n \n using Microsoft.Sales.History;\n+using Microsoft.Utilities;\n+using Microsoft.Sales.Document;\n \n codeunit 30364 \"Shpfy Update Sales Invoice\"\n {\n@@ -19,4 +21,12 @@ codeunit 30364 \"Shpfy Update Sales Invoice\"\n begin\n SalesInvoiceHeader.\"Shpfy Order Id\" := SalesInvoiceHeaderRec.\"Shpfy Order Id\";\n end;\n+\n+ [EventSubscriber(ObjectType::Codeunit, Codeunit::\"Copy Document Mgt.\", 'OnCopySalesDocOnAfterTransferPostedInvoiceFields', '', false, false)]\n+ local procedure OnCopySalesDocOnAfterCopySalesDocUpdateHeader(var ToSalesHeader: Record \"Sales Header\")\n+ begin\n+ Clear(ToSalesHeader.\"Shpfy Order Id\");\n+ Clear(ToSalesHeader.\"Shpfy Order No.\");\n+ Clear(ToSalesHeader.\"Shpfy Refund Id\");\n+ end;\n }\n\\ No newline at end of file\n"}
+{"metadata": {"area": "sales", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-220036", "base_commit": "e21460ab75c1fb80ba3033e3755672cbd4ed8d9f", "created_at": "2025-07-04", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM", "App\\Layers\\W1\\Tests\\Misc"], "FAIL_TO_PASS": [{"codeunitID": 134905, "functionName": ["VerifyEmailOnReminderPageWhenCustomerHasNoContacts"]}, {"codeunitID": 134825, "functionName": ["GetPrimaryConactCustomerWithoutContact"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\nindex f8b1cf9e56e..71c12b1ce1a 100644\n--- a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n@@ -587,6 +587,55 @@ codeunit 134905 \"ERM Issued Reminder Addnl Fee\"\n Assert.AreEqual(ReminderFinChargeEntry.\"Due Date\", CustLedgerEntry.\"Due Date\", ReminderDueDateErr);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure VerifyEmailOnReminderPageWhenCustomerHasNoContacts()\n+ var\n+ Customer: Record Customer;\n+ ReminderLevel: Record \"Reminder Level\";\n+ ReminderText: Record \"Reminder Text\";\n+ ReminderHeader: Record \"Reminder Header\";\n+ ReminderPage: TestPage Reminder;\n+ CustomerCard: TestPage \"Customer Card\";\n+ EMail: Text[80];\n+ DueDate: Date;\n+ DocumentDate: Date;\n+ begin\n+ // [SCENARIO 581797] [ALL-E] Field Email on Reminder is empty when customer does not have any contacts\n+ Initialize();\n+\n+ // [GIVEN] Create Customer with E-Mail and Reminder Terms Code.\n+ CreateCustomer(Customer, '');\n+ Customer.Validate(\"Reminder Terms Code\", CreateReminderTerms());\n+ EMail := 'test1@test.com';\n+ Customer.Modify(true);\n+\n+ CustomerCard.OpenEdit();\n+ CustomerCard.GoToRecord(Customer);\n+ CustomerCard.\"E-Mail\".SetValue(EMail);\n+ CustomerCard.Close();\n+\n+ // [GIVEN] Create Reminder Level with Random Grace Period and Random Additional Fee.\n+ ReminderLevel.SetRange(\"Reminder Terms Code\", Customer.\"Reminder Terms Code\");\n+ ReminderLevel.FindFirst();\n+ LibraryERM.CreateReminderText(\n+ ReminderText, Customer.\"Reminder Terms Code\",\n+ ReminderLevel.\"No.\", ReminderText.Position::Ending, ReminderEndingText);\n+\n+ // [WHEN] Post Sales Invoice and Create Reminder.\n+ DueDate := CreateAndPostSalesInvoice(Customer.\"No.\", '');\n+ DocumentDate := CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', CalcDate(ReminderLevel.\"Grace Period\", DueDate));\n+ CreateReminder(Customer.\"No.\", DocumentDate, false);\n+\n+ // [THEN] Find Reminder Header for Customer and open Reminder Page.\n+ FindReminderHeader(ReminderHeader, Customer.\"No.\");\n+ ReminderPage.OpenEdit();\n+ ReminderPage.GoToRecord(ReminderHeader);\n+\n+ // [THEN] Verify E-Mail on Reminder Page.\n+ ReminderPage.ContactEmail.AssertEquals(EMail);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\ndiff --git a/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al b/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al\nindex 70b34d374fa..33cc3001fc3 100644\n--- a/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al\n+++ b/App/Layers/W1/Tests/Misc/UTCustomerTable.Codeunit.al\n@@ -25,6 +25,7 @@ codeunit 134825 \"UT Customer Table\"\n DeleteCustomerSalesDocExistsErr: Label 'You cannot delete %1 %2 because there is at least one outstanding Sales %3 for this customer.';\n DialogErr: Label 'Dialog';\n PhoneNoCannotContainLettersErr: Label '%1 must not contain letters in %2 %3=''%4''.';\n+ ContactNoShouldNotBeEmpty: Label 'Contact No. should not be empty';\n \n [Test]\n [Scope('OnPrem')]\n@@ -740,8 +741,8 @@ codeunit 134825 \"UT Customer Table\"\n // [WHEN] Function GetPrimaryConact is being run with parameter \"CONT\"\n Customer.GetPrimaryContact(Customer.\"No.\", Contact);\n \n- // [THEN] Variable Contact is empty\n- Contact.TestField(\"No.\", '');\n+ // [THEN] Variable Contact exists without customer contact\n+ Assert.IsTrue(Contact.\"No.\" <> '', ContactNoShouldNotBeEmpty);\n end;\n \n [Test]\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\nindex 9fdc21c529d..de6b7a0cc2e 100644\n--- a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n+++ b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n@@ -2302,7 +2302,22 @@ table 18 Customer\n begin\n Clear(PrimaryContact);\n if Customer.Get(CustomerNo) then\n- if PrimaryContact.Get(Customer.\"Primary Contact No.\") then;\n+ if not PrimaryContact.Get(Customer.\"Primary Contact No.\") then\n+ GetContact(CustomerNo, PrimaryContact);\n+ end;\n+\n+ local procedure GetContact(CustomerNo: Code[20]; var PrimaryContact: Record Contact)\n+ var\n+ ContactBusinessRelation: Record \"Contact Business Relation\";\n+ begin\n+ ContactBusinessRelation.SetCurrentKey(\"Link to Table\", \"No.\");\n+ ContactBusinessRelation.SetRange(\"Link to Table\", ContactBusinessRelation.\"Link to Table\"::Customer);\n+ ContactBusinessRelation.SetRange(\"No.\", CustomerNo);\n+ if ContactBusinessRelation.FindSet() then\n+ repeat\n+ if PrimaryContact.Get(ContactBusinessRelation.\"Contact No.\") then\n+ exit;\n+ until ContactBusinessRelation.Next() = 0;\n end;\n \n local procedure GetCustomerPriceGroupPriceCalcMethod(): Enum \"Price Calculation Method\";\n"}
+{"metadata": {"area": "sustainability", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-188438", "base_commit": "b3cff264abfbab722f8657c126f23aa07ad00056", "created_at": "2024-07-03", "environment_setup_version": "24.3", "project_paths": ["App\\Apps\\W1\\Sustainability\\app", "App\\Apps\\W1\\Sustainability\\test"], "FAIL_TO_PASS": [{"codeunitID": 148181, "functionName": ["TestCustomAmountIsPositiveForNegativeTotalOfGL"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al b/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al\nindex 54ca91b65b2f..bfae0fd4c73a 100644\n--- a/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al\n+++ b/App/Apps/W1/Sustainability/test/src/SustainabilityJournalTest.Codeunit.al\n@@ -5,9 +5,13 @@ codeunit 148181 \"Sustainability Journal Test\"\n \n var\n Assert: Codeunit Assert;\n+ LibraryERM: Codeunit \"Library - ERM\";\n+ LibraryRandom: Codeunit \"Library - Random\";\n LibrarySustainability: Codeunit \"Library - Sustainability\";\n+ LibraryUtility: Codeunit \"Library - Utility\";\n OneDefaultTemplateShouldBeCreatedLbl: Label 'One default template should be created after page is opened', Locked = true;\n OneDefaultBatchShouldBeCreatedLbl: Label 'One default batch should be created after page is opened', Locked = true;\n+ CustomAmountMustBePositiveLbl: Label 'The custom amount must be positive', Locked = true;\n \n [Test]\n procedure TestDefaultTemplateAndBatchSuccessfullyInserted()\n@@ -100,4 +104,46 @@ codeunit 148181 \"Sustainability Journal Test\"\n // [THEN] The Check should fail\n asserterror SustainabilityJournalMgt.CheckScopeMatchWithBatch(SustainabilityJournalLine);\n end;\n+\n+ [Test]\n+ procedure TestCustomAmountIsPositiveForNegativeTotalOfGL()\n+ var\n+ SustainAccountCategory: Record \"Sustain. Account Category\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJouralLine: Record \"Gen. Journal Line\";\n+ SustainabilityCalcMgt: Codeunit \"Sustainability Calc. Mgt.\";\n+ GenJournalTemplateCode: Code[10];\n+ GLAccountNo: Code[20];\n+ GLAmount, CustomAmount : Decimal;\n+ begin\n+ // [SCENARIO 540221] Test that the custom amount is positive when the total of the GL is negative\n+\n+ // [GIVEN] G/L Account exists\n+ GLAccountNo := LibraryERM.CreateGLAccountNoWithDirectPosting();\n+\n+ // [GIVEN] G/L Batch and Template exist\n+ GenJournalTemplateCode := LibraryERM.SelectGenJnlTemplate();\n+ LibraryERM.CreateGenJournalBatch(GenJournalBatch, GenJournalTemplateCode);\n+\n+ // [GIVEN] G/L Entry with Amount = -1000 for the G/L Account\n+ GLAmount := -LibraryRandom.RandDec(1000, 2);\n+ LibraryERM.CreateGeneralJnlLine2WithBalAcc(GenJouralLine, GenJournalTemplateCode, GenJournalBatch.Name, GenJouralLine.\"Document Type\"::Payment, GenJouralLine.\"Account Type\"::\"G/L Account\", GLAccountNo, GenJouralLine.\"Account Type\"::\"G/L Account\", LibraryERM.CreateGLAccountNoWithDirectPosting(), GLAmount);\n+ LibraryERM.PostGeneralJnlLine(GenJouralLine);\n+\n+ // [GIVEN] Sustain Account Category with the G/L Account calculation foundation\n+ SustainAccountCategory := CreateSustAccountCategoryWithGLAccountNo(GLAccountNo);\n+\n+ // [WHEN] Getting the collectable amount for sustanability account category\n+ CustomAmount := SustainabilityCalcMgt.GetCollectableGLAmount(SustainAccountCategory, 0D, 0D);\n+\n+ // [THEN] The custom amount = 1000\n+ Assert.AreEqual(Abs(GLAmount), CustomAmount, CustomAmountMustBePositiveLbl);\n+ end;\n+\n+ local procedure CreateSustAccountCategoryWithGLAccountNo(GLAccountNo: Code[20]) SustainAccountCategory: Record \"Sustain. Account Category\"\n+ begin\n+ SustainAccountCategory := LibrarySustainability.InsertAccountCategory(LibraryUtility.GenerateGUID(), LibraryUtility.GenerateGUID(), Enum::\"Emission Scope\"::\"Scope 2\", Enum::\"Calculation Foundation\"::Custom, true, true, true, 'GL', true);\n+ SustainAccountCategory.\"G/L Account Filter\" := GLAccountNo;\n+ SustainAccountCategory.Modify(true);\n+ end;\n }\n\\ No newline at end of file\n", "patch": "diff --git a/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al b/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al\nindex 4644c8733d76..35add37418cc 100644\n--- a/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al\n+++ b/App/Apps/W1/Sustainability/app/src/Calculation/SustainabilityCalcMgt.Codeunit.al\n@@ -70,7 +70,7 @@ codeunit 6218 \"Sustainability Calc. Mgt.\"\n begin\n FilterGLEntry(SustainAccountCategory, FromDate, ToDate, GLEntry);\n GLEntry.CalcSums(Amount);\n- exit(GLEntry.Amount);\n+ exit(Abs(GLEntry.Amount));\n end;\n \n internal procedure CollectGeneralLedgerAmount(var SustainabilityJnlLine: Record \"Sustainability Jnl. Line\")\n"}
+{"metadata": {"area": "reporting", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-224447", "base_commit": "cc0427613cdcf235d834b83a7e69b98288686d0d", "created_at": "2025-08-21", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134979, "functionName": ["SendIssuedReminderByEmailAndEntryCreatedInEmailRelatedRecords"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al b/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al\nindex 1667c4a29d8..01f9284203b 100644\n--- a/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ReminderAutomationTests.Codeunit.al\n@@ -844,6 +844,53 @@ codeunit 134979 \"Reminder Automation Tests\"\n ReminderTermSetupPage.ReminderLevelSetup.CustomerCommunications.Invoke();\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('ModalEmailEditorHandler,CancelMailSendingStrMenuHandler')]\n+ procedure SendIssuedReminderByEmailAndEntryCreatedInEmailRelatedRecords()\n+ var\n+ Customer: Record Customer;\n+ IssuedReminderHeader: Record \"Issued Reminder Header\";\n+ ReminderTerms: Record \"Reminder Terms\";\n+ ReminderHeader: Record \"Reminder Header\";\n+ LanguageCode: Code[10];\n+ FileName: Text;\n+ begin\n+ // [SCENARIO 591799] Issued reminder emails are not logged in sent e-mail history of a customer\n+ Initialize();\n+\n+ // [WHEN] A connector is installed and an account is added\n+ InstallConnectorAndAddAccount();\n+\n+ // [GIVEN] Create reminder term with levels\n+ CreateReminderTermsWithLevels(ReminderTerms, GetDefaultDueDatePeriodForReminderLevel(), Any.IntegerInRange(2, 5));\n+\n+ // [GIVEN] Create reminder attachment text, file name = XXX, language code = Y\n+ LanguageCode := LibraryERM.GetAnyLanguageDifferentFromCurrent();\n+ CreateReminderAttachmentText(ReminderTerms, LanguageCode);\n+\n+ // [GIVEN] Create a customer X with overdue entries\n+ CreateCustomerWithOverdueEntries(Customer, ReminderTerms, Any.IntegerInRange(2, 5));\n+\n+ // [GIVEN] Set language code Y for customer X\n+ Customer.\"Language Code\" := LanguageCode;\n+ Customer.Modify();\n+ FileName := LibraryVariableStorage.DequeueText();\n+ LibraryVariableStorage.Enqueue(Customer.\"No.\");\n+ LibraryVariableStorage.Enqueue(FileName);\n+\n+ // [GIVEN] Create and issue reminder for customer X \n+ CreateAndIssueReminder(ReminderHeader, Customer.\"No.\");\n+\n+ // [WHEN] Run action \"Send by mail\" on issued reminder\n+ IssuedReminderHeader.SetRange(\"Pre-Assigned No.\", ReminderHeader.\"No.\");\n+ IssuedReminderHeader.FindFirst();\n+ CustomReportSelectionPrint(IssuedReminderHeader, Enum::\"Report Selection Usage\"::Reminder, 1);\n+\n+ // [THEN] Verified in ModalEmailEditorHandler page\n+ LibraryVariableStorage.Clear();\n+ end;\n+\n local procedure CreateReminderAttachmentText(ReminderTerms: Record \"Reminder Terms\"; LanguageCode: Code[10])\n var\n ReminderLevel: Record \"Reminder Level\";\n@@ -1179,6 +1226,57 @@ codeunit 134979 \"Reminder Automation Tests\"\n end;\n end;\n \n+ local procedure InstallConnectorAndAddAccount()\n+ var\n+ TempAccount: Record \"Email Account\" temporary;\n+ ConnectorMock: Codeunit \"Connector Mock\";\n+ EmailScenarioMock: Codeunit \"Email Scenario Mock\";\n+ begin\n+ ConnectorMock.Initialize();\n+ ConnectorMock.AddAccount(TempAccount);\n+ EmailScenarioMock.DeleteAllMappings();\n+ EmailScenarioMock.AddMapping(Enum::\"Email Scenario\"::Default, TempAccount.\"Account Id\", TempAccount.Connector);\n+ end;\n+\n+ local procedure CustomReportSelectionPrint(Document: Variant; ReportUsage: Enum \"Report Selection Usage\"; CustomerNoFieldNo: Integer)\n+ var\n+ ReportSelections: Record \"Report Selections\";\n+ TempReportSelections: Record \"Report Selections\" temporary;\n+ RecRef: RecordRef;\n+ FieldRef: FieldRef;\n+ CustomerNo: Code[20];\n+ begin\n+ RecRef.GetTable(Document);\n+ FieldRef := RecRef.Field(CustomerNoFieldNo);\n+ CustomerNo := CopyStr(Format(FieldRef.Value), 1, MaxStrLen(CustomerNo));\n+\n+ RecRef.SetRecFilter();\n+ RecRef.SetTable(Document);\n+\n+ ReportSelections.FindEmailAttachmentUsageForCust(ReportUsage, CustomerNo, TempReportSelections);\n+ ReportSelections.SendEmailToCust(ReportUsage.AsInteger(), Document, '', '', true, CustomerNo);\n+ end;\n+\n+ [StrMenuHandler]\n+ [Scope('OnPrem')]\n+ procedure CancelMailSendingStrMenuHandler(Options: Text; var Choice: Integer; Instruction: Text)\n+ begin\n+ Choice := 1; //Save as Draft //Discard email\t\n+ end;\n+\n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ModalEmailEditorHandler(var EmailEditor: TestPage \"Email Editor\")\n+ var\n+ Customer: Record Customer;\n+ EmailRelatedRecord: Record \"Email Related Record\";\n+ begin\n+ Customer.Get(LibraryVariableStorage.DequeueText());\n+ EmailRelatedRecord.SetRange(\"Table Id\", Database::Customer);\n+ EmailRelatedRecord.SetRange(\"System Id\", Customer.SystemId);\n+ Assert.IsTrue(EmailRelatedRecord.FindFirst(), EmailRelatedRecordNotFoundErr);\n+ end;\n+\n [ModalPageHandler()]\n procedure CreateRemindersSetupModalPageHandler(var CreateRemindersSetup: TestPage \"Create Reminders Setup\")\n begin\n@@ -1271,4 +1369,5 @@ codeunit 134979 \"Reminder Automation Tests\"\n Any: Codeunit Any;\n IsInitialized: Boolean;\n FiltersAreNotSavedErr: Label 'Filters are not saved';\n+ EmailRelatedRecordNotFoundErr: Label 'Email related record not found';\n }\n\\ No newline at end of file\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\nindex 7a71bebba78..5e7b5d9c79b 100644\n--- a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n+++ b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n@@ -1269,7 +1269,8 @@ table 77 \"Report Selections\"\n Database::\"Sales Invoice Header\",\n Database::\"Sales Cr.Memo Header\",\n Database::\"Sales Shipment Header\",\n- Database::\"Return Receipt Header\"];\n+ Database::\"Return Receipt Header\",\n+ Database::\"Issued Reminder Header\"];\n \n OnAfterIsCustomerAccount(DocumentTableId, IsCustomer);\n end;\n@@ -1521,7 +1522,10 @@ table 77 \"Report Selections\"\n // Related Source - Customer or vendor receiving the document\n TableId := GetAccountTableId(DocumentRecord.Number());\n if TableId = Database::Customer then begin\n- FieldName := 'Sell-to Customer No.';\n+ if DocumentRecord.Number() = Database::\"Issued Reminder Header\" then\n+ FieldName := 'Customer No.'\n+ else\n+ FieldName := 'Sell-to Customer No.';\n OnSendEmailDirectlyOnAfterSetFieldName(DocumentRecord.Number(), FieldName);\n if DataTypeManagement.FindfieldByName(DocumentRecord, FieldRef, FieldName) and Customer.Get(Format(FieldRef.Value())) then begin\n SourceTableIDs.Add(Database::Customer);\n"}
+{"metadata": {"area": "finance", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226875", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-15", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\General Journal"], "FAIL_TO_PASS": [{"codeunitID": 134920, "functionName": ["VendorNameFieldPopulatesOnlyForVendorAccountType"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al b/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al\nindex 9e6664f2979..0e9383fc12c 100644\n--- a/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al\n+++ b/App/Layers/W1/Tests/General Journal/ERMGeneralJournalUT.Codeunit.al\n@@ -6000,6 +6000,53 @@ codeunit 134920 \"ERM General Journal UT\"\n GenJournalLine[4].TestField(\"Document No.\", NewDocNo);\n end;\n \n+ [Test]\n+ procedure VendorNameFieldPopulatesOnlyForVendorAccountType()\n+ var\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJournalTemplate: Record \"Gen. Journal Template\";\n+ GLAccount: Record \"G/L Account\";\n+ Vendor: Record Vendor;\n+ PurchaseJournal: TestPage \"Purchase Journal\";\n+ begin\n+ // [SCENARIO 599505] Purchase Journal page validates vendor name field based on account type\n+ Initialize();\n+\n+ // [GIVEN] Create a vendor with random name\n+ LibraryPurchase.CreateVendor(Vendor);\n+ Vendor.Name := LibraryRandom.RandText(20);\n+ Vendor.Modify(true);\n+\n+ // [GIVEN] Create Purchase Journal Template and Batch\n+ LibraryERM.CreateGenJournalBatch(GenJournalBatch, LibraryJournals.SelectGenJournalTemplate(GenJournalTemplate.Type::Purchases, Page::\"Purchase Journal\"));\n+\n+ // [WHEN] Open Purchase Journal page and perform actions as per YAML recording\n+ PurchaseJournal.OpenEdit();\n+ PurchaseJournal.CurrentJnlBatchName.SetValue(GenJournalBatch.Name);\n+\n+ // [GIVEN] Set Document Type to Invoice and Document No. to random value\n+ PurchaseJournal.\"Document Type\".SetValue(\"Gen. Journal Document Type\"::Invoice);\n+ PurchaseJournal.\"Document No.\".SetValue(LibraryRandom.RandText(10));\n+\n+ // [GIVEN] Set Account Type to Vendor and Account No. to Vendor.\"No.\"\n+ PurchaseJournal.\"Account Type\".SetValue(\"Gen. Journal Account Type\"::Vendor);\n+ PurchaseJournal.\"Account No.\".SetValue(Vendor.\"No.\");\n+\n+ // [THEN] Verify Vendor Name page field is populated with Vendor.Name\n+ PurchaseJournal.\"\".AssertEquals(Vendor.Name);\n+\n+ // [WHEN] Set Account Type to G/L Account and Account No. to a new G/L Account.\"No.\"\n+ PurchaseJournal.\"Account Type\".SetValue(\"Gen. Journal Account Type\"::\"G/L Account\");\n+ LibraryERM.CreateGLAccount(GLAccount);\n+ PurchaseJournal.\"Account No.\".SetValue(GLAccount.\"No.\");\n+\n+ // [THEN] Verify Vendor Name field should be empty for G/L Account\n+ PurchaseJournal.\"\".AssertEquals('');\n+\n+ // [CLEANUP] Close Purchase Journal page\n+ PurchaseJournal.Close();\n+ end;\n+\n local procedure Initialize()\n begin\n LibrarySetupStorage.Restore();\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al\nindex fa043e01294..4d5abfe80aa 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/PurchaseJournal.Page.al\n@@ -170,7 +170,7 @@ page 254 \"Purchase Journal\"\n CurrPage.SaveRecord();\n end;\n }\n- field(\"\"; AccName)\n+ field(\"\"; GetVendorName())\n {\n ApplicationArea = Basic, Suite;\n Caption = 'Vendor Name';\n@@ -1661,6 +1661,14 @@ page 254 \"Purchase Journal\"\n NumberOfRecords := Rec.Count();\n end;\n \n+ local procedure GetVendorName(): Text[100]\n+ begin\n+ if (Rec.\"Account Type\" = Rec.\"Account Type\"::Vendor) and (AccName <> '') then\n+ exit(AccName);\n+\n+ exit('');\n+ end;\n+\n local procedure EnableApplyEntriesAction()\n begin\n ApplyEntriesActionEnabled :=\n"}
+{"metadata": {"area": "finance", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226223", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-09", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134043, "functionName": ["NoVATEntryAddCurrExchRateAdjust"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al\nindex ee712bb9f9b..26f12019b95 100644\n--- a/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMAdditionalCurrency.Codeunit.al\n@@ -1192,6 +1192,38 @@ codeunit 134043 \"ERM Additional Currency\"\n StrSubstNo(AmountLCYError, GenJournalLine.\"Amount (LCY)\"));\n end;\n \n+ [Test]\n+ [HandlerFunctions('StatisticsMessageHandler')]\n+ procedure NoVATEntryAddCurrExchRateAdjust()\n+ var\n+ Currency: Record Currency;\n+ CurrencyExchangeRate: Record \"Currency Exchange Rate\";\n+ GeneralLedgerSetup: Record \"General Ledger Setup\";\n+ VATEntry: Record \"VAT Entry\";\n+ PostingDate: Date;\n+ begin\n+ // [SCENARIO 598998] \"Attempted to divide by zero\" error during Exchange Rates Adjustment if the company has no Tax/VAT Entries.\n+ Initialize();\n+ VATEntry.DeleteAll();\n+\n+ // [GIVEN] Currency FCY with exchange rates.\n+ PostingDate := WorkDate();\n+ CreateCurrencyWithExchangeRates(Currency, 1, PostingDate);\n+\n+ // [GIVEN] General Ledger Setup \"Additional Reporting Currency\" = \"FCY\"\n+ LibraryERM.SetAddReportingCurrency(Currency.Code);\n+\n+ // [GIVEN] General Ledger Setup \"VAT Exchange Rate Adjustment\" := Adjust Additional-Currency Amount\n+ UpdateGenLedgerVATExchRateAdjustment(\n+ GeneralLedgerSetup.\"VAT Exchange Rate Adjustment\"::\"Adjust Additional-Currency Amount\");\n+\n+ // [THEN] Run Adjust Exchange Rate with Adjust G/L Account and without other Adjustments\n+ CurrencyExchangeRate.Get(Currency.code, LibraryERM.FindEarliestDateForExhRate());\n+\n+ // [THEN] Report should executed without any error\n+ RunAdjustExchangeRates(CurrencyExchangeRate, Currency.Code);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al b/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al\nindex 467c235ce97..bdb56817ec5 100644\n--- a/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/Currency/ExchRateAdjmtProcess.Codeunit.al\n@@ -308,6 +308,8 @@ codeunit 699 \"Exch. Rate Adjmt. Process\"\n Window.Open(AdjustingVATEntriesTxt + VATEntryProgressBarTxt);\n \n VATEntryNoTotal := VATEntry.Count();\n+ if VATEntryNoTotal = 0 then\n+ exit;\n SetVATEntryFilters(VATEntry, ExchRateAdjmtParameters.\"Start Date\", ExchRateAdjmtParameters.\"End Date\");\n if VATPostingSetup.FindSet() then\n repeat\n"}
+{"metadata": {"area": "service", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-221877", "base_commit": "0b60a161ce9c6976c82d811815aa974cf29181f8", "created_at": "2025-07-24", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Service"], "FAIL_TO_PASS": [{"codeunitID": 136101, "functionName": ["AutoUpdateServiceHeaderStatusOnServiceItemLineAdd"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\nindex 5a74dfc12b9..204066e8ac0 100644\n--- a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n@@ -122,6 +122,7 @@ codeunit 136101 \"Service Orders\"\n AvailableExpectedQuantityErr: Label 'Available expected quantity must be %1.', Comment = '%1=Value';\n VATCountryRegionLbl: Label 'VAT Country/Region Code must be %1', Comment = '%1 = Country/Region Code';\n ServiceOrderErr: Label 'Service Order does not exist.';\n+ ServiceOrderStatusShouldChangedErr: Label 'Service Header Status should have changed when adding Service Item';\n \n [Test]\n [Scope('OnPrem')]\n@@ -5688,6 +5689,54 @@ codeunit 136101 \"Service Orders\"\n ServiceStatistics.SubForm.\"Amount Including VAT\".AssertEquals(0);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure AutoUpdateServiceHeaderStatusOnServiceItemLineAdd()\n+ var\n+ ServiceHeader: Record \"Service Header\";\n+ ServiceItem: Record \"Service Item\";\n+ Customer: Record Customer;\n+ ServiceOrderPage: TestPage \"Service Order\";\n+ InitialStatus: Enum \"Service Document Status\";\n+ FinalStatus: Enum \"Service Document Status\";\n+ begin\n+ // [SCENARIO 582114] Test that Service Header Status changes automatically when adding Service Item to Finished Service Order\n+\n+ // [GIVEN] Initialize and create test data\n+ Initialize();\n+ LibrarySales.CreateCustomer(Customer);\n+ LibraryService.CreateServiceItem(ServiceItem, Customer.\"No.\");\n+\n+ // [GIVEN] Create a Service Order and set status to Finished\n+ LibraryService.CreateServiceHeader(ServiceHeader, ServiceHeader.\"Document Type\"::Order, Customer.\"No.\");\n+ ServiceHeader.Validate(Status, ServiceHeader.Status::Finished);\n+ ServiceHeader.Modify(true);\n+ InitialStatus := ServiceHeader.Status;\n+\n+ // [WHEN] Open Service Order page and add Service Item Line (simulating user action)\n+ ServiceOrderPage.OpenEdit();\n+ ServiceOrderPage.Filter.SetFilter(\"No.\", ServiceHeader.\"No.\");\n+\n+ // [THEN] Verify initial status is Finished\n+ ServiceOrderPage.Status.AssertEquals(ServiceHeader.Status::Finished);\n+\n+ // [GIVEN] Add Service Item to the Service Item Lines subform\n+ ServiceOrderPage.ServItemLines.New();\n+ ServiceOrderPage.ServItemLines.ServiceItemNo.SetValue(ServiceItem.\"No.\");\n+ ServiceOrderPage.ServItemLines.Next(); // Move focus to trigger validation\n+\n+ // [THEN] Verify that Service Header Status has changed automatically\n+ ServiceOrderPage.Status.AssertEquals(ServiceHeader.Status::Pending); // Expected new status based on repair status priority\n+\n+ // [THEN] Verify the change was logged in Service Document Log\n+ ServiceHeader.Get(ServiceHeader.\"Document Type\", ServiceHeader.\"No.\");\n+ FinalStatus := ServiceHeader.Status;\n+\n+ // [THEN] Verify status actually changed\n+ Assert.AreNotEqual(InitialStatus, FinalStatus, ServiceOrderStatusShouldChangedErr);\n+ ServiceOrderPage.Close();\n+ end;\n+\n local procedure CreateServiceDocumentWithResourceWith100PctDisc(\n var ServiceHeader: Record \"Service Header\"; ServiceLine: Record \"Service Line\"; DocumentType: Enum \"Service Document Type\";\n CustomerNo: Code[20]; ResourceNo: Code[20]; Quantity: Decimal; UnitPrice: Decimal)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al b/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al\nindex 1c8fcc9eb8a..60fc813bbe7 100644\n--- a/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Service/Document/ServiceItemLine.Table.al\n@@ -201,6 +201,10 @@ table 5901 \"Service Item Line\"\n UseServItemLineAsxRec := true;\n Modify(true);\n end;\n+\n+ if Rec.\"Repair Status Code\" <> '' then\n+ Validate(\"Repair Status Code\", Rec.\"Repair Status Code\");\n+\n OnAfterValidateServiceItemNoOnBeforeUpdateResponseTimeHours(Rec, xRec);\n UpdateResponseTimeHours();\n CreateDimFromDefaultDim(0);\n"}
+{"metadata": {"area": "reporting", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-219082", "base_commit": "908f59111599c95d0ba5af721b5ef34d8f4aac1f", "created_at": "2025-06-25", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Service"], "FAIL_TO_PASS": [{"codeunitID": 136101, "functionName": ["PrintServiceOrderWithWorkDescription"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\nindex b74fec47106..55070a77a9a 100644\n--- a/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Service/ServiceOrders.Codeunit.al\n@@ -17,6 +17,7 @@ using Microsoft.Finance.VAT.Setup;\n using Microsoft.Foundation.Address;\n using Microsoft.Foundation.ExtendedText;\n using Microsoft.Foundation.NoSeries;\n+using Microsoft.Foundation.Reporting;\n using Microsoft.Foundation.Shipping;\n using Microsoft.Foundation.UOM;\n using Microsoft.Inventory.Item;\n@@ -5620,6 +5621,39 @@ codeunit 136101 \"Service Orders\"\n Assert.AreEqual(Customer[2].\"Country/Region Code\", ServiceHeader.\"VAT Country/Region Code\", VATCountryRegionLbl);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ServiceOrderReportRequestPageHandler')]\n+ procedure PrintServiceOrderWithWorkDescription()\n+ var\n+ Item: Record Item;\n+ ServiceHeader: Record \"Service Header\";\n+ ServiceItem: Record \"Service Item\";\n+ ServiceItemLine: Record \"Service Item Line\";\n+ ServiceLine: Record \"Service Line\";\n+ ServiceOrder: TestPage \"Service Order\";\n+ begin\n+ // [SCENARIO 575369] Verify Printing Service Order with Work Description does not throw error.\n+ Initialize();\n+\n+ // [GIVEN] Create Item\n+ LibraryInventory.CreateItem(Item);\n+\n+ // [GIVEN] Create Service Order with Work Description\n+ LibraryService.CreateServiceItem(ServiceItem, LibrarySales.CreateCustomerNo());\n+ LibraryService.CreateServiceHeader(ServiceHeader, ServiceHeader.\"Document Type\"::Order, ServiceItem.\"Customer No.\");\n+ LibraryService.CreateServiceItemLine(ServiceItemLine, ServiceHeader, ServiceItem.\"No.\");\n+ LibraryService.CreateServiceLine(ServiceLine, ServiceHeader, ServiceLine.Type::Item, Item.\"No.\");\n+\n+ // [WHEN] Open Service Order Card and click Print\n+ CreateCustomReportSelectionForCustomer(ServiceHeader.\"Customer No.\", \"Report Selection Usage\"::\"SM.Order\", 5900);\n+ ServiceOrder.OpenEdit();\n+ ServiceOrder.GotoRecord(ServiceHeader);\n+ ServiceOrder.WorkDescription.SetValue(LibraryRandom.RandText(20));\n+ ServiceOrder.\"&Print\".Invoke();\n+\n+ // [THEN] Verify no transaction error should occur.\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerTRUE(Question: Text[1024]; var Reply: Boolean)\n@@ -7923,6 +7957,23 @@ codeunit 136101 \"Service Orders\"\n exit(ServiceInvoiceHeader.\"No.\");\n end;\n \n+ local procedure CreateCustomReportSelectionForCustomer(CustomerNo: Code[20]; ReportSelectionUsage: Enum \"Report Selection Usage\"; ReportID: Integer)\n+ var\n+ CustomReportSelection: Record \"Custom Report Selection\";\n+ CustomReportLayout: Record \"Custom Report Layout\";\n+ begin\n+ CustomReportSelection.Init();\n+ CustomReportSelection.Validate(\"Source Type\", Database::Customer);\n+ CustomReportSelection.Validate(\"Source No.\", CustomerNo);\n+ CustomReportSelection.Validate(Usage, ReportSelectionUsage);\n+ CustomReportSelection.Validate(Sequence, 1);\n+ CustomReportSelection.Validate(\"Report ID\", ReportID);\n+ CustomReportSelection.Validate(\"Use for Email Body\", true);\n+ CustomReportSelection.Validate(\n+ \"Email Body Layout Code\", CustomReportLayout.InitBuiltInLayout(CustomReportSelection.\"Report ID\", CustomReportLayout.Type::Word.AsInteger()));\n+ CustomReportSelection.Insert(true);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmMessageHandler(Question: Text[1024]; var Reply: Boolean)\n@@ -8256,5 +8307,11 @@ codeunit 136101 \"Service Orders\"\n LibraryVariableStorage.Enqueue(CreditLimitNotification.CreditLimitDetails.OutstandingAmtLCY.Value);\n LibraryVariableStorage.Enqueue(CreditLimitNotification.CreditLimitDetails.TotalAmountLCY.Value);\n end;\n+\n+ [RequestPageHandler]\n+ procedure ServiceOrderReportRequestPageHandler(var ServiceOrder: TestRequestPage \"Service Order\")\n+ begin\n+ ServiceOrder.Cancel().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\nindex b1515adac7d..09f7b8b3998 100644\n--- a/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n+++ b/App/Layers/W1/BaseApp/Foundation/Reporting/ReportSelections.Table.al\n@@ -582,8 +582,11 @@ table 77 \"Report Selections\"\n \n IsHandled := false;\n OnBeforePrintDocument(TempReportSelections, IsGUI, RecVarToPrint, IsHandled);\n- if not IsHandled then\n+ if not IsHandled then begin\n+ if IsGUI then\n+ Commit();\n REPORT.RunModal(TempReportSelections.\"Report ID\", IsGUI, false, RecVarToPrint);\n+ end;\n \n OnAfterPrintDocument(TempReportSelections, IsGUI, RecVarToPrint, IsHandled);\n \n"}
+{"metadata": {"area": "finance", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-216918", "base_commit": "1ea776a43bea699ee3b63beb68162372fcb1226f", "created_at": "2025-05-29", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\VAT"], "FAIL_TO_PASS": [{"codeunitID": 134284, "functionName": ["JobJnlLineWithNonDeductNormalVATInFCYFromGenJnlLine"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al b/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al\nindex be592f1e578..e6b29da63e9 100644\n--- a/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al\n+++ b/App/Layers/W1/Tests/VAT/NonDedVATMisc.Codeunit.al\n@@ -1135,6 +1135,52 @@ codeunit 134284 \"Non Ded. VAT Misc.\"\n Assert.RecordIsNotEmpty(GLEntry);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure JobJnlLineWithNonDeductNormalVATInFCYFromGenJnlLine()\n+ var\n+ Customer: Record Customer;\n+ Job: Record Job;\n+ JobTask: Record \"Job Task\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ GenJnlLine: Record \"Gen. Journal Line\";\n+ JobJnlLine: Record \"Job Journal Line\";\n+ JobTransferLine: Codeunit \"Job Transfer Line\";\n+ DeductiblePercent: Decimal;\n+ begin\n+ // [FEATURE] [Normal VAT] [UT]\n+ // [SCENARIO 575793] Job journal line with FCY built from the general journal line includes non deductible VAT in \"Unit Cost\"\n+ Initialize();\n+ LibraryNonDeductibleVAT.SetUseForJobCost();\n+ // [GIVEN] VAT Posting Setup, where \"Tax Calculation Type\"::\"Normal VAT\", 'Deductible %' is '60'\n+ DeductiblePercent := LibraryRandom.RandInt(90);\n+ CreateNonDeductibleVATPostingSetup(VATPostingSetup, \"Tax Calculation Type\"::\"Normal VAT\", '', DeductiblePercent);\n+ // [GIVEN] Job \"X\" with currency which factor is 0.5\n+ LibrarySales.CreateCustomer(Customer);\n+ LibraryJob.CreateJob(Job, Customer.\"No.\");\n+ Job.Validate(\"Currency Code\", LibraryERM.CreateCurrencyWithRandomExchRates());\n+ Job.Modify(true);\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+ // [GIVEN] General journal line where line contains \"Non-Deductible VAT Amount\" = 100, \"Job No.\" = \"X\" \"Job Line Type\" = 'Billable'\n+ // [GIVEN] \"Job Quantity\" = 2, \"Job Unit Cost\" = 50\n+ CreateJobGLJournalLine(GenJnlLine, JobTask, VATPostingSetup);\n+\n+ // [WHEN] Run FromGenJnlLineToJnlLine\n+ JobTransferLine.FromGenJnlLineToJnlLine(GenJnlLine, JobJnlLine);\n+\n+ // [THEN] JobJnlLine contains \"Unit Cost LCY\" = (\"Job Unit Cost\" + \"Non-Deductible VAT Amount\") * \"Currency Factor\" / \"Job Quantity\" = (50 + 100) * 0.5 / 2 = 37.5\n+ Assert.AreEqual(\n+ Round(JobJnlLine.\"Unit Cost (LCY)\"),\n+ Round(GenJnlLine.\"Job Total Cost (LCY)\" / GenJnlLine.\"Job Quantity\") +\n+ Round(Round(GenJnlLine.\"Non-Deductible VAT Amount\" * GenJnlLine.\"Job Currency Factor\") / GenJnlLine.\"Job Quantity\"),\n+ 'Unit Cost (LCY) with Non-Deductible VAT amount is not correct in Job Journal Line');\n+ // [THEN] JobJnlLine contains \"Total Unit Cost\" = (\"Job Unit Cost\" + \"Non-Deductible VAT Amount\") * \"Currency Factor\" = (50 + 100) * 0.5 = 75\n+ Assert.AreEqual(\n+ Round(JobJnlLine.\"Total Cost (LCY)\"),\n+ Round(GenJnlLine.\"Job Total Cost (LCY)\" + Round(GenJnlLine.\"Non-Deductible VAT Amount\" * GenJnlLine.\"Job Currency Factor\")),\n+ 'Total Cost (LCY) with Non-Deductible VAT amount is not correct in Job Journal Line');\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -1368,6 +1414,15 @@ codeunit 134284 \"Non Ded. VAT Misc.\"\n GenJournalLine.Modify(true);\n end;\n \n+ local procedure CreateJobGLJournalLine(var GenJournalLine: Record \"Gen. Journal Line\"; JobTask: Record \"Job Task\"; VATPostingSetup: Record \"VAT Posting Setup\")\n+ begin\n+ LibraryJob.CreateJobGLJournalLine(GenJournalLine.\"Job Line Type\"::Billable, JobTask, GenJournalLine);\n+ GenJournalLine.Validate(\"Gen. Posting Type\", GenJournalLine.\"Gen. Posting Type\"::Purchase);\n+ GenJournalLine.Validate(\"VAT Bus. Posting Group\", VATPostingSetup.\"VAT Bus. Posting Group\");\n+ GenJournalLine.Validate(\"VAT Prod. Posting Group\", VATPostingSetup.\"VAT Prod. Posting Group\");\n+ GenJournalLine.Modify(true);\n+ end;\n+\n local procedure FindFAPostingGroup(GenProdPostingGroup: Code[20]; VATProductPostingGroup: Code[20]): Code[20]\n var\n FAPostingGroup: Record \"FA Posting Group\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al\nindex 26f99dcabd6..f35c5e941b5 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJournalLine.Table.al\n@@ -4937,16 +4937,7 @@ table 81 \"Gen. Journal Line\"\n TempJobJnlLine.Validate(\"No.\", \"Account No.\");\n TempJobJnlLine.Validate(Quantity, \"Job Quantity\");\n \n- if \"Currency Factor\" = 0 then begin\n- if \"Job Currency Factor\" = 0 then\n- TmpJobJnlOverallCurrencyFactor := 1\n- else\n- TmpJobJnlOverallCurrencyFactor := \"Job Currency Factor\";\n- end else\n- if \"Job Currency Factor\" = 0 then\n- TmpJobJnlOverallCurrencyFactor := 1 / \"Currency Factor\"\n- else\n- TmpJobJnlOverallCurrencyFactor := \"Job Currency Factor\" / \"Currency Factor\";\n+ TmpJobJnlOverallCurrencyFactor := GetGenJnlLineToJobCurrencyFactor();\n \n UpdateAmountsOnTempJobJnlLine(TmpJobJnlOverallCurrencyFactor);\n \n@@ -7628,6 +7619,22 @@ table 81 \"Gen. Journal Line\"\n RecordRestrictionMgt.RestrictRecordUsage(GenJournalLine, RestrictBatchUsageDetailsTxt);\n end;\n \n+ /// \n+ /// Calculates the currency factor for the general journal line based on the job currency factor and the journal line currency factor.\n+ /// \n+ /// Resulted currency factor\n+ procedure GetGenJnlLineToJobCurrencyFactor(): Decimal\n+ begin\n+ if \"Currency Factor\" = 0 then begin\n+ if \"Job Currency Factor\" = 0 then\n+ exit(1);\n+ exit(\"Job Currency Factor\");\n+ end;\n+ if \"Job Currency Factor\" = 0 then\n+ exit(1 / \"Currency Factor\");\n+ exit(\"Job Currency Factor\" / \"Currency Factor\");\n+ end;\n+\n /// \n /// Event triggered before creating dimensions from the Default Dimensions during the validation of the \"Account No.\" field.\n /// By subscribing to this event, developers can override the default dimension creation process for the \"Account No.\" field.\ndiff --git a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\nindex 2b5a6a4ca7e..c9d976f7272 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n@@ -17,6 +17,8 @@ using Microsoft.Foundation.Enums;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.History;\n using Microsoft.Foundation.Company;\n+using Microsoft.Projects.Project.Journal;\n+using Microsoft.Projects.Project.Job;\n \n /// \n /// Defines the implementation of Non-Deductible VAT\n@@ -436,6 +438,36 @@ codeunit 6201 \"Non-Ded. VAT Impl.\"\n FALedgEntry.\"Non-Ded. VAT FA Cost\" := GenJnlLine.\"Non-Ded. VAT FA Cost\";\n end;\n \n+ procedure CopyNonDedVATFromGenJnlLineToJobJnlLine(var JobJnlLine: Record \"Job Journal Line\"; GenJnlLine: Record \"Gen. Journal Line\")\n+ var\n+ Job: Record Job;\n+ CurrencyFactor, NonDedVATAmountLCY, UnitCost, UnitCostLCY, TotalCost, TotalCostLCY : Decimal;\n+ begin\n+ if not UseNonDeductibleVATAmountForJobCost() then\n+ exit;\n+ if not Job.Get(JobJnlLine.\"Job No.\") then\n+ exit;\n+ NonDedVATAmountLCY := GenJnlLine.\"Non-Deductible VAT Amount LCY\";\n+ if GenJnlLine.\"Currency Code\" <> Job.\"Currency Code\" then begin\n+ CurrencyFactor := GenJnlLine.GetGenJnlLineToJobCurrencyFactor();\n+ NonDedVATAmountLCY := Round(GenJnlLine.\"Non-Deductible VAT Amount\" * CurrencyFactor);\n+ end;\n+ UnitCostLCY := Round(NonDedVATAmountLCY / JobJnlLine.Quantity);\n+ UnitCost := Round(GenJnlLine.\"Non-Deductible VAT Amount\" / JobJnlLine.Quantity);\n+ TotalCostLCY := NonDedVATAmountLCY;\n+ TotalCost := GenJnlLine.\"Non-Deductible VAT Amount\";\n+ if JobJnlLine.\"Unit Cost\" > 0 then begin\n+ UnitCostLCY := Abs(UnitCostLCY);\n+ UnitCost := Abs(UnitCost);\n+ TotalCostLCY := Abs(TotalCostLCY);\n+ TotalCost := Abs(TotalCost);\n+ end;\n+ JobJnlLine.\"Unit Cost (LCY)\" += UnitCostLCY;\n+ JobJnlLine.\"Unit Cost\" += UnitCost;\n+ JobJnlLine.\"Total Cost (LCY)\" += TotalCostLCY;\n+ JobJnlLine.\"Total Cost\" += TotalCost;\n+ end;\n+\n procedure CheckPrepmtWithNonDeductubleVATInPurchaseLine(PurchaseLine: Record \"Purchase Line\")\n begin\n if (PurchaseLine.\"Prepayment %\" <> 0) and (PurchaseLine.\"Non-Deductible VAT %\" <> 0) then\ndiff --git a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al\nindex 216076f8cf0..4114e9a6815 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDeductibleVAT.Codeunit.al\n@@ -15,6 +15,7 @@ using Microsoft.FixedAssets.Ledger;\n using Microsoft.Foundation.Enums;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.History;\n+using Microsoft.Projects.Project.Journal;\n \n /// \n /// Provides an interface of the Non-Deductible VAT functionality.\n@@ -430,6 +431,11 @@ codeunit 6200 \"Non-Deductible VAT\"\n NonDedVATImpl.CopyNonDedVATFromGenJnlLineToFALedgEntry(FALedgEntry, GenJnlLine);\n end;\n \n+ procedure CopyNonDedVATFromGenJnlLineToJobJnlLine(var JobJnlLine: Record \"Job Journal Line\"; GenJnlLine: Record \"Gen. Journal Line\")\n+ begin\n+ NonDedVATImpl.CopyNonDedVATFromGenJnlLineToJobJnlLine(JobJnlLine, GenJnlLine);\n+ end;\n+\n /// \n /// Throws an error if purchase line contains prepayment and Non-Deductible VAT\n /// \ndiff --git a/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al\nindex d541dd087c6..50866220a3f 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Journal/JobTransferLine.Codeunit.al\n@@ -498,18 +498,7 @@ codeunit 1004 \"Job Transfer Line\"\n JobJnlLine.\"Total Cost (LCY)\" := GenJnlLine.\"Job Total Cost (LCY)\";\n JobJnlLine.\"Total Cost\" := GenJnlLine.\"Job Total Cost\";\n \n- if NonDeductibleVAT.UseNonDeductibleVATAmountForJobCost() then\n- if JobJnlLine.\"Unit Cost\" > 0 then begin\n- JobJnlLine.\"Unit Cost (LCY)\" += Abs(Round(GenJnlLine.\"Non-Deductible VAT Amount LCY\" / JobJnlLine.Quantity));\n- JobJnlLine.\"Unit Cost\" += Abs(Round(GenJnlLine.\"Non-Deductible VAT Amount\" / JobJnlLine.Quantity));\n- JobJnlLine.\"Total Cost (LCY)\" += Abs(GenJnlLine.\"Non-Deductible VAT Amount LCY\");\n- JobJnlLine.\"Total Cost\" += Abs(GenJnlLine.\"Non-Deductible VAT Amount\");\n- end else begin\n- JobJnlLine.\"Unit Cost (LCY)\" += Round(GenJnlLine.\"Non-Deductible VAT Amount LCY\" / JobJnlLine.Quantity);\n- JobJnlLine.\"Unit Cost\" += Round(GenJnlLine.\"Non-Deductible VAT Amount\" / JobJnlLine.Quantity);\n- JobJnlLine.\"Total Cost (LCY)\" += GenJnlLine.\"Non-Deductible VAT Amount LCY\";\n- JobJnlLine.\"Total Cost\" += GenJnlLine.\"Non-Deductible VAT Amount\";\n- end;\n+ NonDeductibleVAT.CopyNonDedVATFromGenJnlLineToJobJnlLine(JobJnlLine, GenJnlLine);\n \n JobJnlLine.\"Unit Price (LCY)\" := GenJnlLine.\"Job Unit Price (LCY)\";\n JobJnlLine.\"Unit Price\" := GenJnlLine.\"Job Unit Price\";\n"}
+{"metadata": {"area": "service", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218856", "base_commit": "7bfa7e70c56ba44878906b722f59a492dc75f376", "created_at": "2025-06-23", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Service"], "FAIL_TO_PASS": [{"codeunitID": 136102, "functionName": ["ChangeCustomerOfTypePeronInServiceContract"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al b/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al\nindex ad01a498eef..1b594959106 100644\n--- a/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Service/ServiceContracts.Codeunit.al\n@@ -10,6 +10,8 @@ using Microsoft.Finance.Dimension;\n using Microsoft.Finance.GeneralLedger.Account;\n using Microsoft.Finance.GeneralLedger.Ledger;\n using Microsoft.Finance.VAT.Setup;\n+using Microsoft.CRM.BusinessRelation;\n+using Microsoft.CRM.Contact;\n using Microsoft.Inventory.Item;\n using Microsoft.Projects.Resources.Resource;\n using Microsoft.Sales.Customer;\n@@ -42,6 +44,7 @@ codeunit 136102 \"Service Contracts\"\n var\n ServiceContractHeader2: Record \"Service Contract Header\";\n Assert: Codeunit Assert;\n+ LibraryMarketing: Codeunit \"Library - Marketing\";\n LibraryTestInitialize: Codeunit \"Library - Test Initialize\";\n LibraryService: Codeunit \"Library - Service\";\n LibraryUtility: Codeunit \"Library - Utility\";\n@@ -3563,6 +3566,49 @@ codeunit 136102 \"Service Contracts\"\n Assert.Equal('', Format(ServiceContractHeader.\"Last Invoice Period End\"));\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandler,SignContractConfirmHandler,ServContrctTemplateListHandler')]\n+ [Scope('OnPrem')]\n+ procedure ChangeCustomerOfTypePeronInServiceContract()\n+ var\n+ ContactBusinessRelation: Record \"Contact Business Relation\";\n+ Contact: Record Contact;\n+ ServiceContractHeader: Record \"Service Contract Header\";\n+ ServiceContractLine: Record \"Service Contract Line\";\n+ ShiptoAddress: Record \"Ship-to Address\";\n+ ServContractManagement: Codeunit ServContractManagement;\n+ ContactCard: TestPage \"Contact Card\";\n+ begin\n+ // [SCENARIO 578655] Change Customer No. on Service Contract of Customer type Person.\n+ Initialize();\n+\n+ // [GIVEN] Create Contact of type Person.\n+ LibraryMarketing.CreatePersonContact(Contact);\n+\n+ // [GIVEN] Open Contact Card and invoke Create Customer.\n+ ContactCard.OpenEdit();\n+ ContactCard.Filter.SetFilter(\"No.\", Contact.\"No.\");\n+ ContactCard.CreateCustomer.Invoke();\n+\n+ // [GIVEN] Create Service Contract Header and Service Contract Line.\n+ CreateServiceContract(ServiceContractHeader, ServiceContractLine, ServiceContractHeader.\"Contract Type\"::Contract);\n+ ModifyServiceContractHeader(ServiceContractHeader, ServiceContractHeader.\"Service Period\");\n+\n+ // [GIVEN] Find Contact Business Relation of the Contact.\n+ ContactBusinessRelation.SetRange(\"Contact No.\", Contact.\"No.\");\n+ ContactBusinessRelation.SetRange(\"Link to Table\", ContactBusinessRelation.\"Link to Table\"::Customer);\n+ ContactBusinessRelation.FindFirst();\n+\n+ // [GIVEN] Create Ship to Address.\n+ LibrarySales.CreateShipToAddress(ShiptoAddress, ContactBusinessRelation.\"No.\");\n+\n+ // [WHEN] Change Customer No. in Service Contract.\n+ ServContractManagement.ChangeCustNoOnServContract(ShiptoAddress.\"Customer No.\", ShiptoAddress.Code, ServiceContractHeader);\n+\n+ // [THEN] Check Customer No. is updated.\n+ CheckChangeCustomerNo(ServiceContractHeader, ContactBusinessRelation.\"No.\");\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5358,6 +5404,11 @@ codeunit 136102 \"Service Contracts\"\n Error(MessageText);\n end;\n \n+ [MessageHandler]\n+ procedure MessageHandler(Message: Text[1024])\n+ begin\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure InvoiceConfirmHandler(ConfirmMessage: Text[1024]; var Result: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al b/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al\nindex 4f315c8f604..572b132d573 100644\n--- a/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al\n+++ b/App/Layers/W1/BaseApp/Service/Contract/ServiceContractHeader.Table.al\n@@ -1389,7 +1389,7 @@ table 5965 \"Service Contract Header\"\n if (\"Bill-to Customer No.\" <> '') and (\"Bill-to Contact No.\" <> '') then begin\n Cont.Get(\"Bill-to Contact No.\");\n if ContBusinessRelation.FindByRelation(ContBusinessRelation.\"Link to Table\"::Customer, \"Bill-to Customer No.\") then\n- if ContBusinessRelation.\"Contact No.\" <> Cont.\"Company No.\" then\n+ if (ContBusinessRelation.\"Contact No.\" <> Cont.\"Company No.\") and (Cont.Type = Cont.Type::Company) then\n Error(Text045, Cont.\"No.\", Cont.Name, \"Bill-to Customer No.\");\n end;\n \n@@ -2240,6 +2240,7 @@ table 5965 \"Service Contract Header\"\n ContBusinessRelation: Record \"Contact Business Relation\";\n Cust: Record Customer;\n Cont: Record Contact;\n+ ContactBusinessRelationFound: Boolean;\n IsHandled: Boolean;\n begin\n IsHandled := false;\n@@ -2251,13 +2252,18 @@ table 5965 \"Service Contract Header\"\n \"Contact No.\" := Cont.\"No.\";\n \"Phone No.\" := Cont.\"Phone No.\";\n \"E-Mail\" := Cont.\"E-Mail\";\n- if Cont.Type = Cont.Type::Person then\n- \"Contact Name\" := Cont.Name\n- else\n+ if Cont.Type = Cont.Type::Person then begin\n+ \"Contact Name\" := Cont.Name;\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"No.\");\n+ end else begin\n+ if not ContactBusinessRelationFound then\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\");\n+\n if Cust.Get(\"Customer No.\") then\n \"Contact Name\" := Cust.Contact\n else\n \"Contact Name\" := ''\n+ end;\n end else begin\n \"Contact Name\" := '';\n \"Phone No.\" := '';\n@@ -2265,7 +2271,7 @@ table 5965 \"Service Contract Header\"\n exit;\n end;\n \n- if ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\") then begin\n+ if ContactBusinessRelationFound then begin\n if (\"Customer No.\" <> '') and\n (\"Customer No.\" <> ContBusinessRelation.\"No.\")\n then\n@@ -2289,23 +2295,29 @@ table 5965 \"Service Contract Header\"\n ContBusinessRelation: Record \"Contact Business Relation\";\n Cust: Record Customer;\n Cont: Record Contact;\n+ ContactBusinessRelationFound: Boolean;\n begin\n if Cont.Get(ContactNo) then begin\n \"Bill-to Contact No.\" := Cont.\"No.\";\n- if Cont.Type = Cont.Type::Person then\n- \"Bill-to Contact\" := Cont.Name\n- else\n+ if Cont.Type = Cont.Type::Person then begin\n+ \"Bill-to Contact\" := Cont.Name;\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"No.\");\n+ end else begin\n+ if not ContactBusinessRelationFound then\n+ ContactBusinessRelationFound := ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\");\n+\n if Cust.Get(\"Bill-to Customer No.\") then\n \"Bill-to Contact\" := Cust.Contact\n else\n \"Bill-to Contact\" := '';\n+ end;\n end else begin\n \"Bill-to Contact\" := '';\n exit;\n end;\n \n OnUpdateBillToCustOnBeforeContBusinessRelationFindByContact(Rec, Cust, Cont);\n- if ContBusinessRelation.FindByContact(ContBusinessRelation.\"Link to Table\"::Customer, Cont.\"Company No.\") then begin\n+ if ContactBusinessRelationFound then begin\n if \"Bill-to Customer No.\" = '' then begin\n SkipBillToContact := true;\n Validate(\"Bill-to Customer No.\", ContBusinessRelation.\"No.\");\n"}
+{"metadata": {"area": "project", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-215225", "base_commit": "cc7b76c98d2c241ae675ae9b79fe1b634617ec36", "created_at": "2025-05-12", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136305, "functionName": ["CheckUnitCostAndPriceNotZeroInRecurringJobJnlAfterPosting"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al b/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al\nindex e427075ebd9..1a379eb28aa 100644\n--- a/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/JobJournal.Codeunit.al\n@@ -2938,6 +2938,35 @@ codeunit 136305 \"Job Journal\"\n Assert.AreNotEqual(GenJournalLine.\"Job Total Cost (LCY)\", PreviousProjectTotalCostLCY, ProjectTotalCostErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ConfirmHandlerTrue,MessageHandler')]\n+ procedure CheckUnitCostAndPriceNotZeroInRecurringJobJnlAfterPosting()\n+ var\n+ Job: Record Job;\n+ JobTask: Record \"Job Task\";\n+ Resource: Record Resource;\n+ RecurringJobJnl: TestPage \"Recurring Job Jnl.\";\n+ begin\n+ // [SCENARIO 575092] Verify that the Unit Price and Unit Cost are not 0 in the recurring job journal after posting.\n+ Initialize();\n+\n+ // [GIVEN] Create a Resource.\n+ FindResource(Resource);\n+\n+ // [GIVEN] Create Job, job task & multiple Job planning line.\n+ CreateFullJob(Job, JobTask, Resource);\n+\n+ // [GIVEN] Create Recurring Job Journal.\n+ OpenRecurringJobJnl(RecurringJobJnl, JobTask, Resource.\"No.\");\n+\n+ // [WHEN] Post Recurring Job Journal.\n+ PostRecurringJobJnl(RecurringJobJnl);\n+\n+ // [THEN] Verify that the Unit Price and Unit Cost are not zero in the recurring job journal after posting.\n+ RecurringJobJnl.\"Unit Price\".AssertEquals(Resource.\"Unit Price\");\n+ RecurringJobJnl.\"Unit Cost\".AssertEquals(Resource.\"Unit Cost\");\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3917,6 +3946,51 @@ codeunit 136305 \"Job Journal\"\n JobJnlLine.TestField(\"Reserved Qty. (Base)\", 0);\n end;\n \n+ local procedure FindResource(var Resource: Record Resource)\n+ begin\n+ Resource.Get(LibraryJob.CreateConsumable(\"Job Planning Line Type\"::Resource));\n+ Resource.Validate(Type, Resource.Type::Person);\n+ Resource.Validate(\"Unit Cost\", LibraryRandom.RandIntInRange(100, 200));\n+ Resource.Validate(\"Unit Price\", LibraryRandom.RandIntInRange(300, 500));\n+ Resource.Modify(true);\n+ end;\n+\n+ local procedure CreateFullJob(var Job: Record Job; var JobTask: Record \"Job Task\"; Resource: Record Resource)\n+ var\n+ JobPlanningLine: Record \"Job Planning Line\";\n+ begin\n+ LibraryJob.CreateJob(Job);\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+\n+ LibraryJob.CreateJobPlanningLine(\n+ JobTask, JobPlanningLine.\"Line Type\"::\"Both Budget and Billable\",\n+ JobPlanningLine.Type::Resource, Resource.\"No.\", LibraryRandom.RandInt(10), JobPlanningLine);\n+ end;\n+\n+ local procedure OpenRecurringJobJnl(var RecurringJobJnl: TestPage \"Recurring Job Jnl.\"; JobTask: Record \"Job Task\"; ResourceNo: Code[20])\n+ var\n+ JobJournalLineType: Enum \"Job Journal Line Type\";\n+ RecurringMethod: Option ,Fixed,Variable;\n+ begin\n+ RecurringJobJnl.OpenEdit();\n+ RecurringJobJnl.\"Recurring Method\".SetValue(Format(RecurringMethod::Variable));\n+ RecurringJobJnl.\"Recurring Frequency\".SetValue('10D');\n+ RecurringJobJnl.\"Document No.\".SetValue(JobTask.\"Job No.\");\n+ RecurringJobJnl.\"Job No.\".SetValue(JobTask.\"Job No.\");\n+ RecurringJobJnl.\"Job Task No.\".SetValue(JobTask.\"Job Task No.\");\n+ RecurringJobJnl.Type.SetValue(Format(JobJournalLineType::Resource));\n+ RecurringJobJnl.\"No.\".SetValue(ResourceNo);\n+ RecurringJobJnl.Quantity.SetValue(Format(LibraryRandom.RandInt(5)));\n+ RecurringJobJnl.Close();\n+ end;\n+\n+ local procedure PostRecurringJobJnl(var RecurringJobJnl: TestPage \"Recurring Job Jnl.\")\n+ begin\n+ RecurringJobJnl.OpenEdit();\n+ RecurringJobJnl.\"P&ost\".Invoke();\n+ Commit();\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ContactListPageHandler(var ContactList: TestPage \"Contact List\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al\nindex 9f7bd75b991..57af0bb5690 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobJnlPostBatch.Codeunit.al\n@@ -275,6 +275,7 @@ codeunit 1013 \"Job Jnl.-Post Batch\"\n \n local procedure UpdateAndDeleteLines()\n var\n+ UnitCost, UnitPrice : Decimal;\n IsHandled: Boolean;\n begin\n OnBeforeUpdateAndDeleteLines(JobJnlLine);\n@@ -295,8 +296,12 @@ codeunit 1013 \"Job Jnl.-Post Batch\"\n JobJnlLine2.Validate(\"Posting Date\", CalcDate(JobJnlLine2.\"Recurring Frequency\", JobJnlLine2.\"Posting Date\"));\n if (JobJnlLine2.\"Recurring Method\" = JobJnlLine2.\"Recurring Method\"::Variable) and\n (JobJnlLine2.\"No.\" <> '')\n- then\n+ then begin\n+ UnitCost := JobJnlLine2.\"Unit Cost\";\n+ UnitPrice := JobJnlLine2.\"Unit Price\";\n JobJnlLine2.DeleteAmounts();\n+ UpdateUnitCostAndPrice(JobJnlLine2, UnitCost, UnitPrice);\n+ end;\n JobJnlLine2.Modify();\n until JobJnlLine2.Next() = 0;\n end else begin\n@@ -339,6 +344,15 @@ codeunit 1013 \"Job Jnl.-Post Batch\"\n NoSeriesBatch.SaveState();\n end;\n \n+ local procedure UpdateUnitCostAndPrice(var JobJournalLine: Record \"Job Journal Line\"; UnitCost: Decimal; UnitPrice: Decimal)\n+ begin\n+ if (UnitCost = 0) and (UnitPrice = 0) then\n+ exit;\n+\n+ JobJournalLine.\"Unit Cost\" := UnitCost;\n+ JobJournalLine.\"Unit Price\" := UnitPrice;\n+ end;\n+\n procedure SetSuppressCommit(NewSuppressCommit: Boolean)\n begin\n SuppressCommit := NewSuppressCommit;\n"}
+{"metadata": {"area": "project", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-213629", "base_commit": "e0211616ed03e968b987e2becd1069b217690c34", "created_at": "2025-04-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136306, "functionName": ["CopyJobAndCreateProjectJournalLineWithoutError"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\nindex 36cc3d9db4a..369594bf631 100644\n--- a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n@@ -58,6 +58,7 @@ codeunit 136306 \"Job Invoicing\"\n DetailLevel: Option All,\"Per Job\",\"Per Job Task\",\"Per Job Planning Line\";\n LineDiscountPctErr: Label '%1 should be %2', Comment = '%1 = Field Caption, %2 = Field Value';\n WrongNoOfLinesLbl: Label 'Wrong number of lines created.';\n+ ValueFalseErr: Label 'Value must be equal to false';\n \n [Test]\n [HandlerFunctions('TransferToInvoiceHandler,MessageHandler')]\n@@ -4043,6 +4044,44 @@ codeunit 136306 \"Job Invoicing\"\n Assert.AreEqual(1, InvoicesList.Count, WrongNoOfLinesLbl);\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandler,ConfirmHandler')]\n+ [Scope('OnPrem')]\n+ procedure CopyJobAndCreateProjectJournalLineWithoutError()\n+ var\n+ Job: Record Job;\n+ JobPlanningLine: Record \"Job Planning Line\";\n+ JobTask: Record \"Job Task\";\n+ JobJournalLine: Record \"Job Journal Line\";\n+ CopyJob: Codeunit \"Copy Job\";\n+ JobLineType: Enum \"Job Line Type\";\n+ TargetJobNo: Code[20];\n+ begin\n+ // [SCENARIO 573397] Copy project of System-Created Entry must be equal to 'No' in Project Planning Line\n+ Initialize();\n+\n+ // [GIVEN] Create Job with Customer\n+ CreateJobWithCustomer(Job);\n+\n+ // [GIVEN] Create Job Task\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+\n+ // [GIVEN] Create Job Journal Line of type \"Both Budget and Billable\" and post it.\n+ CreateAndPostJobJournalLineWithIteAndType(JobJournalLine, JobTask, JobLineType::\"Both Budget and Billable\");\n+\n+ // [GIVEN] Create target Job Id\n+ TargetJobNo := LibraryUtility.GenerateGUID();\n+\n+ // [WHEN] Copy Job by setting Copy Quantity as true.\n+ CopyJob.SetCopyOptions(false, true, false, 0, 0, 0);\n+ CopyJob.CopyJob(Job, TargetJobNo, TargetJobNo, Job.\"Bill-to Customer No.\", '');\n+\n+ // [THEN] Find the created Job Planning Line and \"System-Created Entry\" should be set false\n+ JobPlanningLine.SetRange(\"Job No.\", TargetJobNo);\n+ JobPlanningLine.FindFirst();\n+ Assert.IsFalse(JobPlanningLine.\"System-Created Entry\", ValueFalseErr);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5676,6 +5715,20 @@ codeunit 136306 \"Job Invoicing\"\n until JobPlanningLine.Next() = 0;\n end;\n \n+ local procedure CreateAndPostJobJournalLineWithIteAndType(var JobJournalLine: Record \"Job Journal Line\"; JobTask: Record \"Job Task\"; JobLineType: Enum \"Job Line Type\")\n+ var\n+ Item: Record Item;\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+ LibraryJob.CreateJobJournalLine(JobLineType, JobTask, JobJournalLine);\n+ JobJournalLine.Validate(Type, JobJournalLine.Type::Item);\n+ JobJournalLine.Validate(\"No.\", Item.\"No.\");\n+ JobJournalLine.Validate(Quantity, LibraryRandom.RandInt(100));\n+ JobJournalLine.Modify(true);\n+\n+ LibraryJob.PostJobJournal(JobJournalLine);\n+ end;\n+\n [RequestPageHandler]\n [Scope('OnPrem')]\n procedure TransferSalesCreditMemoReportWithDatesHandler(var JobTransferToCreditMemo: TestRequestPage \"Job Transfer to Credit Memo\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al\nindex 162d6cc55e7..544c740a441 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Job/CopyJob.Codeunit.al\n@@ -192,6 +192,7 @@ codeunit 1006 \"Copy Job\"\n TargetJobPlanningLine.\"Completely Picked\" := false;\n TargetJobPlanningLine.\"Ledger Entry No.\" := 0;\n TargetJobPlanningLine.\"Ledger Entry Type\" := TargetJobPlanningLine.\"Ledger Entry Type\"::\" \";\n+ TargetJobPlanningLine.\"System-Created Entry\" := false;\n OnCopyJobPlanningLinesOnBeforeTargetJobPlanningLineInsert(TargetJobPlanningLine, SourceJobPlanningLine);\n TargetJobPlanningLine.Insert(true);\n OnCopyJobPlanningLinesOnAfterTargetJobPlanningLineInsert(TargetJobPlanningLine, SourceJobPlanningLine);\n"}
+{"metadata": {"area": "intercompany", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-213524", "base_commit": "594d5dfcee2efe390ab75b6b0e30bc5a9f13f7f0", "created_at": "2025-04-16", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134154, "functionName": ["ICNavigateFromSalesCreditMemoLine"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al\nindex 0480aea9fa6..3ca288e85d2 100644\n--- a/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMIntercompanyIII.Codeunit.al\n@@ -3408,6 +3408,40 @@ codeunit 134154 \"ERM Intercompany III\"\n Assert.AreEqual(300, SalesLine.\"Line Amount\", 'When a sales order with a discount amount and prices including VAT is received from intercompany, the line amount should be preserved');\n end;\n \n+ [Test]\n+ procedure ICNavigateFromSalesCreditMemoLine()\n+ var\n+ Customer: Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ ICOutboxTransactions: TestPage \"IC Outbox Transactions\";\n+ PostedSalesCreditMemo: TestPage \"Posted Sales Credit Memo\";\n+ begin\n+ // [SCENARIO 574577] \"Unable to navigate to the related document\" error message if you use Go to Document from the Intercompany Outbox Transactions for a Credit Memo.\n+ Initialize();\n+ LibraryApplicationArea.EnableEssentialSetup();\n+ CleanupIC(false, true, true, false);\n+ CreateCustomerWithICPartner(Customer);\n+\n+ // [GIVEN] A posted sales credit memo to an IC customer\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::\"Credit Memo\", Customer.\"No.\");\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, LibraryInventory.CreateItemNo(), 1);\n+ LibrarySales.PostSalesDocument(SalesHeader, true, true);\n+\n+ // [GIVEN] The posted sales credit memo IC transaction should be on the Outbox\n+ ICOutboxTransactions.OpenEdit();\n+\n+ // [WHEN] Navigating from Outbox for this transaction\n+ PostedSalesCreditMemo.Trap();\n+ ICOutboxTransactions.GoToDocument.Invoke();\n+\n+ // [THEN] It should open the Posted Sales Credit Memo\n+ PostedSalesCreditMemo.\"Pre-Assigned No.\".AssertEquals(SalesHeader.\"No.\");\n+\n+ // Cleanup\n+ CleanupIC(false, true, true, false);\n+ end;\n+\n local procedure Initialize()\n var\n ICSetup: Record \"IC Setup\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al b/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al\nindex 92bf43b1d84..944f49028e6 100644\n--- a/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/Intercompany/ICNavigation.Codeunit.al\n@@ -56,6 +56,20 @@ codeunit 437 \"IC Navigation\"\n exit(true);\n end;\n \n+ local procedure NavigateToSalesCreditMemo(DocumentNo: Code[20]): Boolean\n+ var\n+ SalesCrMemoHeader: Record \"Sales Cr.Memo Header\";\n+ PostedSalesCreditMemo: Page \"Posted Sales Credit Memo\";\n+ begin\n+ // An IC Transaction of type Sales Credit Memo can only be sent when posted.\n+ if not SalesCrMemoHeader.Get(DocumentNo) then\n+ exit(false);\n+ // The related document is a Posted Sales Credit Memo.\n+ PostedSalesCreditMemo.SetRecord(SalesCrMemoHeader);\n+ PostedSalesCreditMemo.Run();\n+ exit(true);\n+ end;\n+\n local procedure NavigateToSalesInvoice(DocumentNo: Code[20]; ICPartnerCode: Code[20]): Boolean\n var\n Customer: Record Customer;\n@@ -120,6 +134,8 @@ codeunit 437 \"IC Navigation\"\n exit(NavigateToSalesOrderDocument(DocumentNo, ICDirectionType, ICPartnerCode));\n DocumentType::Invoice:\n exit(NavigateToSalesInvoice(DocumentNo));\n+ DocumentType::\"Credit Memo\":\n+ exit(NavigateToSalesCreditMemo(DocumentNo));\n else begin\n ShouldNavigateToDoc := false;\n OnNavigateToSalesDocumentOnAfterCheckDocumentType(DocumentNo, ICDirectionType, ICPartnerCode, DocumentType, ShouldNavigateToDoc);\n"}
+{"metadata": {"area": "inventory", "image_count": 0}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-213741", "base_commit": "aba5cc540cc2ff7bfc88064b9c6728b32f120fce", "created_at": "2025-04-22", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Assembly"], "FAIL_TO_PASS": [{"codeunitID": 137911, "functionName": ["VerifyAdjustCostItemEntriesMustBeExecutedForAssemblyItem"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al b/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al\nindex 46d1c5d5be0..55f596ef397 100644\n--- a/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Assembly/SCMCalculateAssemblyCost.Codeunit.al\n@@ -40,6 +40,7 @@ codeunit 137911 \"SCM Calculate Assembly Cost\"\n LibraryTestInitialize: Codeunit \"Library - Test Initialize\";\n NotificationLifecycleMgt: Codeunit \"Notification Lifecycle Mgt.\";\n LibrarySetupStorage: Codeunit \"Library - Setup Storage\";\n+ LibraryManufacturing: Codeunit \"Library - Manufacturing\";\n WorkDate2: Date;\n TEXT_PARENT: Label 'Parent';\n TEXT_CHILD: Label 'Child';\n@@ -452,6 +453,54 @@ codeunit 137911 \"SCM Calculate Assembly Cost\"\n ComponentItem.\"Standard Cost\", ComponentItem.\"Standard Cost\" * CurrExchRate);\n end;\n \n+ [Test]\n+ [HandlerFunctions('MessageHandler')]\n+ procedure VerifyAdjustCostItemEntriesMustBeExecutedForAssemblyItem()\n+ var\n+ AssemblyItem, ComponentItem, NonInvItem : Record Item;\n+ ValueEntry: Record \"Value Entry\";\n+ begin\n+ // [SCENARIO 574360] Verify \"Adjust Cost - Item Entries\" must be executed for Assembly item which include non-Inventory item in Assembly BOM.\n+ // When \"Automatic Cost Posting\" is false in Inventory Setup and \"Inc. Non. Inv. Cost To Prod\" is true in Mfg Setup.\n+ Initialize();\n+\n+ // [GIVEN] Set Automatic Cost Posting to false.\n+ LibraryInventory.SetAutomaticCostPosting(false);\n+\n+ // [GIVEN] Update \"Inc. Non. Inv. Cost To Prod\" in Manufacturing Setup.\n+ LibraryManufacturing.UpdateNonInventoryCostToProductionInManufacturingSetup(true);\n+\n+ // [GIVEN] Create an Assembled item with \"Costing Method\"::Standard.\n+ CreateItem(AssemblyItem, AssemblyItem.\"Costing Method\"::Standard, AssemblyItem.\"Replenishment System\"::Assembly, 0);\n+\n+ // [GIVEN] Create an Component item with \"Costing Method\"::FIFO.\n+ CreateItem(ComponentItem, ComponentItem.\"Costing Method\"::FIFO, ComponentItem.\"Replenishment System\"::Purchase, LibraryRandom.RandIntInRange(100, 200));\n+\n+ // [GIVEN] Create Non-Inventory item with Unit Cost.\n+ LibraryInventory.CreateNonInventoryTypeItem(NonInvItem);\n+ NonInvItem.Validate(\"Unit Cost\", LibraryRandom.RandIntInRange(200, 500));\n+ NonInvItem.Modify();\n+\n+ // [GIVEN] Post Positive Adjustment for Component item.\n+ PostPositiveAdjustment(ComponentItem.\"No.\", LibraryRandom.RandIntInRange(200, 500));\n+\n+ // [GIVEN] Create Assembly List for Component and Non-Inventory item.\n+ CreateAssemblyListComponent(AssemblyItem.\"No.\", ComponentItem.\"No.\", 1);\n+ CreateAssemblyListComponent(AssemblyItem.\"No.\", NonInvItem.\"No.\", 1);\n+\n+ // [GIVEN] Create and post Assembly Order.\n+ CreateAndPostAssemblyHeader(AssemblyItem.\"No.\", 1, WorkDate());\n+\n+ // [WHEN] Run \"Adjust Cost - Item Entries\"\n+ LibraryCosting.AdjustCostItemEntries(AssemblyItem.\"No.\", '');\n+\n+ // [THEN] Verify \"Adjust Cost - Item Entries\" must be executed for Assembly item.\n+ ValueEntry.SetRange(\"Item Ledger Entry Type\", ValueEntry.\"Item Ledger Entry Type\"::\"Assembly Output\");\n+ ValueEntry.SetRange(\"Entry Type\", ValueEntry.\"Entry Type\"::\"Direct Cost - Non Inventory\");\n+ ValueEntry.SetRange(\"Item No.\", AssemblyItem.\"No.\");\n+ Assert.RecordCount(ValueEntry, 0);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(CODEUNIT::\"SCM Calculate Assembly Cost\");\n@@ -585,5 +634,10 @@ codeunit 137911 \"SCM Calculate Assembly Cost\"\n ItemLedgerEntry.TestField(\"Cost Amount (Actual)\", ExpectedCostLCY);\n ItemLedgerEntry.TestField(\"Cost Amount (Actual) (ACY)\", Round(ExpectedCostACY, Currency.\"Amount Rounding Precision\"));\n end;\n+\n+ [MessageHandler]\n+ procedure MessageHandler(Message: Text[1024])\n+ begin\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al\nindex 9bc596d4312..92b2588e89d 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Costing/CalcInventoryAdjmtOrder.Codeunit.al\n@@ -158,10 +158,12 @@ codeunit 5896 \"Calc. Inventory Adjmt. - Order\"\n if HasNewCost(InventoryAdjmtEntryOrder.\"Indirect Cost\", InventoryAdjmtEntryOrder.\"Indirect Cost (ACY)\") then\n InventoryAdjustmentBuffer.AddCost(\n ItemLedgerEntry.\"Entry No.\", InventoryAdjustmentBuffer.\"Entry Type\"::\"Indirect Cost\", \"Cost Variance Type\"::\" \", InventoryAdjmtEntryOrder.\"Indirect Cost\", InventoryAdjmtEntryOrder.\"Indirect Cost (ACY)\");\n- if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n- if HasNewCost(InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\") then\n- InventoryAdjustmentBuffer.AddCost(\n- ItemLedgerEntry.\"Entry No.\", InventoryAdjustmentBuffer.\"Entry Type\"::\"Direct Cost - Non Inventory\", \"Cost Variance Type\"::\" \", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\");\n+\n+ if ItemLedgerEntry.\"Order Type\" = ItemLedgerEntry.\"Order Type\"::Production then\n+ if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n+ if HasNewCost(InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\") then\n+ InventoryAdjustmentBuffer.AddCost(\n+ ItemLedgerEntry.\"Entry No.\", InventoryAdjustmentBuffer.\"Entry Type\"::\"Direct Cost - Non Inventory\", \"Cost Variance Type\"::\" \", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inventory\", InventoryAdjmtEntryOrder.\"Direct Cost Non-Inv. (ACY)\");\n \n if Item.\"Costing Method\" <> Item.\"Costing Method\"::Standard then\n exit;\n@@ -171,11 +173,12 @@ codeunit 5896 \"Calc. Inventory Adjmt. - Order\"\n InventoryAdjustmentBuffer.\"Entry Type\"::Variance, InventoryAdjustmentBuffer.\"Variance Type\"::Material,\n InventoryAdjmtEntryOrder.\"Single-Level Material Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Material Cost (ACY)\");\n \n- if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n- if HasNewCost(InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\") then\n- InventoryAdjustmentBuffer.AddCost(ItemLedgerEntry.\"Entry No.\",\n- InventoryAdjustmentBuffer.\"Entry Type\"::Variance, InventoryAdjustmentBuffer.\"Variance Type\"::\"Material - Non Inventory\",\n- InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\");\n+ if ItemLedgerEntry.\"Order Type\" = ItemLedgerEntry.\"Order Type\"::Production then\n+ if MfgCostCalcMgt.CanIncNonInvCostIntoProductionItem() then\n+ if HasNewCost(InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\") then\n+ InventoryAdjustmentBuffer.AddCost(ItemLedgerEntry.\"Entry No.\",\n+ InventoryAdjustmentBuffer.\"Entry Type\"::Variance, InventoryAdjustmentBuffer.\"Variance Type\"::\"Material - Non Inventory\",\n+ InventoryAdjmtEntryOrder.\"Single-Lvl Mat. Non-Invt. Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Mat.NonInvCost(ACY)\");\n \n if HasNewCost(InventoryAdjmtEntryOrder.\"Single-Level Capacity Cost\", InventoryAdjmtEntryOrder.\"Single-Lvl Capacity Cost (ACY)\") then\n InventoryAdjustmentBuffer.AddCost(ItemLedgerEntry.\"Entry No.\",\n"}
+{"metadata": {"area": "manufacturing", "image_count": 0}, "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"], "FAIL_TO_PASS": [{"codeunitID": 137088, "functionName": ["ReleasedProdOrderQuantityPerandExpectedQtyRoundingPrecisionChecking"]}], "PASS_TO_PASS": [], "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"}
+{"metadata": {"area": "pricing", "image_count": 0}, "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"], "FAIL_TO_PASS": [{"codeunitID": 134117, "functionName": ["AmountTypeFieldDoesNotChangeOnClosePageSalesPriceList"]}], "PASS_TO_PASS": [], "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"}
+{"metadata": {"area": "sales", "image_count": 0}, "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"], "FAIL_TO_PASS": [{"codeunitID": 134386, "functionName": ["UpdateEmailAndPhoneNoWhenChangeBillToOfSalesInvoice"]}], "PASS_TO_PASS": [], "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"}
+{"metadata": {"area": "inventory", "image_count": 8}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227219", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137038, "functionName": ["ReleaseTransferOrderWhenVariantMandatory"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al\nindex f3c55b5f7a0..c7d556a7bc7 100644\n--- a/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMTransfers.Codeunit.al\n@@ -49,6 +49,7 @@\n DerivedTransLineErr: Label 'Expected no Derived Transfer Line i.e. line with \"Derived From Line No.\" equal to original transfer line.';\n IncorrectSNUndoneErr: Label 'The Serial No. of the item on the transfer shipment line that was undone was different from the SN on the corresponding transfer line.';\n ApplToItemEntryErr: Label '%1 must be %2 in %3.', Comment = '%1 is Appl-to Item Entry, %2 is Item Ledger Entry No. and %3 is Transfer Line';\n+ VariantCodeMandatoryErr: Label '%1 must have a value in %2: Document No.=%3, Line No.=%4. It cannot be zero or empty.', Comment = '%1:Field Caption, %2: TableCaption, %3:Document No, %4: Line No.';\n \n [Test]\n [HandlerFunctions('MessageHandler')]\n@@ -4096,6 +4097,48 @@\n 'The cost amount of the undo transfer shipment entry should match the original transfer shipment entry (with opposite sign)');\n end;\n \n+ [Test]\n+ procedure ReleaseTransferOrderWhenVariantMandatory()\n+ var\n+ InTransitLocation: Record Location;\n+ Item: Record Item;\n+ ItemVariant: array[2] of Record \"Item Variant\";\n+ FromLocation: Record Location;\n+ ToLocation: Record Location;\n+ TransferHeader: Record \"Transfer Header\";\n+ TransferLine: Record \"Transfer Line\";\n+ begin\n+ // [SCENARIO 601487] Release Transfer Order when Variant Mandatory in Inventory Setup.\n+ Initialize();\n+\n+ // [GIVEN] Create From/To Locations and InTransit Location\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(FromLocation);\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(ToLocation);\n+ LibraryWarehouse.CreateInTransitLocation(InTransitLocation);\n+\n+ // [GIVEN] Create Item and two Variants\n+ LibraryInventory.CreateItem(Item);\n+ LibraryInventory.CreateItemVariant(ItemVariant[1], Item.\"No.\");\n+ LibraryInventory.CreateItemVariant(ItemVariant[2], Item.\"No.\");\n+\n+ // [GIVEN] Set Inventory Setup to require variant if exists\n+ SetVariantMandatoryInInventorySetup();\n+\n+ // [GIVEN] Create Transfer Order and Line.\n+ LibraryInventory.CreateTransferHeader(TransferHeader, FromLocation.Code, ToLocation.Code, InTransitLocation.Code);\n+ LibraryInventory.CreateTransferLine(TransferHeader, TransferLine, Item.\"No.\", LibraryRandom.RandIntInRange(10, 100));\n+\n+ // [WHEN] Try to release the transfer order\n+ asserterror LibraryWarehouse.ReleaseTransferOrder(TransferHeader);\n+\n+ // [THEN] Assert error matches expected label\n+ Assert.ExpectedError(\n+ StrSubstNo(\n+ VariantCodeMandatoryErr,\n+ TransferLine.FieldCaption(\"Variant Code\"), TransferLine.TableCaption(),\n+ TransferLine.\"Document No.\", TransferLine.\"Line No.\"));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5670,6 +5713,15 @@\n until WarehouseActivityLine.Next() = 0;\n end;\n \n+ local procedure SetVariantMandatoryInInventorySetup()\n+ var\n+ InventorySetup: Record \"Inventory Setup\";\n+ begin\n+ InventorySetup.Get();\n+ InventorySetup.Validate(\"Variant Mandatory if Exists\", true);\n+ InventorySetup.Modify(true);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure MessageHandler(Message: Text[1024])\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al\nindex 979cdb45246..1254b0d5d0d 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Transfer/ReleaseTransferDocument.Codeunit.al\n@@ -119,7 +119,7 @@ codeunit 5708 \"Release Transfer Document\"\n if IsHandled then\n exit;\n \n- TransLine.SetLoadFields(\"Document No.\", Quantity, \"Item No.\");\n+ TransLine.SetLoadFields(\"Document No.\", Quantity, \"Item No.\", \"Variant Code\");\n TransLine.SetRange(\"Document No.\", TransHeader.\"No.\");\n TransLine.SetFilter(Quantity, '<>0');\n if TransLine.IsEmpty() then\n@@ -131,6 +131,8 @@ codeunit 5708 \"Release Transfer Document\"\n Item.Get(TransLine.\"Item No.\");\n if Item.IsInventoriableType() then\n TransLine.TestField(\"Unit of Measure Code\");\n+ if Item.IsVariantMandatory() then\n+ TransLine.TestField(\"Variant Code\");\n until TransLine.Next() = 0;\n TransLine.SetFilter(\"Item No.\", '');\n end;\n"}
+{"metadata": {"area": "finance", "image_count": 2}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227358", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-18", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134227, "functionName": ["RecurringJournalSuccessfullyPostedWhenUnlinkIncomingDocumentOnPostingOptionIsActivated"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\nindex 82601475bc6..adef8e520c9 100644\n--- a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n@@ -1410,6 +1410,22 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n GenJournalLine[1].\"Line No.\"));\n end;\n \n+ [Test]\n+ procedure RecurringJournalSuccessfullyPostedWhenUnlinkIncomingDocumentOnPostingOptionIsActivated()\n+ var\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ RecurringFrequency: array[6] of DateFormula;\n+ begin\n+ // [SCENARIO 602441] The changes to the Gen. Journal Line record cannot be saved because some information is not up-to-date\" error when posting Recurring General Journal and the Unlink Incoming Document on Posting option is activated.\n+ Initialize();\n+\n+ // [GIVEN] Create Recurring Journal Lines.\n+ CreateRecurringJournalLineWithVariable(GenJournalLine, RecurringFrequency);\n+\n+ // [THEN] Post Recurring Journal Lines Successfully\n+ LibraryERM.PostGeneralJnlLine(GenJournalLine);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"ERM PostRecurringJournal\");\n@@ -1954,6 +1970,73 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n Assert.AreEqual(GenJnlAllocation.\"Dimension Set ID\", DimensionSetID, AllocationDimensionErr);\n end;\n \n+ local procedure CreateRecurringJournalLineWithVariable(var GenJournalLine: Record \"Gen. Journal Line\"; var RecurringFrequency: array[6] of DateFormula)\n+ var\n+ GLAccount: Record \"G/L Account\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ Vendor: Record Vendor;\n+ Counter: Integer;\n+ NoOfLines: Integer;\n+ begin\n+ // Use Random Number Generator to generate the No. of lines.\n+ NoOfLines := 2 * LibraryRandom.RandInt(3);\n+\n+ //[GIVEN] Find G/L Account\n+ FindGLAccount(GLAccount);\n+\n+ //[GIVEN] Create Vendor\n+ LibraryPurchase.CreateVendor(Vendor);\n+\n+ //[WHEN] Create Recurring Journal Lines with Allocation and with random values.\n+ CreateRecurringGenJournalTemplateAndBatch(GenJournalBatch);\n+ for Counter := 1 to NoOfLines do begin\n+ if Counter = 1 then begin\n+ CreateGeneralJournalLineWithAccountType(\n+ GenJournalLine, GenJournalBatch, GenJournalLine.\"Recurring Method\"::\"V Variable\", -1000,\n+ Vendor.\"No.\");\n+ RecurringFrequency[Counter] := GenJournalLine.\"Recurring Frequency\";\n+ GenJournalLine.\"Document No.\" := '123';\n+ GenJournalLine.Modify();\n+ end else\n+ CreateGeneralJournalLineDocType(\n+ GenJournalLine, GenJournalBatch, GenJournalLine.\"Recurring Method\"::\"V Variable\", 1000,\n+ GLAccount.\"No.\");\n+ GenJournalLine.\"Document No.\" := '123';\n+ GenJournalLine.Modify();\n+ GLAccount.Next();\n+ RecurringFrequency[Counter] := GenJournalLine.\"Recurring Frequency\";\n+ end;\n+ end;\n+\n+ local procedure CreateGeneralJournalLineWithAccountType(var GenJournalLine: Record \"Gen. Journal Line\"; GenJournalBatch: Record \"Gen. Journal Batch\"; RecurringMethod: Enum \"Gen. Journal Recurring Method\"; Amount: Decimal; AccountNo: Code[20])\n+ begin\n+ CreateGeneralJournalLineWithType(\n+ GenJournalLine, GenJournalBatch, RecurringMethod, GenJournalLine.\"Document Type\"::Invoice,\n+ GenJournalLine.\"Account Type\"::Vendor, AccountNo, Amount);\n+ end;\n+\n+ local procedure CreateGeneralJournalLineDocType(var GenJournalLine: Record \"Gen. Journal Line\"; GenJournalBatch: Record \"Gen. Journal Batch\"; RecurringMethod: Enum \"Gen. Journal Recurring Method\"; Amount: Decimal; AccountNo: Code[20])\n+ begin\n+ CreateGeneralJournalLineWithType(\n+ GenJournalLine, GenJournalBatch, RecurringMethod, GenJournalLine.\"Document Type\"::Invoice,\n+ GenJournalLine.\"Account Type\"::\"G/L Account\", AccountNo, Amount);\n+ end;\n+\n+ local procedure CreateRecurringGenJournalTemplateAndBatch(var GenJournalBatch: Record \"Gen. Journal Batch\")\n+ var\n+ GenJnlTemplate: Record \"Gen. Journal Template\";\n+ begin\n+ LibraryERM.FindRecurringTemplateName(GenJnlTemplate);\n+ GenJnlTemplate.Validate(Type, GenJnlTemplate.Type::General);\n+ GenJnlTemplate.Validate(Recurring, true);\n+ GenJnlTemplate.Validate(\"Bal. Account Type\", GenJnlTemplate.\"Bal. Account Type\"::\"G/L Account\");\n+ GenJnlTemplate.Validate(\"Force Doc. Balance\", true);\n+ GenJnlTemplate.Validate(\"Copy VAT Setup to Jnl. Lines\", true);\n+ GenJnlTemplate.Validate(\"Unlink Inc. Doc On Posting\", true);\n+ GenJnlTemplate.Modify(true);\n+ LibraryERM.CreateRecurringBatchName(GenJournalBatch, GenJnlTemplate.Name);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerYes(Question: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al\nindex 61aff663d95..72ec7e79918 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostBatch.Codeunit.al\n@@ -1006,6 +1006,7 @@ codeunit 13 \"Gen. Jnl.-Post Batch\"\n exit;\n if not CurrGenJnlTemplate.\"Unlink Inc. Doc On Posting\" then\n exit;\n+ GenJnlLine.GET(GenJnlLine.\"Journal Template Name\", GenJnlLine.\"Journal Batch Name\", GenJnlLine.\"Line No.\");\n GenJnlLine.\"Incoming Document Entry No.\" := 0;\n GenJnlLine.Modify();\n end;\n"}
+{"metadata": {"area": "warehouse", "image_count": 3}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226004", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-07", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137055, "functionName": ["InventoryPickRoundingCausesResidualQuantity"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al\nindex 6e2c6a34131..8eaf3b44088 100644\n--- a/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMWarehousePick.Codeunit.al\n@@ -41,6 +41,8 @@ codeunit 137055 \"SCM Warehouse Pick\"\n LocationCodeMustNotOccurErr: Label 'Location code %1 must not occur. Expected value - %2', Comment = '%1 : occured location code, %2 : expected location code.';\n ReturnQtyMismatchErr: Label 'The value in the %1 field in the %2 does not match.', Comment = '%1 :FieldCaption, %2:Table Caption';\n ReservationAction: Option AutoReserve,GetQuantities;\n+ PickQuantityErr: Label 'Expected picked quantity %1 %2, but got %3 %2', Comment = '%1, %3 - Quantity; %2 - Unit of Measure Code';\n+ ShipQtyErr: Label 'Sales line should be fully shipped with no residual quantity';\n \n [Test]\n [HandlerFunctions('ReservationPageHandler')]\n@@ -1776,6 +1778,98 @@ codeunit 137055 \"SCM Warehouse Pick\"\n StrSubstNo(ReturnQtyMismatchErr, PurchaseLine.\"Return Qty. Shipped\", PurchaseLine.TableCaption));\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ [HandlerFunctions('CreateInvtPutAwayPickRequestPageHandler,MessageHandler')]\n+ procedure InventoryPickRoundingCausesResidualQuantity()\n+ var\n+ Item: Record Item;\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ Location: Record Location;\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ Customer: Record Customer;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ UnitOfMeasure: Record \"Unit of Measure\";\n+ Bin: Record Bin;\n+ TotalPickedQty: Decimal;\n+ QtyPerUOM: Decimal;\n+ QtyRoundingPrecision: Decimal;\n+ OrderQuantity: Decimal;\n+ BinCode: Code[20];\n+ begin\n+ // [SCENARIO 579500] Inventory pick rounding causes residual quantity When picking items with non-integer UOM conversion and very small \n+ // Quantity Rounding Precision, the pick process may result in rounding residuals\n+ Initialize();\n+\n+ // [GIVEN] Setup variables for rounding test with random values within problematic ranges\n+ SetStaticValues579500(QtyPerUOM, QtyRoundingPrecision, OrderQuantity);\n+\n+ // [GIVEN] Generate random bin code\n+ BinCode := LibraryUtility.GenerateRandomCode(SalesLine.FieldNo(\"Bin Code\"), Database::\"Sales Line\"); // Random bin code\n+\n+ // [GIVEN] Create item with specific UOM configuration for rounding test and LOT tracking with expiration dates\n+ LibraryInventory.CreateItem(Item);\n+ SetupItemTrackingWithExpirationDates(Item);\n+\n+ // [GIVEN] Add secondary UOM with problematic conversion factor and very small rounding precision\n+ LibraryInventory.CreateUnitOfMeasureCode(UnitOfMeasure);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure, Item.\"No.\", UnitOfMeasure.Code, QtyPerUOM);\n+ ItemUnitOfMeasure.Validate(\"Qty. Rounding Precision\", QtyRoundingPrecision);\n+ ItemUnitOfMeasure.Modify(true);\n+\n+ // [GIVEN] Set Sales Unit of Measure to the secondary UOM\n+ Item.Validate(\"Sales Unit of Measure\", UnitOfMeasure.Code);\n+ Item.Modify(true);\n+\n+ // [GIVEN] Setup Location with Require Pick = YES and Pick According to FEFO = Yes\n+ LibraryWarehouse.CreateLocationWMS(Location, false, false, true, false, false);\n+ Location.Validate(\"Bin Mandatory\", true);\n+ Location.Validate(\"Pick According to FEFO\", true);\n+ Location.Modify(true);\n+\n+ // [GIVEN] Add Warehouse Employee for location\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, Location.Code, true);\n+\n+ // [GIVEN] Create bin for the location\n+ LibraryWarehouse.CreateBin(Bin, Location.Code, BinCode, '', '');\n+\n+ // [GIVEN] Add inventory for the item (sufficient for order quantity)\n+ CreateInventoryForLotAndExpiry579500(Item.\"No.\", Location.Code, Bin.Code);\n+\n+ // [GIVEN] Create Customer\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Create Sales Order with random quantity \n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\");\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", OrderQuantity);\n+ SalesLine.Validate(\"Location Code\", Location.Code);\n+ SalesLine.Modify(true);\n+\n+ // [GIVEN] Release Sales Order\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+\n+ // [GiVEN] Create Inventory Pick from Sales Order\n+ Commit();\n+ SalesHeader.CreateInvtPutAwayPick();\n+\n+ // [WHEN] autofill Qty. to Handle, post the pick\n+ PostInventoryActivity(WarehouseActivityHeader.\"Source Document\"::\"Sales Order\", SalesHeader.\"No.\", WarehouseActivityLine.\"Activity Type\"::\"Invt. Pick\");\n+\n+ // [GIVEN] Get total picked quantity from Item Ledger Entries\n+ GetTotalPickedQuantity(Item.\"No.\", Location.Code, QtyPerUOM, TotalPickedQty);\n+\n+ // [THEN] Assert that picked quantity equals expected with tolerance for rounding\n+ Assert.AreNearlyEqual(OrderQuantity, TotalPickedQty, QtyRoundingPrecision * 10,\n+ StrSubstNo(PickQuantityErr, OrderQuantity, UnitOfMeasure.Code, TotalPickedQty));\n+\n+ // [THEN] Validate that no residual quantity remains (no second pick is required) Check that sales line is fully shipped\n+ SalesLine.Get(SalesLine.\"Document Type\", SalesLine.\"Document No.\", SalesLine.\"Line No.\");\n+ Assert.AreEqual(SalesLine.Quantity, SalesLine.\"Quantity Shipped\", ShipQtyErr);\n+ end;\n+\n local procedure Initialize()\n var\n WarehouseActivityLine: Record \"Warehouse Activity Line\";\n@@ -2604,6 +2698,128 @@ codeunit 137055 \"SCM Warehouse Pick\"\n exit(-PurchaseLine.\"Return Qty. to Ship\");\n end;\n \n+ local procedure SetupItemTrackingWithExpirationDates(var Item: Record Item)\n+ var\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ begin\n+ LibraryInventory.CreateItemTrackingCode(ItemTrackingCode);\n+ ItemTrackingCode.Validate(\"Lot Specific Tracking\", true);\n+ ItemTrackingCode.Validate(\"Use Expiration Dates\", true);\n+ ItemTrackingCode.Validate(\"Man. Expir. Date Entry Reqd.\", true);\n+ ItemTrackingCode.Modify(true);\n+\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Modify(true);\n+ end;\n+\n+ local procedure SetStaticValues579500(var QtyPerUOM: Decimal; var QtyRoundingPrecision: Decimal; var OrderQuantity: Decimal)\n+ begin\n+ QtyPerUOM := 2.888;\n+ QtyRoundingPrecision := 0.00001;\n+ OrderQuantity := 248;\n+ end;\n+\n+ local procedure GetTotalPickedQuantity(ItemNo: Code[20]; LocationCode: Code[10]; QtyPerUOM: Decimal; var TotalPickedQty: Decimal)\n+ var\n+ ItemLedgerEntry: Record \"Item Ledger Entry\";\n+ begin\n+ TotalPickedQty := 0;\n+ ItemLedgerEntry.SetRange(\"Item No.\", ItemNo);\n+ ItemLedgerEntry.SetRange(\"Location Code\", LocationCode);\n+ ItemLedgerEntry.SetRange(\"Entry Type\", ItemLedgerEntry.\"Entry Type\"::Sale);\n+ if ItemLedgerEntry.FindSet() then\n+ repeat\n+ TotalPickedQty += Abs(ItemLedgerEntry.Quantity) / QtyPerUOM;\n+ until ItemLedgerEntry.Next() = 0;\n+ end;\n+\n+ local procedure PostInventoryActivity(SourceDocument: Enum \"Warehouse Activity Source Document\"; SourceNo: Code[20]; ActivityType: Enum \"Warehouse Activity Type\")\n+ var\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ begin\n+ WarehouseActivityHeader.SetRange(\"Source Document\", SourceDocument);\n+ WarehouseActivityHeader.SetRange(\"Source No.\", SourceNo);\n+ WarehouseActivityHeader.SetRange(Type, WarehouseActivityHeader.Type::\"Invt. Pick\");\n+ WarehouseActivityHeader.FindFirst();\n+\n+ // Autofill Qty. to Handle\n+ WarehouseActivityLine.SetRange(\"Activity Type\", ActivityType);\n+ WarehouseActivityLine.SetRange(\"No.\", WarehouseActivityHeader.\"No.\");\n+ WarehouseActivityLine.SetRange(\"Action Type\", WarehouseActivityLine.\"Action Type\"::Take);\n+ if WarehouseActivityLine.FindSet() then\n+ repeat\n+ WarehouseActivityLine.Validate(\"Qty. to Handle\", WarehouseActivityLine.Quantity);\n+ WarehouseActivityLine.Modify(true);\n+ until WarehouseActivityLine.Next() = 0;\n+\n+ // Post the pick (Ship)\n+ LibraryWarehouse.PostInventoryActivity(WarehouseActivityHeader, false);\n+ end;\n+\n+ local procedure CreateInventoryForLotAndExpiry579500(ItemNo: Code[20]; LocationCode: Code[10]; BinCode: Code[20])\n+ var\n+ LotNo: array[10] of Code[50];\n+ ExpiryDate: array[10] of Date;\n+ Quantity: array[10] of Decimal;\n+ i: Integer;\n+ begin\n+ LotNo[1] := 'LOT01';\n+ LotNo[2] := 'LOT03';\n+ LotNo[3] := 'LOT06';\n+ LotNo[4] := 'LOT01';\n+ LotNo[5] := 'LOT02';\n+ LotNo[6] := 'LOT03';\n+ LotNo[7] := 'LOT04';\n+ LotNo[8] := 'LOT02';\n+ LotNo[9] := 'LOT03';\n+ LotNo[10] := 'LOT05';\n+\n+ ExpiryDate[1] := 20251130D;\n+ ExpiryDate[2] := 20250925D;\n+ ExpiryDate[3] := 20250925D;\n+ ExpiryDate[4] := 20250925D;\n+ ExpiryDate[5] := 20251130D;\n+ ExpiryDate[6] := 20250925D;\n+ ExpiryDate[7] := 20250606D;\n+ ExpiryDate[8] := 20250616D;\n+ ExpiryDate[9] := 20250925D;\n+ ExpiryDate[10] := 20250713D;\n+\n+ Quantity[1] := 434.97616;\n+ Quantity[2] := 17.3126;\n+ Quantity[3] := 17.0373;\n+ Quantity[4] := 4.13394;\n+ Quantity[5] := 4.34355;\n+ Quantity[6] := 151.33333;\n+ Quantity[7] := 40.01221;\n+ Quantity[8] := 1.78787;\n+ Quantity[9] := 42.73313;\n+ Quantity[10] := 4.013;\n+\n+ for i := 1 to ArrayLen(LotNo) do\n+ UpdateItemInventoryWithLot(ItemNo, LocationCode, BinCode, Quantity[i], LotNo[i], ExpiryDate[i]);\n+ end;\n+\n+ local procedure UpdateItemInventoryWithLot(ItemNo: Code[20]; LocationCode: Code[10]; BinCode: Code[20]; Quantity: Decimal; LotNo: Code[50]; ExpiryDate: Date)\n+ var\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.ClearItemJournal(ItemJournalTemplate, ItemJournalBatch);\n+ ItemJournalBatch.Validate(\"Item Tracking on Lines\", true);\n+ ItemJournalBatch.Modify(true);\n+\n+ LibraryInventory.CreateItemJournalLine(\n+ ItemJournalLine, ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name,\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", ItemNo, Quantity);\n+ ItemJournalLine.Validate(\"Location Code\", LocationCode);\n+ ItemJournalLine.Validate(\"Bin Code\", BinCode);\n+ ItemJournalLine.\"Lot No.\" := LotNo;\n+ ItemJournalLine.\"Expiration Date\" := ExpiryDate;\n+ ItemJournalLine.Modify(true);\n+ LibraryInventory.PostItemJournalLine(ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ReservationPageHandler(var Reservation: TestPage Reservation)\n@@ -2716,5 +2932,12 @@ codeunit 137055 \"SCM Warehouse Pick\"\n ProdOrderRouting.\"No.\".SetValue(MachineCenter.\"No.\");\n ProdOrderRouting.\"Setup Time\".SetValue(100);\n end;\n+\n+ [RequestPageHandler]\n+ procedure CreateInvtPutAwayPickRequestPageHandler(var CreateInvtPutAwayPickMvmt: TestRequestPage \"Create Invt Put-away/Pick/Mvmt\")\n+ begin\n+ CreateInvtPutAwayPickMvmt.CInvtPick.SetValue(true);\n+ CreateInvtPutAwayPickMvmt.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al b/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al\nindex ee0c77f69da..dea4f3bdce6 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/CreateInventoryPickMovement.Codeunit.al\n@@ -420,7 +420,7 @@ codeunit 7322 \"Create Inventory Pick/Movement\"\n CreatePickOrMoveLine(\n NewWarehouseActivityLine, RemQtyToPickBase, SalesLine.\"Outstanding Qty. (Base)\", SalesLine.\"Reserved Quantity\" <> 0);\n OnCreatePickOrMoveFromSalesOnAfterCreatePickOrMoveLine(NewWarehouseActivityLine, SalesLine, CurrWarehouseActivityHeader, ShowError, AutoCreation, LineCreated);\n-\n+ CorrectQtyRounding(SalesLine, CurrWarehouseActivityHeader);\n if SalesHeader.\"Shipping Advice\" = SalesHeader.\"Shipping Advice\"::Complete then begin\n if RemQtyToPickBase < 0 then begin\n if AutoCreation then begin\n@@ -2313,6 +2313,36 @@ codeunit 7322 \"Create Inventory Pick/Movement\"\n exit(true);\n end;\n \n+ local procedure CorrectQtyRounding(SalesLine: Record \"Sales Line\"; WarehouseActivityHeader: Record \"Warehouse Activity Header\")\n+ var\n+ WareHouseActivityLine: Record \"Warehouse Activity Line\";\n+ TotalQtyPicked: Decimal;\n+ TotalQtyOutstanding: Decimal;\n+ TotalPickedQuantityCalculated: Decimal;\n+ TotalQtyOutStandingCalculated: Decimal;\n+ begin\n+ if WarehouseActivityHeader.Type <> WarehouseActivityHeader.Type::\"Invt. Pick\" then\n+ exit;\n+\n+ WareHouseActivityLine.SetSource(Database::\"Sales Line\", SalesLine.\"Document Type\".AsInteger(), SalesLine.\"Document No.\", SalesLine.\"Line No.\", 0);\n+ WareHouseActivityLine.SetRange(\"No.\", WarehouseActivityHeader.\"No.\");\n+ WareHouseActivityLine.CalcSums(Quantity, \"Qty. (Base)\", \"Qty. Outstanding\", \"Qty. Outstanding (Base)\");\n+ TotalQtyPicked := WareHouseActivityLine.Quantity;\n+ TotalQtyOutstanding := WareHouseActivityLine.\"Qty. Outstanding\";\n+ TotalPickedQuantityCalculated := Round(WareHouseActivityLine.\"Qty. (Base)\" / SalesLine.\"Qty. per Unit of Measure\", 0.00001);\n+ TotalQtyOutStandingCalculated := Round(WareHouseActivityLine.\"Qty. Outstanding (Base)\" / SalesLine.\"Qty. per Unit of Measure\", 0.00001);\n+ if TotalQtyPicked = TotalPickedQuantityCalculated then\n+ exit;\n+\n+ if Abs(TotalPickedQuantityCalculated - TotalQtyPicked) > SalesLine.\"Qty. Rounding Precision\" then\n+ exit;\n+\n+ WareHouseActivityLine.FindLast();\n+ WareHouseActivityLine.Quantity += (TotalPickedQuantityCalculated - TotalQtyPicked);\n+ WareHouseActivityLine.\"Qty. Outstanding\" += (TotalQtyOutStandingCalculated - TotalQtyOutstanding);\n+ WareHouseActivityLine.Modify();\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterAutoCreatePickOrMove(var WarehouseRequest: Record \"Warehouse Request\"; LineCreated: Boolean; var WarehouseActivityHeader: Record \"Warehouse Activity Header\"; Location: Record Location; HideDialog: Boolean)\n begin\n"}
+{"metadata": {"area": "inventory", "image_count": 9}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223202", "base_commit": "071306f0d5dbae52846a3a732e27560b476295c9", "created_at": "2025-08-07", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM-Manufacturing"], "FAIL_TO_PASS": [{"codeunitID": 137210, "functionName": ["FirmedProdOrderStatisticsCheckOverhead"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al b/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al\nindex 57db2703546..edc1079c082 100644\n--- a/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM-Manufacturing/SCMCopyProductionBOM.Codeunit.al\n@@ -41,6 +41,7 @@ codeunit 137210 \"SCM Copy Production BOM\"\n ProdBOMNo: Code[20];\n CountError: Label 'Version Count Must Match.';\n OverHeadCostErr: Label 'Overhead Cost must be %1 in %2.', Comment = '%1= Field Value, %2= FieldCaption.';\n+ ManufacturingOverhead: Label 'Expected Overhead = %1, but Statistics shows = %2', Comment = '%1=Expected Overhead, %2=Overhead from Statistics page.';\n \n [Normal]\n local procedure Initialize()\n@@ -609,6 +610,86 @@ codeunit 137210 \"SCM Copy Production BOM\"\n ProductionOrderStatistics.MfgOverhead_ExpectedCost.Caption()));\n end;\n \n+ [Test]\n+ procedure FirmedProdOrderStatisticsCheckOverhead()\n+ var\n+ ParentItem: Record Item;\n+ RawItem: Record Item;\n+ ProductionOrder: Record \"Production Order\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ FirmedProductionOrder: TestPage \"Firm Planned Prod. Order\";\n+ ProductionOrderStatistics: TestPage \"Production Order Statistics\";\n+ MfgOverheadExpectedCost: Decimal;\n+ MfgOverheadExpectedCost1: Decimal;\n+ Quantity: Decimal;\n+ begin\n+ // [SCENARIO 593018] Manufacturing overhead is wrong in the production order statistics page (99000816) and report (99000791).\n+ Initialize();\n+\n+ // [GIVEN] Create Raw Item with specified Unit Cost\n+ CreateItem(RawItem, 0, 0);\n+ RawItem.Validate(Type, RawItem.Type::Inventory);\n+ RawItem.Validate(\"Unit Cost\", LibraryRandom.RandIntInRange(100, 100));\n+ RawItem.Modify(true);\n+\n+ // [GIVEN] Create Production BOM and add Raw Item with Qty = 1\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, RawItem.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, RawItem.\"No.\", 1);\n+ ProductionBOMHeader.Validate(\"Unit of Measure Code\", RawItem.\"Base Unit of Measure\");\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify(true);\n+\n+ // [GIVEN] Create Parent Item with Indirect Cost % and link to BOM\n+ CreateItem(ParentItem, 0, 0); // No direct cost or overhead\n+ ParentItem.Validate(\"Indirect Cost %\", LibraryRandom.RandIntInRange(10, 10));\n+ ParentItem.Validate(\"Production BOM No.\", ProductionBOMHeader.\"No.\");\n+ ParentItem.Modify(true);\n+\n+ // [GIVEN] Create Firm Planned Production Order for Parent Item\n+ LibraryManufacturing.CreateProductionOrder(ProductionOrder, ProductionOrder.Status::\"Firm Planned\", ProductionOrder.\"Source Type\"::Item, '', 0);\n+\n+ // [GIVEN] Store Quantity in Variable.\n+ Quantity := LibraryRandom.RandIntInRange(20, 20);\n+\n+ // [GIVEN] Create line only (do NOT populate header)\n+ LibraryManufacturing.CreateProdOrderLine(ProdOrderLine, ProductionOrder.Status, ProductionOrder.\"No.\", ParentItem.\"No.\", '', '', Quantity);\n+\n+ // [WHEN] Refresh Prod Order with Lines = false (header only)\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, false, true, true, false);\n+\n+ MfgOverheadExpectedCost := (RawItem.\"Unit Cost\" * ParentItem.\"Indirect Cost %\" / 100 * Quantity);\n+\n+ // [GIVEN] Create Firm Planned Production Order for Parent Item\n+ LibraryManufacturing.CreateProductionOrder(ProductionOrder, ProductionOrder.Status::\"Firm Planned\", ProductionOrder.\"Source Type\"::Item, '', 0);\n+\n+ // [GIVEN] Create multiple lines (do NOT populate header)\n+ LibraryManufacturing.CreateProdOrderLine(ProdOrderLine, ProductionOrder.Status, ProductionOrder.\"No.\", ParentItem.\"No.\", '', '', LibraryRandom.RandIntInRange(10, 10));\n+ LibraryManufacturing.CreateProdOrderLine(ProdOrderLine, ProductionOrder.Status, ProductionOrder.\"No.\", ParentItem.\"No.\", '', '', LibraryRandom.RandIntInRange(10, 10));\n+\n+ // [WHEN] Refresh Prod Order with Lines = false (header only)\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, false, true, true, false);\n+\n+ // [WHEN] Open Firmed Prod Order Statistics page\n+ FirmedProductionOrder.OpenEdit();\n+ FirmedProductionOrder.GoToRecord(ProductionOrder);\n+ ProductionOrderStatistics.Trap();\n+ FirmedProductionOrder.Statistics.Invoke();\n+\n+ // [THEN] Get Mfg Overhead Expected Cost\n+ Evaluate(MfgOverheadExpectedCost1, ProductionOrderStatistics.MfgOverhead_ExpectedCost.Value());\n+\n+ // [ASSERT] Overhead in statistics equals expected overhead\n+ Assert.AreEqual(\n+ MfgOverheadExpectedCost,\n+ MfgOverheadExpectedCost1,\n+ StrSubstNo(ManufacturingOverhead,\n+ Format(MfgOverheadExpectedCost),\n+ Format(MfgOverheadExpectedCost1)));\n+ \n+ end;\n+\n [Normal]\n local procedure CreateProductionBOM(var ProductionBOMHeader: Record \"Production BOM Header\")\n var\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al\nindex 84769ae059d..aad60ef36b9 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Costing/MfgCostCalculationMgt.Codeunit.al\n@@ -305,9 +305,12 @@ codeunit 99000758 \"Mfg. Cost Calculation Mgt.\"\n ExpSubDirCost := ExpSubDirCost + Round(ExpSubDirCostRtng * ShareOfTotalCapCost);\n ExpCapOvhdCost := ExpCapOvhdCost + Round(ExpCapOvhdCostRtng * ShareOfTotalCapCost);\n ExpMfgDirCost := ExpMatCost + ExpCapDirCost + ExpSubDirCost + ExpCapOvhdCost;\n- ExpOvhdCost := ExpMfgOvhdCost + ProdOrderLine.\"Overhead Rate\" * ProdOrderLine.\"Quantity (Base)\";\n- ExpMfgOvhdCost := ExpOvhdCost +\n- Round(CostCalculationMgt.CalcOvhdCost(ExpMfgDirCost, ProdOrderLine.\"Indirect Cost %\", 0, 0));\n+ ExpOvhdCost := ExpMfgOvhdCost;\n+ if ExpMfgDirCost = 0 then\n+ ExpMfgOvhdCost := ExpOvhdCost +\n+ Round(CostCalculationMgt.CalcOvhdCost(ExpMfgDirCost, ProdOrderLine.\"Indirect Cost %\", ProdOrderLine.\"Overhead Rate\", ProdOrderLine.\"Quantity (Base)\"))\n+ else\n+ ExpMfgOvhdCost := Round(CostCalculationMgt.CalcOvhdCost(ExpMfgDirCost, ProdOrderLine.\"Indirect Cost %\", ProdOrderLine.\"Overhead Rate\", ProdOrderLine.\"Quantity (Base)\"));\n \n OnAfterCalcProdOrderLineExpCost(ProdOrderLine, ShareOfTotalCapCost, ExpMatCost, ExpCapDirCost, ExpSubDirCost, ExpCapOvhdCost, ExpMfgOvhdCost);\n #if not CLEAN26\n"}
+{"metadata": {"area": "finance", "image_count": 9}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-226448", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-10", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\VAT"], "FAIL_TO_PASS": [{"codeunitID": 134282, "functionName": ["CheckVATEntryNonDeductibleVATPurchaseInvoicePosting"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al b/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al\nindex 6d22cda27cb..2ddbcc070b0 100644\n--- a/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al\n+++ b/App/Layers/W1/Tests/VAT/NonDeductibleUT.Codeunit.al\n@@ -285,6 +285,62 @@ codeunit 134282 \"Non-Deductible UT\"\n PurchaseLine.TestField(\"Non-Deductible VAT Amount\", 0);\n end;\n \n+ [Test]\n+ procedure CheckVATEntryNonDeductibleVATPurchaseInvoicePosting()\n+ var\n+ GenPostingSetup: Record \"General Posting Setup\";\n+ GLAccount: Record \"G/L Account\";\n+ PurchHeader: Record \"Purchase Header\";\n+ PurchLine: Record \"Purchase Line\";\n+ VATEntry: Record \"VAT Entry\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ Vendor: Record Vendor;\n+ GLAccountNo: Code[20];\n+ PostedDocumentNo: Code[20];\n+ VATRate: Decimal;\n+ begin\n+ // [SCENARIO 595966] Check VAT Entry Non-Deductible VAT on Purchase Invoice Posting with G/L Account Line.\n+ Initialize();\n+\n+ // [GIVEN] Create Vendor and set Prices Including VAT\n+ LibraryPurchase.CreateVendor(Vendor);\n+ Vendor.Validate(\"Prices Including VAT\", true);\n+ Vendor.Modify(true);\n+\n+ // [GIVEN] Enable Non-Deductible VAT in VAT Setup (with confirm handler)\n+ LibraryNonDeductibleVAT.EnableNonDeductibleVAT();\n+\n+ // [GIVEN] Create G/L Account and set posting groups/categories\n+ VATRate := 20.0;\n+ GLAccountNo := CreateGLAccountWithVATPostingSetup(VATRate);\n+ GLAccount.Get(GLAccountNo);\n+\n+ // [GIVEN] Create/Modify VAT Product Posting Group and VAT Posting Setup.\n+ LibraryERM.CreateVATPostingSetup(VATPostingSetup, Vendor.\"VAT Bus. Posting Group\", GLAccount.\"VAT Prod. Posting Group\");\n+ VATPostingSetup.Validate(\"VAT Calculation Type\", VATPostingSetup.\"VAT Calculation Type\"::\"Normal VAT\");\n+ VATPostingSetup.Validate(\"Allow Non-Deductible VAT\", VATPostingSetup.\"Allow Non-Deductible VAT\"::Allow);\n+ VATPostingSetup.Validate(\"VAT %\", 20);\n+ VATPostingSetup.Validate(\"Non-Deductible VAT %\", 100);\n+ VATPostingSetup.Modify(true);\n+\n+ // [WHEN] Create and post Purchase Invoice for the vendor with G/L Account line\n+ LibraryPurchase.CreatePurchHeader(PurchHeader, PurchHeader.\"Document Type\"::Invoice, Vendor.\"No.\");\n+ LibraryPurchase.CreatePurchaseLine(PurchLine, PurchHeader, PurchLine.Type::\"G/L Account\", GLAccountNo, 1);\n+ PurchLine.Validate(\"Direct Unit Cost\", 14.19);\n+ PurchLine.Modify(true);\n+ PurchHeader.Validate(\"Vendor Invoice No.\", 'Test-1001');\n+ PurchHeader.Modify(true);\n+ LibraryERM.CreateGeneralPostingSetup(GenPostingSetup, PurchLine.\"Gen. Bus. Posting Group\", PurchLine.\"Gen. Prod. Posting Group\");\n+ PostedDocumentNo := LibraryPurchase.PostPurchaseDocument(PurchHeader, false, true);\n+\n+ // [THEN] verify that Purchase Invoice is posted with 0 VAT Amount and 0 Non-Deductible VAT Amount\n+ VATEntry.SetRange(\"Document No.\", PostedDocumentNo);\n+ VATEntry.SetRange(\"Document Type\", VATEntry.\"Document Type\"::Invoice);\n+ VATEntry.FindFirst();\n+ Assert.AreEqual(0, VATEntry.Base, 'Vat Base should be 0.');\n+ Assert.AreEqual(0, VATEntry.Amount, 'Vat Amount should be 0.');\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"Non-Deductible UT\");\n@@ -383,4 +439,33 @@ codeunit 134282 \"Non-Deductible UT\"\n Assert.AreEqual(ExpectedAmount, VATEntry.\"Non-Deductible VAT Base\", StrSubstNo(AmountErrorLbl, VATEntry.FieldCaption(\"Non-Deductible VAT Base\"), ExpectedAmount));\n Assert.AreEqual(ExpectedAmount, VATEntry.\"Non-Deductible VAT Amount\", StrSubstNo(AmountErrorLbl, VATEntry.FieldCaption(\"Non-Deductible VAT Amount\"), ExpectedAmount));\n end;\n+\n+ local procedure CreateGLAccountWithVATPostingSetup(var VATRate: Decimal) GLAccountNo: Code[20]\n+ var\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ begin\n+ VATRate := LibraryRandom.RandIntInRange(2, 5);\n+ LibraryERM.CreateVATPostingSetupWithAccounts(VATPostingSetup,\n+ VATPostingSetup.\"VAT Calculation Type\"::\"Normal VAT\", VATRate);\n+ GLAccountNo := VATPostingSetup.\"Purchase VAT Account\";\n+ UpdateGLAccountPostingGroups(GLAccountNo,\n+ VATPostingSetup.\"VAT Prod. Posting Group\", VATPostingSetup.\"VAT Bus. Posting Group\");\n+ end;\n+\n+ local procedure UpdateGLAccountPostingGroups(GLAccountNo: Code[20]; VATProdPostingGroup: Code[20]; VATBusPostingGroup: Code[20])\n+ var\n+ GLAccount: Record \"G/L Account\";\n+ GenProductPostingGroup: Record \"Gen. Product Posting Group\";\n+ begin\n+ GLAccount.Get(GLAccountNo);\n+ LibraryERM.CreateGenProdPostingGroup(GenProductPostingGroup);\n+ GLAccount.\"Gen. Posting Type\" := GLAccount.\"Gen. Posting Type\"::Purchase;\n+ GLAccount.Validate(\"Account Category\", GLAccount.\"Account Category\"::Expense);\n+ GLAccount.Validate(\"Account Type\", GLAccount.\"Account Type\"::Posting);\n+ GLAccount.Validate(\"Direct Posting\", true);\n+ GLAccount.\"Gen. Prod. Posting Group\" := GenProductPostingGroup.Code;\n+ GLAccount.\"VAT Prod. Posting Group\" := VATProdPostingGroup;\n+ GLAccount.\"VAT Bus. Posting Group\" := VATBusPostingGroup;\n+ GLAccount.Modify(true);\n+ end;\n }\n\\ No newline at end of file\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\nindex c9d976f7272..a9f725ac966 100644\n--- a/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Finance/VAT/Calculation/NonDedVATImpl.Codeunit.al\n@@ -16,6 +16,7 @@ using Microsoft.FixedAssets.Ledger;\n using Microsoft.Foundation.Enums;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.History;\n+using Microsoft.Purchases.Vendor;\n using Microsoft.Foundation.Company;\n using Microsoft.Projects.Project.Journal;\n using Microsoft.Projects.Project.Job;\n@@ -951,6 +952,8 @@ codeunit 6201 \"Non-Ded. VAT Impl.\"\n GeneralLedgerSetup.GetRecordOnce();\n UpdateNonDeductibleAmounts(GenJournalLine.\"Non-Deductible VAT Base ACY\", GenJournalLine.\"Non-Deductible VAT Amount ACY\", BaseAmountACY, VATAmountACY, GetNonDedVATPctFromGenJournalLine(GenJournalLine), GeneralLedgerSetup.\"Amount Rounding Precision\");\n AdjustVATAmounts(VATAmountACY, BaseAmountACY, GenJournalLine.\"Non-Deductible VAT Amount ACY\", GenJournalLine.\"Non-Deductible VAT Base ACY\");\n+ if IsNormalVATInvoiceForVendor(GenJournalLine) then\n+ UpdateNonDeductibleAmounts(GenJournalLine.\"Non-Deductible VAT Base LCY\", GenJournalLine.\"Non-Deductible VAT Amount LCY\", BaseAmount, VATAmount, GetNonDedVATPctFromGenJournalLine(GenJournalLine), GeneralLedgerSetup.\"Amount Rounding Precision\");\n AdjustVATAmounts(VATAmount, BaseAmount, GenJournalLine.\"Non-Deductible VAT Amount LCY\", GenJournalLine.\"Non-Deductible VAT Base LCY\");\n end;\n \n@@ -1152,6 +1155,17 @@ codeunit 6201 \"Non-Ded. VAT Impl.\"\n exit(DocAmountRoundingPrecision);\n end;\n \n+ local procedure IsNormalVATInvoiceForVendor(GenJournalLine: Record \"Gen. Journal Line\"): Boolean\n+ var\n+ Vendor: Record Vendor;\n+ begin\n+ if (GenJournalLine.\"Document Type\" = GenJournalLine.\"Document Type\"::Invoice) and\n+ (GenJournalLine.\"VAT Calculation Type\" = GenJournalLine.\"VAT Calculation Type\"::\"Normal VAT\") and\n+ (Vendor.Get(GenJournalLine.\"Bill-to/Pay-to No.\") and (Vendor.\"Prices Including VAT\")) then\n+ exit(true);\n+ exit(false);\n+ end;\n+\n [EventSubscriber(ObjectType::Codeunit, Codeunit::\"Company-Initialize\", 'OnCompanyInitialize', '', false, false)]\n local procedure CreateVATSetupOnCompanyInitialize()\n var\n"}
+{"metadata": {"area": "finance", "image_count": 8}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227153", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-16", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Report"], "FAIL_TO_PASS": [{"codeunitID": 134982, "functionName": ["ReconcileCustVendAccounts_MultiplePostingGroups"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al b/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al\nindex 073ba04a94f..03f6e89bb23 100644\n--- a/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al\n+++ b/App/Layers/W1/Tests/Report/ERMFinancialReports.Codeunit.al\n@@ -1498,6 +1498,93 @@ codeunit 134982 \"ERM Financial Reports\"\n Assert.AreNotEqual(0, GLEntry.\"Source Currency Amount\", SourceCurrencyCodeErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('RHReconcileCustandVendAccs')]\n+ procedure ReconcileCustVendAccounts_MultiplePostingGroups()\n+ var\n+ SalesReceivablesSetup: Record \"Sales & Receivables Setup\";\n+ CustomerPostingGroup: array[2] of Record \"Customer Posting Group\";\n+ Customer: Record Customer;\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ GLAccount: array[3] of Record \"G/L Account\";\n+ ReconcileCustAndVendAccs: Report \"Reconcile Cust. and Vend. Accs\";\n+ Amount1, Amount2 : Decimal;\n+ WorkdateTxt: Text[30];\n+ begin\n+ // [SCENARIO 601857] Report Reconcile Customer and Vendor Accounts shows wrong amounts when multiple posting groups are used\n+ Initialize();\n+\n+ // [GIVEN] Enable Allow Multiple Posting Groups\n+ SalesReceivablesSetup.Get();\n+ SalesReceivablesSetup.Validate(\"Allow Multiple Posting Groups\", true);\n+ SalesReceivablesSetup.Modify(true);\n+\n+ // [GIVEN] Create two Customer Posting Groups with different Receivables Accounts\n+ LibrarySales.CreateCustomerPostingGroup(CustomerPostingGroup[1]);\n+ LibrarySales.CreateCustomerPostingGroup(CustomerPostingGroup[2]);\n+ LibrarySales.CreateAltCustomerPostingGroup(CustomerPostingGroup[1].Code, CustomerPostingGroup[2].Code);\n+\n+ // [GIVEN] Create a customer with one of the posting groups and enable multiple posting groups\n+ LibrarySales.CreateCustomer(Customer);\n+ Customer.Validate(\"Customer Posting Group\", CustomerPostingGroup[1].Code);\n+ Customer.Validate(\"Allow Multiple Posting Groups\", true);\n+ Customer.Modify(true);\n+\n+ // [GIVEN] Create General Journal Batch\n+ LibraryJournals.CreateGenJournalBatch(GenJournalBatch);\n+\n+ // [GIVEN] Post payment 1 with first posting group\n+ Amount1 := -1 * LibraryRandom.RandDec(1000, 2);\n+ LibraryERM.CreateGLAccount(GLAccount[1]);\n+ LibraryJournals.CreateGenJournalLine(\n+ GenJournalLine,\n+ GenJournalBatch.\"Journal Template Name\",\n+ GenJournalBatch.Name,\n+ GenJournalLine.\"Document Type\"::Payment,\n+ GenJournalLine.\"Account Type\"::Customer,\n+ Customer.\"No.\",\n+ GenJournalLine.\"Bal. Account Type\"::\"G/L Account\",\n+ GLAccount[1].\"No.\",\n+ Amount1);\n+ GenJournalLine.Validate(\"Posting Group\", CustomerPostingGroup[1].Code);\n+ GenJournalLine.Modify(true);\n+ LibraryERM.PostGeneralJnlLine(GenJournalLine);\n+\n+ // [GIVEN] Post payment 2 with second posting group\n+ Amount2 := -1 * LibraryRandom.RandDec(2000, 2);\n+ LibraryERM.CreateGLAccount(GLAccount[2]);\n+ LibraryJournals.CreateGenJournalLine(\n+ GenJournalLine,\n+ GenJournalBatch.\"Journal Template Name\",\n+ GenJournalBatch.Name,\n+ GenJournalLine.\"Document Type\"::Payment,\n+ GenJournalLine.\"Account Type\"::Customer,\n+ Customer.\"No.\",\n+ GenJournalLine.\"Bal. Account Type\"::\"G/L Account\",\n+ GLAccount[2].\"No.\",\n+ Amount2);\n+ GenJournalLine.Validate(\"Posting Group\", CustomerPostingGroup[2].Code);\n+ GenJournalLine.Modify(true);\n+ LibraryERM.PostGeneralJnlLine(GenJournalLine);\n+\n+ // [WHEN] Run the Reconcile Cust. And Vend. Accounts report with DateFilter as Workdate\n+ WorkdateTxt := Format(WorkDate());\n+ Clear(ReconcileCustAndVendAccs);\n+ GLAccount[3].SetRange(\"Date Filter\", WorkDate());\n+ GLAccount[3].FindFirst();\n+ ReconcileCustAndVendAccs.SetTableView(GLAccount[3]);\n+ Commit();\n+ ReconcileCustAndVendAccs.Run();\n+\n+ // [THEN] Verify: Amounts are distributed to correct G/L accounts\n+ LibraryReportDataset.LoadDataSetFile();\n+ LibraryReportDataset.AssertElementWithValueExists('No_GLAccount', CustomerPostingGroup[1].\"Receivables Account\");\n+ LibraryReportDataset.AssertElementWithValueExists('No_GLAccount', CustomerPostingGroup[2].\"Receivables Account\");\n+ LibraryReportDataset.AssertElementWithValueExists('Amount', Amount1);\n+ LibraryReportDataset.AssertElementWithValueExists('Amount', Amount2);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al\nindex e033f91eb0b..2153bcde821 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Reports/ReconcileCustandVendAccs.Report.al\n@@ -472,130 +472,88 @@ report 33 \"Reconcile Cust. and Vend. Accs\"\n \n local procedure CalcCustAccAmount(PostingGr: Code[20]): Decimal\n var\n- Cust: Record Customer;\n DtldCustLedgEntry: Record \"Detailed Cust. Ledg. Entry\";\n CustAccAmount: Decimal;\n begin\n- Cust.SetCurrentKey(\"Customer Posting Group\");\n- Cust.SetRange(\"Customer Posting Group\", PostingGr);\n-\n- if Cust.Find('-') then\n- repeat\n- DtldCustLedgEntry.SetCurrentKey(\"Customer No.\", \"Posting Date\");\n- DtldCustLedgEntry.SetRange(\"Customer No.\", Cust.\"No.\");\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n- DtldCustLedgEntry.CalcSums(\"Amount (LCY)\");\n- CustAccAmount := CustAccAmount + DtldCustLedgEntry.\"Amount (LCY)\";\n- until Cust.Next() = 0;\n+ DtldCustLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\");\n+ DtldCustLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n+ DtldCustLedgEntry.CalcSums(\"Amount (LCY)\");\n+ CustAccAmount := CustAccAmount + DtldCustLedgEntry.\"Amount (LCY)\";\n \n exit(CustAccAmount);\n end;\n \n local procedure CalcCustCreditAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Cust: Record Customer;\n DtldCustLedgEntry: Record \"Detailed Cust. Ledg. Entry\";\n CustCreditAmount: Decimal;\n begin\n- Cust.SetCurrentKey(\"Customer Posting Group\");\n- Cust.SetRange(\"Customer Posting Group\", PostingGr);\n-\n- if Cust.Find('-') then\n- repeat\n- DtldCustLedgEntry.SetCurrentKey(\"Customer No.\", \"Posting Date\", \"Entry Type\");\n- DtldCustLedgEntry.SetRange(\"Customer No.\", Cust.\"No.\");\n- DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n- DtldCustLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n- CustCreditAmount := CustCreditAmount + DtldCustLedgEntry.\"Credit Amount (LCY)\";\n- until Cust.Next() = 0;\n+ DtldCustLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldCustLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n+ DtldCustLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n+ CustCreditAmount := CustCreditAmount + DtldCustLedgEntry.\"Credit Amount (LCY)\";\n \n exit(CustCreditAmount);\n end;\n \n local procedure CalcCustDebitAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Cust: Record Customer;\n DtldCustLedgEntry: Record \"Detailed Cust. Ledg. Entry\";\n CustDebitAmount: Decimal;\n begin\n- Cust.SetCurrentKey(\"Customer Posting Group\");\n- Cust.SetRange(\"Customer Posting Group\", PostingGr);\n-\n- if Cust.Find('-') then\n- repeat\n- DtldCustLedgEntry.SetCurrentKey(\"Customer No.\", \"Posting Date\", \"Entry Type\");\n- DtldCustLedgEntry.SetRange(\"Customer No.\", Cust.\"No.\");\n- DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n- DtldCustLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n- CustDebitAmount := CustDebitAmount + DtldCustLedgEntry.\"Debit Amount (LCY)\";\n- until Cust.Next() = 0;\n+ DtldCustLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldCustLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldCustLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldCustLedgEntry.\"Posting Date\");\n+ DtldCustLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n+ CustDebitAmount := CustDebitAmount + DtldCustLedgEntry.\"Debit Amount (LCY)\";\n \n exit(-CustDebitAmount);\n end;\n \n local procedure CalcVendAccAmount(PostingGr: Code[20]): Decimal\n var\n- Vend: Record Vendor;\n DtldVendLedgEntry: Record \"Detailed Vendor Ledg. Entry\";\n VendAccAmount: Decimal;\n begin\n- Vend.SetCurrentKey(\"Vendor Posting Group\");\n- Vend.SetRange(\"Vendor Posting Group\", PostingGr);\n-\n- if Vend.Find('-') then\n- repeat\n- DtldVendLedgEntry.SetCurrentKey(\"Vendor No.\", \"Posting Date\");\n- DtldVendLedgEntry.SetRange(\"Vendor No.\", Vend.\"No.\");\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n- DtldVendLedgEntry.CalcSums(\"Amount (LCY)\");\n- VendAccAmount := VendAccAmount + DtldVendLedgEntry.\"Amount (LCY)\";\n- until Vend.Next() = 0;\n+ DtldVendLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\");\n+ DtldVendLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n+ DtldVendLedgEntry.CalcSums(\"Amount (LCY)\");\n+ VendAccAmount := VendAccAmount + DtldVendLedgEntry.\"Amount (LCY)\";\n \n exit(VendAccAmount);\n end;\n \n local procedure CalcVendCreditAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Vend: Record Vendor;\n DtldVendLedgEntry: Record \"Detailed Vendor Ledg. Entry\";\n VendCreditAmount: Decimal;\n begin\n- Vend.SetCurrentKey(\"Vendor Posting Group\");\n- Vend.SetRange(\"Vendor Posting Group\", PostingGr);\n-\n- if Vend.Find('-') then\n- repeat\n- DtldVendLedgEntry.SetCurrentKey(\"Vendor No.\", \"Posting Date\", \"Entry Type\");\n- DtldVendLedgEntry.SetRange(\"Vendor No.\", Vend.\"No.\");\n- DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n- DtldVendLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n- VendCreditAmount := VendCreditAmount + DtldVendLedgEntry.\"Credit Amount (LCY)\";\n- until Vend.Next() = 0;\n+ DtldVendLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldVendLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n+ DtldVendLedgEntry.CalcSums(\"Credit Amount (LCY)\");\n+ VendCreditAmount := VendCreditAmount + DtldVendLedgEntry.\"Credit Amount (LCY)\";\n \n exit(VendCreditAmount);\n end;\n \n local procedure CalcVendDebitAmount(PostingGr: Code[20]; EntryType: Enum \"Detailed CV Ledger Entry Type\"): Decimal\n var\n- Vend: Record Vendor;\n DtldVendLedgEntry: Record \"Detailed Vendor Ledg. Entry\";\n VendDebitAmount: Decimal;\n begin\n- Vend.SetCurrentKey(\"Vendor Posting Group\");\n- Vend.SetRange(\"Vendor Posting Group\", PostingGr);\n-\n- if Vend.Find('-') then\n- repeat\n- DtldVendLedgEntry.SetCurrentKey(\"Vendor No.\", \"Posting Date\", \"Entry Type\");\n- DtldVendLedgEntry.SetRange(\"Vendor No.\", Vend.\"No.\");\n- DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n- \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n- DtldVendLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n- VendDebitAmount := VendDebitAmount + DtldVendLedgEntry.\"Debit Amount (LCY)\";\n- until Vend.Next() = 0;\n+ DtldVendLedgEntry.SetCurrentKey(\"Posting Group\", \"Posting Date\", \"Entry Type\");\n+ DtldVendLedgEntry.SetRange(\"Posting Group\", PostingGr);\n+ DtldVendLedgEntry.SetRange(\"Entry Type\", EntryType);\n+ \"G/L Account\".CopyFilter(\"Date Filter\", DtldVendLedgEntry.\"Posting Date\");\n+ DtldVendLedgEntry.CalcSums(\"Debit Amount (LCY)\");\n+ VendDebitAmount := VendDebitAmount + DtldVendLedgEntry.\"Debit Amount (LCY)\";\n \n exit(-VendDebitAmount);\n end;\n"}
+{"metadata": {"area": "sales", "image_count": 12}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-227240", "base_commit": "13fec5e51af6c3380265dc849cb57151fbd8ccfe", "created_at": "2025-09-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134905, "functionName": ["VerifyDueDateAfterUpdateDueDateInCustLedgerEntry"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\nindex 71c12b1ce1a..6d8f4aaca9e 100644\n--- a/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMIssuedReminderAddnlFee.Codeunit.al\n@@ -636,6 +636,68 @@ codeunit 134905 \"ERM Issued Reminder Addnl Fee\"\n ReminderPage.ContactEmail.AssertEquals(EMail);\n end;\n \n+ [Test]\n+ procedure VerifyDueDateAfterUpdateDueDateInCustLedgerEntry()\n+ var\n+ CustLedgerEntry: Record \"Cust. Ledger Entry\";\n+ Customer: Record Customer;\n+ CustomerPostingGroup: Record \"Customer Posting Group\";\n+ GLAccount: Record \"G/L Account\";\n+ ReminderFinChargeEntry: Record \"Reminder/Fin. Charge Entry\";\n+ ReminderLevel: Record \"Reminder Level\";\n+ VATProductPostingGroup: Record \"VAT Product Posting Group\";\n+ VATPostingSetup: Record \"VAT Posting Setup\";\n+ DueDate: Date;\n+ DocumentDate: Date;\n+ IssuedReminderNo: Code[20];\n+ begin\n+ // [SCENARIO 598460] The Due date in created Reminder is updated incorrectly when changing the Due date in the Customer Ledger Entry.\n+ Initialize();\n+\n+ // [GIVEN] Create Customer and VAT Posting Setup. \n+ CreateCustomer(Customer, '');\n+ CustomerPostingGroup.Get(Customer.\"Customer Posting Group\");\n+ GLAccount.Get(CustomerPostingGroup.\"Additional Fee Account\");\n+ LibraryERM.CreateVATProductPostingGroup(VATProductPostingGroup);\n+ GLAccount.Validate(\"VAT Prod. Posting Group\", VATProductPostingGroup.Code);\n+ GLAccount.Modify(true);\n+\n+ LibraryERM.CreateVATPostingSetup(VATPostingSetup, Customer.\"VAT Bus. Posting Group\", VATProductPostingGroup.Code);\n+\n+ //[GIVEN] Create and post Sales Invoice.\n+ DueDate := CreateAndPostSalesInvoice(Customer.\"No.\", '');\n+ GetReminderLevel(ReminderLevel, Customer.\"Reminder Terms Code\");\n+ DocumentDate := CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', CalcDate(ReminderLevel.\"Grace Period\", DueDate));\n+\n+ // [GIVEN] Create and Issue Reminder.\n+ CreateReminder(Customer.\"No.\", DocumentDate, false);\n+ IssuedReminderNo := IssueReminder(DocumentDate);\n+\n+ // [WHEN] Update Due Date in forward direction for Customer Ledger Entry.\n+ DueDate := DocumentDate + LibraryRandom.RandIntInRange(16, 17);\n+ CustLedgerEntry.SetRange(\"Customer No.\", Customer.\"No.\");\n+ CustLedgerEntry.FindLast();\n+ CustLedgerEntry.Validate(\"Due Date\", DueDate);\n+ CustLedgerEntry.Modify(true);\n+\n+ // [VERIFY] Verify Due Date in Reminder/Fin. Charge Entry should be equal to Cust. Ledger Entry - Due Date.\n+ ReminderFinChargeEntry.SetRange(Type, ReminderFinChargeEntry.Type::Reminder);\n+ ReminderFinChargeEntry.SetRange(\"No.\", IssuedReminderNo);\n+ ReminderFinChargeEntry.FindFirst();\n+ Assert.AreEqual(ReminderFinChargeEntry.\"Due Date\", CustLedgerEntry.\"Due Date\", ReminderDueDateErr);\n+\n+ // [WHEN] Update Due Date in backward direction for Customer Ledger Entry.\n+ DueDate := DocumentDate - LibraryRandom.RandIntInRange(16, 17);\n+ CustLedgerEntry.Validate(\"Due Date\", DueDate);\n+ CustLedgerEntry.Modify(true);\n+\n+ // [VERIFY] Verify Due Date in Reminder/Fin. Charge Entry should be equal to Cust. Ledger Entry - Due Date.\n+ ReminderFinChargeEntry.SetRange(Type, ReminderFinChargeEntry.Type::Reminder);\n+ ReminderFinChargeEntry.SetRange(\"No.\", IssuedReminderNo);\n+ ReminderFinChargeEntry.FindFirst();\n+ Assert.AreEqual(ReminderFinChargeEntry.\"Due Date\", CustLedgerEntry.\"Due Date\", ReminderDueDateErr);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\nindex 9ff59101df2..ff238e73dcf 100644\n--- a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n@@ -409,9 +409,6 @@ codeunit 393 \"Reminder-Issue\"\n if IsHandled then\n exit;\n \n- if NewDueDate < ReminderEntry2.\"Due Date\" then\n- exit;\n-\n ReminderEntry2.Validate(\"Due Date\", NewDueDate);\n ReminderEntry2.Modify();\n end;\n"}
+{"metadata": {"area": "shopify", "image_count": 8}, "repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-5633", "base_commit": "260795201c277427aa3bb70bc24672bb8d60c87b", "created_at": "2025-11-26T21:22:42Z", "environment_setup_version": "27.2", "project_paths": ["src\\Apps\\W1\\Shopify\\App", "src\\Apps\\W1\\Shopify\\Test"], "FAIL_TO_PASS": [{"codeunitID": 139606, "functionName": ["UnitTestExportShipmentThirdParty"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al\nindex 87c4a69e3a..2aa63a294f 100644\n--- a/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al\n+++ b/src/Apps/W1/Shopify/Test/Shipping/ShpfyShippingTest.Codeunit.al\n@@ -154,6 +154,36 @@ codeunit 139606 \"Shpfy Shipping Test\"\n LibraryAssert.IsTrue(FulfillmentRequest.Contains(StrSubstNo(QuantityLbl, SalesShipmentLine.Quantity)), 'quantity check');\n end;\n \n+ [Test]\n+ procedure UnitTestExportShipmentThirdParty()\n+ var\n+ SalesShipmentHeader: Record \"Sales Shipment Header\";\n+ FulfillmentOrderHeader: Record \"Shpfy FulFillment Order Header\";\n+ ExportShipments: Codeunit \"Shpfy Export Shipments\";\n+ ShippingHelper: Codeunit \"Shpfy Shipping Helper\";\n+ DeliveryMethodType: Enum \"Shpfy Delivery Method Type\";\n+ FulfillmentRequests: List of [Text];\n+ AssignedFulfillmentOrderIds: Dictionary of [BigInteger, Code[20]];\n+ ShopifyOrderId: BigInteger;\n+ LocationId: BigInteger;\n+ begin\n+ // [SCENARIO] Export a Sales Shipment record into a Json token that contains the shipping info for a third-party fulfillment service\n+ // [GIVEN] A random Sales Shipment, a random LocationId for a third-party fulfillment location, a random Shop\n+ Initialize();\n+ LocationId := Any.IntegerInRange(10000, 99999);\n+ CreateThirdPartyFulfillmentLocation(Shop, LocationId);\n+ DeliveryMethodType := DeliveryMethodType::Shipping;\n+ ShopifyOrderId := ShippingHelper.CreateRandomShopifyOrder(LocationId, DeliveryMethodType);\n+ FulfillmentOrderHeader := ShippingHelper.CreateShopifyFulfillmentOrder(ShopifyOrderId, DeliveryMethodType);\n+ ShippingHelper.CreateRandomSalesShipment(SalesShipmentHeader, ShopifyOrderId);\n+\n+ // [WHEN] Invoke the function CreateFulfillmentOrderRequest()\n+ FulfillmentRequests := ExportShipments.CreateFulfillmentOrderRequest(SalesShipmentHeader, Shop, LocationId, DeliveryMethodType, AssignedFulfillmentOrderIds);\n+\n+ // [THEN] We must find no fulfilment data in the json token as the location is for a third-party fulfillment service\n+ LibraryAssert.AreEqual(0, FulfillmentRequests.Count, 'FulfillmentRequest count check');\n+ end;\n+\n local procedure Initialize()\n var\n CommunicationMgt: Codeunit \"Shpfy Communication Mgt.\";\n@@ -188,6 +218,17 @@ codeunit 139606 \"Shpfy Shipping Test\"\n LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::\"Shpfy Shipping Test\");\n end;\n \n+ local procedure CreateThirdPartyFulfillmentLocation(ShopifyShop: Record \"Shpfy Shop\"; LocationId: BigInteger)\n+ var\n+ ShopLocation: Record \"Shpfy Shop Location\";\n+ begin\n+ ShopLocation.\"Shop Code\" := ShopifyShop.Code;\n+ ShopLocation.Id := LocationId;\n+ ShopLocation.Name := 'Third-Party Fulfillment Service';\n+ ShopLocation.\"Is Fulfillment Service\" := true;\n+ ShopLocation.Insert();\n+ end;\n+\n [HttpClientHandler]\n internal procedure HttpSubmitHandler(Request: TestHttpRequestMessage; var Response: TestHttpResponseMessage): Boolean\n begin\n", "patch": "diff --git a/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al b/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al\nindex 1f790f98d1..6160dcd402 100644\n--- a/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al\n+++ b/src/Apps/W1/Shopify/App/src/Shipping/Codeunits/ShpfyExportShipments.Codeunit.al\n@@ -90,11 +90,13 @@ codeunit 30190 \"Shpfy Export Shipments\"\n TrackingCompany: Enum \"Shpfy Tracking Companies\";\n PrevFulfillmentOrderId: BigInteger;\n IsHandled: Boolean;\n+ EmptyFulfillment: Boolean;\n TrackingUrl: Text;\n GraphQueryStart: Text;\n GraphQuery: TextBuilder;\n LineCount: Integer;\n GraphQueries: List of [Text];\n+ UnfulfillableOrders: List of [BigInteger];\n begin\n Clear(PrevFulfillmentOrderId);\n \n@@ -165,11 +167,17 @@ codeunit 30190 \"Shpfy Export Shipments\"\n end;\n GraphQuery.Append('lineItemsByFulfillmentOrder: [');\n GraphQueryStart := GraphQuery.ToText();\n+ EmptyFulfillment := true;\n repeat\n // Skip fulfillment orders that are assigned and not accepted\n if AssignedFulfillmentOrderIds.ContainsKey(TempFulfillmentOrderLine.\"Shopify Fulfillment Order Id\") then\n continue;\n \n+ if not CanFulfillOrder(TempFulfillmentOrderLine, Shop, UnfulfillableOrders) then\n+ continue;\n+\n+ EmptyFulfillment := false;\n+\n if PrevFulfillmentOrderId <> TempFulfillmentOrderLine.\"Shopify Fulfillment Order Id\" then begin\n if PrevFulfillmentOrderId <> 0 then\n GraphQuery.Append(']},');\n@@ -202,7 +210,8 @@ codeunit 30190 \"Shpfy Export Shipments\"\n until TempFulfillmentOrderLine.Next() = 0;\n GraphQuery.Append(']}]})');\n GraphQuery.Append('{fulfillment { legacyResourceId name createdAt updatedAt deliveredAt displayStatus estimatedDeliveryAt status totalQuantity location { legacyResourceId } trackingInfo { number url company } service { serviceName type } fulfillmentLineItems(first: 10) { pageInfo { endCursor hasNextPage } nodes { id quantity originalTotalSet { presentmentMoney { amount } shopMoney { amount }} lineItem { id isGiftCard }}}}, userErrors {field,message}}}\"}');\n- GraphQueries.Add(GraphQuery.ToText());\n+ if not EmptyFulfillment then\n+ GraphQueries.Add(GraphQuery.ToText());\n end;\n exit(GraphQueries);\n end;\n@@ -225,6 +234,27 @@ codeunit 30190 \"Shpfy Export Shipments\"\n end;\n end;\n \n+ local procedure CanFulfillOrder(FulfillmentOrderLine: Record \"Shpfy FulFillment Order Line\"; Shop: Record \"Shpfy Shop\"; var UnfulfillableOrders: List of [BigInteger]): Boolean\n+ var\n+ ShopLocation: Record \"Shpfy Shop Location\";\n+ SyncLocations: Codeunit \"Shpfy Sync Shop Locations\";\n+ begin\n+ if UnfulfillableOrders.Contains(FulfillmentOrderLine.\"Shopify Fulfillment Order Id\") then\n+ exit(false);\n+\n+ if not ShopLocation.Get(Shop.Code, FulfillmentOrderLine.\"Shopify Location Id\") then\n+ exit(true);\n+\n+ if not ShopLocation.\"Is Fulfillment Service\" then\n+ exit(true);\n+\n+ if ShopLocation.Name = SyncLocations.GetFulfillmentServiceName() then\n+ exit(true);\n+\n+ UnfulfillableOrders.Add(FulfillmentOrderLine.\"Shopify Fulfillment Order Id\");\n+ exit(false);\n+ end;\n+\n local procedure GetNotifyCustomer(Shop: Record \"Shpfy Shop\"; SalesShipmmentHeader: Record \"Sales Shipment Header\"; LocationId: BigInteger): Boolean\n var\n IsHandled: Boolean;\n"}
+{"metadata": {"area": "shopify", "image_count": 3}, "repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-4822", "base_commit": "f0b7291eb64a17df19a536e44be37380b2e4203d", "created_at": "2025-09-19T13:01:33Z", "environment_setup_version": "27.0", "project_paths": ["src\\Apps\\W1\\Shopify\\App", "src\\Apps\\W1\\Shopify\\Test"], "FAIL_TO_PASS": [{"codeunitID": 139539, "functionName": ["TestCreateCompanyLocationSellToBillTo"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al\nindex be8c01cb17..d27dba8d65 100644\n--- a/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al\n+++ b/src/Apps/W1/Shopify/Test/Companies/ShpfyCompanyLocationsTest.Codeunit.al\n@@ -23,6 +23,7 @@ codeunit 139539 \"Shpfy Company Locations Test\"\n Customer: Record Customer;\n InitializeTest: Codeunit \"Shpfy Initialize Test\";\n OutboundHttpRequests: Codeunit \"Library - Variable Storage\";\n+ Assert: Codeunit \"Library Assert\";\n IsInitialized: Boolean;\n ResponseResourceUrl: Text;\n UnexpectedAPICallsErr: Label 'More than expected API calls to Shopify detected.';\n@@ -57,6 +58,37 @@ codeunit 139539 \"Shpfy Company Locations Test\"\n ShopifyCompanies.OpenEdit();\n ShopifyCompanies.GoToRecord(ShopifyCompany);\n ShopifyCompanies.Locations.GoToRecord(CompanyLocation);\n+\n+ // Cleanup\n+ CompanyLocation.Delete();\n+ end;\n+\n+ [Test]\n+ [HandlerFunctions('HttpSubmitHandler')]\n+ procedure TestCreateCompanyLocationSellToBillTo()\n+ var\n+ ShopifyCustomer: Record \"Shpfy Customer\";\n+ CompanyAPI: Codeunit \"Shpfy Company API\";\n+ begin\n+ // [GIVEN] A valid customer and company location setup\n+ RegExpectedOutboundHttpRequests();\n+ Initialize();\n+ ShopifyCompany.GetBySystemId(CompanyLocation.\"Company SystemId\");\n+ Customer.\"Bill-to Customer No.\" := 'BILLTO';\n+ Customer.Modify(true);\n+\n+ // [WHEN] CreateCompanyLocation is called\n+ CompanyAPI.SetCompany(ShopifyCompany);\n+ CompanyAPI.SetShop(Shop);\n+ CompanyAPI.CreateCustomerAsCompanyLocation(Customer, ShopifyCompany, ShopifyCustomer);\n+\n+ // [THEN] Company location should be created successfully\n+#pragma warning disable AA0210\n+ CompanyLocation.SetRange(\"Customer Id\", Customer.SystemId);\n+#pragma warning restore AA0210\n+ CompanyLocation.FindFirst();\n+ Assert.AreEqual(Customer.\"No.\", CompanyLocation.\"Sell-to Customer No.\", 'Sell-to Customer No. mismatch');\n+ Assert.AreEqual(Customer.\"Bill-to Customer No.\", CompanyLocation.\"Bill-to Customer No.\", 'Bill-to Customer No. mismatch');\n end;\n \n [Test]\n", "patch": "diff --git a/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al b/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al\nindex 2d2014446c..d09ff272d8 100644\n--- a/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al\n+++ b/src/Apps/W1/Shopify/App/src/Companies/Codeunits/ShpfyCompanyAPI.Codeunit.al\n@@ -523,7 +523,7 @@ codeunit 30286 \"Shpfy Company API\"\n JResponse := CommunicationMgt.ExecuteGraphQL(GraphQuery.ToText());\n if JResponse.SelectToken('$.data.companyLocationCreate.companyLocation', JCompanyLocation) then\n if not JsonHelper.IsTokenNull(JCompanyLocation) then begin\n- LocationId := CreateCustomerLocation(JCompanyLocation.AsObject(), ShopifyCompany, Customer.SystemId);\n+ LocationId := CreateCustomerLocation(JCompanyLocation.AsObject(), ShopifyCompany, Customer);\n if JsonHelper.GetJsonArray(JCompanyLocation, JContactRoles, 'company.contactRoles.edges') then begin\n foreach JItem in JContactRoles do\n CompanyContactRoles.Add(JsonHelper.GetValueAsText(JItem, 'node.name'), CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JItem, 'node.id')));\n@@ -540,7 +540,7 @@ codeunit 30286 \"Shpfy Company API\"\n /// \n /// JSON object containing the company location data from Shopify API response.\n /// The parent Shopify company record.\n- /// The GUID of the Business Central customer that was exported.\n+ /// The Business Central customer record used to populate additional fields.\n /// \n /// This procedure:\n /// - Extracts the Shopify-generated ID and creates the initial record\n@@ -552,7 +552,7 @@ codeunit 30286 \"Shpfy Company API\"\n /// The procedure assumes the JSON structure matches Shopify's companyLocationCreate response format.\n /// All text fields are properly truncated to match the field lengths in the table definition.\n /// \n- local procedure CreateCustomerLocation(JCompanyLocation: JsonObject; ShopifyCompany: Record \"Shpfy Company\"; CustomerId: Guid): BigInteger\n+ local procedure CreateCustomerLocation(JCompanyLocation: JsonObject; ShopifyCompany: Record \"Shpfy Company\"; Customer: Record Customer): BigInteger\n var\n CompanyLocation: Record \"Shpfy Company Location\";\n CompanyLocationId: BigInteger;\n@@ -580,7 +580,10 @@ codeunit 30286 \"Shpfy Company API\"\n #pragma warning restore AA0139\n CompanyLocation.Recipient := CopyStr(JsonHelper.GetValueAsText(JCompanyLocation, 'billingAddress.recipient', MaxStrLen(CompanyLocation.Recipient)), 1, MaxStrLen(CompanyLocation.Recipient));\n CompanyLocation.\"Shpfy Payment Terms Id\" := CommunicationMgt.GetIdOfGId(JsonHelper.GetValueAsText(JCompanyLocation, 'buyerExperienceConfiguration.paymentTermsTemplate.id'));\n- CompanyLocation.\"Customer Id\" := CustomerId;\n+ CompanyLocation.\"Customer Id\" := Customer.SystemId;\n+ CompanyLocation.\"Sell-to Customer No.\" := Customer.\"No.\";\n+ if Customer.\"Bill-to Customer No.\" <> '' then\n+ CompanyLocation.\"Bill-to Customer No.\" := Customer.\"Bill-to Customer No.\";\n CompanyLocation.Modify(true);\n exit(CompanyLocationId);\n end;\n"}
+{"metadata": {"area": "shopify", "image_count": 5}, "repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-4699", "base_commit": "effc43e8f96bc2b06545bcf81b9579bd08542747", "created_at": "2025-09-05T11:48:36Z", "environment_setup_version": "27.0", "project_paths": ["src\\Apps\\W1\\Shopify\\App", "src\\Apps\\W1\\Shopify\\Test"], "FAIL_TO_PASS": [{"codeunitID": 139567, "functionName": ["UnitTestCreateItemFCYToLCYConversion"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al\nindex a352529aba..f626c18258 100644\n--- a/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al\n+++ b/src/Apps/W1/Shopify/Test/Products/ShpfyCreateItemTest.Codeunit.al\n@@ -22,6 +22,7 @@ codeunit 139567 \"Shpfy Create Item Test\"\n \n var\n LibraryAssert: Codeunit \"Library Assert\";\n+ LibraryERM: Codeunit \"Library - ERM\";\n LibraryRandom: Codeunit \"Library - Random\";\n \n [Test]\n@@ -487,4 +488,42 @@ codeunit 139567 \"Shpfy Create Item Test\"\n LibraryAssert.RecordIsNotEmpty(ItemReference);\n until ShopifyVariant.Next() = 0;\n end;\n+\n+ [Test]\n+ procedure UnitTestCreateItemFCYToLCYConversion()\n+ var\n+ Item: Record Item;\n+ Shop: Record \"Shpfy Shop\";\n+ ShopifyVariant: Record \"Shpfy Variant\";\n+ ProductInitTest: Codeunit \"Shpfy Product Init Test\";\n+ InitializeTest: Codeunit \"Shpfy Initialize Test\";\n+ begin\n+ // [SCENARIO] Create a Item from a Shopify Product with the SKU value containing the Item No.\n+\n+ // [GIVEN] The Shop with the setting \"SKU Mapping\" = \"Item No.\";\n+ Shop := InitializeTest.CreateShop();\n+ Shop.\"SKU Mapping\" := \"Shpfy SKU Mapping\"::\"Item No.\";\n+ Shop.\"Currency Code\" := CreateCurrencyAndExchangeRate(2, 2);\n+ Shop.Modify();\n+\n+ // [GIVEN] A Shopify variant record of a standard shopify product. (The variant record always exists, even if the products don't have any variants.)\n+ ShopifyVariant := ProductInitTest.CreateStandardProduct(Shop);\n+ ShopifyVariant.Price := 10;\n+ ShopifyVariant.\"Unit Cost\" := 6;\n+ ShopifyVariant.Modify();\n+ ShopifyVariant.SetRecFilter();\n+\n+ // [WHEN] Executing the report \"Shpfy Create Item\" with the \"Shpfy Variant\" Record.\n+ Codeunit.Run(Codeunit::\"Shpfy Create Item\", ShopifyVariant);\n+\n+ // [THEN] Check Item fields\n+ LibraryAssert.IsTrue(Item.GetBySystemId(ShopifyVariant.\"Item SystemId\"), 'Get Item');\n+ LibraryAssert.AreNearlyEqual(ShopifyVariant.\"Unit Cost\" / 2, Item.\"Unit Cost\", 0.1, 'Unit Cost');\n+ LibraryAssert.AreNearlyEqual(ShopifyVariant.Price / 2, Item.\"Unit Price\", 0.1, 'Unit Price');\n+ end;\n+\n+ local procedure CreateCurrencyAndExchangeRate(ExchangeRateAmount: Decimal; AdjustmentExchangeRateAmount: Decimal): Code[10]\n+ begin\n+ exit(LibraryERM.CreateCurrencyWithExchangeRate(WorkDate() - 1, ExchangeRateAmount, AdjustmentExchangeRateAmount));\n+ end;\n }\n", "patch": "diff --git a/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al b/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al\nindex 4e6ffd2866..717c4f204b 100644\n--- a/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al\n+++ b/src/Apps/W1/Shopify/App/src/Products/Codeunits/ShpfyCreateItem.Codeunit.al\n@@ -8,6 +8,7 @@ namespace Microsoft.Integration.Shopify;\n using Microsoft.Inventory.Item;\n using Microsoft.Foundation.UOM;\n using Microsoft.Purchases.Vendor;\n+using Microsoft.Finance.Currency;\n using Microsoft.Inventory.Item.Catalog;\n \n /// \n@@ -230,6 +231,7 @@ codeunit 30171 \"Shpfy Create Item\"\n ItemCategory: Record \"Item Category\";\n ItemVariant: Record \"Item Variant\";\n Vendor: Record Vendor;\n+ CurrencyExchangeRate: Record \"Currency Exchange Rate\";\n CurrentTemplateCode: Code[20];\n ItemNo: Code[20];\n Code: Text;\n@@ -258,10 +260,16 @@ codeunit 30171 \"Shpfy Create Item\"\n CreateItemUnitOfMeasure(ShopifyVariant, Item);\n \n if ShopifyVariant.\"Unit Cost\" <> 0 then\n- Item.Validate(\"Unit Cost\", ShopifyVariant.\"Unit Cost\");\n+ if Shop.\"Currency Code\" = '' then\n+ Item.Validate(\"Unit Cost\", ShopifyVariant.\"Unit Cost\")\n+ else\n+ Item.Validate(\"Unit Cost\", Round(CurrencyExchangeRate.ExchangeAmtFCYToLCY(WorkDate(), Shop.\"Currency Code\", ShopifyVariant.\"Unit Cost\", CurrencyExchangeRate.ExchangeRate(WorkDate(), Shop.\"Currency Code\"))));\n \n if ShopifyVariant.Price <> 0 then\n- Item.Validate(\"Unit Price\", ShopifyVariant.Price);\n+ if Shop.\"Currency Code\" = '' then\n+ Item.Validate(\"Unit Price\", ShopifyVariant.Price)\n+ else\n+ Item.Validate(\"Unit Price\", Round(CurrencyExchangeRate.ExchangeAmtFCYToLCY(WorkDate(), Shop.\"Currency Code\", ShopifyVariant.Price, CurrencyExchangeRate.ExchangeRate(WorkDate(), Shop.\"Currency Code\"))));\n \n if ShopifyProduct.\"Product Type\" <> '' then begin\n ItemCategory.SetFilter(Description, FilterMgt.CleanFilterValue(ShopifyProduct.\"Product Type\", MaxStrLen(ItemCategory.Description)));\n"}
+{"metadata": {"area": "inventory", "image_count": 5}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223790", "base_commit": "e33326f4a8f7341c0857ef5a7013a3fe593d8146", "created_at": "2025-08-13", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137035, "functionName": ["CheckPlanningWorksheetPlanComponentwhenStockkeepingUnitsSetup"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al\nindex cd0d28c59b88..9867c364a8cb 100644\n--- a/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMPSBugsI.Codeunit.al\n@@ -45,6 +45,8 @@ codeunit 137035 \"SCM PS Bugs-I\"\n QuantityErr: Label 'Quantity update should be possible in %1.', Comment = '%1= Table Name.';\n DueDateErr: Label 'Planned production order due date not match with planning worksheet due date';\n SKUInventoryErr: Label 'Expected inventory to be blank for non-inventory item';\n+ MainItemErr: Label 'New planning worksheet line not created for main item';\n+ CompoItemErr: Label 'New planning worksheet line not created for component item';\n \n [Test]\n [Scope('OnPrem')]\n@@ -1320,6 +1322,97 @@ codeunit 137035 \"SCM PS Bugs-I\"\n LibraryVariableStorage.AssertEmpty();\n end;\n \n+ [Test]\n+ [HandlerFunctions('SKURequestPageHandler')]\n+ procedure CheckPlanningWorksheetPlanComponentwhenStockkeepingUnitsSetup()\n+ var\n+ CompItem: Record Item;\n+ InventorySetup: Record \"Inventory Setup\";\n+ Location: Record Location;\n+ MainItem: Record Item;\n+ ManufacturingSetup: Record \"Manufacturing Setup\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ Requisitionline: Record \"Requisition Line\";\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ Itemcard: TestPage \"Item Card\";\n+ SKUCardPage: TestPage \"Stockkeeping Unit Card\";\n+ ActualCount: Integer;\n+ begin\n+ // [SCENARIO 579977] Check Planning Worksheet Plan Component when Stockkeeping Units Setup for Items.\n+ Initialize();\n+\n+ // [GIVEN] Set Manufacturing Setup for Dynamic Low-Level Code and Inventory Setup for ombined MPS/MRP Calculation.\n+ ManufacturingSetup.Get();\n+ ManufacturingSetup.Validate(\"Dynamic Low-Level Code\", true);\n+ ManufacturingSetup.Modify(true);\n+ InventorySetup.Get();\n+ InventorySetup.Validate(\"Combined MPS/MRP Calculation\", true);\n+ InventorySetup.Modify(true);\n+\n+ // [GIVEN] Create Item with Replenishment System as Production Order.\n+ LibraryInventory.CreateItem(CompItem);\n+\n+ // [GIVEN] Create Location.\n+ LibraryWarehouse.CreateLocation(Location);\n+\n+ // [GIVEN] Create Stockkeeping Unit for Item and Location.\n+ Commit();\n+ LibraryVariableStorage.Enqueue(Location.Code);\n+ ItemCard.OpenView();\n+ ItemCard.GotoRecord(CompItem);\n+ ItemCard.\"&Create Stockkeeping Unit\".Invoke();\n+ ItemCard.OK().Invoke();\n+\n+ // [GIVEN] Modify Stockkeeping Unit for Item.\n+ SKUCardPage.OpenView();\n+ SKUCardPage.Filter.SetFilter(\"Item No.\", CompItem.\"No.\");\n+ SKUCardPage.Filter.SetFilter(\"Location Code\", Location.\"Code\");\n+ SKUCardPage.\"Replenishment System\".SetValue(\"Replenishment System\"::Purchase);\n+ SKUCardPage.\"Reordering Policy\".SetValue(\"Reordering Policy\"::\"Order\");\n+ SKUCardPage.Close();\n+\n+ // [GIVEN] Create BOM for the item.\n+ LibraryManufacturing.CreateCertifiedProductionBOM(ProductionBOMHeader, CompItem.\"No.\", 1);\n+\n+ // [GIVEN] Create Main Item with Replenishment System as Production Order.\n+ LibraryInventory.CreateItem(MainItem);\n+\n+ // [GIVEN] Create Stockkeeping Unit for Main Item and Location.\n+ Commit();\n+ LibraryVariableStorage.Enqueue(Location.Code);\n+ ItemCard.OpenView();\n+ ItemCard.GotoRecord(MainItem);\n+ ItemCard.\"&Create Stockkeeping Unit\".Invoke();\n+ ItemCard.OK().Invoke();\n+\n+ // [GIVEN] Modify Stockkeeping Unit Created for Main Item.\n+ SKUCardPage.OpenView();\n+ SKUCardPage.Filter.SetFilter(\"Item No.\", MainItem.\"No.\");\n+ SKUCardPage.Filter.SetFilter(\"Location Code\", Location.\"Code\");\n+ SKUCardPage.\"Replenishment System\".SetValue(\"Replenishment System\"::\"Prod. Order\");\n+ SKUCardPage.\"Reordering Policy\".SetValue(\"Reordering Policy\"::\"Lot-for-Lot\");\n+ SKUCardPage.\"Manufacturing Policy\".SetValue(\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ SKUCardPage.\"Production BOM No.\".SetValue(ProductionBOMHeader.\"No.\");\n+ SKUCardPage.Close();\n+\n+ // [WHEN] Create Sales order for Item and Location.\n+ Librarysales.CreateSalesDocumentWithItem(\n+ SalesHeader, SalesLine, SalesHeader.\"Document Type\"::Order, '', MainItem.\"No.\", 10, Location.\"Code\", WorkDate());\n+\n+ // [WHEN] Calculate regenerative plan in planning worksheet update Planning Worksheet.\n+ CalculateRegenerativePlanningWorksheet(CompItem, MainItem, WorkDate(), CalcDate('<1Y>', WorkDate()), true, false);\n+\n+ // [THEN] Verify Actual Count Match with Expected Result for Main Item Planning Worksheet Line.\n+ CountPlanningWorksheetLine(Requisitionline, ActualCount, MainItem.\"No.\", Location.\"Code\");\n+ Assert.AreEqual(1, ActualCount, MainItemErr);\n+\n+ // [THEN] Verify Actual Count Match with Expected Result for Component Item Planning Worksheet Line.\n+ CountPlanningWorksheetLine(Requisitionline, ActualCount, CompItem.\"No.\", Location.\"Code\");\n+ Assert.AreEqual(1, ActualCount, CompoItemErr);\n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -2143,6 +2236,32 @@ codeunit 137035 \"SCM PS Bugs-I\"\n Assert.AreEqual(DueDate, ProductionOrder.\"Due Date\", DueDateErr);\n end;\n \n+ local procedure CountPlanningWorksheetLine(Requisitionline: Record \"Requisition Line\"; var ActualCount: Integer; ItemNo: Code[20]; LocationCode: Code[10])\n+ begin\n+ Clear(ActualCount);\n+ Requisitionline.Reset();\n+ Requisitionline.SetRange(\"No.\", ItemNo);\n+ Requisitionline.SetRange(\"Location Code\", LocationCode);\n+ if Requisitionline.FindSet() then\n+ ActualCount := Requisitionline.Count;\n+ end;\n+\n+ local procedure CalculateRegenerativePlanningWorksheet(var CompItemRec: Record Item; var MainItemRec: Record Item; OrderDate: Date; ToDate: Date; RespectPlanningParameters: Boolean; Regenerative: Boolean)\n+ var\n+ TmpItemRec: Record Item;\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ CalculatePlanPlanWksh: Report \"Calculate Plan - Plan. Wksh.\";\n+ begin\n+ LibraryPlanning.SelectRequisitionWkshName(RequisitionWkshName, RequisitionWkshName.\"Template Type\"::Planning); // Find Requisition Worksheet Name to Calculate Plan.\n+ Commit();\n+ CalculatePlanPlanWksh.InitializeRequest(OrderDate, ToDate, RespectPlanningParameters, true, true, '', 0D, false);\n+ CalculatePlanPlanWksh.SetTemplAndWorksheet(RequisitionWkshName.\"Worksheet Template Name\", RequisitionWkshName.Name, Regenerative);\n+ TmpItemRec.SetFilter(\"No.\", '%1..%2', CompItemRec.\"No.\", MainItemRec.\"No.\");\n+ CalculatePlanPlanWksh.SetTableView(TmpItemRec);\n+ CalculatePlanPlanWksh.UseRequestPage(false);\n+ CalculatePlanPlanWksh.RunModal();\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandler(Question: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al\nindex e6df0fd1150e..bd56f5d829d5 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Inventory/Location/MfgStockkeepingUnit.TableExt.al\n@@ -8,6 +8,7 @@ using Microsoft.Inventory.Item;\n using Microsoft.Manufacturing.Document;\n using Microsoft.Manufacturing.ProductionBOM;\n using Microsoft.Manufacturing.Routing;\n+using Microsoft.Manufacturing.Setup;\n \n tableextension 99000759 \"Mfg. Stockkeeping Unit\" extends \"Stockkeeping Unit\"\n {\n@@ -62,6 +63,27 @@ tableextension 99000759 \"Mfg. Stockkeeping Unit\" extends \"Stockkeeping Unit\"\n Caption = 'Production BOM No.';\n DataClassification = CustomerContent;\n TableRelation = \"Production BOM Header\";\n+ trigger OnValidate()\n+ var\n+ Item: Record Item;\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ MfgSetup: Record \"Manufacturing Setup\";\n+ ProdBOMHeader: Record \"Production BOM Header\";\n+ CalculateLowLevelCode: Codeunit \"Calculate Low-Level Code\";\n+ begin\n+ if (\"Production BOM No.\" <> '') and (\"Production BOM No.\" <> xRec.\"Production BOM No.\") then begin\n+ ProdBOMHeader.Get(\"Production BOM No.\");\n+ ItemUnitOfMeasure.Get(\"Item No.\", ProdBOMHeader.\"Unit of Measure Code\");\n+ if ProdBOMHeader.Status = ProdBOMHeader.Status::Certified then begin\n+ MfgSetup.Get();\n+ Item.Get(\"Item No.\");\n+ if MfgSetup.\"Dynamic Low-Level Code\" then begin\n+ Item.\"Low-Level Code\" := CalculateLowLevelCode.CalcLevels(1, Item.\"No.\", 0, 0);\n+ CalculateLowLevelCode.SetRecursiveLevelsOnBOM(ProdBOMHeader, Item.\"Low-Level Code\" + 1, false);\n+ end;\n+ end;\n+ end;\n+ end;\n }\n field(99000765; \"Planned Order Receipt (Qty.)\"; Decimal)\n {\n"}
+{"metadata": {"area": "inventory", "image_count": 7}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-223819", "base_commit": "61943a7dd68306f6b3913043e73e4654232a9476", "created_at": "2025-08-14", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Dimension"], "FAIL_TO_PASS": [{"codeunitID": 134474, "functionName": ["OverrideDimWithNewLocationsAndSalespersonOnItemJournalLine"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al b/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al\nindex 8e58207a24d3..3a47bcf8819f 100644\n--- a/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al\n+++ b/App/Layers/W1/Tests/Dimension/ERMDimensionLocations.Codeunit.al\n@@ -1232,6 +1232,64 @@ codeunit 134474 \"ERM Dimension Locations\"\n Assert.AreNotEqual(TransferHeader.\"Shortcut Dimension 2 Code\", TransferLine.\"Shortcut Dimension 2 Code\", DimensionsNotEqualErr);\n end;\n \n+ [Test]\n+ procedure OverrideDimWithNewLocationsAndSalespersonOnItemJournalLine()\n+ var\n+ DimensionValue: array[2] of Record \"Dimension Value\";\n+ Item: Record Item;\n+ LocationFrom: Record Location;\n+ LocationTo: Record Location;\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ SalespersonPurchaser: Record \"Salesperson/Purchaser\";\n+ begin\n+ // [SCENARIO 596687] In the Item Reclassification Journal is the Dimension value wrongly updated by adding a Sales Person to the line\n+ Initialize();\n+\n+ // [GIVEN] Global dimension 1 values \"V1\" and \"V2\".\n+ LibraryDimension.CreateDimensionValue(DimensionValue[1], LibraryERM.GetGlobalDimensionCode(1));\n+ LibraryDimension.CreateDimensionValue(DimensionValue[2], LibraryERM.GetGlobalDimensionCode(1));\n+\n+ // [GIVEN] Assign value \"V1\" to location \"BLUE\".\n+ // [GIVEN] Assign value \"V2\" to location \"RED\".\n+ LibraryInventory.CreateItem(Item);\n+ CreateLocationWithDefaultDimension(LocationFrom, DimensionValue[1]);\n+ CreateLocationWithDefaultDimension(LocationTo, DimensionValue[2]);\n+\n+ // [GIVEN] Create item reclassification journal line.\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, ItemJournalTemplate.Type::Transfer);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, ItemJournalTemplate.Type, ItemJournalTemplate.Name);\n+ LibraryInventory.CreateItemJnlLineWithNoItem(\n+ ItemJournalLine, ItemJournalBatch, ItemJournalTemplate.Name, ItemJournalBatch.Name, \"Item Ledger Entry Type\"::Transfer);\n+ ItemJournalline.Validate(\"Item No.\", Item.\"No.\");\n+\n+ // [GIVEN] Set \"Location Code\" = \"BLUE\" on the item journal line.\n+ // [GIVEN] Verify that \"Shortcut Dimension 1 Code\" = \"V1\".\n+ // [GIVEN] Verify that \"Dimension Set ID\" includes value \"V1\".\n+ ItemJournalLine.Validate(\"Location Code\", LocationFrom.Code);\n+ ItemJournalLine.TestField(\"Shortcut Dimension 1 Code\", DimensionValue[1].Code);\n+ VerifyDimensionValue(ItemJournalLine.\"Dimension Set ID\", DimensionValue[1]);\n+\n+ // [WHEN] Set \"New Location Code\" = \"RED\".\n+ ItemJournalLine.Validate(\"New Location Code\", LocationTo.Code);\n+\n+ // [WHEN] Set \"Sales Person Purchaser\" = \"RED\".\n+ LibrarySales.CreateSalesperson(SalespersonPurchaser);\n+ CreateDefaultDimensionWithSpecCode(SalespersonPurchaser.Code, DATABASE::\"Salesperson/Purchaser\");\n+ ItemJournalLine.Validate(\"Salespers./Purch. Code\", SalespersonPurchaser.Code);\n+\n+ // [THEN] \"New Shortcut Dimension 1 Code\" = \"V2\".\n+ // [THEN] \"New Dimension Set ID\" includes value \"V2\".\n+ ItemJournalLine.TestField(\"New Shortcut Dimension 1 Code\", DimensionValue[2].Code);\n+ VerifyDimensionValue(ItemJournalLine.\"New Dimension Set ID\", DimensionValue[2]);\n+\n+ // [THEN] \"Shortcut Dimension 1 Code\" remains \"V1\".\n+ // [THEN] \"Dimension Set ID\" is not changed.\n+ ItemJournalLine.TestField(\"Shortcut Dimension 1 Code\", DimensionValue[1].Code);\n+ VerifyDimensionValue(ItemJournalLine.\"Dimension Set ID\", DimensionValue[1]);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"ERM Dimension Locations\");\n@@ -1340,6 +1398,25 @@ codeunit 134474 \"ERM Dimension Locations\"\n DefaultDimensionPriority.Modify(true);\n end;\n \n+ local procedure CreateDefaultDimensionWithSpecCode(AccountNo: Code[20]; TableID: Integer)\n+ var\n+ Dimension: Record Dimension;\n+ DimensionValue: Record \"Dimension Value\";\n+ DefaultDimension: Record \"Default Dimension\";\n+ begin\n+ LibraryDimension.CreateDimension(Dimension);\n+ CreateDimensionValueWithSpecCode(DimensionValue, AccountNo, Dimension.Code);\n+ LibraryDimension.CreateDefaultDimension(DefaultDimension, TableID, AccountNo, Dimension.Code, DimensionValue.Code);\n+ end;\n+\n+ local procedure CreateDimensionValueWithSpecCode(var DimensionValue: Record \"Dimension Value\"; DimensionValueCode: Code[20]; DimensionCode: Code[20])\n+ begin\n+ DimensionValue.Init();\n+ DimensionValue.Validate(\"Dimension Code\", DimensionCode);\n+ DimensionValue.Validate(Code, DimensionValueCode);\n+ DimensionValue.Insert(true);\n+ end;\n+\n [ModalPageHandler]\n procedure DefaultDimensionsMultipleModalPageHandler(var DefaultDimensionsMultiple: TestPage \"Default Dimensions-Multiple\")\n begin\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\nindex 7fc2d9853602..c0a52d871c5d 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n@@ -2375,11 +2375,14 @@ table 83 \"Item Journal Line\"\n OnCreateDimOnBeforeUpdateGlobalDimFromDimSetID(Rec, xRec, CurrFieldNo, OldDimSetID, DefaultDimSource, InheritFromDimSetID, InheritFromTableNo);\n DimMgt.UpdateGlobalDimFromDimSetID(\"Dimension Set ID\", \"Shortcut Dimension 1 Code\", \"Shortcut Dimension 2 Code\");\n \n- if \"Entry Type\" = \"Entry Type\"::Transfer then begin\n- \"New Dimension Set ID\" := \"Dimension Set ID\";\n- \"New Shortcut Dimension 1 Code\" := \"Shortcut Dimension 1 Code\";\n- \"New Shortcut Dimension 2 Code\" := \"Shortcut Dimension 2 Code\";\n- end;\n+ if \"Entry Type\" = \"Entry Type\"::Transfer then\n+ if Rec.\"New Location Code\" <> '' then\n+ CreateNewDimFromDefaultDim(Rec.FieldNo(\"New Location Code\"))\n+ else begin\n+ \"New Dimension Set ID\" := \"Dimension Set ID\";\n+ \"New Shortcut Dimension 1 Code\" := \"Shortcut Dimension 1 Code\";\n+ \"New Shortcut Dimension 2 Code\" := \"Shortcut Dimension 2 Code\";\n+ end;\n end;\n \n /// \n"}
+{"metadata": {"area": "sales", "image_count": 13}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-222092", "base_commit": "d4b9caabb22e77ab18779535aa89967bb58f89d9", "created_at": "2025-07-27", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134904, "functionName": ["DimensionsInGeneralLedgerEntriesWhenDimensionsModifiedInReminderBeforeIssuing"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al\nindex 47f98eaf54a8..99b8ac6fb838 100644\n--- a/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMReminderForAdditinalFee.Codeunit.al\n@@ -324,6 +324,86 @@ codeunit 134904 \"ERM Reminder For Additinal Fee\"\n Assert.AreEqual(Dim2CodeValue, ShortcutDimCode[2], StrSubstNo(DimensionValueErr, Dim2CodeValue));\n end;\n \n+ [Test]\n+ procedure DimensionsInGeneralLedgerEntriesWhenDimensionsModifiedInReminderBeforeIssuing();\n+ var\n+ Customer: Record Customer;\n+ CustomerPostingGroup: Record \"Customer Posting Group\";\n+ DefaultDimension: array[2] of Record \"Default Dimension\";\n+ DimensionValue: Record \"Dimension Value\";\n+ GLAccount: Record \"G/L Account\";\n+ GLEntry: Record \"G/L Entry\";\n+ ReminderHeader: Record \"Reminder Header\";\n+ ReminderLevel: Record \"Reminder Level\";\n+ ReminderTerms: Record \"Reminder Terms\";\n+ SalesHeader: Record \"Sales Header\";\n+ GetShortcutDimValues: Codeunit \"Get Shortcut Dimension Values\";\n+ Dim1CodeValue: array[2] of Code[20];\n+ Dim2CodeValue: Code[20];\n+ IssuedReminderNo: Code[20];\n+ ShortcutDimCode: array[8] of Code[20];\n+ begin\n+ // [SCENARIO 590674] Dimensions assigned to General Ledger Entries when the Dimensions are modified in the Reminder before issuing it.\n+ Initialize();\n+\n+ // [GIVEN] Create two Dimension Values for Global Dimension 1 Code.\n+ Dim1CodeValue[1] := LibraryUtility.GenerateGUID();\n+ Dim1CodeValue[2] := Dim1CodeValue[1] + '1';\n+ LibraryDimension.CreateDimensionValueWithCode(DimensionValue, Dim1CodeValue[1], LibraryERM.GetGlobalDimensionCode(1));\n+ LibraryDimension.CreateDimensionValueWithCode(DimensionValue, Dim1CodeValue[2], LibraryERM.GetGlobalDimensionCode(1));\n+\n+ // [GIVEN] Create Dimension Value for Global Dimension 2 Code and assign it.\n+ Dim2CodeValue := LibraryUtility.GenerateGUID();\n+ LibraryDimension.CreateDimensionValueWithCode(DimensionValue, Dim2CodeValue, LibraryERM.GetGlobalDimensionCode(2));\n+\n+ // [GIVEN] Create Reminder Terms with Post Additional Fee = True.\n+ CreateReminderTerms(ReminderLevel, '');\n+ ReminderTerms.Get(ReminderLevel.\"Reminder Terms Code\");\n+ ReminderTerms.\"Post Additional Fee\" := true;\n+ ReminderTerms.Modify(true);\n+\n+ // [GIVEN] Create Customer with Reminder Terms and Customer Posting Group.\n+ Customer.Get(CreateCustomer(ReminderLevel.\"Reminder Terms Code\", ''));\n+ LibrarySales.CreateCustomerPostingGroup(CustomerPostingGroup);\n+\n+ // [GIVEN] Create Default Dimension for Customer with global Dimension 1 Code.\n+ LibraryDimension.CreateDefaultDimensionWithNewDimValue(\n+ DefaultDimension[1], DATABASE::Customer, Customer.\"No.\",\n+ DefaultDimension[1].\"Value Posting\"::\"Code Mandatory\");\n+\n+ // [GIVEN] Find GL Account for Additional Fee Account and assign Global Dimension 1 Code and Global Dimension 2 Code.\n+ GLAccount.Get(CustomerPostingGroup.\"Additional Fee Account\");\n+ GLAccount.ValidateShortcutDimCode(1, Dim1CodeValue[1]);\n+ GLAccount.ValidateShortcutDimCode(2, Dim2CodeValue);\n+ GLAccount.Modify(true);\n+\n+ // [GIVEN] Validate Customer Posting Group in Customer.\n+ Customer.Validate(\"Customer Posting Group\", CustomerPostingGroup.Code);\n+ Customer.Modify(true);\n+\n+ // [GIVEN] Posted Sales Invoice and Run Suggested Reminder with Additional Fee line.\n+ CreateAndPostSalesInvoice(SalesHeader, Customer.\"No.\");\n+ ReminderHeader.Get(\n+ CreateAndSuggestReminder(\n+ SalesHeader.\"Sell-to Customer No.\",\n+ CalcDate('<1D>', CalcDate(ReminderLevel.\"Grace Period\", SalesHeader.\"Due Date\"))));\n+ ReminderHeader.Validate(\"Shortcut Dimension 1 Code\", Dim1CodeValue[2]);\n+ ReminderHeader.Modify(true);\n+\n+ // [WHEN] Reminder is issued\n+ IssuedReminderNo := IssueReminderAndGetIssuedNo(ReminderHeader.\"No.\");\n+\n+ // [THEN] Find G/L Entry for Reminder with GL Account.\n+ GLEntry.SetRange(\"Document Type\", GLEntry.\"Document Type\"::Reminder);\n+ GLEntry.SetRange(\"Document No.\", IssuedReminderNo);\n+ GLEntry.SetRange(\"G/L Account No.\", GLAccount.\"No.\");\n+ GLEntry.FindFirst();\n+\n+ // [THEN] G/L Entry contains Global Dimension 1 Code as updated in Reminder Header.\n+ GetShortcutDimValues.GetShortcutDimensions(GLEntry.\"Dimension Set ID\", ShortcutDimCode);\n+ Assert.AreEqual(Dim1CodeValue[2], ShortcutDimCode[1], StrSubstNo(DimensionValueErr, Dim1CodeValue[2]));\n+ end;\n+\n [Scope('OnPrem')]\n procedure InterestAmountWithBeginningText()\n var\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\nindex 825eb23c9503..9ff59101df20 100644\n--- a/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Reminder/ReminderIssue.Codeunit.al\n@@ -270,8 +270,8 @@ codeunit 393 \"Reminder-Issue\"\n begin\n GenJnlLine2.\"Shortcut Dimension 1 Code\" := GlobalReminderHeader.\"Shortcut Dimension 1 Code\";\n GenJnlLine2.\"Shortcut Dimension 2 Code\" := GlobalReminderHeader.\"Shortcut Dimension 2 Code\";\n- DimSetIDArr[1] := GlobalReminderHeader.\"Dimension Set ID\";\n- DimSetIDArr[2] := TempGenJnlLine.\"Dimension Set ID\";\n+ DimSetIDArr[1] := TempGenJnlLine.\"Dimension Set ID\";\n+ DimSetIDArr[2] := GlobalReminderHeader.\"Dimension Set ID\";\n GenJnlLine2.\"Dimension Set ID\" :=\n DimMgt.GetCombinedDimensionSetID(\n DimSetIDArr, GenJnlLine2.\"Shortcut Dimension 1 Code\", GenJnlLine2.\"Shortcut Dimension 2 Code\");\n"}
+{"metadata": {"area": "warehouse", "image_count": 6}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218062", "base_commit": "226d490962047079ac9870319a3690af8959e6ad", "created_at": "2025-06-15", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137294, "functionName": ["NoErrorOfAvailabilityWhenCreatePickFromPickWorkSheetForProductionOrder"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al\nindex eaf731a270b2..178112c70e63 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryMiscellaneousII.Codeunit.al\n@@ -49,6 +49,7 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n NoOfPicksCreatedMsg: Label 'Number of Invt. Pick activities created';\n WhseHandlingRequiredErr: Label 'Warehouse handling is required';\n InventoryMovementIsNotRegisteredErr: Label 'Inventory Movement is not registered.';\n+ InventoryPickNotFoundErr: Label 'Warehouse Activity Header not found for Production Order Components.';\n \n [Test]\n [Scope('OnPrem')]\n@@ -2132,6 +2133,88 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n Assert.IsTrue(RegisteredInvMovementHdr.Count > 0, InventoryMovementIsNotRegisteredErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('DummyMessageHandler,ReservationPageHandler,PickSelectionPageHandlerSingleDoc,CreatePickPageHandlerForPerWhsDoc')]\n+ [Scope('OnPrem')]\n+ procedure NoErrorOfAvailabilityWhenCreatePickFromPickWorkSheetForProductionOrder()\n+ var\n+ Bin, Bin2, Bin3 : Record Bin;\n+ CompItem, ProdItem : Record Item;\n+ Location: Record Location;\n+ ProductionOrder: array[2] of Record \"Production Order\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ WareHouseActivityHeader: Record \"Warehouse Activity Header\";\n+ begin\n+ // [SCENARIO 575862] No availability error when creating pick from pick worksheet with location setup Bin mandatory and the item reserved on the related production order\n+ Initialize();\n+\n+ // [GIVEN] Reset Warehouse Employee Default Location.\n+ ResetWarehouseEmployeeDefaultLocation();\n+\n+ // [GIVEN] Create Location with WMS enabled Bin mandatory\n+ LibraryWarehouse.CreateLocationWMS(Location, true, false, false, false, false);\n+\n+ // [GIVEN] Create Warehouse Employee for Location.\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, Location.Code, true);\n+\n+ // [GIVEN] Create Bins for Location.\n+ LibraryWarehouse.CreateBin(Bin, Location.Code, Bin.Code, '', '');\n+ LibraryWarehouse.CreateBin(Bin2, Location.Code, Bin2.Code, '', '');\n+ LibraryWarehouse.CreateBin(Bin3, Location.Code, Bin3.Code, '', '');\n+\n+ // [GIVEN] Set \"Prod. Consump. Whse. Handling\" = \"Warehouse Pick (mandatory)\" and assign Bins to \"To-Production Bin Code\" and \"From-Production Bin Code\".\n+ Location.Validate(\"Prod. Consump. Whse. Handling\", Location.\"Prod. Consump. Whse. Handling\"::\"Warehouse Pick (mandatory)\");\n+ Location.Validate(\"To-Production Bin Code\", Bin.Code);\n+ Location.Validate(\"From-Production Bin Code\", Bin2.Code);\n+ Location.Modify(true);\n+\n+ // [GIVEN] Create Component Item with \"Replenishment System\" = \"Purchase\" and \"Flushing Method\" = \"Manual\".\n+ LibraryInventory.CreateItem(CompItem);\n+ CompItem.Validate(\"Replenishment System\", CompItem.\"Replenishment System\"::Purchase);\n+ CompItem.Validate(\"Flushing Method\", CompItem.\"Flushing Method\"::Manual);\n+ CompItem.Modify();\n+\n+ // [GIVEN] Create Production BOM for Component Item.\n+ LibraryInventory.CreateItem(ProdItem);\n+ ProdItem.Validate(\"Replenishment System\", ProdItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProdItem.Validate(\"Manufacturing Policy\", ProdItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ ProdItem.Validate(\"Flushing Method\", ProdItem.\"Flushing Method\"::Manual);\n+ ProdItem.Validate(\"Production BOM No.\", LibraryManufacturing.CreateCertifiedProductionBOM(ProductionBOMHeader, CompItem.\"No.\", 1));\n+ ProdItem.Modify();\n+\n+ // [GIVEN] Create Inventory for Component Item.\n+ CreateInventory(CompItem, 3, Location.Code, Bin3.Code, 0);\n+\n+ // [GIVEN] Create first Production Orders for Production Item of quantity 2\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder[1], ProductionOrder[1].Status::Released, ProductionOrder[1].\"Source Type\"::Item, ProdItem.\"No.\", 2);\n+ ProductionOrder[1].Validate(\"Location Code\", Location.Code);\n+ ProductionOrder[1].Modify(true);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder[1], false, true, true, true, false);\n+\n+ // [GIVEN] Reserve Component Item on Production Order 1\n+ ReserveQuantityOnComponent(CompItem.\"No.\", ProductionOrder[1].\"No.\");\n+\n+ // [GIVEN] Create second Production Order for Production Item of quantity 1\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder[2], ProductionOrder[2].Status::Released, ProductionOrder[2].\"Source Type\"::Item, ProdItem.\"No.\", 1);\n+ ProductionOrder[2].Validate(\"Location Code\", Location.Code);\n+ ProductionOrder[2].Modify(true);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder[2], false, true, true, true, false);\n+\n+ // [GIVEN] Reserve Component Item on Production Order 2\n+ ReserveQuantityOnComponent(CompItem.\"No.\", ProductionOrder[2].\"No.\");\n+\n+ // [WHEN] Create Pick Worksheet for Production Order Components.\n+ GetWarehouseDocumentFromPickWorksheet(ProductionOrder);\n+\n+ // [THEN] Verify Warehouse Activity Header for Production Order Components.\n+ WarehouseActivityHeader.SetRange(\"Location Code\", Location.Code);\n+ WareHouseActivityHeader.FindSet();\n+ Assert.IsTrue(WareHouseActivityHeader.Count = 2, InventoryPickNotFoundErr);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -3796,6 +3879,50 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n VerifyInventoryPickLine(SalesOrderNo, LotNos[2], Lot2Qty);\n end;\n \n+ local procedure GetWarehouseDocumentFromPickWorksheet(ProductionOrder: array[2] of Record \"Production Order\")\n+ var\n+ PickWorksheet: TestPage \"Pick Worksheet\";\n+ begin\n+ LibraryVariableStorage.Enqueue(ProductionOrder[1].\"No.\"); // Enqueue for PickSelectionPageHandler.\n+ LibraryVariableStorage.Enqueue(ProductionOrder[1].\"Location Code\"); // Enqueue PickSelectionPageHandler.\n+ PickWorksheet.OpenEdit();\n+ PickWorksheet.\"Get Warehouse Documents\".Invoke();\n+\n+ LibraryVariableStorage.Enqueue(ProductionOrder[2].\"No.\"); // Enqueue for PickSelectionPageHandler.\n+ LibraryVariableStorage.Enqueue(ProductionOrder[2].\"Location Code\"); // Enqueue PickSelectionPageHandler.\n+ PickWorksheet.\"Get Warehouse Documents\".Invoke();\n+ Commit();\n+\n+ PickWorksheet.CreatePick.Invoke();\n+ PickWorksheet.OK().Invoke();\n+ end;\n+\n+ local procedure ReserveQuantityOnComponent(ItemNo: code[20]; ProdOrderno: Code[20])\n+ var\n+ ProdOrderComponents: TestPage \"Prod. Order Components\";\n+ begin\n+ ProdOrderComponents.OpenEdit();\n+ ProdOrderComponents.FILTER.SetFilter(\"Item No.\", ItemNo);\n+ ProdOrderComponents.FILTER.SetFilter(\"Prod. Order No.\", ProdOrderno);\n+ ProdOrderComponents.Reserve.Invoke();\n+ ProdOrderComponents.Close();\n+ end;\n+\n+ local procedure CreateInventory(Item: Record Item; Quantity: Decimal; LocationCode: Code[10]; BinCode: Code[20]; UnitAmount: Decimal)\n+ var\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.CreateItemJournalBatchByType(ItemJournalBatch, ItemJournalBatch.\"Template Type\"::Item);\n+\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJournalBatch, Item, LocationCode, '', WorkDate(),\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Quantity, UnitAmount);\n+ ItemJournalLine.Validate(\"Bin Code\", BinCode);\n+ ItemJournalLine.Modify();\n+\n+ LibraryInventory.PostItemJournalBatch(ItemJournalBatch);\n+ end;\n+\n [MessageHandler]\n [Scope('OnPrem')]\n procedure DummyMessageHandler(Message: Text[1024])\n@@ -3817,5 +3944,36 @@ codeunit 137294 \"SCM Inventory Miscellaneous II\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ReservationPageHandler(var Reservation: TestPage Reservation)\n+ begin\n+ Reservation.\"Reserve from Current Line\".Invoke();\n+ Reservation.OK().Invoke();\n+ end;\n+\n+ [RequestPageHandler]\n+ [Scope('OnPrem')]\n+ procedure CreatePickPageHandlerForPerWhsDoc(var CreatePick: TestRequestPage \"Create Pick\")\n+ begin\n+ CreatePick.PerWhseDoc.SetValue(true);\n+ CreatePick.OK().Invoke();\n+ end;\n+\n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure PickSelectionPageHandlerSingleDoc(var PickSelection: TestPage \"Pick Selection\")\n+ var\n+ DocumentNo: Variant;\n+ LocationCode: Variant;\n+ begin\n+ LibraryVariableStorage.Dequeue(DocumentNo); // Dequeue Variable.\n+ LibraryVariableStorage.Dequeue(LocationCode); // Dequeue Variable.\n+ PickSelection.Filter.SetFilter(\"Document No.\", DocumentNo);\n+ PickSelection.\"Document No.\".AssertEquals(DocumentNo);\n+ PickSelection.\"Location Code\".AssertEquals(LocationCode);\n+ PickSelection.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al b/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al\nindex 0b63877adb3b..32239d687e93 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Availability/WarehouseAvailabilityMgt.Codeunit.al\n@@ -870,7 +870,9 @@ codeunit 7314 \"Warehouse Availability Mgt.\"\n end else\n AvailQtyBase := CalcInvtAvailQty(Item, Location, WhseWorksheetLine.\"Variant Code\", TempWhseActivLine);\n \n- if Location.\"Require Pick\" then\n+ if Location.\"Require Pick\" or\n+ (Location.\"Prod. Consump. Whse. Handling\" = Location.\"Prod. Consump. Whse. Handling\"::\"Warehouse Pick (mandatory)\")\n+ then\n QtyReservedOnPickShip := CalcReservQtyOnPicksShips(WhseWorksheetLine.\"Location Code\", WhseWorksheetLine.\"Item No.\", WhseWorksheetLine.\"Variant Code\", TempWhseActivLine);\n \n QtyReservedForCurrLine :=\n"}
+{"metadata": {"area": "sales", "image_count": 12}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218253", "base_commit": "db3b5298f26de0882a366877931e512984bb1001", "created_at": "2025-06-17", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134389, "functionName": ["QuantityReducedInSalesInvoiceAfterGenShipmentLineReservesTrackingInformation"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\nindex a4fa97f4520d..bc57ae20d22e 100644\n--- a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n@@ -17,6 +17,7 @@ codeunit 134389 \"ERM Customer Statistics\"\n LibraryERM: Codeunit \"Library - ERM\";\n LibraryRandom: Codeunit \"Library - Random\";\n LibraryApplicationArea: Codeunit \"Library - Application Area\";\n+ LibraryVariableStorage: Codeunit \"Library - Variable Storage\";\n LibraryUtility: Codeunit \"Library - Utility\";\n IsInitialized: Boolean;\n OverDueBalanceErr: Label 'Customer OverDue Balance is not correct';\n@@ -29,6 +30,7 @@ codeunit 134389 \"ERM Customer Statistics\"\n EntryNoMustMatchErr: Label 'Entry No. must match.';\n PaymentsLCYAndAmountLCYMustMatchErr: Label 'Payemnts (LCY) and Amount (LCY) must match.';\n CustomerCardFactboxTotalErr: Label 'Customer card factbox total is not Correct';\n+ LotNoErr: Label 'Lot No. should have value.';\n \n [Test]\n [Scope('OnPrem')]\n@@ -1003,6 +1005,83 @@ codeunit 134389 \"ERM Customer Statistics\"\n Assert.AreEqual(SalesLine.\"Amount Including VAT\", Customer.GetTotalAmountLCY(), CustomerCardFactboxTotalErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemTrackingLinesPageHandler,EnterQuantityToCreatePageHandler,GetShipmentLinesPageHandler')]\n+ procedure QuantityReducedInSalesInvoiceAfterGenShipmentLineReservesTrackingInformation()\n+ var\n+ Customer: Record Customer;\n+ Item: Record Item;\n+ ItemTrackingCode: Record \"Item Tracking Code\";\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ Quantity: Integer;\n+ begin\n+ // [SCENARIO 576049] When the quantity in a Sales Invoices was changed after using 'Get Shipment lines' and an item with item tracking lines and reserve always has the tracking information.\n+ Initialize();\n+\n+ // [GIVEN] Created New Customer.\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Create Item Tracking Code and Validate Trackings.\n+ LibraryInventory.CreateItemTrackingCode(ItemTrackingCode);\n+ ItemTrackingCode.Validate(\"Lot Specific Tracking\", false);\n+ ItemTrackingCode.Validate(\"SN Specific Tracking\", false);\n+ ItemTrackingCode.Validate(\"SN Sales Inbound Tracking\", true);\n+ ItemTrackingCode.Validate(\"SN Sales Outbound Tracking\", true);\n+ ItemTrackingCode.Validate(\"Lot Sales Inbound Tracking\", true);\n+ ItemTrackingCode.Validate(\"Lot Sales Outbound Tracking\", true);\n+ ItemTrackingCode.Modify(true);\n+\n+ // [GIVEN] Created New Item and Validate Item Tracking Code, Serial Nos, Reserve.\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(\"Item Tracking Code\", ItemTrackingCode.Code);\n+ Item.Validate(\"Lot Nos.\", LibraryERM.CreateNoSeriesCode());\n+ Item.Validate(\"Serial Nos.\", LibraryERM.CreateNoSeriesCode());\n+ Item.Validate(Reserve, Item.Reserve::Always);\n+ Item.Modify(true);\n+\n+ // [GIVEN] Store quantity in Variable.\n+ Quantity := LibraryRandom.RandIntInRange(10, 10);\n+\n+ // [GIVEN] Created Item Inventory By Posting Item Journal.\n+ CreateItemInventory(Item, Quantity);\n+\n+ // [GIVEN] Create new Sales Header.\n+ CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\", WorkDate());\n+\n+ // [GIVEN] Create Sales line and Validate Unit Price.\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", Quantity);\n+ SalesLine.Validate(\"Unit Price\", LibraryRandom.RandDec(1000, 0));\n+ SalesLine.Modify(true);\n+\n+ // [GIVEN] Enqueue Quantity and assign Tracking Lines\n+ LibraryVariableStorage.Enqueue(true);\n+ LibraryVariableStorage.Enqueue(Quantity);\n+ SalesLine.OpenItemTrackingLines();\n+\n+ // [GIVEN] Post Sales Order invoked with \"Shipped\" selected.\n+ LibrarySales.PostSalesDocument(SalesHeader, true, false);\n+\n+ // [GIVEN] Create New Sales Invoice And Get Shipment Line Through GetShipmentLines.\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, Customer.\"No.\");\n+ SalesLine.Validate(\"Document Type\", SalesHeader.\"Document Type\");\n+ SalesLine.Validate(\"Document No.\", SalesHeader.\"No.\");\n+ LibrarySales.GetShipmentLines(SalesLine);\n+\n+ // [GIVEN] Find the Sales Line.\n+ SalesLine.SetRange(\"Document No.\", SalesHeader.\"No.\");\n+ SalesLine.SetRange(Type, SalesLine.Type::Item);\n+ SalesLine.FindFirst();\n+\n+ // [WHEN] Validate Quantity with random integer less than previous quanitity.\n+ SalesLine.Validate(Quantity, LibraryRandom.RandInt(5));\n+ SalesLine.Modify(true);\n+\n+ // [THEN] Tracking Lines is not deleted.\n+ LibraryVariableStorage.Enqueue(false);\n+ SalesLine.OpenItemTrackingLines();\n+ end;\n+\n local procedure Initialize()\n var\n Currency: Record Currency;\n@@ -1506,4 +1585,26 @@ codeunit 134389 \"ERM Customer Statistics\"\n begin\n GetShipmentLines.OK().Invoke();\n end;\n+\n+ [ModalPageHandler]\n+ procedure ItemTrackingLinesPageHandler(var ItemTrackingLines: TestPage \"Item Tracking Lines\")\n+ var\n+ AssignSerial: Boolean;\n+ begin\n+ AssignSerial := LibraryVariableStorage.DequeueBoolean();\n+ if AssignSerial then\n+ ItemTrackingLines.\"Assign Serial No.\".Invoke();\n+\n+ if not AssignSerial then\n+ Assert.IsTrue(ItemTrackingLines.\"Lot No.\".Value() <> '', LotNoErr);\n+ ItemTrackingLines.OK().Invoke();\n+ end;\n+\n+ [ModalPageHandler]\n+ procedure EnterQuantityToCreatePageHandler(var EnterQuantitytoCreate: TestPage \"Enter Quantity to Create\")\n+ begin\n+ EnterQuantitytoCreate.QtyToCreate.SetValue(LibraryVariableStorage.DequeueInteger());\n+ EnterQuantitytoCreate.CreateNewLotNo.SetValue(true);\n+ EnterQuantitytoCreate.OK().Invoke();\n+ end;\n }\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al b/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al\nindex 15a14be1bfcb..b95b0aa54eb2 100644\n--- a/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Sales/Document/SalesLineReserve.Codeunit.al\n@@ -1304,6 +1304,9 @@ codeunit 99000832 \"Sales Line-Reserve\"\n if (NewSalesLine.Type <> NewSalesLine.Type::Item) or (NewSalesLine.Quantity = 0) or (NewSalesLine.Reserve <> NewSalesLine.Reserve::Always) then\n exit(false);\n \n+ if ShipmentExists(NewSalesLine) then\n+ exit(false);\n+\n Item.SetLoadFields(\"Costing Method\");\n Item.Get(NewSalesLine.\"No.\");\n \n@@ -1313,6 +1316,15 @@ codeunit 99000832 \"Sales Line-Reserve\"\n exit(NewSalesLine.Quantity < OldSalesLine.Quantity);\n end;\n \n+ local procedure ShipmentExists(SalesLine: Record \"Sales Line\"): Boolean\n+ var\n+ SalesShipmentLine: Record \"Sales Shipment Line\";\n+ begin\n+ SalesShipmentLine.SetRange(\"Document No.\", SalesLine.\"Shipment No.\");\n+ SalesShipmentLine.SetRange(\"Line No.\", SalesLine.\"Shipment Line No.\");\n+ exit(not SalesShipmentLine.IsEmpty());\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterReservQuantity(SalesLine: Record \"Sales Line\"; var QtyToReserve: Decimal; var QtyToReserveBase: Decimal)\n begin\n"}
+{"metadata": {"area": "project", "image_count": 7}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218995", "base_commit": "26bcb2715129beebf0d07da7f19e06fe66636119", "created_at": "2025-06-24", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136306, "functionName": ["PostPurchaseCreditMemoWithNonInventoryItemLinkedToProject"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\nindex 3f5a305f277c..8683b7e13047 100644\n--- a/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/JobInvoicing.Codeunit.al\n@@ -4082,6 +4082,47 @@ codeunit 136306 \"Job Invoicing\"\n Assert.IsFalse(JobPlanningLine.\"System-Created Entry\", ValueFalseErr);\n end;\n \n+ [Test]\n+ procedure PostPurchaseCreditMemoWithNonInventoryItemLinkedToProject()\n+ var\n+ Item: Record Item;\n+ Job: Record Job;\n+ JobTask: Record \"Job Task\";\n+ PurchaseHeader: Record \"Purchase Header\";\n+ PurchaseLine: Record \"Purchase Line\";\n+ Vendor: Record Vendor;\n+ begin\n+ // [SCENARIO 580434] Error when posting a Purchase Credit Memo for 'Non-Inventory' item with Project No. selected\n+ Initialize();\n+\n+ // [GIVEN] Create Non-Inventory Item\n+ LibraryInventory.CreateNonInventoryTypeItem(Item);\n+\n+ // [GIVEN] Create Job with Customer\n+ CreateJobWithCustomer(Job);\n+\n+ // [GIVEN] Create Job Task\n+ LibraryJob.CreateJobTask(Job, JobTask);\n+\n+ // [GIVEN] Create Vendor\n+ LibraryPurchase.CreateVendor(Vendor);\n+\n+ // [GIVEN] Create Purchase Credit Memo\n+ LibraryPurchase.CreatePurchHeader(PurchaseHeader, PurchaseHeader.\"Document Type\"::\"Credit Memo\", Vendor.\"No.\");\n+ LibraryPurchase.CreatePurchaseLine(PurchaseLine, PurchaseHeader, PurchaseLine.Type::Item, Item.\"No.\", 1);\n+\n+ // [GIVEN] Set Job No., Job Task No. and Job Line Type as Billable\n+ PurchaseLine.Validate(\"Job No.\", Job.\"No.\");\n+ PurchaseLine.Validate(\"Job Task No.\", JobTask.\"Job Task No.\");\n+ PurchaseLine.Validate(\"Job Line Type\", PurchaseLine.\"Job Line Type\"::Billable);\n+ PurchaseLine.Modify(true);\n+\n+ // [WHEN] Post Purchase Credit Memo\n+ LibraryPurchase.PostPurchaseDocument(PurchaseHeader, true, true);\n+\n+ // [THEN] No error should come, as posting for Non-Inventory Item.\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al\nindex a913f1c1ea1b..bd54e22b3b45 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Posting/JobPostLine.Codeunit.al\n@@ -478,6 +478,9 @@ codeunit 1001 \"Job Post-Line\"\n if IsHandled then\n exit;\n \n+ if PurchaseLine.IsNonInventoriableItem() then\n+ exit;\n+\n Job.Get(PurchaseLine.\"Job No.\");\n if Job.GetQuantityAvailable(PurchaseLine.\"No.\", PurchaseLine.\"Location Code\", PurchaseLine.\"Variant Code\", 0, 2) <\n -PurchaseLine.\"Return Qty. to Ship (Base)\"\n"}
+{"metadata": {"area": "warehouse", "image_count": 12}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-218786", "base_commit": "a0daccc2bd96d0bd4269d1b5eae4cc44ddd34673", "created_at": "2025-06-21", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137065, "functionName": ["WarehousePickUpdateQuantityInOrder"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al\nindex 9251a2965f1f..fda235875212 100644\n--- a/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMReservationII.Codeunit.al\n@@ -58,6 +58,7 @@ codeunit 137065 \"SCM Reservation II\"\n PostJnlLinesMsg: Label 'Do you want to post the journal lines';\n SuggestedBackGroundRunQst: Label 'Would you like to run the low-level code calculation as a background job?';\n ActionMessageEntryExistErr: Label 'Action Message Entry exist for item %1', Comment = '%1 = Item No.';\n+ QuantityErr: Label 'Quantity must be equal to %1', Comment = '%1 = Quantity';\n \n [Test]\n [HandlerFunctions('ProdOrderComponentsHandler')]\n@@ -2997,6 +2998,84 @@ codeunit 137065 \"SCM Reservation II\"\n VerifyThereIsNoDamagedReservationEntryForSurplus(Database::\"Sales Line\", SalesHeader[2].\"No.\", ReservationEntry.\"Reservation Status\"::Surplus);//, -SalesLine[2].\"Quantity (Base)\");\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure WarehousePickUpdateQuantityInOrder()\n+ var\n+ Bin: array[8] of Record Bin;\n+ CompItem, ProdItem : Record Item;\n+ Location: Record Location;\n+ ProductionOrder: Record \"Production Order\";\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ Quantity: Decimal;\n+ UpdatedQuantity: Decimal;\n+ begin\n+ // [SCENARIO 581104] Manually change quantity of \"Take Line\" in Warehouse Pick changes the quantity of the correct \"Place Lines\"\n+ Initialize();\n+\n+ // [GIVEN] Set Quantity and UpdatedQuantity.\n+ Quantity := LibraryRandom.RandIntInRange(900, 1000);\n+ UpdatedQuantity := LibraryRandom.RandIntInRange(400, 500);\n+\n+ // [GIVEN] Reset Warehouse Employee Default Location.\n+ ResetWarehouseEmployeeDefaultLocation();\n+\n+ // [GIVEN] Create Location with WMS enabled Bin mandatory\n+ LibraryWarehouse.CreateLocationWMS(Location, true, false, true, false, false);\n+\n+ // [GIVEN] Create Warehouse Employee for Location.\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, Location.Code, true);\n+\n+ // [GIVEN] Create Bins for Location.\n+ CreateBin(Bin, Location.Code);\n+\n+ // [GIVEN] Set \"Prod. Consump. Whse. Handling\" = \"Warehouse Pick (mandatory)\" and assign Bins to \"To-Production Bin Code\" and \"From-Production Bin Code\".\n+ Location.Validate(\"Prod. Consump. Whse. Handling\", Location.\"Prod. Consump. Whse. Handling\"::\"Warehouse Pick (mandatory)\");\n+ Location.Validate(\"To-Production Bin Code\", Bin[1].Code);\n+ Location.Validate(\"From-Production Bin Code\", Bin[2].Code);\n+ Location.Validate(\"Open Shop Floor Bin Code\", Bin[3].Code);\n+ Location.Modify(true);\n+\n+ // [GIVEN] Create Component Item with \"Replenishment System\" = \"Purchase\" and \"Flushing Method\" = \"Manual\".\n+ LibraryInventory.CreateItem(CompItem);\n+ CompItem.Validate(\"Replenishment System\", CompItem.\"Replenishment System\"::Purchase);\n+ CompItem.Validate(\"Flushing Method\", CompItem.\"Flushing Method\"::\"Pick + Manual\");\n+ CompItem.Validate(\"Allow Whse. Overpick\", true);\n+ CompItem.Modify();\n+\n+ // [GIVEN] Create Production BOM for Component Item.\n+ LibraryInventory.CreateItem(ProdItem);\n+ ProdItem.Validate(\"Replenishment System\", ProdItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProdItem.Validate(\"Manufacturing Policy\", ProdItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ ProdItem.Validate(\"Flushing Method\", ProdItem.\"Flushing Method\"::Manual);\n+ ProdItem.Validate(\"Production BOM No.\", LibraryManufacturing.CreateCertifiedProductionBOM(ProductionBOMHeader, CompItem.\"No.\", 1));\n+ ProdItem.Modify();\n+\n+ // [GIVEN] Create Inventory for Component Item for five different Bins.\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[4].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[5].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[6].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[7].Code, 0);\n+ CreateInventoryWithBin(CompItem, Quantity, Location.Code, Bin[8].Code, 0);\n+\n+ // [GIVEN] Create Production Orders for Production Item of quantity Quantity * 5.\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder, ProductionOrder.Status::Released, ProductionOrder.\"Source Type\"::Item, ProdItem.\"No.\", Quantity * 5);\n+ ProductionOrder.Validate(\"Location Code\", Location.Code);\n+ ProductionOrder.Modify(true);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+\n+ // [GIVEN] Create Warehouse Pick from Production Order.\n+ LibraryWarehouse.CreateWhsePickFromProduction(ProductionOrder);\n+\n+ // [WHEN] Update quantity in Warehouse Pick Lines.\n+ UpdateQuantityWarehousePickFromPage(ProductionOrder.\"No.\", Location.Code, UpdatedQuantity);\n+\n+ // [THEN] Verify that the Warehouse Activity Lines are updated correctly.\n+ VerifyWareHouseActivityLinesForQuantity(ProductionOrder.\"No.\", Location, Quantity, UpdatedQuantity);\n+ end;\n+\n local procedure Initialize()\n var\n AllProfile: Record \"All Profile\";\n@@ -4693,6 +4772,72 @@ codeunit 137065 \"SCM Reservation II\"\n asserterror ReservationEntry.FindFirst();\n end;\n \n+ local procedure ResetWarehouseEmployeeDefaultLocation()\n+ var\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ begin\n+ WarehouseEmployee.SetRange(\"User ID\", UserId());\n+ WarehouseEmployee.SetRange(Default, true);\n+ WarehouseEmployee.ModifyAll(Default, false);\n+ end;\n+\n+ local procedure VerifyWareHouseActivityLinesForQuantity(ProductionOrderNo: Code[20]; Location: Record Location; Quantity: Decimal; UpdatedQuantity: Decimal)\n+ var\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ begin\n+ FindWarehouseActivityLine(WarehouseActivityLine, ProductionOrderNo, WarehouseActivityLine.\"Source Document\"::\"Prod. Consumption\", WarehouseActivityLine.\"Action Type\"::Place);\n+ WarehouseActivityLine.SetRange(\"Bin Code\", Location.\"To-Production Bin Code\");\n+ WarehouseActivityLine.FindFirst();\n+ Assert.IsTrue(WarehouseActivityLine.\"Qty. (Base)\" = Quantity, StrSubstNo(QuantityErr, Quantity));\n+\n+ WarehouseActivityLine.Reset();\n+ FindWarehouseActivityLine(WarehouseActivityLine, ProductionOrderNo, WarehouseActivityLine.\"Source Document\"::\"Prod. Consumption\", WarehouseActivityLine.\"Action Type\"::Place);\n+ WarehouseActivityLine.SetRange(\"Bin Code\", Location.\"To-Production Bin Code\");\n+ WarehouseActivityLine.FindLast();\n+ Assert.IsTrue(WarehouseActivityLine.\"Qty. (Base)\" = UpdatedQuantity, StrSubstNo(QuantityErr, UpdatedQuantity));\n+ end;\n+\n+ local procedure UpdateQuantityWarehousePickFromPage(ProductionOrderNo: Code[20]; LocationCode: Code[10]; Quantity: Decimal)\n+ var\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ WarehousePickPage: TestPage \"Warehouse Pick\";\n+ begin\n+ WarehouseActivityLine.SetRange(\"Source Document\", WarehouseActivityHeader.\"Source Document\"::\"Prod. Consumption\");\n+ WarehouseActivityLine.SetRange(\"Source No.\", ProductionOrderNo);\n+ WarehouseActivityLine.SetRange(\"Location Code\", LocationCode);\n+ WarehouseActivityLine.FindFirst();\n+ WarehouseActivityHeader.Get(WarehouseActivityHeader.Type::Pick, WarehouseActivityLine.\"No.\");\n+ WarehousePickPage.OpenEdit();\n+ WarehousePickPage.GoToRecord(WarehouseActivityHeader);\n+ WarehousePickPage.WhseActivityLines.Last();\n+ WarehousePickPage.WhseActivityLines.Previous();\n+ WarehousePickPage.WhseActivityLines.Quantity.SetValue(Quantity);\n+ end;\n+\n+ local procedure CreateInventoryWithBin(Item: Record Item; Quantity: Decimal; LocationCode: Code[10]; BinCode: Code[20]; UnitAmount: Decimal)\n+ var\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.CreateItemJournalBatchByType(ItemJournalBatch, ItemJournalBatch.\"Template Type\"::Item);\n+\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJournalBatch, Item, LocationCode, '', WorkDate(),\n+ ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Quantity, UnitAmount);\n+ ItemJournalLine.Validate(\"Bin Code\", BinCode);\n+ ItemJournalLine.Modify();\n+\n+ LibraryInventory.PostItemJournalBatch(ItemJournalBatch);\n+ end;\n+\n+ local procedure CreateBin(var Bin: array[8] of Record Bin; LocationCode: Code[10])\n+ var\n+ i: Integer;\n+ begin\n+ for i := 1 to arraylen(Bin) do\n+ LibraryWarehouse.CreateBin(Bin[i], LocationCode, Bin[i].Code, '', '');\n+ end;\n+\n [PageHandler]\n [Scope('OnPrem')]\n procedure ProdOrderComponentsHandler(var ProdOrderComponents: TestPage \"Prod. Order Components\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al b/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al\nindex 0b806569d9b4..a4b3f3fb5f23 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/WarehouseActivityLine.Table.al\n@@ -3102,6 +3102,7 @@ table 5767 \"Warehouse Activity Line\"\n var\n Item: Record Item;\n WhseActivityLine: Record \"Warehouse Activity Line\";\n+ QuantityUpdated: Boolean;\n begin\n if CurrFieldNo = 0 then\n exit;\n@@ -3125,10 +3126,21 @@ table 5767 \"Warehouse Activity Line\"\n Item.Get(FromWhseActivityLine.\"Item No.\");\n Item.TestField(\"Allow Whse. Overpick\");\n \n+ SetFilterFromWhseActivityLineToUpdateQty(WhseActivityLine, FromWhseActivityLine, xWhseActivityLine, QuantityUpdated);\n+ if QuantityUpdated then\n+ WhseActivityLine.Modify(true);\n+ end;\n+\n+ local procedure SetFilterFromWhseActivityLineToUpdateQty(\n+ var WhseActivityLine: Record \"Warehouse Activity Line\";\n+ FromWhseActivityLine: Record \"Warehouse Activity Line\";\n+ xWhseActivityLine: Record \"Warehouse Activity Line\";\n+ var QuantityUpdated: Boolean)\n+ begin\n WhseActivityLine.SetLoadFields(\"Activity Type\", \"No.\", \"Line No.\", \"Item No.\", \"Variant Code\", \"Location Code\", \"Action Type\", Quantity, \"Lot No.\", \"Serial No.\", \"Source No.\", \"Source Line No.\", \"Source Document\");\n WhseActivityLine.SetRange(\"Activity Type\", FromWhseActivityLine.\"Activity Type\");\n WhseActivityLine.SetRange(\"No.\", FromWhseActivityLine.\"No.\");\n- WhseActivityLine.SetFilter(\"Line No.\", '<>%1', FromWhseActivityLine.\"Line No.\");\n+ WhseActivityLine.SetFilter(\"Line No.\", '>%1', FromWhseActivityLine.\"Line No.\");\n WhseActivityLine.SetRange(\"Item No.\", FromWhseActivityLine.\"Item No.\");\n WhseActivityLine.SetRange(\"Variant Code\", FromWhseActivityLine.\"Variant Code\");\n WhseActivityLine.SetRange(\"Location Code\", FromWhseActivityLine.\"Location Code\");\n@@ -3139,11 +3151,18 @@ table 5767 \"Warehouse Activity Line\"\n WhseActivityLine.SetRange(\"Source Document\", FromWhseActivityLine.\"Source Document\");\n WhseActivityLine.SetRange(\"Source No.\", FromWhseActivityLine.\"Source No.\");\n WhseActivityLine.SetRange(\"Source Line No.\", FromWhseActivityLine.\"Source Line No.\");\n+ if WhseActivityLine.FindFirst() then begin\n+ WhseActivityLine.Validate(Quantity, FromWhseActivityLine.Quantity);\n+ QuantityUpdated := true;\n+ exit;\n+ end;\n \n- WhseActivityLine.FindFirst();\n-\n- WhseActivityLine.Validate(Quantity, FromWhseActivityLine.Quantity);\n- WhseActivityLine.Modify(true);\n+ WhseActivityLine.SetRange(\"Line No.\");\n+ WhseActivityLine.SetFilter(\"Line No.\", '<>%1', FromWhseActivityLine.\"Line No.\");\n+ if WhseActivityLine.FindFirst() then begin\n+ WhseActivityLine.Validate(Quantity, FromWhseActivityLine.Quantity);\n+ QuantityUpdated := true;\n+ end\n end;\n \n [IntegrationEvent(false, false)]\n"}
+{"metadata": {"area": "utilities", "image_count": 5}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-217974", "base_commit": "645334f664bea223d7a58bdcd730164852241728", "created_at": "2025-06-13", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137156, "functionName": ["MoveNegativeLines_SetsReturnOrderShipToAddressToCompany"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al\nindex 670a87576340..2c5a96d5e372 100644\n--- a/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMOrdersIV.Codeunit.al\n@@ -72,6 +72,7 @@ codeunit 137156 \"SCM Orders IV\"\n DocumentLineSourceNoErr: label 'Expected source on document line is %1 but found %2.', Comment = '%1 = Expected Source No., %2 = Actual Source No.';\n ReservationFromStockErr: Label 'Reservation from Stock must be %1 in %2.', Comment = '%1= Field Value, %2 =Table Caption.';\n PurchasingCodeOnSalesInvoiceErr: Label 'The Purchasing Code should be blank for item %1 on the sales invoice because it is used only for the drop shipment process.', Comment = '%1= Item No.';\n+ ShipToAddressErr: Label 'Ship-to Address on Return Order should be company address';\n \n #if not CLEAN25\n [Test]\n@@ -3553,6 +3554,43 @@ codeunit 137156 \"SCM Orders IV\"\n Assert.ExpectedError(StrSubstNo(PurchasingCodeOnSalesInvoiceErr, Item.\"No.\"));\n end;\n \n+ [Test]\n+ procedure MoveNegativeLines_SetsReturnOrderShipToAddressToCompany()\n+ var\n+ Customer: Record Customer;\n+ Item: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ CompanyInfo: Record \"Company Information\";\n+ begin\n+ // [SCENARIO 580640] Verify Ship to Address of Return Order when Move Negative Lines on the Sales Order.\n+ Initialize();\n+\n+ // [GIVEN] Create Customer.\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Create Sales Header with Document Type as Order.\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\");\n+\n+ // [GIVEN] Create SalesLine with Negative Quantity.\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, LibraryInventory.CreateItem(Item), LibraryRandom.RandIntInRange(-5, -10));\n+\n+ // [WHEN] Move Negative Lines\n+ MoveNegativeLinesOnSalesOrder(SalesHeader);\n+\n+ // [GIVEN] Get company address\n+ CompanyInfo.Get();\n+\n+ // [THEN] Sales Return Order is created with Ship to Address as Company Address.\n+ SalesHeader.SetRange(\"Document Type\", SalesHeader.\"Document Type\"::\"Return Order\");\n+ SalesHeader.SetRange(\"Sell-to Customer No.\", Customer.\"No.\");\n+ SalesHeader.FindFirst();\n+ Assert.AreEqual(\n+ CompanyInfo.\"Ship-to Address\", SalesHeader.\"Ship-to Address\", ShipToAddressErr);\n+ Assert.AreEqual(\n+ CompanyInfo.\"Ship-to City\", SalesHeader.\"Ship-to City\", ShipToAddressErr);\n+ end;\n+\n local procedure Initialize()\n var\n PriceListLine: Record \"Price List Line\";\n@@ -5405,8 +5443,8 @@ codeunit 137156 \"SCM Orders IV\"\n begin\n WarehouseActivityLine.SetRange(\"Action Type\", ActionType);\n FindWarehouseActivityLine(\n- WarehouseActivityLine, WarehouseActivityLine.\"Source Document\"::\"Purchase Order\", SourceNo,\n- WarehouseActivityLine.\"Activity Type\"::\"Put-away\");\n+WarehouseActivityLine, WarehouseActivityLine.\"Source Document\"::\"Purchase Order\", SourceNo,\n+WarehouseActivityLine.\"Activity Type\"::\"Put-away\");\n WarehouseActivityLine.ModifyAll(\"Zone Code\", ZoneCode, true);\n WarehouseActivityLine.ModifyAll(\"Bin Code\", BinCode, true);\n end;\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al b/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al\nindex 780de254f475..452e82783b47 100644\n--- a/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Utilities/CopyDocumentMgt.Codeunit.al\n@@ -747,6 +747,7 @@ codeunit 6620 \"Copy Document Mgt.\"\n begin\n FromSalesHeader.CalcFields(\"Work Description\");\n ToSalesHeader.TransferFields(FromSalesHeader, false);\n+ UpdateShipToAddress(ToSalesHeader);\n UpdateSalesHeaderWhenCopyFromSalesHeader(ToSalesHeader, OldSalesHeader, FromDocType);\n SetReceivedFromCountryCode(FromDocType, ToSalesHeader);\n OnAfterCopySalesHeader(ToSalesHeader, OldSalesHeader, FromSalesHeader, FromDocType);\n"}
+{"metadata": {"area": "warehouse", "image_count": 10}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-222488", "base_commit": "34f4bd6914204e9f211b9f09a3b0c3a09954da33", "created_at": "2025-07-30", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137152, "functionName": ["RegisterPutAwayWithBreakBulkFilterShouldRegisterAllLines"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al\nindex d40ac8d858c1..e83bdf59b1cc 100644\n--- a/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMWarehouseReceiving.Codeunit.al\n@@ -4302,6 +4302,63 @@ codeunit 137152 \"SCM Warehouse - Receiving\"\n VerifyWarehouseActivityLineWithBin(Item.\"No.\", Bin[3].Code, Bin[1].Code);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ConfirmHandlerTrue')]\n+ procedure RegisterPutAwayWithBreakBulkFilterShouldRegisterAllLines()\n+ var\n+ Item: Record Item;\n+ ItemUnitOfMeasure: Record \"Item Unit of Measure\";\n+ PurchaseHeader: Record \"Purchase Header\";\n+ UOM: Record \"Unit of Measure\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ WarehouseEmployee: Record \"Warehouse Employee\";\n+ WarehouseEntry: Record \"Warehouse Entry\";\n+ PutAwayPage: TestPage \"Warehouse Put-away\";\n+ ExpectedLinesCount: Integer;\n+ begin\n+ // [SCENARIO 592107] Verify all put away lines are registered, when register a warehouse put away with the break bulk filter set to yes\n+ Initialize();\n+\n+ // [GIVEN] Create Warehouse Employee for location WHITE.\n+ LibraryWarehouse.CreateWarehouseEmployee(WarehouseEmployee, LocationWhite.Code, true);\n+\n+ // [GIVEN] Create an Item and assign Put-away Unit of Measure Code.\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(\"Put-away Unit of Measure Code\", Item.\"Base Unit of Measure\");\n+ Item.Modify(true);\n+\n+ // [GIVEN] Create Unit of Measure and Item Unit of Measure with Qty. per Unit of Measure as 48.\n+ LibraryInventory.CreateUnitOfMeasureCode(UOM);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure, Item.\"No.\", UOM.Code, 48);\n+\n+ // [GIVEN] Create Purchase Order and Post Warehouse Receipt.\n+ CreatePurchaseOrderAndPostWarehouseReceipt(\n+ PurchaseHeader, LocationWhite.Code, Item.\"No.\", LibraryRandom.RandDec(10, 2), UOM.Code);\n+\n+ // [GIVEN] Find Warehouse Put-away\n+ WarehouseActivityLine.SetRange(\"Activity Type\", WarehouseActivityLine.\"Activity Type\"::\"Put-away\");\n+ WarehouseActivityLine.SetRange(\"Source Document\", WarehouseActivityLine.\"Source Document\"::\"Purchase Order\");\n+ WarehouseActivityLine.SetRange(\"Source No.\", PurchaseHeader.\"No.\");\n+ WarehouseActivityLine.FindSet();\n+ ExpectedLinesCount := WarehouseActivityLine.Count();\n+\n+ // [GIVEN] Open Warehouse Put-away page\n+ PutAwayPage.OpenEdit();\n+ PutAwayPage.FILTER.SetFilter(\"No.\", WarehouseActivityLine.\"No.\");\n+\n+ // [GIVEN] Set Break Bulk filter = Yes\n+ PutAwayPage.\"Breakbulk Filter\".SetValue(true);\n+\n+ // [WHEN] Register Warehouse Put-Away.\n+ PutAwayPage.\"&Register Put-away\".Invoke();\n+\n+ // [THEN] Verify Put-Away should be registered and all lines should be posted in Warehouse Entry table\n+ WarehouseEntry.SetRange(\"Entry Type\", WarehouseEntry.\"Entry Type\"::Movement);\n+ WarehouseEntry.SetRange(\"Source Document\", WarehouseEntry.\"Source Document\"::\"P. Order\");\n+ WarehouseEntry.SetRange(\"Source No.\", PurchaseHeader.\"No.\");\n+ Assert.RecordCount(WarehouseEntry, ExpectedLinesCount);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al b/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al\nindex 07db37f9fc83..680830c4c772 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/WhsePutawaySubform.Page.al\n@@ -482,9 +482,17 @@ page 5771 \"Whse. Put-away Subform\"\n \n procedure RegisterPutAwayYesNo()\n var\n+ WhseActivityHeader: Record \"Warehouse Activity Header\";\n WhseActivLine: Record \"Warehouse Activity Line\";\n begin\n- WhseActivLine.Copy(Rec);\n+ WhseActivityHeader.Get(Rec.\"Activity Type\", Rec.\"No.\");\n+ if (Rec.\"Activity Type\"::\"Put-away\" = Rec.\"Activity Type\"::\"Put-away\") and WhseActivityHeader.\"Breakbulk Filter\" then begin\n+ WhseActivLine.SetRange(\"Activity Type\", WhseActivLine.\"Activity Type\"::\"Put-away\");\n+ WhseActivLine.SetRange(\"No.\", Rec.\"No.\");\n+ WhseActivLine.FindSet();\n+ end\n+ else\n+ WhseActivLine.Copy(Rec);\n WhseActivLine.FilterGroup(3);\n WhseActivLine.SetRange(Breakbulk);\n WhseActivLine.FilterGroup(0);\n"}
+{"metadata": {"area": "warehouse", "image_count": 14}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-222484", "base_commit": "a60a6b56b858f370ae21d8d0241ed67f72d6202c", "created_at": "2025-07-30", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137260, "functionName": ["RegisterPickWithNoErrorForFEFOLocation"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al\nindex df8ad3bb4d4b..de51c3ce8532 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryItemTracking.Codeunit.al\n@@ -47,6 +47,7 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n JournalPostedMsg: Label 'The journal lines were successfully posted.';\n CouldNotRegisterWhseActivityErr: Label 'Could not register Warehouse Activity.';\n OrderToOrderBindingOnSalesLineQst: Label 'Registering the pick will remove the existing order-to-order reservation for the sales order.\\Do you want to continue?';\n+ ILELotNotMatchedErr: Label 'Item Ledger Entry Lot No. %1 should be equal to the first lot with FEFO.', Comment = '%1 - Lot No.';\n \n [Test]\n [HandlerFunctions('WhseItemTrackingLinesPageHandler,RegisterWhseMessageHandler,ConfirmHandler')]\n@@ -2080,6 +2081,77 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n Assert.ExpectedError(StrSubstNo(CannotMatchItemTrackingErr, SalesLine.\"Document No.\", SalesLine.\"Line No.\", SalesLine.\"No.\", SalesLine.Description));\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemTrackingLinesPageHandler,ReservationFromCurrentLineHandler')]\n+ [Scope('OnPrem')]\n+ procedure RegisterPickWithNoErrorForFEFOLocation()\n+ var\n+ Location: Record Location;\n+ Bin: Record Bin;\n+ Item: Record Item;\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemLedgerEntry: Record \"Item Ledger Entry\";\n+ SalesHeader: array[2] of Record \"Sales Header\";\n+ WarehouseShipmentHeader: Record \"Warehouse Shipment Header\";\n+ WarehouseActivityHeader: Record \"Warehouse Activity Header\";\n+ WarehouseActivityLine: Record \"Warehouse Activity Line\";\n+ ExpirationDate: Date;\n+ ShipmentBinCode: Code[20];\n+ LotNo: array[2] of Code[10];\n+ begin\n+\n+ // [SCENARIO 572962] No Error when Lot No. LOT0001 is available on inventory, when trying to register pick for item with reservation and item tracking with location set up FEFO\n+ Initialize();\n+\n+ // [GIVEN] Set up Expiration Date for the Lot No.\n+ ExpirationDate := CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', WorkDate());\n+\n+ // [GIVEN] Create Location with pick according to FEFO.\n+ CreateLocationWithPostingSetupAndPickAccordingTOFEFO(Location, ShipmentBinCode);\n+\n+ // [GIVEN] Item with Lot No. tracking.\n+ LibraryInventory.CreateTrackedItem(Item, '', '', CreateItemTrackingCode(false, true, true, false, true));\n+\n+ // [GIVEN] Positive adjustment with Lot = \"X\" and ExpirationDate = D1 , Lot = \"Y\" and ExpirationDate = D2 and D2 > D1.\n+ LibraryWarehouse.CreateBin(Bin, Location.Code, LibraryUtility.GenerateGUID(), '', '');\n+ SelectItemJournalAndPostItemJournalLine(\n+ LotNo[1], Bin.Code, '', Item.\"No.\", Location.Code, '', 1, ExpirationDate,\n+ ItemJournalBatch.\"Template Type\"::Item, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", false);\n+ SelectItemJournalAndPostItemJournalLine(\n+ LotNo[2], Bin.Code, '', Item.\"No.\", Location.Code, '', 1,\n+ CalcDate('<' + Format(LibraryRandom.RandInt(5)) + 'D>', ExpirationDate),\n+ ItemJournalBatch.\"Template Type\"::Item, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", false);\n+\n+ // [GIVEN] Create Sales order and reserve the first Lot No. \"LOT0001\" with Expiration Date = D1.\n+ CreateSOAndTrackInventory(SalesHeader[1], Item.\"No.\", Location.Code, 1);\n+\n+ // Create seconf sales order and reserve the second Lot No. \"LOT0002\" with Expiration Date = D2.\n+ CreateSOAndTrackInventory(SalesHeader[2], Item.\"No.\", Location.Code, 1);\n+\n+ // [GIVEN] Create Warehouse Shipment from Sales Order second.\n+ CreateWhseShipmentFromSO(WarehouseShipmentHeader, SalesHeader[2]);\n+\n+ // [WHEN] CreatePick From Warehouse Shipment.\n+ LibraryWarehouse.CreatePick(WarehouseShipmentHeader);\n+\n+ // [WHEN] Register Pick should not fail with error \"Lot No. is not available on inventory\" for the first Lot No. \"LOT0001\" with Expiration Date = D1.\n+ WarehouseActivityLine.SetRange(\"Item No.\", Item.\"No.\");\n+ WarehouseActivityLine.SetRange(\"Action Type\", WarehouseActivityLine.\"Action Type\"::Take);\n+ WarehouseActivityLine.FindFirst();\n+ WarehouseActivityHeader.Get(WarehouseActivityLine.\"Activity Type\", WarehouseActivityLine.\"No.\");\n+ LibraryWarehouse.RegisterWhseActivity(WarehouseActivityHeader);\n+\n+ // [WHEN] Post Warehouse Shipment.\n+ LibraryWarehouse.PostWhseShipment(WarehouseShipmentHeader, false);\n+\n+ // [THEN] Item Ledger Entry for the first Lot No. \"LOT0001\" with Expiration Date = D1 should be created.\n+ ItemLedgerEntry.SetRange(\"Entry Type\", ItemLedgerEntry.\"Entry Type\"::Sale);\n+ ItemLedgerEntry.SetRange(\"Item No.\", Item.\"No.\");\n+ ItemLedgerEntry.FindFirst();\n+ Assert.AreEqual(LotNo[1], ItemLedgerEntry.\"Lot No.\", StrSubstNo(ILELotNotMatchedErr, LotNo[1]));\n+ end;\n+\n local procedure Initialize()\n var\n InventorySetup: Record \"Inventory Setup\";\n@@ -3485,6 +3557,19 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n LibrarySales.UndoSalesShipmentLine(SalesShipmentLine);\n end;\n \n+ local procedure CreateSOAndTrackInventory(var SalesHeader: Record \"Sales Header\"; ItemNo: Code[20]; LocationCode: Code[10]; Quantity: Decimal)\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, LibrarySales.CreateCustomerNo());\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, ItemNo, Quantity);\n+ SalesLine.Validate(\"Location Code\", LocationCode);\n+ LibraryVariableStorage.Enqueue(SalesLine.Quantity);\n+ SalesLine.Modify(true);\n+ SalesLine.ShowReservation();\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandler(ConfirmMessage: Text[1024]; var Reply: Boolean)\n@@ -3687,6 +3772,14 @@ codeunit 137260 \"SCM Inventory Item Tracking\"\n ProductionJournal.Post.Invoke();\n end;\n \n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ReservationFromCurrentLineHandler(var Reservation: TestPage Reservation)\n+ begin\n+ Reservation.\"Reserve from Current Line\".Invoke();\n+ Reservation.OK().Invoke();\n+ end;\n+\n local procedure AssignLotNos(var ItemTrackingLines: TestPage \"Item Tracking Lines\")\n var\n LinesToProcess: Integer;\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al b/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al\nindex 06bc64083218..cc14d68c515b 100644\n--- a/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Warehouse/Activity/WhseActivityRegister.Codeunit.al\n@@ -2044,6 +2044,7 @@ codeunit 7307 \"Whse.-Activity-Register\"\n if Item.\"Reserved Qty. on Inventory\" > 0 then begin\n xReservedQty := Item.\"Reserved Qty. on Inventory\";\n WhseActivityItemTrackingSetup.CopyTrackingFromWhseActivityLine(WhseActivLine);\n+ RemoveNonSpecificreservations(WhseActivLine, WhseItemTrackingSetup, QtyToRelease);\n LateBindingMgt.ReleaseForReservation(\n WhseActivLine.\"Item No.\", WhseActivLine.\"Variant Code\", WhseActivLine.\"Location Code\",\n WhseActivityItemTrackingSetup, QtyToRelease);\n@@ -2127,6 +2128,40 @@ codeunit 7307 \"Whse.-Activity-Register\"\n until WarehouseActivityLine.Next() = 0;\n end;\n \n+ local procedure RemoveNonSpecificreservations(WhseActivLine: Record \"Warehouse Activity Line\"; WhseItemTrackingSetup: Record \"Item Tracking Setup\"; QtyToRelease: Decimal)\n+ var\n+ ReservationEntry: Record \"Reservation Entry\";\n+ SalesLine: Record \"Sales Line\";\n+ QtyToPick: Decimal;\n+ begin\n+ if not WhseItemTrackingSetup.TrackingRequired() then\n+ exit;\n+ if not (WhseActivLine.\"Source Type\" = Database::\"Sales Line\") then\n+ exit;\n+\n+ QtyToPick := QtyToRelease;\n+ SalesLine.Get(WhseActivLine.\"Source Subtype\", WhseActivLine.\"Source No.\", WhseActivLine.\"Source Line No.\");\n+ ReservationEntry.SetSourceFilter(WhseActivLine.\"Source Type\", WhseActivLine.\"Source Subtype\", WhseActivLine.\"Source No.\", WhseActivLine.\"Source Line No.\", true);\n+ ReservationEntry.SetRange(Positive, false);\n+ if ReservationEntry.FindSet() then\n+ repeat\n+ DeleteNonSpecificReservationEntries(ReservationEntry, SalesLine, QtyToPick);\n+ until (ReservationEntry.Next() = 0) or (QtyToPick >= 0);\n+ end;\n+\n+ local procedure DeleteNonSpecificReservationEntries(ReservationEntry: Record \"Reservation Entry\"; SalesLine: Record \"Sales Line\"; var QtyToPick: Decimal)\n+ var\n+ ReservationManagement: Codeunit \"Reservation Management\";\n+ begin\n+ if ReservationEntry.TrackingExists() then\n+ exit;\n+\n+ ReservationManagement.SetReservSource(SalesLine);\n+ ReservationManagement.DeleteReservEntries(false, ReservationEntry.\"Quantity (Base)\");\n+ QtyToPick += ReservationEntry.\"Quantity (Base)\"\n+ end;\n+\n+\n [IntegrationEvent(false, false)]\n local procedure OnBeforeCode(var WarehouseActivityLine: Record \"Warehouse Activity Line\")\n begin\n"}
+{"metadata": {"area": "inventory", "image_count": 4}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-220314", "base_commit": "96c641e94b94056dda25b90907bef9b77622e31d", "created_at": "2025-07-08", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137275, "functionName": ["ItemReclassJournalUnitOfMeasureUpdatedWhenItemChanged"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al\nindex 436478abba92..b3bf0372e39c 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryJournals.Codeunit.al\n@@ -1800,6 +1800,54 @@ codeunit 137275 \"SCM Inventory Journals\"\n Codeunit.Run(Codeunit::\"Item Jnl.-Post Batch\", ItemJournalLine);\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure ItemReclassJournalUnitOfMeasureUpdatedWhenItemChanged()\n+ var\n+ Item: array[2] of Record Item;\n+ UnitOfMeasure: array[2] of Record \"Unit of Measure\";\n+ ItemUnitOfMeasure: array[2] of Record \"Item Unit of Measure\";\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemReclassJournal: TestPage \"Item Reclass. Journal\";\n+ i: Integer;\n+ begin\n+ // [SCENARIO 581983] Unit of Measure Code should be updated automatically when Item No. is changed in Item Reclassification Journal\n+ Initialize();\n+\n+ // [GIVEN] Create two items with different base unit of measure codes\n+ for i := 1 to 2 do begin\n+ LibraryInventory.CreateUnitOfMeasureCode(UnitOfMeasure[i]);\n+ LibraryInventory.CreateItem(Item[i]);\n+ LibraryInventory.CreateItemUnitOfMeasure(ItemUnitOfMeasure[i], Item[i].\"No.\", UnitOfMeasure[i].Code, 1);\n+ Item[i].Validate(\"Base Unit of Measure\", UnitOfMeasure[i].Code);\n+ Item[i].Modify(true);\n+ end;\n+\n+ // [GIVEN] Setup Item Reclassification Journal template and batch\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, ItemJournalTemplate.Type::Transfer);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, ItemJournalTemplate.Type::Transfer, ItemJournalTemplate.Name);\n+ LibraryInventory.ClearItemJournal(ItemJournalTemplate, ItemJournalBatch);\n+\n+ // [WHEN] Open Item Reclassification Journal page\n+ ItemReclassJournal.OpenEdit();\n+ ItemReclassJournal.CurrentJnlBatchName.SetValue(ItemJournalBatch.Name);\n+\n+ // [WHEN] Enter first item no. and verify unit of measure is set\n+ ItemReclassJournal.\"Item No.\".SetValue(Item[1].\"No.\");\n+ ItemReclassJournal.\"Unit of Measure Code\".AssertEquals(UnitOfMeasure[1].Code);\n+\n+ // [WHEN] Change item no. to second item\n+ ItemReclassJournal.\"Item No.\".SetValue(Item[2].\"No.\");\n+\n+ // [THEN] Verify unit of measure code is updated to second item's base unit of measure\n+ ItemReclassJournal.\"Unit of Measure Code\".AssertEquals(UnitOfMeasure[2].Code);\n+\n+ // [THEN] Verify no error occurs when changing item number\n+ // This test verifies the fix for the bug where changing Item No. with different Unit of Measure Codes caused validation errors\n+ ItemReclassJournal.Close();\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\nindex fb9253b7ae77..ad41ac368015 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Journal/ItemJournalLine.Table.al\n@@ -76,6 +76,7 @@ table 83 \"Item Journal Line\"\n if \"Item No.\" <> xRec.\"Item No.\" then begin\n \"Variant Code\" := '';\n \"Bin Code\" := '';\n+ \"Unit of Measure Code\" := '';\n if CurrFieldNo <> 0 then begin\n GetItem();\n if Item.IsInventoriableType() then\n"}
+{"metadata": {"area": "sales", "image_count": 2}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-214926", "base_commit": "2ed9a2df09bf29573bbaf9e087313bec188ce69b", "created_at": "2025-05-07", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134389, "functionName": ["CheckCustomerCardStatisticsTotalOnFactBox"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\nindex 12e3e3ea3927..4ddc570573df 100644\n--- a/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMCustomerStatistics.Codeunit.al\n@@ -28,6 +28,7 @@ codeunit 134389 \"ERM Customer Statistics\"\n FieldIsNotHiddenErr: Label 'Field is hidden';\n EntryNoMustMatchErr: Label 'Entry No. must match.';\n PaymentsLCYAndAmountLCYMustMatchErr: Label 'Payemnts (LCY) and Amount (LCY) must match.';\n+ CustomerCardFactboxTotalErr: Label 'Customer card factbox total is not Correct';\n \n [Test]\n [Scope('OnPrem')]\n@@ -964,6 +965,44 @@ codeunit 134389 \"ERM Customer Statistics\"\n CustomerCard.Close();\n end;\n \n+ [Test]\n+ [HandlerFunctions('GetShipmentLinesPageHandler')]\n+ procedure CheckCustomerCardStatisticsTotalOnFactBox()\n+ var\n+ Customer: Record Customer;\n+ Item: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ // [SCENARIO 574648] Check Customer Card Statistics Total On FactBox When Sales Order Only Shiped and Sales Invoice \n+ // Created By GetShipmentLines without Posting.\n+ Initialize();\n+\n+ // [GIVEN] Created New Customer.\n+ LibrarySales.CreateCustomer(Customer);\n+\n+ // [GIVEN] Created New Item.\n+ LibraryInventory.CreateItem(Item);\n+\n+ // [GIVEN] Created Item Inventory By Posting Item Journal With Qty 10.\n+ CreateItemInventory(Item, 10);\n+\n+ // [WHEN] Created New Sales Order With Qty 10.\n+ CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, Customer.\"No.\", WorkDate());\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", 10);\n+ SalesLine.Validate(\"Unit Price\", LibraryRandom.RandDec(1000, 0));\n+ SalesLine.Modify(true);\n+\n+ // [WHEN] \"SO\" Post invoked with \"Shipped\" selected.\n+ LibrarySales.PostSalesDocument(SalesHeader, true, false);\n+\n+ // [WHEN] Create New Sales Invoice And Get Shipment Line Through GetShipmentLines.\n+ CreateAndReleaseSalesInvoiceUsingGetShipmentLines(SalesHeader.\"Sell-to Customer No.\");\n+\n+ // [THEN] Check Customer Card Statistics Total is Equal To SalesLine.\"Amount Including VAT\" and Not Multiply.\n+ Assert.AreEqual(SalesLine.\"Amount Including VAT\", Customer.GetTotalAmountLCY(), CustomerCardFactboxTotalErr);\n+ end;\n+\n local procedure Initialize()\n var\n Currency: Record Currency;\n@@ -1400,6 +1439,31 @@ codeunit 134389 \"ERM Customer Statistics\"\n DetailedCustLedgEntry.Insert();\n end;\n \n+ local procedure CreateAndReleaseSalesInvoiceUsingGetShipmentLines(CustomerNo: Code[20])\n+ var\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Invoice, CustomerNo);\n+ SalesLine.Validate(\"Document Type\", SalesHeader.\"Document Type\");\n+ SalesLine.Validate(\"Document No.\", SalesHeader.\"No.\");\n+ LibrarySales.GetShipmentLines(SalesLine);\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+ end;\n+\n+ local procedure CreateItemInventory(var Item: Record Item; Qty: Decimal)\n+ var\n+ ItemJournalTemplate: Record \"Item Journal Template\";\n+ ItemJournalBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ LibraryInventory.SelectItemJournalTemplateName(ItemJournalTemplate, ItemJournalTemplate.Type::Item);\n+ LibraryInventory.SelectItemJournalBatchName(ItemJournalBatch, ItemJournalTemplate.Type::Item, ItemJournalTemplate.Name);\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJournalBatch.\"Journal Template Name\",\n+ ItemJournalBatch.Name, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Item.\"No.\", Qty);\n+ LibraryInventory.PostItemJournalLine(ItemJournalBatch.\"Journal Template Name\", ItemJournalBatch.Name);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerYes(Message: Text; var Response: Boolean)\n@@ -1450,5 +1514,11 @@ codeunit 134389 \"ERM Customer Statistics\"\n CreditLimitNotification.CreditLimitDetails.OverdueBalance.AssertEquals(Customer.\"Balance Due (LCY)\");\n CreditLimitNotification.CreditLimitDetails.\"Credit Limit (LCY)\".AssertEquals(Customer.\"Credit Limit (LCY)\");\n end;\n+\n+ [ModalPageHandler]\n+ procedure GetShipmentLinesPageHandler(var GetShipmentLines: TestPage \"Get Shipment Lines\")\n+ begin\n+ GetShipmentLines.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\nindex ebeb6ca13f79..1fcc2d218ab3 100644\n--- a/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n+++ b/App/Layers/W1/BaseApp/Sales/Customer/Customer.Table.al\n@@ -2353,6 +2353,8 @@ table 18 Customer\n AdditionalAmountLCY: Decimal;\n IsHandled: Boolean;\n TotalAmountLCY: Decimal;\n+ ShippedFromOrderLCY: Decimal;\n+ ShippedOutstandingInvoicesLCY: Decimal;\n begin\n IsHandled := false;\n OnBeforeGetTotalAmountLCYCommon(Rec, AdditionalAmountLCY, IsHandled);\n@@ -2362,10 +2364,13 @@ table 18 Customer\n SalesOutstandingAmountFromShipment := SalesLine.OutstandingInvoiceAmountFromShipment(\"No.\");\n InvoicedPrepmtAmountLCY := GetInvoicedPrepmtAmountLCY();\n RetRcdNotInvAmountLCY := GetReturnRcdNotInvAmountLCY();\n+ ShippedFromOrderLCY := GetShippedFromOrderLCYAmountLCY();\n+ ShippedOutstandingInvoicesLCY := GetShippedOutstandingInvoicesAmountLCY();\n \n TotalAmountLCY :=\n- \"Balance (LCY)\" + \"Outstanding Orders (LCY)\" + \"Shipped Not Invoiced (LCY)\" + \"Outstanding Invoices (LCY)\" +\n- SalesOutstandingAmountFromShipment - InvoicedPrepmtAmountLCY - RetRcdNotInvAmountLCY + AdditionalAmountLCY;\n+ \"Balance (LCY)\" + \"Outstanding Orders (LCY)\" + (\"Shipped Not Invoiced (LCY)\" - ShippedFromOrderLCY) +\n+ (\"Outstanding Invoices (LCY)\" - ShippedOutstandingInvoicesLCY) + SalesOutstandingAmountFromShipment -\n+ InvoicedPrepmtAmountLCY - RetRcdNotInvAmountLCY + AdditionalAmountLCY;\n \n OnAfterGetTotalAmountLCYCommon(Rec, TotalAmountLCY);\n exit(TotalAmountLCY);\n@@ -3451,6 +3456,33 @@ table 18 Customer\n OnAfterGetVATRegistrationNo(Rec, VATRegNo);\n end;\n \n+ procedure GetShippedOutstandingInvoicesAmountLCY(): Decimal\n+ var\n+ SalesLine: Record \"Sales Line\";\n+ begin\n+ SalesLine.SetRange(\"Bill-to Customer No.\", \"No.\");\n+ SalesLine.SetRange(\"Document Type\", SalesLine.\"Document Type\"::Invoice);\n+ SalesLine.SetFilter(\"Shipment No.\", '<>%1', '');\n+ SalesLine.SetFilter(\"Shipment Line No.\", '<>%1', 0);\n+ SalesLine.CalcSums(\"Outstanding Amount (LCY)\");\n+ exit(SalesLine.\"Outstanding Amount (LCY)\");\n+ end;\n+\n+ procedure GetShippedFromOrderLCYAmountLCY(): Decimal\n+ var\n+ SalesShippedNotInvoicedLCY: Query \"Sales Shipped Not Invoiced LCY\";\n+ ShippedFromOrderLCY: Decimal;\n+ begin\n+ ShippedFromOrderLCY := 0;\n+ SalesShippedNotInvoicedLCY.SetRange(BillToCustomerNo, \"No.\");\n+ SalesShippedNotInvoicedLCY.SetFilter(OrderNo, '<>%1', '');\n+ SalesShippedNotInvoicedLCY.SetFilter(OrderLineNo, '<>%1', 0);\n+ if SalesShippedNotInvoicedLCY.Open() then\n+ while SalesShippedNotInvoicedLCY.Read() do\n+ ShippedFromOrderLCY += SalesShippedNotInvoicedLCY.ShippedNotInvoicedLCY;\n+ exit(ShippedFromOrderLCY);\n+ end;\n+\n [InherentPermissions(PermissionObjectType::TableData, Database::\"My Customer\", 'rm')]\n local procedure UpdateMyCustomer(CallingFieldNo: Integer)\n var\ndiff --git a/App/Layers/W1/BaseApp/Sales/Customer/SalesShippedNotInvoicedLCY.Query.al b/App/Layers/W1/BaseApp/Sales/Customer/SalesShippedNotInvoicedLCY.Query.al\nnew file mode 100644\nindex 000000000000..3640fed3530f\n--- /dev/null\n+++ b/App/Layers/W1/BaseApp/Sales/Customer/SalesShippedNotInvoicedLCY.Query.al\n@@ -0,0 +1,31 @@\n+namespace Microsoft.Sales.Customer;\n+\n+using Microsoft.Sales.Document;\n+using Microsoft.Sales.History;\n+\n+query 115 \"Sales Shipped Not Invoiced LCY\"\n+{\n+ Caption = 'Sales Shipped Not Invoiced (LCY)';\n+ QueryType = Normal;\n+ DataAccessIntent = ReadOnly;\n+\n+ elements\n+ {\n+ dataitem(SalesShipmentLine; \"Sales Shipment Line\")\n+ {\n+ column(BillToCustomerNo; \"Bill-to Customer No.\") { }\n+ column(OrderNo; \"Order No.\") { }\n+ column(OrderLineNo; \"Order Line No.\") { }\n+ filter(BillToCustomerNoFilter; \"Bill-to Customer No.\") { }\n+ filter(OrderNoFilter; \"Order No.\") { }\n+ filter(OrderLineNoFilter; \"Order Line No.\") { }\n+ dataitem(SalesLine; \"Sales Line\")\n+ {\n+ DataItemTableFilter = \"Document Type\" = const(Order);\n+ DataItemLink = \"Document No.\" = SalesShipmentLine.\"Order No.\",\n+ \"Line No.\" = SalesShipmentLine.\"Order Line No.\";\n+ column(ShippedNotInvoicedLCY; \"Shipped Not Invoiced (LCY)\") { }\n+ }\n+ }\n+ }\n+}\n\\ No newline at end of file\n"}
+{"metadata": {"area": "inventory", "image_count": 5}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-215972", "base_commit": "09f92492d0cfe5dbba4cebef931acf5b33578799", "created_at": "2025-05-19", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137140, "functionName": ["ReservationShouldNotPossibleOnTransferOrderIfItemReserveSetAsNever"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al\nindex 6e9a6abd3cd6..3253f5221abc 100644\n--- a/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMInventoryDocuments.Codeunit.al\n@@ -41,6 +41,7 @@ codeunit 137140 \"SCM Inventory Documents\"\n SpecialEquipmentCodeShouldBeVisibleErr: Label 'Special Equipment Code should be visible.';\n DueDateBeforeWorkDateMsg: Label 'is before work date';\n TransferOrderErr: Label 'Transfer Order has not been posted successfully.';\n+ ReserveMustNotBeNeverErr: Label 'Reserve must not be Never';\n \n [Test]\n [Scope('OnPrem')]\n@@ -2069,6 +2070,44 @@ codeunit 137140 \"SCM Inventory Documents\"\n Assert.IsTrue(DirectTransHeader.FindFirst(), TransferOrderErr);\n end;\n \n+ [Test]\n+ procedure ReservationShouldNotPossibleOnTransferOrderIfItemReserveSetAsNever()\n+ var\n+ Item: Record Item;\n+ LocationA: Record Location;\n+ LocationB: Record Location;\n+ TransferHeader: Record \"Transfer Header\";\n+ TransferLine: Record \"Transfer Line\";\n+ begin\n+ // [SCENARIO 578318] Reservation of an Item possible with in a Transfer order if the item is set to reserve=never\n+ Initialize();\n+\n+ // [GIVEN] Create Two locations: \"A\" and \"B\" without Warehouse Setup\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(LocationA);\n+ LibraryWarehouse.CreateLocationWithInventoryPostingSetup(LocationB);\n+\n+ // [GIVEN] Create an Item with Reserve = Never\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(Reserve, Item.Reserve::Never);\n+ Item.Modify();\n+\n+ // [GIVEN] Create and Post Item Journal Line\n+ CreateAndPostItemJournalLine(Item.\"No.\", LocationA.Code, '');\n+\n+ // [GIVEN] Create a Direct Transfer Order from Location \"A\" to location \"B\" and Reserve From Inventory\n+ CreateDirectTransferHeader(TransferHeader, LocationA.code, LocationB.Code);\n+ TransferHeader.Validate(\"Posting Date\", WorkDate());\n+ TransferHeader.Modify(true);\n+\n+ // [WHEN] Create transfer line with Item with Reserve set as Never and Show Reservation\n+ LibraryWarehouse.CreateTransferLine(TransferHeader, TransferLine, Item.\"No.\", 10);\n+ asserterror TransferLine.ShowReservation();\n+\n+ // [THEN] Verify Reserve must not be Never error\n+ Assert.ExpectedErrorCode('TestField');\n+ Assert.ExpectedError(ReserveMustNotBeNeverErr);\n+ end;\n+\n local procedure PostWhseShipmentFromTO(DocumentNo: Code[20])\n var\n WhseShipmentLine: Record \"Warehouse Shipment Line\";\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al b/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al\nindex 9ab054c5f5c3..d012f240926e 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Transfer/TransferLine.Table.al\n@@ -1592,6 +1592,8 @@ table 5741 \"Transfer Line\"\n exit;\n \n TestField(\"Item No.\");\n+ Item.Get(\"Item No.\");\n+ Item.TestField(Reserve);\n Clear(Reservation);\n OptionNumber := StrMenu(Text011);\n if OptionNumber > 0 then begin\n"}
+{"metadata": {"area": "inventory", "image_count": 20}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-216057", "base_commit": "eb4658a742a755d408f23b5f96668caaba44842b", "created_at": "2025-05-20", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137045, "functionName": ["NoDuplicateSurplusReservationEntriesOnRecalculateRequisitionWorksheet"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\nindex 70fa87435bd0..c841fa564264 100644\n--- a/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMBugfixes.Codeunit.al\n@@ -1038,6 +1038,62 @@ codeunit 137045 \"SCM Bugfixes\"\n Assert.AreEqual(4, ActualCount, AssemblyCommentLineErr);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemTrackingLinesModalPageHandler')]\n+ procedure NoDuplicateSurplusReservationEntriesOnRecalculateRequisitionWorksheet()\n+ var\n+ Item: Record Item;\n+ SalesHeader: Record \"Sales Header\";\n+ SalesLine: Record \"Sales Line\";\n+ Vendor: Record Vendor;\n+ RequisitionLine: Record \"Requisition Line\";\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ PurchaseHeader: Record \"Purchase Header\";\n+ NewPurchOrderChoice: Option \" \",\"Make Purch. Orders\",\"Make Purch. Orders & Print\",\"Copy to Req. Wksh\";\n+ Qty: Decimal;\n+ begin\n+ // [SCENARIO 575040] When recalculating an item in a requisition or planning worksheet with no planning results lead to wrong surplus entries in the reservation table whic are added to the item tracking page.\n+ Initialize();\n+\n+ // [GIVEN] Created Lot Tracked Item with Reordering Policy:Lot-for-Lot.\n+ CreateTrackedItem(Item);\n+\n+ // [GIVEN] Created Sales Order with 1 Item and 100 quantity.\n+ Qty := 100;\n+ LibrarySales.CreateSalesHeader(SalesHeader, SalesHeader.\"Document Type\"::Order, '');\n+ LibrarySales.CreateSalesLine(SalesLine, SalesHeader, SalesLine.Type::Item, Item.\"No.\", Qty);\n+ LibrarySales.ReleaseSalesDocument(SalesHeader);\n+\n+ // [GIVEN] Calculate requisition plan\n+ CalculateRequisitionPlan(RequisitionWkshName, Item);\n+\n+ // [GIVEN] Find Requisition Line\n+ FindRequisitionLine(RequisitionLine, RequisitionWkshName, RequisitionLine.\"Action Message\"::New);\n+\n+ // [GIVEN] Update Vendor No., Planning Flexibility with None and change the quantity to 150\n+ RequisitionLine.Validate(\"Vendor No.\", LibraryPurchase.CreateVendor(Vendor));\n+ RequisitionLine.Validate(\"Planning Flexibility\", RequisitionLine.\"Planning Flexibility\"::None);\n+ RequisitionLine.Validate(Quantity, 150);\n+ RequisitionLine.Modify(true);\n+\n+ // [GIVEN] Assign the Lot On Item tracking Line\n+ RequisitionLine.OpenItemTrackingLines();\n+\n+ // [GIVEN] Set \"Accept Action Message\" on all Requisition lines.\n+ LibraryPlanning.CarryOutPlanWksh(RequisitionLine, 0, NewPurchOrderChoice::\"Make Purch. Orders\", 0, 0, '', '', '', '');\n+\n+ // [GIVEN] Check at reservation entries for Purchase Order created, only 2 reservation entries should exist for the PO\n+ PurchaseHeader.SetRange(\"Buy-from Vendor No.\", Vendor.\"No.\");\n+ PurchaseHeader.FindLast();\n+ AssertReservationEntryCount(PurchaseHeader, 2);\n+\n+ // [WHEN] Calculate Plan again for same item from requisition worksheet\n+ CalculateRequisitionPlan(RequisitionWkshName, Item);\n+\n+ // [THEN] After recalculation, a new reservation entry should NOT be created for the PO\n+ AssertReservationEntryCount(PurchaseHeader, 2);\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -1740,6 +1796,15 @@ codeunit 137045 \"SCM Bugfixes\"\n CalculatePlanPlanWksh.RunModal();\n end;\n \n+ local procedure AssertReservationEntryCount(PurchaseHeader: Record \"Purchase Header\"; ExpectedCount: Integer)\n+ var\n+ ReservationEntry: Record \"Reservation Entry\";\n+ begin\n+ ReservationEntry.SetRange(\"Source Type\", Database::\"Purchase Line\");\n+ ReservationEntry.SetRange(\"Source ID\", PurchaseHeader.\"No.\");\n+ Assert.RecordCount(ReservationEntry, ExpectedCount);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ContactListModalPageHandler(var ContactLookup: Page \"Contact List\"; var Response: Action)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\nindex ca1799815e42..c1b41b1585bc 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Tracking/ReservationEntry.Table.al\n@@ -11,6 +11,7 @@ using Microsoft.Inventory.Journal;\n using Microsoft.Inventory.Ledger;\n using Microsoft.Inventory.Location;\n using Microsoft.Inventory.Requisition;\n+using Microsoft.Purchases.Document;\n using Microsoft.Sales.Document;\n using Microsoft.Utilities;\n using Microsoft.Warehouse.Activity;\n@@ -1021,6 +1022,10 @@ table 337 \"Reservation Entry\"\n CreateReservEntry.TransferReservEntry(\n SourceType, SourceSubtype, SourceID, SourceBatchName, SourceProdOrderLine, SourceRefNo,\n QtyPerUOM, OldReservEntry, TransferQty);\n+\n+ if (OldReservEntry.\"Reservation Status\" = OldReservEntry.\"Reservation Status\"::Prospect) and (SourceType = Database::\"Purchase Line\") and (SourceSubtype in [1, 2]) then\n+ ChangeReservationStatusToSurplus(SourceType, SourceSubtype, SourceID, SourceRefNo);\n+\n OnTransferReservationsOnAfterSecondOldReservEntryLoop(OldReservEntry, NewReservEntry, SourceType, SourceSubtype, SourceID);\n until (OldReservEntry.Next() = 0) or (TransferQty = 0);\n end;\n@@ -1125,6 +1130,18 @@ table 337 \"Reservation Entry\"\n OnUpdateSourceCost(Rec, UnitCost);\n end;\n \n+ local procedure ChangeReservationStatusToSurplus(SourceType: Integer; SourceSubtype: Option; SourceID: Code[20]; SourceRefNo: Integer)\n+ var\n+ NewReservationEntry: Record \"Reservation Entry\";\n+ begin\n+ NewReservationEntry.SetSourceFilter(SourceType, SourceSubtype, SourceID, SourceRefNo, true);\n+ NewReservationEntry.SetRange(\"Reservation Status\", NewReservationEntry.\"Reservation Status\"::Prospect);\n+ if NewReservationEntry.FindFirst() then begin\n+ NewReservationEntry.\"Reservation Status\" := NewReservationEntry.\"Reservation Status\"::Surplus;\n+ NewReservationEntry.Modify(true);\n+ end;\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterCopyTrackingFromItemLedgEntry(var ReservationEntry: Record \"Reservation Entry\"; ItemLedgerEntry: Record \"Item Ledger Entry\")\n begin\n"}
+{"metadata": {"area": "finance", "image_count": 7}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-216572", "base_commit": "74df6483b659ca304abb6f7adda003cda1424db7", "created_at": "2025-05-26", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\ERM"], "FAIL_TO_PASS": [{"codeunitID": 134227, "functionName": ["CheckDimensionOfRecurringJournalImportAllocationFromAllocationAccount"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\nindex ff710ce5b0e2..aa89a458bd93 100644\n--- a/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n+++ b/App/Layers/W1/Tests/ERM/ERMPostRecurringJournal.Codeunit.al\n@@ -19,6 +19,7 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n LibrarySetupStorage: Codeunit \"Library - Setup Storage\";\n LibraryPurchase: Codeunit \"Library - Purchase\";\n LibrarySales: Codeunit \"Library - Sales\";\n+ LibraryDimension: Codeunit \"Library - Dimension\";\n LibraryTestInitialize: Codeunit \"Library - Test Initialize\";\n GenJnlDocType: Enum \"Gen. Journal Document Type\";\n GenJnlAccountType: Enum \"Gen. Journal Account Type\";\n@@ -31,6 +32,7 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n SkippedLineMsg: Label 'One or more lines has not been posted because the amount is zero.';\n DocumentOutOfBalanceErr: Label 'Document No. %1 is out of balance', Locked = true;\n AllocAccountImportWrongAccTypeErr: Label 'Import from Allocation Account is only allowed for G/L Account Destination account type.', Locked = true;\n+ AllocationDimensionErr: Label 'Allocation dimension is not correct';\n \n [Test]\n [Scope('OnPrem')]\n@@ -1298,6 +1300,48 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n \n end;\n \n+ [Test]\n+ [HandlerFunctions('HandleEditDimensionSetEntriesPage,AllocationAccountListPageHandler,ConfirmHandlerYes')]\n+ procedure CheckDimensionOfRecurringJournalImportAllocationFromAllocationAccount()\n+ var\n+ AllocationAccount: Record \"Allocation Account\";\n+ FirstDimensionValue: Record \"Dimension Value\";\n+ GenJnlAllocation: Record \"Gen. Jnl. Allocation\";\n+ GenJournalBatch: Record \"Gen. Journal Batch\";\n+ GenJournalLine: Record \"Gen. Journal Line\";\n+ SecondDimensionValue: Record \"Dimension Value\";\n+ GLAccounts: array[2] of Record \"G/L Account\";\n+ AllocationShares: array[2] of Decimal;\n+ DimensionSetID: array[2] of Integer;\n+ begin\n+ // [SCENARIO 579186] In Recurring General Journals Import from Allocation Accounts does not import dimensions.\n+ Initialize();\n+\n+ // [GIVEN] Create Recurring General Journal Batch.\n+ CreateRecurringGenJournalBatch(GenJournalBatch);\n+\n+ // [GIVEN] Create Recurring Journal with a line.\n+ CreateRecurringJnlLine(GenJournalLine, GenJournalBatch, WorkDate(), 0D, LibraryRandom.RandInt(10));\n+\n+ // [GIVEN] Create allocation for general journal line.\n+ LibraryERM.CreateGenJnlAllocation(GenJnlAllocation, GenJournalLine.\"Journal Template Name\", GenJournalLine.\"Journal Batch Name\", GenJournalLine.\"Line No.\");\n+\n+ // [GIVEN] Dimension With Value.\n+ CreateDimensionsWithValues(FirstDimensionValue, SecondDimensionValue);\n+\n+ // [GIVEN] Allocation Account \"XXX\" with 2 lines exists for different G/L Accounts and different Allocation Shares with Dimension.\n+ CreateAllocationAccountWithTwoGLAccLines(AllocationAccount, GLAccounts, AllocationShares, FirstDimensionValue, SecondDimensionValue, DimensionSetID);\n+\n+ // [WHEN] Invoke Import from Allocation Account. Handler chooses Allocation Account \"XXX\" in lookup\n+ LibraryVariableStorage.Enqueue(AllocationAccount.\"No.\");\n+ GenJnlAllocation.ChooseAndImportFromAllocationAccount();\n+ // UI Handled by handler\n+\n+ // [THEN] There are 2 Gen Journal Allocations with the same Dimension as in Allocation Account\n+ VerifyGenJnlAllocationDimension(GenJnlAllocation, GenJournalLine, GLAccounts[1], DimensionSetID[1]);\n+ VerifyGenJnlAllocationDimension(GenJnlAllocation, GenJournalLine, GLAccounts[2], DimensionSetID[2]);\n+ end;\n+\n local procedure Initialize()\n begin\n LibraryTestInitialize.OnTestInitialize(Codeunit::\"ERM PostRecurringJournal\");\n@@ -1769,6 +1813,79 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n VendorLedgerEntry.TestField(\"Due Date\", PostingDate + 1);\n end;\n \n+ local procedure CreateDimensionsWithValues(var FirstDimensionValue: Record \"Dimension Value\"; var SecondDimensionValue: Record \"Dimension Value\")\n+ var\n+ Dimension: Record Dimension;\n+ begin\n+ LibraryDimension.CreateDimension(Dimension);\n+ LibraryDimension.CreateDimensionValue(FirstDimensionValue, Dimension.Code);\n+ LibraryDimension.CreateDimensionValue(SecondDimensionValue, Dimension.Code);\n+ end;\n+\n+ local procedure CreateAllocationAccountWithTwoGLAccLines(var AllocationAccount: Record \"Allocation Account\"; var GLAccounts: array[2] of Record \"G/L Account\"; var AllocationShares: array[2] of Decimal; FirstDimensionValue: Record \"Dimension Value\"; SecondDimensionValue: Record \"Dimension Value\"; var DimensionSetID: array[2] of Integer)\n+ var\n+ AllocAccountDistribution: Record \"Alloc. Account Distribution\";\n+ AllocationAccountPage: TestPage \"Allocation Account\";\n+ FixedAllocationAccountCode: Code[20];\n+ begin\n+ FixedAllocationAccountCode := CreateAllocationAccountWithFixedDistribution(AllocationAccountPage);\n+ AddGLDestinationAccountForFixedDistributionWithDimension(AllocationAccountPage, GLAccounts[1]);\n+ AllocationShares[1] := LibraryRandom.RandDecInRange(1, 100, 2);\n+ AllocationAccountPage.FixedAccountDistribution.Share.SetValue(AllocationShares[1]);\n+ SetDimensionToCurrentVariableLine(AllocationAccountPage, FirstDimensionValue);\n+\n+ AllocAccountDistribution.SetRange(\"Allocation Account No.\", FixedAllocationAccountCode);\n+ AllocAccountDistribution.SetRange(\"Account Type\", AllocAccountDistribution.\"Account Type\"::Fixed);\n+ AllocAccountDistribution.SetRange(\"Destination Account Number\", GLAccounts[1].\"No.\");\n+ AllocAccountDistribution.FindFirst();\n+ DimensionSetID[1] := AllocAccountDistribution.\"Dimension Set ID\";\n+\n+ AllocationAccountPage.FixedAccountDistribution.New();\n+ AddGLDestinationAccountForFixedDistributionWithDimension(AllocationAccountPage, GLAccounts[2]);\n+ AllocationShares[2] := LibraryRandom.RandDecInRange(1, 100, 2);\n+ AllocationAccountPage.FixedAccountDistribution.Share.SetValue(AllocationShares[2]);\n+ SetDimensionToCurrentVariableLine(AllocationAccountPage, SecondDimensionValue);\n+\n+ AllocAccountDistribution.Reset();\n+ AllocAccountDistribution.SetRange(\"Allocation Account No.\", FixedAllocationAccountCode);\n+ AllocAccountDistribution.SetRange(\"Account Type\", AllocAccountDistribution.\"Account Type\"::Fixed);\n+ AllocAccountDistribution.SetRange(\"Destination Account Number\", GLAccounts[2].\"No.\");\n+ AllocAccountDistribution.FindFirst();\n+ AllocationAccountPage.FixedAccountDistribution.GoToRecord(AllocAccountDistribution);\n+ DimensionSetID[2] := AllocAccountDistribution.\"Dimension Set ID\";\n+\n+ AllocationAccountPage.Close();\n+\n+ AllocationAccount.Get(FixedAllocationAccountCode);\n+ end;\n+\n+ local procedure SetDimensionToCurrentVariableLine(var AllocationAcccount: TestPage \"Allocation Account\"; var DimensionValue: Record \"Dimension Value\")\n+ begin\n+ LibraryVariableStorage.Enqueue(DimensionValue.SystemId);\n+ AllocationAcccount.FixedAccountDistribution.Dimensions.Invoke();\n+ end;\n+\n+ local procedure AddGLDestinationAccountForFixedDistributionWithDimension(var AllocationAccountPage: TestPage \"Allocation Account\"; var GLAccount: Record \"G/L Account\")\n+ var\n+ DummyAllocAccountDistribution: Record \"Alloc. Account Distribution\";\n+ begin\n+ if GLAccount.\"No.\" = '' then\n+ GLAccount.Get(LibraryERM.CreateGLAccountNoWithDirectPosting());\n+\n+ AllocationAccountPage.FixedAccountDistribution.\"Destination Account Type\".SetValue(DummyAllocAccountDistribution.\"Destination Account Type\"::\"G/L Account\");\n+ AllocationAccountPage.FixedAccountDistribution.\"Destination Account Number\".SetValue(GLAccount.\"No.\");\n+ end;\n+\n+ local procedure VerifyGenJnlAllocationDimension(GenJnlAllocation: Record \"Gen. Jnl. Allocation\"; GenJournalLine: Record \"Gen. Journal Line\"; GLAccount: Record \"G/L Account\"; DimensionSetID: Integer)\n+ begin\n+ GenJnlAllocation.SetRange(\"Journal Template Name\", GenJournalLine.\"Journal Template Name\");\n+ GenJnlAllocation.SetRange(\"Journal Batch Name\", GenJournalLine.\"Journal Batch Name\");\n+ GenJnlAllocation.SetRange(\"Journal Line No.\", GenJournalLine.\"Line No.\");\n+ GenJnlAllocation.SetRange(\"Account No.\", GLAccount.\"No.\");\n+ GenJnlAllocation.FindFirst();\n+ Assert.AreEqual(GenJnlAllocation.\"Dimension Set ID\", DimensionSetID, AllocationDimensionErr);\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandlerYes(Question: Text[1024]; var Reply: Boolean)\n@@ -1821,5 +1938,19 @@ codeunit 134227 \"ERM PostRecurringJournal\"\n NameValueBuffer.ID := LibraryUtility.GetNewRecNo(NameValueBuffer, NameValueBuffer.FieldNo(ID));\n NameValueBuffer.Insert();\n end;\n+\n+ [ModalPageHandler]\n+ procedure HandleEditDimensionSetEntriesPage(var EditDimensionSetEntriesPage: TestPage \"Edit Dimension Set Entries\")\n+ var\n+ DimensionValue: Record \"Dimension Value\";\n+ DimensionValueSystemId: Text;\n+ begin\n+ DimensionValueSystemId := LibraryVariableStorage.DequeueText();\n+ DimensionValue.GetBySystemId(DimensionValueSystemId);\n+ EditDimensionSetEntriesPage.New();\n+ EditDimensionSetEntriesPage.\"Dimension Code\".SetValue(DimensionValue.\"Dimension Code\");\n+ EditDimensionSetEntriesPage.DimensionValueCode.SetValue(DimensionValue.Code);\n+ EditDimensionSetEntriesPage.OK().Invoke();\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al\nindex 130b3e0f3456..7a287e4fb7f1 100644\n--- a/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al\n+++ b/App/Layers/W1/BaseApp/Finance/GeneralLedger/Journal/GenJnlAllocation.Table.al\n@@ -669,6 +669,10 @@ table 221 \"Gen. Jnl. Allocation\"\n begin\n Rec.Validate(\"Account No.\", AllocAccountDistribution.\"Destination Account Number\");\n Rec.Validate(\"Allocation %\", AllocAccountDistribution.Percent);\n+ Rec.Validate(\"Shortcut Dimension 1 Code\", AllocAccountDistribution.\"Global Dimension 1 Code\");\n+ Rec.Validate(\"Shortcut Dimension 2 Code\", AllocAccountDistribution.\"Global Dimension 2 Code\");\n+ Rec.Validate(\"Dimension Set ID\", AllocAccountDistribution.\"Dimension Set ID\");\n+ Rec.Modify(true);\n end;\n \n local procedure CheckGLAccount(var GLAccount: Record \"G/L Account\")\n"}
+{"metadata": {"area": "inventory", "image_count": 6}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-217797", "base_commit": "055fbb3433b4edcc3fc5709cf9b0cf7e48a372ac", "created_at": "2025-06-11", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137009, "functionName": ["LookupItemAvailabilityByEventOnItemCardOpenTheCorrectPlanningWorksheetBatch"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al\nindex 63f145ed7b95..cce6dab13ec0 100644\n--- a/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMAvailabilitybyEvent.Codeunit.al\n@@ -24,6 +24,7 @@ codeunit 137009 \"SCM Availability by Event\"\n LibraryPurchase: Codeunit \"Library - Purchase\";\n LibraryAssembly: Codeunit \"Library - Assembly\";\n LibraryPatterns: Codeunit \"Library - Patterns\";\n+ LibraryPlanning: Codeunit \"Library - Planning\";\n LibraryRandom: Codeunit \"Library - Random\";\n LibraryVariableStorage: Codeunit \"Library - Variable Storage\";\n LibrarySetupStorage: Codeunit \"Library - Setup Storage\";\n@@ -531,6 +532,62 @@ codeunit 137009 \"SCM Availability by Event\"\n TempInvtPageData.TestField(\"Remaining Forecast\", -ForecastQty + SalesQty);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ItemAvailabilityByEventPageHandler,PlanningWorksheetModalPageHandler')]\n+ procedure LookupItemAvailabilityByEventOnItemCardOpenTheCorrectPlanningWorksheetBatch()\n+ var\n+ Item: Record Item;\n+ NewPlanningWorkSheetBatchName: Code[10];\n+ OldPlanningWorkSheetBatchName: Code[10];\n+ ItemCard: TestPage \"Item Card\";\n+ PlanningWorksheet: TestPage \"Planning Worksheet\";\n+ begin\n+ // [SCENARIO 575726] Verify that the 'Lookup Item Availability by Event' on the item card opens the correct planning worksheet batch.\n+ Initialize();\n+\n+ // [GIVEN] Create a Item.\n+ LibraryInventory.CreateItem(Item);\n+ LibraryVariableStorage.Enqueue(Item.\"No.\");\n+\n+ // [GIEVN] Get old planning worksheet batch name.\n+ OldPlanningWorkSheetBatchName := GetRequisitionWkshBatch();\n+\n+ // [GIVEN] Open planning worksheet batch.\n+ PlanningWorksheet.OpenEdit();\n+ PlanningWorksheet.New();\n+\n+ // [GIVEN] Set the old planning worksheet batch name.\n+ PlanningWorksheet.CurrentWkshBatchName.SetValue(OldPlanningWorkSheetBatchName);\n+ LibraryVariableStorage.Enqueue(OldPlanningWorkSheetBatchName);\n+\n+ // [GIVEN] Set the item number and quantity in the planning worksheet.\n+ PlanningWorksheet.\"No.\".SetValue(Item.\"No.\");\n+ PlanningWorksheet.Quantity.SetValue(LibraryRandom.RandIntInRange(10, 20));\n+ PlanningWorksheet.Close();\n+\n+ // [GIVEN] Set new planning worksheet batch.\n+ NewPlanningWorkSheetBatchName := CreateRequisitionWkshBatch();\n+ PlanningWorksheet.OpenEdit();\n+ PlanningWorksheet.CurrentWkshBatchName.SetValue(NewPlanningWorkSheetBatchName);\n+ PlanningWorksheet.Close();\n+\n+ // [THEN] Verify the current planning worksheet batch name.\n+ PlanningWorksheet.OpenView();\n+ Assert.Equal(NewPlanningWorkSheetBatchName, PlanningWorksheet.CurrentWkshBatchName.Value);\n+\n+ // [GIVEN] Open Item Card.\n+ ItemCard.OpenEdit();\n+ ItemCard.GoToRecord(Item);\n+\n+ // [WHEN] Invoke Item Availability by Event Action.\n+ ItemCard.\"\".Invoke();\n+ ItemCard.Close();\n+\n+ // [THEN] Verify Lookup Item Availability by Event on the item card opens the correct planning worksheet batch.\n+ // It was verified on the PlanningWorksheetModalPageHandler. \n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n local procedure AutoReservePurchaseLine(PurchaseLine: Record \"Purchase Line\")\n var\n ReservMgt: Codeunit \"Reservation Management\";\n@@ -671,6 +728,35 @@ codeunit 137009 \"SCM Availability by Event\"\n ProdOrderComponent.Insert();\n end;\n \n+ local procedure GetRequisitionWkshBatch(): Code[10]\n+ var\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ begin\n+ RequisitionWkshName.SetRange(\"Template Type\", RequisitionWkshName.\"Template Type\"::Planning);\n+ RequisitionWkshName.FindFirst();\n+\n+ exit(RequisitionWkshName.Name);\n+ end;\n+\n+ local procedure GetRequisitionWkshTemplate(): Code[10]\n+ var\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ begin\n+ RequisitionWkshName.SetRange(\"Template Type\", RequisitionWkshName.\"Template Type\"::Planning);\n+ RequisitionWkshName.FindFirst();\n+\n+ exit(RequisitionWkshName.\"Worksheet Template Name\");\n+ end;\n+\n+ local procedure CreateRequisitionWkshBatch(): Code[10]\n+ var\n+ RequisitionWkshName: Record \"Requisition Wksh. Name\";\n+ begin\n+ LibraryPlanning.CreateRequisitionWkshName(RequisitionWkshName, GetRequisitionWkshTemplate());\n+\n+ exit(RequisitionWkshName.Name);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure ItemAvailabilityByLocationPageHandler(var ItemAvailabilitybyLocation: TestPage \"Item Availability by Location\")\n@@ -722,5 +808,28 @@ codeunit 137009 \"SCM Availability by Event\"\n begin\n Reply := true;\n end;\n+\n+ [ModalPageHandler]\n+ procedure ItemAvailabilityByEventPageHandler(var ItemAvailabilitybyEvent: TestPage \"Item Availability by Event\")\n+ var\n+ InventoryPageDataType: Enum \"Inventory Page Data Type\";\n+ begin\n+ ItemAvailabilitybyEvent.IncludePlanningSuggestions.SetValue(true);\n+ ItemAvailabilitybyEvent.Filter.SetFilter(Type, Format(InventoryPageDataType::Plan));\n+ ItemAvailabilitybyEvent.\"Show Document\".Invoke();\n+ ItemAvailabilitybyEvent.OK().Invoke();\n+ end;\n+\n+ [ModalPageHandler]\n+ procedure PlanningWorksheetModalPageHandler(var PlanningWorksheet: TestPage \"Planning Worksheet\")\n+ var\n+ CurrentWkshBatchName: Variant;\n+ ItemNo: Variant;\n+ begin\n+ ItemNo := LibraryVariableStorage.DequeueText();\n+ CurrentWkshBatchName := LibraryVariableStorage.DequeueText();\n+ PlanningWorksheet.CurrentWkshBatchName.AssertEquals(CurrentWkshBatchName);\n+ PlanningWorksheet.\"No.\".AssertEquals(ItemNo);\n+ end;\n }\n \n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al b/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al\nindex 2eaf3fe58c79..986790155380 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Requisition/PlanningWorksheet.Page.al\n@@ -953,7 +953,7 @@ page 99000852 \"Planning Worksheet\"\n // if called from API (such as edit-in-excel), do not filter \n if ClientTypeManagement.GetCurrentClientType() = CLIENTTYPE::ODataV4 then\n exit;\n- OpenedFromBatch := (Rec.\"Journal Batch Name\" <> '') and (Rec.\"Worksheet Template Name\" = '');\n+ OpenedFromBatch := (Rec.\"Journal Batch Name\" <> '') and (Rec.\"Worksheet Template Name\" <> '');\n if OpenedFromBatch then begin\n CurrentWkshBatchName := Rec.\"Journal Batch Name\";\n ReqJnlManagement.OpenJnl(CurrentWkshBatchName, Rec);\ndiff --git a/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al\nindex a2b07ee7538a..033dc48d99c5 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Requisition/ReqJnlManagement.Codeunit.al\n@@ -98,7 +98,10 @@ codeunit 330 ReqJnlManagement\n begin\n OnBeforeOpenJnl(CurrentJnlBatchName, ReqLine);\n \n- CheckTemplateName(ReqLine.GetRangeMax(\"Worksheet Template Name\"), CurrentJnlBatchName);\n+ if (ReqLine.\"Worksheet Template Name\" <> '') and (ReqLine.GetFilter(\"Journal Batch Name\") = '') then\n+ CheckTemplateName(ReqLine.\"Worksheet Template Name\", CurrentJnlBatchName)\n+ else\n+ CheckTemplateName(ReqLine.GetRangeMax(\"Worksheet Template Name\"), CurrentJnlBatchName);\n ReqLine.FilterGroup := 2;\n ReqLine.SetRange(\"Journal Batch Name\", CurrentJnlBatchName);\n ReqLine.FilterGroup := 0;\n"}
+{"metadata": {"area": "inventory", "image_count": 6}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-214557", "base_commit": "72ed0651950681ae8b8c302d37d00d3b6f32692b", "created_at": "2025-05-01", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137075, "functionName": ["ReqLineIsNotCreatedWhenCalcRegenPlanForCompItemPresentInRelProdOrder"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al\nindex 66bf5a9fce6e..d5d73bcc3bcc 100644\n--- a/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMPlanningOrderTracking.Codeunit.al\n@@ -861,6 +861,69 @@\n // [THEN] Order Tracking page is opened with 2 lines for Item \"I\" and quantity = 1(checked in OrderTrackingWithLinesModalPageHandler handler)\n end;\n \n+ [Test]\n+ [Scope('OnPrem')]\n+ procedure ReqLineIsNotCreatedWhenCalcRegenPlanForCompItemPresentInRelProdOrder()\n+ var\n+ Item: array[4] of Record Item;\n+ ProductionBOMHeader: array[2] of Record \"Production BOM Header\";\n+ productionBOMLine: array[3] of Record \"Production BOM Line\";\n+ ProductionOrder: Record \"Production Order\";\n+ RequisitionLine: Record \"Requisition Line\";\n+ begin\n+ // [SCENARIO 563946] Requition Line is not created when Stan runs Calculate Regenerative \n+ // Plan action for Component Item if the that Item is present in a Released Production Order \n+ // with required Quantity in its Prod. Order Line.\n+ Initialize();\n+\n+ // [GIVEN] Create four Items.\n+ CreateItem(Item[1]);\n+ CreateItem(Item[2]);\n+ CreateItem(Item[3]);\n+ CreateItem(Item[4]);\n+\n+ // [GIVEN] Create a Production BOM for Item [2] and Item [3].\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader[1], Item[2].\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader[1], ProductionBOMLine[1], '', ProductionBOMLine[1].Type::Item, Item[2].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader[1], ProductionBOMLine[2], '', ProductionBOMLine[2].Type::Item, Item[3].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+\n+ // [GIVEN] Validate \"Status\" in Production BOM Header [1].\n+ ProductionBOMHeader[1].Validate(\"Status\", ProductionBOMHeader[1].Status::Certified);\n+ ProductionBOMHeader[1].Modify(true);\n+\n+ // [GIVEN] Create a Production BOM for Item [4].\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader[2], Item[4].\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(ProductionBOMHeader[2], ProductionBOMLine[3], '', ProductionBOMLine[3].Type::Item, Item[4].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+\n+ // [GIVEN] Validate \"Status\" in Production BOM Header [2].\n+ ProductionBOMHeader[2].Validate(\"Status\", ProductionBOMHeader[2].Status::Certified);\n+ ProductionBOMHeader[2].Modify(true);\n+\n+ // [GIVEN] Validate \"Production BOM No.\" in Item [1].\n+ Item[1].Validate(\"Production BOM No.\", ProductionBOMHeader[1].\"No.\");\n+ Item[1].Modify(true);\n+\n+ // [GIVEN] Validate \"Production BOM No.\" in Item [2].\n+ Item[2].Validate(\"Production BOM No.\", ProductionBOMHeader[2].\"No.\");\n+ Item[2].Modify(true);\n+\n+ // [GIVEN] Validate \"Production BOM No.\" in Item [3].\n+ Item[3].Validate(\"Production BOM No.\", ProductionBOMHeader[2].\"No.\");\n+ Item[3].Modify(true);\n+\n+ // [GIVEN] Create and Refresh Released Production Order.\n+ CreateAndRefreshReleasedProductionOrder(ProductionOrder, Item[1].\"No.\", LibraryRandom.RandIntInRange(1, 1));\n+\n+ // [GIVEN] Calculate Regenerative Plan for Planning Worksheet.\n+ CalculateRegenPlanForPlanningWorksheet(Item[4]);\n+\n+ // [WHEN] Find Requisition Line.\n+ RequisitionLine.SetRange(\"No.\", Item[4].\"No.\");\n+\n+ // [THEN] Requisition Line is not found.\n+ Assert.IsTrue(RequisitionLine.IsEmpty(), StrSubstNo(ReqLineShouldNotExistErr, ''));\n+ end;\n+\n local procedure Initialize()\n var\n RequisitionLine: Record \"Requisition Line\";\n@@ -1597,6 +1660,15 @@\n ReservationEntry.Insert();\n end;\n \n+ local procedure CreateItem(var Item: Record Item)\n+ begin\n+ LibraryInventory.CreateItem(Item);\n+ Item.Validate(\"Replenishment System\", Item.\"Replenishment System\"::\"Prod. Order\");\n+ Item.Validate(\"Reordering Policy\", Item.\"Reordering Policy\"::\"Lot-for-Lot\");\n+ Item.Validate(\"Manufacturing Policy\", Item.\"Manufacturing Policy\"::\"Make-to-Order\");\n+ Item.Modify(true);\n+ end;\n+\n [RequestPageHandler]\n [Scope('OnPrem')]\n procedure CalculatePlanPlanWkshRequestPageHandler(var CalculatePlanPlanWksh: TestRequestPage \"Calculate Plan - Plan. Wksh.\")\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al b/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al\nindex e3a6cf2ff5fb..2acbb26614e2 100644\n--- a/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Inventory/Tracking/InventoryProfileOffsetting.Codeunit.al\n@@ -15,6 +15,7 @@ using Microsoft.Inventory.Planning;\n using Microsoft.Inventory.Requisition;\n using Microsoft.Inventory.Setup;\n using Microsoft.Inventory.Transfer;\n+using Microsoft.Manufacturing.Document;\n using Microsoft.Pricing.Calculation;\n using Microsoft.Purchases.Document;\n using Microsoft.Purchases.Vendor;\n@@ -982,6 +983,9 @@ codeunit 99000854 \"Inventory Profile Offsetting\"\n CanBeRescheduled: Boolean;\n ItemInventoryExists: Boolean;\n begin\n+ if CheckDemandAndSupplyQuantityAreEqual(SupplyInvtProfile, DemandInvtProfile) then\n+ exit;\n+\n xDemandInvtProfile.CopyFilters(DemandInvtProfile);\n xSupplyInvtProfile.CopyFilters(SupplyInvtProfile);\n ItemInventoryExists := CheckItemInventoryExists(SupplyInvtProfile);\n@@ -1097,6 +1101,28 @@ codeunit 99000854 \"Inventory Profile Offsetting\"\n OnAfterMatchAttributes(SupplyInvtProfile, DemandInvtProfile, TempTrkgReservEntry);\n end;\n \n+ local procedure CheckDemandAndSupplyQuantityAreEqual(var SupplyInvtProfile: Record \"Inventory Profile\"; var DemandInvtProfile: Record \"Inventory Profile\"): Boolean\n+ var\n+ TotalDemandQty: Decimal;\n+ TotalSupplyQty: Decimal;\n+ begin\n+ if (SupplyInvtProfile.\"Source Type\" <> Database::\"Prod. Order Line\") or (DemandInvtProfile.\"Source Type\" <> Database::\"Prod. Order Component\") then\n+ exit(false);\n+\n+ if DemandInvtProfile.FindSet() then\n+ repeat\n+ TotalDemandQty += DemandInvtProfile.Quantity;\n+ until DemandInvtProfile.Next() = 0;\n+\n+ if SupplyInvtProfile.FindSet() then\n+ repeat\n+ TotalSupplyQty += SupplyInvtProfile.Quantity;\n+ until SupplyInvtProfile.Next() = 0;\n+\n+ if TotalSupplyQty = TotalDemandQty then\n+ exit(true);\n+ end;\n+\n local procedure DecreaseQtyForMaxQty(var SupplyInvtProfile: Record \"Inventory Profile\"; ReduceQty: Decimal)\n begin\n if ReduceQty > 0 then begin\n"}
+{"metadata": {"area": "manufacturing", "image_count": 11}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-212355", "base_commit": "a7de1e6b1a271e60b86657a69a98e863b2b85d33", "created_at": "2025-04-06", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\SCM"], "FAIL_TO_PASS": [{"codeunitID": 137154, "functionName": ["InputQtyAndStartingDateTimeIsRecalculatedWhenReplanProdOrder"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al b/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al\nindex 972aa5e52834..c2e1e71567ec 100644\n--- a/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al\n+++ b/App/Layers/W1/Tests/SCM/SCMWarehouseManagementII.Codeunit.al\n@@ -64,6 +64,8 @@ codeunit 137154 \"SCM Warehouse Management II\"\n ReceiptLinesNotCreatedErr: Label 'There are no warehouse receipt lines created.';\n ItemTrackingMode: Option \" \",\"Assign Lot No.\",\"Assign Multiple Lot No.\",\"Assign Serial No.\",\"Assign Lot And Serial\",\"Select Entries\",\"Blank Quantity Base\",\"Assign Lot No. & Expiration Date\",\"Assign Manual Lot Nos\",\"Show Entries\";\n DescriptionMustBeSame: Label 'Description must be same.';\n+ InputQtyErr: Label 'Input Quantity Must be %1 in %2', Comment = '1% = Remaining Quanity value, %2 = Prod. Order Routing Line';\n+ StartingDateTimeErr: Label 'Starting Date-Time must not be %1 in %2', Comment = '%1 = StartingDateTime value, %2 = Prod. Order Routing Line.';\n \n [Test]\n [HandlerFunctions('ReservationPageHandler')]\n@@ -3447,6 +3449,97 @@ codeunit 137154 \"SCM Warehouse Management II\"\n LibraryWarehouse.PostWhseShipment(WarehouseShipmentHeader, false);\n end;\n \n+ [Test]\n+ [HandlerFunctions('ProductionJournalPageHandler,ConfirmHandlerYes,MessageHandlerNotext')]\n+ procedure InputQtyAndStartingDateTimeIsRecalculatedWhenReplanProdOrder()\n+ var\n+ CompItem, ProdItem : Record Item;\n+ ProductionBOMLine: Record \"Production BOM Line\";\n+ RoutingHeader: Record \"Routing Header\";\n+ ProductionOrder: Record \"Production Order\";\n+ ProdOrderLine: Record \"Prod. Order Line\";\n+ ProdOrderRoutingLine: Record \"Prod. Order Routing Line\";\n+ WorkCenter: Record \"Work Center\";\n+ Direction: Option Forward,Backward;\n+ CalcMethod: Option \"No Levels\",\"One level\",\"All levels\";\n+ StartingDateTime: DateTime;\n+ begin\n+ // [SCENARIO 565975] \"Input Quantity\" and \"Starting Date-Time\" in Prod. Order Routing Line is \n+ // recalculated when Production Journal is posted and Stan runs Replan Production Order Report.\n+ Initialize();\n+\n+ // [GIVEN] Create a Component Item and Validate \"Replenishment System\", \n+ // \"Manufacturing Policy\" and \"Flushing Method\".\n+ LibraryInventory.CreateItem(CompItem);\n+ CompItem.Validate(\"Replenishment System\", CompItem.\"Replenishment System\"::Purchase);\n+ CompItem.Validate(\"Manufacturing Policy\", CompItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ CompItem.Validate(\"Flushing Method\", CompItem.\"Flushing Method\"::\"Pick + Manual\");\n+ CompItem.Modify(true);\n+\n+ // [GIVEN] Create a Work Center.\n+ CreateWorkCenter(WorkCenter);\n+\n+ // [GIVEN] Create and Certify Routing.\n+ CreateAndCertifyRouting(RoutingHeader, WorkCenter);\n+\n+ // [GIVEN] Create and Certify Production BOM.\n+ CreateAndCertifyProductionBOM(ProductionBOMLine, CompItem, LibraryRandom.RandIntInRange(10, 10));\n+\n+ // [GIVEN] Create a Production Item and Validate \"Replenishment System\", \n+ // \"Manufacturing Policy\", \"Routing No.\" and \"Production BOM No.\".\n+ LibraryInventory.CreateItem(ProdItem);\n+ ProdItem.Validate(\"Replenishment System\", ProdItem.\"Replenishment System\"::\"Prod. Order\");\n+ ProdItem.Validate(\"Manufacturing Policy\", ProdItem.\"Manufacturing Policy\"::\"Make-to-Stock\");\n+ ProdItem.Validate(\"Routing No.\", RoutingHeader.\"No.\");\n+ ProdItem.Validate(\"Production BOM No.\", ProductionBOMLine.\"Production BOM No.\");\n+ ProdItem.Modify(true);\n+\n+ // [GIVEN] Set Item Inventory.\n+ SetItemInventory(CompItem, LibraryRandom.RandIntInRange(500, 500));\n+\n+ // [GIVEN] Create and Refresh Production Order.\n+ CreateAndRefreshProductionOrder(ProductionOrder, ProdItem.\"No.\", LibraryRandom.RandIntInRange(50, 50));\n+\n+ // [GIVEN] Find Prod. Order Routing Line.\n+ ProdOrderRoutingLine.SetRange(\"Routing No.\", RoutingHeader.\"No.\");\n+ ProdOrderRoutingLine.FindFirst();\n+\n+ // [GIVEN] Generate and save Starting Date-Time in a Variable.\n+ StartingDateTime := ProdOrderRoutingLine.\"Starting Date-Time\";\n+\n+ // [GIVEN] Open Production Journal.\n+ OpenProductionJournal(ProductionOrder.\"No.\");\n+\n+ // [GIVEN] Run Replan Production Order Report.\n+ LibraryManufacturing.RunReplanProductionOrder(ProductionOrder, Direction::Backward, CalcMethod::\"No Levels\");\n+\n+ // [GIVEN] Find Prod. Order Line.\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProductionOrder.\"No.\");\n+ ProdOrderLine.FindFirst();\n+\n+ // [WHEN] Find Prod. Order Routing Line.\n+ ProdOrderRoutingLine.SetRange(\"Routing No.\", RoutingHeader.\"No.\");\n+ ProdOrderRoutingLine.FindFirst();\n+\n+ // [THEN] \"Input Quantity\" in Prod. Order Routing Line is equal to \"Remaining Quantity\" of Prod. Order Line.\n+ Assert.AreEqual(\n+ ProdOrderLine.\"Remaining Quantity\",\n+ ProdOrderRoutingLine.\"Input Quantity\",\n+ StrSubstNo(\n+ InputQtyErr,\n+ ProdOrderLine.\"Remaining Quantity\",\n+ ProdOrderRoutingLine.TableCaption()));\n+\n+ // [THEN] \"Starting Date-Time\" in Prod. Order Routing Line is equal to StartingDateTime.\n+ Assert.AreNotEqual(\n+ StartingDateTime,\n+ ProdOrderRoutingLine.\"Starting Date-Time\",\n+ StrSubstNo(\n+ StartingDateTimeErr,\n+ StartingDateTime,\n+ ProdOrderRoutingLine.TableCaption()));\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -5174,6 +5267,71 @@ codeunit 137154 \"SCM Warehouse Management II\"\n LibraryInventory.PostItemJournalBatch(ItemJournalBatch);\n end;\n \n+ local procedure CreateAndRefreshProductionOrder(var ProductionOrder: Record \"Production Order\"; ItemNo: Code[20]; Quantity: Decimal)\n+ begin\n+ LibraryManufacturing.CreateProductionOrder(\n+ ProductionOrder, ProductionOrder.Status::Released, ProductionOrder.\"Source Type\"::Item, ItemNo, Quantity);\n+ LibraryManufacturing.RefreshProdOrder(ProductionOrder, false, true, true, true, false);\n+ end;\n+\n+ local procedure SetItemInventory(Item: Record Item; Quantity: Decimal)\n+ var\n+ ItemJnlTemplate: Record \"Item Journal Template\";\n+ ItemJnlBatch: Record \"Item Journal Batch\";\n+ ItemJournalLine: Record \"Item Journal Line\";\n+ begin\n+ Item.TestField(\"No.\");\n+\n+ LibraryInventory.CreateItemJournalTemplate(ItemJnlTemplate);\n+ LibraryInventory.CreateItemJournalBatch(ItemJnlBatch, ItemJnlTemplate.Name);\n+ LibraryInventory.CreateItemJournalLine(ItemJournalLine, ItemJnlTemplate.Name, ItemJnlBatch.Name, ItemJournalLine.\"Entry Type\"::\"Positive Adjmt.\", Item.\"No.\", Quantity);\n+\n+ LibraryInventory.PostItemJournalLine(ItemJnlTemplate.Name, ItemJnlBatch.Name);\n+ end;\n+\n+ local procedure OpenProductionJournal(No: Code[20])\n+ var\n+ ReleasedProductionOrder: TestPage \"Released Production Order\";\n+ begin\n+ ReleasedProductionOrder.OpenEdit();\n+ ReleasedProductionOrder.FILTER.SetFilter(\"No.\", No);\n+ ReleasedProductionOrder.ProdOrderLines.ProductionJournal.Invoke();\n+ end;\n+\n+ local procedure CreateWorkCenter(var WorkCenter: Record \"Work Center\")\n+ begin\n+ LibraryManufacturing.CreateWorkCenterWithCalendar(WorkCenter);\n+ WorkCenter.Validate(\"Unit Cost\", LibraryRandom.RandDec(100, 2));\n+ WorkCenter.Validate(Capacity, LibraryRandom.RandIntInRange(3, 3));\n+ WorkCenter.Validate(Efficiency, LibraryRandom.RandIntInRange(100, 100));\n+ WorkCenter.Modify(true);\n+ end;\n+\n+ local procedure CreateAndCertifyRouting(var RoutingHeader: Record \"Routing Header\"; WorkCenter: Record \"Work Center\")\n+ var\n+ RoutingLine: Record \"Routing Line\";\n+ begin\n+ LibraryManufacturing.CreateRoutingHeader(RoutingHeader, RoutingHeader.Type::Serial);\n+ LibraryManufacturing.CreateRoutingLine(RoutingHeader, RoutingLine, '', Format(LibraryRandom.RandIntInRange(10, 10)), RoutingLine.Type::\"Work Center\", WorkCenter.\"No.\");\n+ RoutingLine.Validate(\"Setup Time\", LibraryRandom.RandIntInRange(10, 10));\n+ RoutingLine.Validate(\"Run Time\", LibraryRandom.RandIntInRange(10, 10));\n+ RoutingLine.Modify(true);\n+\n+ RoutingHeader.Validate(Status, RoutingHeader.Status::Certified);\n+ RoutingHeader.Modify(true);\n+ end;\n+\n+ local procedure CreateAndCertifyProductionBOM(var ProductionBOMLine: Record \"Production BOM Line\"; Item: Record Item; Qty: Decimal)\n+ var\n+ ProductionBOMHeader: Record \"Production BOM Header\";\n+ begin\n+ LibraryManufacturing.CreateProductionBOMHeader(ProductionBOMHeader, Item.\"Base Unit of Measure\");\n+ LibraryManufacturing.CreateProductionBOMLine(\n+ ProductionBOMHeader, ProductionBOMLine, '', ProductionBOMLine.Type::Item, Item.\"No.\", Qty);\n+ ProductionBOMHeader.Validate(Status, ProductionBOMHeader.Status::Certified);\n+ ProductionBOMHeader.Modify(true);\n+ end;\n+\n [ModalPageHandler]\n [Scope('OnPrem')]\n procedure EnterQuantityToCreatePageHandler(var EnterQuantityToCreate: TestPage \"Enter Quantity to Create\")\n@@ -5347,6 +5505,19 @@ codeunit 137154 \"SCM Warehouse Management II\"\n SourceDocumentFilterCard.Run.Invoke();\n end;\n \n+ [ModalPageHandler]\n+ [Scope('OnPrem')]\n+ procedure ProductionJournalPageHandler(var ProductionJournal: TestPage \"Production Journal\")\n+ begin\n+ ProductionJournal.First();\n+ ProductionJournal.Quantity.SetValue(LibraryRandom.RandIntInRange(200, 200));\n+ ProductionJournal.Next();\n+ ProductionJournal.\"Setup Time\".SetValue(LibraryRandom.RandIntInRange(10, 10));\n+ ProductionJournal.\"Run Time\".SetValue(LibraryRandom.RandIntInRange(10, 10));\n+ ProductionJournal.\"Output Quantity\".SetValue(LibraryRandom.RandIntInRange(20, 20));\n+ ProductionJournal.Post.Invoke();\n+ end;\n+\n [PageHandler]\n [Scope('OnPrem')]\n procedure GLPostingPreviewPageHandler(var ShowAllEntries: TestPage \"G/L Posting Preview\")\n@@ -5372,6 +5543,11 @@ codeunit 137154 \"SCM Warehouse Management II\"\n Assert.IsTrue(StrPos(Message, LocalMessage) > 0, Message);\n end;\n \n+ [MessageHandler]\n+ procedure MessageHandlerNotext(Message: Text[1024])\n+ begin\n+ end;\n+\n [ConfirmHandler]\n [Scope('OnPrem')]\n procedure ConfirmHandler(ConfirmMessage: Text[1024]; var Reply: Boolean)\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al b/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al\nindex 33305adaa10c..25cb5cb00d64 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Document/ReplanProductionOrder.Report.al\n@@ -65,7 +65,7 @@ report 99001026 \"Replan Production Order\"\n \"Ending Time\" := \"Prod. Order Line\".\"Ending Time\";\n Modify();\n end;\n- CalcProdOrderRtngLine.CalculateRoutingLine(\"Prod. Order Routing Line\", Direction, true);\n+ CalcProdOrderRtngLine.ReplanRoutingLine(\"Prod. Order Routing Line\", Direction, true);\n end;\n Modify();\n end;\ndiff --git a/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al b/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al\nindex c46c8c20688a..1481dab83903 100644\n--- a/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Manufacturing/Routing/CalculateRoutingLine.Codeunit.al\n@@ -1261,6 +1261,7 @@ codeunit 99000774 \"Calculate Routing Line\"\n OnCalculateRoutingLineOnBeforeProdOrderCapNeedReset(ProdOrderRoutingLine, ProdOrderRoutingLine2);\n \n ProdOrderCapNeed.Reset();\n+ ProdOrderCapNeed.SetLoadFields(Status, \"Prod. Order No.\", \"Requested Only\", \"Routing No.\", \"Routing Reference No.\", \"Operation No.\");\n ProdOrderCapNeed.SetRange(Status, ProdOrderRoutingLine.Status);\n ProdOrderCapNeed.SetRange(\"Prod. Order No.\", ProdOrderRoutingLine.\"Prod. Order No.\");\n ProdOrderCapNeed.SetRange(\"Requested Only\", false);\n@@ -2114,6 +2115,118 @@ codeunit 99000774 \"Calculate Routing Line\"\n CalendarEntry.SetRange(\"Ending Date-Time\", 0DT, CreateDateTime(DateValue + 1, TimeValue));\n end;\n \n+ procedure ReplanRoutingLine(var ProdOrderRoutingLine2: Record \"Prod. Order Routing Line\"; Direction: Option Forward,Backward; CalcStartEndDate: Boolean)\n+ var\n+ ProdOrderCapacityNeed: Record \"Prod. Order Capacity Need\";\n+ MfgCostCalcMgt: Codeunit \"Mfg. Cost Calculation Mgt.\";\n+ ExpectedOperOutput: Decimal;\n+ ActualOperOutput: Decimal;\n+ TotalQtyPerOperation: Decimal;\n+ TotalCapacityPerOperation: Decimal;\n+ begin\n+ MfgSetup.Get();\n+\n+ ProdOrderRoutingLine := ProdOrderRoutingLine2;\n+\n+ WaitTimeOnly :=\n+ (ProdOrderRoutingLine.\"Setup Time\" = 0) and (ProdOrderRoutingLine.\"Run Time\" = 0) and\n+ (ProdOrderRoutingLine.\"Move Time\" = 0);\n+\n+ if ProdOrderRoutingLine.\"Ending Time\" = 0T then\n+ ProdOrderRoutingLine.\"Ending Time\" := 000000T;\n+\n+ if ProdOrderRoutingLine.\"Starting Time\" = 0T then\n+ ProdOrderRoutingLine.\"Starting Time\" := 000000T;\n+\n+ ProdOrderRoutingLine.\"Expected Operation Cost Amt.\" := 0;\n+ ProdOrderRoutingLine.\"Expected Capacity Ovhd. Cost\" := 0;\n+ ProdOrderRoutingLine.\"Expected Capacity Need\" := 0;\n+\n+ ProdOrderCapacityNeed.Reset();\n+ ProdOrderCapacityNeed.SetRange(Status, ProdOrderRoutingLine.Status);\n+ ProdOrderCapacityNeed.SetRange(\"Prod. Order No.\", ProdOrderRoutingLine.\"Prod. Order No.\");\n+ ProdOrderCapacityNeed.SetRange(\"Requested Only\", false);\n+ ProdOrderCapacityNeed.SetRange(\"Routing No.\", ProdOrderRoutingLine.\"Routing No.\");\n+ ProdOrderCapacityNeed.SetRange(\"Routing Reference No.\", ProdOrderRoutingLine.\"Routing Reference No.\");\n+ ProdOrderCapacityNeed.SetRange(\"Operation No.\", ProdOrderRoutingLine.\"Operation No.\");\n+ ProdOrderCapacityNeed.DeleteAll();\n+\n+ NextCapNeedLineNo := 1;\n+\n+ ProdOrderRoutingLine.TestField(\"Work Center No.\");\n+\n+ CurrentWorkCenterNo := '';\n+ Workcenter.Get(ProdOrderRoutingLine.\"Work Center No.\");\n+ if ProdOrderRoutingLine.Type = ProdOrderRoutingLine.Type::\"Machine Center\" then begin\n+ MachineCenter.Get(ProdOrderRoutingLine.\"No.\");\n+ Workcenter.\"Queue Time\" := MachineCenter.\"Queue Time\";\n+ Workcenter.\"Queue Time Unit of Meas. Code\" := MachineCenter.\"Queue Time Unit of Meas. Code\";\n+ end;\n+ if not CalcStartEndDate then\n+ Clear(Workcenter.\"Queue Time\");\n+ ProdOrder.Get(ProdOrderRoutingLine.Status, ProdOrderRoutingLine.\"Prod. Order No.\");\n+\n+ ProdOrderQty := 0;\n+ TotalScrap := 0;\n+ TotalLotSize := 0;\n+ ProdOrderLine.SetRange(Status, ProdOrderRoutingLine.Status);\n+ ProdOrderLine.SetRange(\"Prod. Order No.\", ProdOrderRoutingLine.\"Prod. Order No.\");\n+ ProdOrderLine.SetRange(\"Routing Reference No.\", ProdOrderRoutingLine.\"Routing Reference No.\");\n+ ProdOrderLine.SetRange(\"Routing No.\", ProdOrderRoutingLine.\"Routing No.\");\n+ ProdOrderLine.SetLoadFields(\"Quantity (Base)\", \"Scrap %\", \"Prod. Order No.\", \"Line No.\", Status, \"Routing No.\", \"Routing Version Code\", \"Ending Date\", \"Ending Time\");\n+ if ProdOrderLine.Find('-') then begin\n+ ExpectedOperOutput := 0;\n+ repeat\n+ ExpectedOperOutput := ExpectedOperOutput + ProdOrderLine.\"Quantity (Base)\";\n+ TotalScrap := TotalScrap + ProdOrderLine.\"Scrap %\";\n+ until ProdOrderLine.Next() = 0;\n+ ActualOperOutput := MfgCostCalcMgt.CalcActOutputQtyBase(ProdOrderLine, ProdOrderRoutingLine);\n+ ProdOrderQty := ExpectedOperOutput - ActualOperOutput;\n+ if ProdOrderQty < 0 then\n+ ProdOrderQty := 0;\n+ end;\n+\n+ MaxLotSize :=\n+ ProdOrderQty *\n+ (1 + ProdOrderRoutingLine.\"Scrap Factor % (Accumulated)\") *\n+ (1 + TotalScrap / 100) +\n+ ProdOrderRoutingLine.\"Fixed Scrap Qty. (Accum.)\";\n+\n+ ProdOrderRoutingLine.\"Input Quantity\" := MaxLotSize;\n+\n+ if ActualOperOutput > 0 then\n+ TotalQtyPerOperation :=\n+ ExpectedOperOutput *\n+ (1 + ProdOrderRoutingLine.\"Scrap Factor % (Accumulated)\") *\n+ (1 + TotalScrap / 100) +\n+ ProdOrderRoutingLine.\"Fixed Scrap Qty. (Accum.)\"\n+ else\n+ TotalQtyPerOperation := MaxLotSize;\n+\n+ TotalCapacityPerOperation :=\n+ Round(\n+ TotalQtyPerOperation *\n+ ProdOrderRoutingLine.RunTimePer() *\n+ CalendarMgt.QtyperTimeUnitofMeasure(\n+ ProdOrderRoutingLine.\"Work Center No.\", ProdOrderRoutingLine.\"Run Time Unit of Meas. Code\"),\n+ UOMMgt.QtyRndPrecision());\n+\n+ if MfgSetup.\"Cost Incl. Setup\" then\n+ CalcCostInclSetup(ProdOrderRoutingLine, TotalCapacityPerOperation);\n+\n+ CalcExpectedCost(ProdOrderRoutingLine, TotalQtyPerOperation, TotalCapacityPerOperation);\n+\n+ if ProdOrderRoutingLine.\"Schedule Manually\" then\n+ CalculateRoutingLineFixed()\n+ else\n+ if Direction = Direction::Backward then\n+ CalcRoutingLineBack(CalcStartEndDate)\n+ else\n+ CalcRoutingLineForward(CalcStartEndDate);\n+\n+ ProdOrderRoutingLine2 := ProdOrderRoutingLine;\n+ end;\n+\n [IntegrationEvent(false, false)]\n local procedure OnAfterCalcCostInclSetup(ProdOrderRoutingLine: Record \"Prod. Order Routing Line\"; var TotalCapacityPerOperation: Decimal)\n begin\n"}
+{"metadata": {"area": "project", "image_count": 6}, "repo": "microsoftInternal/NAV", "instance_id": "microsoftInternal__NAV-214825", "base_commit": "9a03d309156dd751b1a508767c678093c9516506", "created_at": "2025-05-06", "environment_setup_version": "27.0", "project_paths": ["App\\Layers\\W1\\BaseApp", "App\\Layers\\W1\\Tests\\Job"], "FAIL_TO_PASS": [{"codeunitID": 136350, "functionName": ["CheckUnavailableItemQtyWhenAddProjectPlanningLinesBeforeThePreviousOne"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al b/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al\nindex bb7f40e246dc..8aac1963c2d5 100644\n--- a/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al\n+++ b/App/Layers/W1/Tests/Job/UTTJob.Codeunit.al\n@@ -2248,6 +2248,36 @@ codeunit 136350 \"UT T Job\"\n Assert.IsFalse(PurchaseLine.IsEmpty, 'Purchase Line not created for Job Task' + JobTask.\"Job Task No.\");\n end;\n \n+ [Test]\n+ [HandlerFunctions('CheckPurchOrderFromJobModalPageHandlerHaveLines')]\n+ procedure CheckUnavailableItemQtyWhenAddProjectPlanningLinesBeforeThePreviousOne()\n+ var\n+ Item, Item2 : Record Item;\n+ JobPlanningLines: TestPage \"Job Planning Lines\";\n+ begin\n+ // [SCENARIO 574938] Create Purchase Order from Project not working as expected if we add Project Planning Lines before the previous ones.\n+ Initialize();\n+\n+ // [GIVEN] Create 2 New Item.\n+ LibraryInventory.CreateItem(Item);\n+ LibraryInventory.CreateItem(Item2);\n+\n+ // [GIVEN] Create Job X with Job Task and 2 Job Planning Lines.\n+ CreateJobAndJobTask();\n+ CreateJobPlanningLineWithItem(JobPlanningLine.\"Line Type\"::\"Both Budget and Billable\", Item.\"No.\", LibraryRandom.RandInt(100));\n+ CreateJobPlanningLineBeforePreviousLine(JobPlanningLine.\"Line Type\"::\"Both Budget and Billable\", Item2.\"No.\", LibraryRandom.RandInt(100));\n+\n+ // [WHEN] Open Job Planning Lines.\n+ JobPlanningLines.OpenEdit();\n+ JobPlanningLines.GoToRecord(JobPlanningLine);\n+ LibraryVariableStorage.Clear();\n+ LibraryVariableStorage.Enqueue(Item.\"No.\");\n+\n+ // [WHEN] Create Purchase Order from Job Planning Lines.\n+ JobPlanningLines.CreatePurchaseOrder.Invoke();//assert check\n+ LibraryVariableStorage.AssertEmpty();\n+ end;\n+\n local procedure Initialize()\n var\n LibraryERMCountryData: Codeunit \"Library - ERM Country Data\";\n@@ -2617,6 +2647,30 @@ codeunit 136350 \"UT T Job\"\n until DefaultDimension.Next() = 0;\n end;\n \n+ local procedure CreateJobPlanningLineBeforePreviousLine(LineType: Enum \"Job Planning Line Line Type\"; ItemNo: Code[20]; Quantity: Decimal)\n+ var\n+ JobPlanLine: Record \"Job Planning Line\";\n+ LineNo: Integer;\n+ begin\n+ JobPlanLine.SetRange(\"Job No.\", JobTask.\"Job No.\");\n+ JobPlanLine.SetRange(\"Job Task No.\", JobTask.\"Job Task No.\");\n+ if JobPlanLine.FindFirst() then;\n+ LineNo := JobPlanLine.\"Line No.\" / 2;\n+ JobPlanningLine.Init();\n+ JobPlanningLine.Validate(\"Job No.\", JobTask.\"Job No.\");\n+ JobPlanningLine.Validate(\"Job Task No.\", JobTask.\"Job Task No.\");\n+ JobPlanningLine.Validate(\"Line No.\", LineNo);\n+ JobPlanningLine.Insert(true);\n+\n+ JobPlanningLine.Validate(\"Planning Date\", WorkDate());\n+ JobPlanningLine.Validate(\"Line Type\", LineType);\n+ JobPlanningLine.Validate(Type, JobPlanningLine.Type::Item);\n+ JobPlanningLine.Validate(Description, LibraryUtility.GenerateGUID());\n+ JobPlanningLine.Validate(\"No.\", ItemNo);\n+ JobPlanningLine.Validate(Quantity, Quantity);\n+ JobPlanningLine.Modify(true);\n+ end;\n+\n [EventSubscriber(ObjectType::Table, Database::\"Job\", 'OnAfterModifyEvent', '', false, false)]\n local procedure InsertNameValueBufferOnJobModify(var Rec: Record Job; var xRec: Record Job; RunTrigger: Boolean)\n var\n@@ -2730,6 +2784,13 @@ codeunit 136350 \"UT T Job\"\n PurchOrderFromSalesOrder.OK().Invoke();\n end;\n \n+ [ModalPageHandler]\n+ procedure CheckPurchOrderFromJobModalPageHandlerHaveLines(var PurchOrderFromSalesOrder: TestPage \"Purch. Order From Sales Order\")\n+ begin\n+ //[THEN] Check Purch. Order From Sales Order Page have Record.\n+ PurchOrderFromSalesOrder.\"No.\".AssertEquals(LibraryVariableStorage.DequeueText());\n+ end;\n+\n [MessageHandler]\n procedure MessageHandler(Message: Text[1024])\n var\n", "patch": "diff --git a/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al b/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al\nindex 604bb9158a26..2da4897165fb 100644\n--- a/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al\n+++ b/App/Layers/W1/BaseApp/Projects/Project/Job/PurchaseDocFromJob.Codeunit.al\n@@ -78,6 +78,7 @@ codeunit 1018 \"Purchase Doc. From Job\"\n JobPlanningLine.SetRange(\"Job Task No.\", JobTask.\"Job Task No.\");\n if JobPlanningLine.IsEmpty() then\n exit;\n+ JobPlanningLine.SetCurrentKey(\"Job Contract Entry No.\");\n JobPlanningLine.FindSet();\n RecRef.GetTable(JobPlanningLine);\n ContractEntryNoFilter := SelectionFilterMgt.GetSelectionFilter(RecRef, JobPlanningLine.FieldNo(\"Job Contract Entry No.\"));\n"}
+{"metadata": {"area": "subscription billing", "image_count": 0}, "repo": "microsoft/BCApps", "instance_id": "microsoft__BCApps-4766", "base_commit": "700d04453d3f0851ce7b7e34eb50b283f7c10e52", "created_at": "2025-09-15T15:39:32Z", "environment_setup_version": "27.0", "project_paths": ["src\\Apps\\W1\\Subscription Billing\\App", "src\\Apps\\W1\\Subscription Billing\\Test"], "FAIL_TO_PASS": [{"codeunitID": 148155, "functionName": ["ContractLineDisconnectServiceOnNoChange"]}, {"codeunitID": 148154, "functionName": ["ContractLineDisconnectServiceOnNoChange"]}], "PASS_TO_PASS": [], "test_patch": "diff --git a/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al\nindex 7e485c8c43..e945075fa8 100644\n--- a/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al\n+++ b/src/Apps/W1/Subscription Billing/Test/Customer Contracts/ContractsTest.Codeunit.al\n@@ -613,23 +613,62 @@ codeunit 148155 \"Contracts Test\"\n CustomerContractLine: Record \"Cust. Sub. Contract Line\";\n ServiceCommitment: Record \"Subscription Line\";\n ServiceObject: Record \"Subscription Header\";\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after Type has changed.', Locked = true;\n EntryNo: Integer;\n begin\n- // Test: Subscription Line should be disconnected from the contract when the line type changes\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the line type changes\n Initialize();\n \n+ // [GIVEN] A customer contract with a connected Subscription Line\n SetupNewContract(false, ServiceObject, CustomerContract);\n \n- CustomerContractLine.Reset();\n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n CustomerContractLine.SetRange(\"Subscription Contract No.\", CustomerContract.\"No.\");\n CustomerContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n CustomerContractLine.SetFilter(\"Subscription Header No.\", '<>%1', '');\n CustomerContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n CustomerContractLine.FindFirst();\n EntryNo := CustomerContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The contract line type is changed from Item to Comment\n CustomerContractLine.Validate(\"Contract Line Type\", CustomerContractLine.\"Contract Line Type\"::Comment);\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n+ ServiceCommitment.Get(EntryNo);\n+ Assert.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n+ end;\n+\n+ [Test]\n+ [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]\n+ procedure ContractLineDisconnectServiceOnNoChange()\n+ var\n+ CustomerContract: Record \"Customer Subscription Contract\";\n+ CustomerContractLine: Record \"Cust. Sub. Contract Line\";\n+ ServiceCommitment: Record \"Subscription Line\";\n+ ServiceObject: Record \"Subscription Header\";\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after No. has changed.', Locked = true;\n+ EntryNo: Integer;\n+ begin\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the Item No. is cleared\n+ Initialize();\n+\n+ // [GIVEN] A customer contract with a connected Subscription Line\n+ SetupNewContract(false, ServiceObject, CustomerContract);\n+\n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n+ CustomerContractLine.SetRange(\"Subscription Contract No.\", CustomerContract.\"No.\");\n+ CustomerContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n+ CustomerContractLine.SetFilter(\"Subscription Header No.\", '<>%1', '');\n+ CustomerContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n+ CustomerContractLine.FindFirst();\n+ EntryNo := CustomerContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The Item No. is cleared on the contract line\n+ CustomerContractLine.Validate(\"No.\", '');\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n ServiceCommitment.Get(EntryNo);\n- ServiceCommitment.TestField(\"Subscription Contract No.\", '');\n+ Assert.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n end;\n \n [Test]\ndiff --git a/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al b/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al\nindex c47f577102..b827f99217 100644\n--- a/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al\n+++ b/src/Apps/W1/Subscription Billing/Test/Vendor Contracts/VendorContractsTest.Codeunit.al\n@@ -338,11 +338,15 @@ codeunit 148154 \"Vendor Contracts Test\"\n procedure ContractLineDisconnectServiceOnTypeChange()\n var\n EntryNo: Integer;\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after Type has changed.', Locked = true;\n begin\n- // Test: Subscription Line should be disconnected from the contract when the line type changes\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the line type changes\n Initialize();\n+\n+ // [GIVEN] A vendor contract with a connected Subscription Line\n SetupNewContract(false);\n \n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n VendorContractLine.Reset();\n VendorContractLine.SetRange(\"Subscription Contract No.\", VendorContract.\"No.\");\n VendorContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n@@ -350,9 +354,43 @@ codeunit 148154 \"Vendor Contracts Test\"\n VendorContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n VendorContractLine.FindFirst();\n EntryNo := VendorContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The contract line type is changed from Item to Comment\n VendorContractLine.Validate(\"Contract Line Type\", VendorContractLine.\"Contract Line Type\"::Comment);\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n+ ServiceCommitment.Get(EntryNo);\n+ AssertThat.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n+ end;\n+\n+ [Test]\n+ [HandlerFunctions('ExchangeRateSelectionModalPageHandler,MessageHandler')]\n+ procedure ContractLineDisconnectServiceOnNoChange()\n+ var\n+ EntryNo: Integer;\n+ SubscriptionLineDisconnectErr: Label 'Subscription Line should be disconnected from the contract after No. has changed.', Locked = true;\n+ begin\n+ // [SCENARIO] Subscription Line should be disconnected from the contract when the Item No. is cleared\n+ Initialize();\n+\n+ // [GIVEN] A vendor contract with a connected Subscription Line\n+ SetupNewContract(false);\n+\n+ // [GIVEN] Find a contract line that has a connected Subscription Line\n+ VendorContractLine.Reset();\n+ VendorContractLine.SetRange(\"Subscription Contract No.\", VendorContract.\"No.\");\n+ VendorContractLine.SetRange(\"Contract Line Type\", Enum::\"Contract Line Type\"::Item);\n+ VendorContractLine.SetFilter(\"Subscription Header No.\", '<>%1', '');\n+ VendorContractLine.SetFilter(\"Subscription Line Entry No.\", '<>%1', 0);\n+ VendorContractLine.FindFirst();\n+ EntryNo := VendorContractLine.\"Subscription Line Entry No.\";\n+\n+ // [WHEN] The Item No. is cleared on the contract line\n+ VendorContractLine.Validate(\"No.\", '');\n+\n+ // [THEN] The Subscription Line should be disconnected from the contract\n ServiceCommitment.Get(EntryNo);\n- ServiceCommitment.TestField(\"Subscription Contract No.\", '');\n+ AssertThat.AreEqual('', ServiceCommitment.\"Subscription Contract No.\", SubscriptionLineDisconnectErr);\n end;\n \n [Test]\n", "patch": "diff --git a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al\nindex 91f83b18b3..a092d10f19 100644\n--- a/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al\n+++ b/src/Apps/W1/Subscription Billing/App/Customer Contracts/Tables/CustSubContractLine.Table.al\n@@ -49,23 +49,25 @@ table 8062 \"Cust. Sub. Contract Line\"\n GLAccount: Record \"G/L Account\";\n TempCustomerContractLine: Record \"Cust. Sub. Contract Line\" temporary;\n begin\n- case \"Contract Line Type\" of\n- \"Contract Line Type\"::Item:\n- begin\n- if not Item.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n- if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n- Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n- end;\n- \"Contract Line Type\"::\"G/L Account\":\n- begin\n- if not GLAccount.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n- if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n- Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n- end;\n- end;\n+ if \"No.\" <> '' then\n+ case \"Contract Line Type\" of\n+ \"Contract Line Type\"::Item:\n+ begin\n+ if not Item.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n+ if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n+ Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n+ end;\n+ \"Contract Line Type\"::\"G/L Account\":\n+ begin\n+ if not GLAccount.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n+ if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n+ Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n+ end;\n+ end;\n \n+ CheckAndDisconnectContractLine();\n TempCustomerContractLine := Rec;\n Init();\n SystemId := TempCustomerContractLine.SystemId;\n@@ -170,6 +172,8 @@ table 8062 \"Cust. Sub. Contract Line\"\n ServiceObject: Record \"Subscription Header\";\n ServiceCommitment: Record \"Subscription Line\";\n begin\n+ if \"No.\" = '' then\n+ exit;\n CustomerContract.Get(\"Subscription Contract No.\");\n ServiceObject.InitForSourceNo(\"Contract Line Type\", \"No.\");\n ServiceObject.UpdateCustomerDataFromCustomerContract(CustomerContract);\ndiff --git a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al\nindex 533581b5a2..38ecf0e9c3 100644\n--- a/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al\n+++ b/src/Apps/W1/Subscription Billing/App/Vendor Contracts/Tables/VendSubContractLine.Table.al\n@@ -46,23 +46,25 @@ table 8065 \"Vend. Sub. Contract Line\"\n GLAccount: Record \"G/L Account\";\n TempVendorContractLine: Record \"Vend. Sub. Contract Line\" temporary;\n begin\n- case \"Contract Line Type\" of\n- \"Contract Line Type\"::Item:\n- begin\n- if not Item.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n- if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n- Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n- end;\n- \"Contract Line Type\"::\"G/L Account\":\n- begin\n- if not GLAccount.Get(\"No.\") then\n- Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n- if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n- Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n- end;\n- end;\n+ if \"No.\" <> '' then\n+ case \"Contract Line Type\" of\n+ \"Contract Line Type\"::Item:\n+ begin\n+ if not Item.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, Item.TableCaption, \"No.\");\n+ if Item.Blocked or Item.\"Subscription Option\" in [\"Item Service Commitment Type\"::\"Sales without Service Commitment\", \"Item Service Commitment Type\"::\"Sales without Service Commitment\"] then\n+ Error(ItemBlockedOrWithoutServiceCommitmentsErr, \"No.\");\n+ end;\n+ \"Contract Line Type\"::\"G/L Account\":\n+ begin\n+ if not GLAccount.Get(\"No.\") then\n+ Error(EntityDoesNotExistErr, GLAccount.TableCaption, \"No.\");\n+ if GLAccount.Blocked or not GLAccount.\"Direct Posting\" or (GLAccount.\"Account Type\" <> GLAccount.\"Account Type\"::Posting) then\n+ Error(GLAccountBlockedOrNotForDirectPostingErr, \"No.\");\n+ end;\n+ end;\n \n+ CheckAndDisconnectContractLine();\n TempVendorContractLine := Rec;\n Init();\n SystemId := TempVendorContractLine.SystemId;\n@@ -161,6 +163,8 @@ table 8065 \"Vend. Sub. Contract Line\"\n ServiceObject: Record \"Subscription Header\";\n ServiceCommitment: Record \"Subscription Line\";\n begin\n+ if \"No.\" = '' then\n+ exit;\n VendorContract.Get(\"Subscription Contract No.\");\n ServiceObject.InitForSourceNo(\"Contract Line Type\", \"No.\");\n ServiceObject.\"Created in Contract line\" := true;\n"}
diff --git a/src/bcbench/commands/dataset.py b/src/bcbench/commands/dataset.py
index b60d498c0..ad147dfc7 100644
--- a/src/bcbench/commands/dataset.py
+++ b/src/bcbench/commands/dataset.py
@@ -154,3 +154,65 @@ def _write_github_output(key: str, value: str) -> None:
raise ConfigurationError("GITHUB_OUTPUT environment variable not set. This feature is only available when running in GitHub Actions.")
with open(config.env.github_output, "a", encoding="utf-8") as f:
f.write(f"{key}={value}\n")
+
+
+@dataset_app.command("update-metadata")
+def update_metadata(
+ dataset_path: DatasetPath = _config.paths.dataset_path,
+ dry_run: Annotated[bool, typer.Option(help="Print changes without writing to file")] = False,
+):
+ """Update metadata fields (e.g., image_count) for all dataset entries."""
+ from pathlib import Path
+
+ from rich.console import Console
+ from rich.table import Table
+
+ console = Console()
+ entries = load_dataset_entries(dataset_path)
+
+ updated_entries: list[dict] = []
+ changes: list[tuple[str, int | None, int | None]] = []
+
+ for entry in entries:
+ # Count images in problem statement directory
+ new_image_count = entry.count_images()
+ old_image_count = entry.metadata.image_count
+
+ # Create updated entry dict
+ entry_dict = entry.model_dump(by_alias=True, mode="json")
+
+ # Update metadata with new image_count
+ entry_dict["metadata"]["image_count"] = new_image_count
+ updated_entries.append(entry_dict)
+
+ # Track changes
+ if old_image_count != new_image_count:
+ changes.append((entry.instance_id, old_image_count, new_image_count))
+
+ # Display changes
+ if changes:
+ table = Table(title="Metadata Updates")
+ table.add_column("Instance ID", style="cyan")
+ table.add_column("Old image_count", style="red")
+ table.add_column("New image_count", style="green")
+
+ for instance_id, old_count, new_count in changes:
+ table.add_row(instance_id, str(old_count), str(new_count))
+
+ console.print(table)
+ console.print(f"\n[bold]Total entries with changes: {len(changes)}[/bold]")
+ else:
+ console.print("[green]No changes needed - all metadata is up to date.[/green]")
+
+ if dry_run:
+ console.print("[yellow]Dry run - no changes written.[/yellow]")
+ return
+
+ # Write updated entries back to file
+ output_path = Path(dataset_path)
+ with output_path.open("w", encoding="utf-8") as f:
+ for entry_dict in updated_entries:
+ json.dump(entry_dict, f, ensure_ascii=False)
+ f.write("\n")
+
+ console.print(f"[green]Updated {len(updated_entries)} entries in {dataset_path}[/green]")
diff --git a/src/bcbench/dataset/__init__.py b/src/bcbench/dataset/__init__.py
index fbe6e70e8..27bf50000 100644
--- a/src/bcbench/dataset/__init__.py
+++ b/src/bcbench/dataset/__init__.py
@@ -1,10 +1,11 @@
"""Dataset module for querying, validating and analyze dataset entries."""
-from bcbench.dataset.dataset_entry import DatasetEntry, TestEntry
+from bcbench.dataset.dataset_entry import DatasetEntry, TestEntry, count_images_in_directory
from bcbench.dataset.dataset_loader import load_dataset_entries
__all__ = [
"DatasetEntry",
"TestEntry",
+ "count_images_in_directory",
"load_dataset_entries",
]
diff --git a/src/bcbench/dataset/dataset_entry.py b/src/bcbench/dataset/dataset_entry.py
index f5c3a0df0..f6d47cb52 100644
--- a/src/bcbench/dataset/dataset_entry.py
+++ b/src/bcbench/dataset/dataset_entry.py
@@ -11,7 +11,7 @@
_config = get_config()
-__all__ = ["DatasetEntry", "TestEntry"]
+__all__ = ["IMAGE_EXTENSIONS", "DatasetEntry", "TestEntry", "count_images_in_directory"]
class TestEntry(BaseModel):
@@ -25,6 +25,7 @@ class EntryMetadata(BaseModel):
model_config = ConfigDict(frozen=True)
area: str | None = None
+ image_count: int | None = None
class DatasetEntry(BaseModel):
@@ -103,3 +104,30 @@ def extract_project_name(self) -> str:
# Fallback to the last meaningful part
return parts[-1] if parts else ""
+
+ def count_images(self) -> int | None:
+ """Count the number of image files in the problem statement directory.
+
+ Returns:
+ The count of image files, or None if the directory doesn't exist.
+ """
+ return count_images_in_directory(self.problem_statement_dir)
+
+
+# Image file extensions to count
+IMAGE_EXTENSIONS = frozenset({".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"})
+
+
+def count_images_in_directory(directory: Path) -> int | None:
+ """Count the number of image files in a directory.
+
+ Args:
+ directory: The directory to search for images.
+
+ Returns:
+ The count of image files, or None if the directory doesn't exist.
+ """
+ if not directory.exists():
+ return None
+
+ return sum(1 for f in directory.iterdir() if f.is_file() and f.suffix.lower() in IMAGE_EXTENSIONS)
diff --git a/tests/test_image_count.py b/tests/test_image_count.py
new file mode 100644
index 000000000..3a788649b
--- /dev/null
+++ b/tests/test_image_count.py
@@ -0,0 +1,107 @@
+from pathlib import Path
+from unittest.mock import patch
+
+from bcbench.dataset.dataset_entry import IMAGE_EXTENSIONS, count_images_in_directory
+from tests.conftest import create_dataset_entry, create_problem_statement_dir
+
+
+class TestCountImagesInDirectory:
+ def test_returns_none_for_nonexistent_directory(self, tmp_path: Path):
+ nonexistent = tmp_path / "does_not_exist"
+ result = count_images_in_directory(nonexistent)
+ assert result is None
+
+ def test_returns_zero_for_empty_directory(self, tmp_path: Path):
+ empty_dir = tmp_path / "empty"
+ empty_dir.mkdir()
+ result = count_images_in_directory(empty_dir)
+ assert result == 0
+
+ def test_returns_zero_for_directory_with_no_images(self, tmp_path: Path):
+ dir_with_files = tmp_path / "files"
+ dir_with_files.mkdir()
+ (dir_with_files / "README.md").write_text("# Test")
+ (dir_with_files / "data.json").write_text("{}")
+ result = count_images_in_directory(dir_with_files)
+ assert result == 0
+
+ def test_counts_png_files(self, tmp_path: Path):
+ dir_with_images = tmp_path / "images"
+ dir_with_images.mkdir()
+ (dir_with_images / "image1.png").write_bytes(b"fake png")
+ (dir_with_images / "image2.png").write_bytes(b"fake png")
+ result = count_images_in_directory(dir_with_images)
+ assert result == 2
+
+ def test_counts_various_image_extensions(self, tmp_path: Path):
+ dir_with_images = tmp_path / "images"
+ dir_with_images.mkdir()
+ (dir_with_images / "photo.jpg").write_bytes(b"fake jpg")
+ (dir_with_images / "screenshot.jpeg").write_bytes(b"fake jpeg")
+ (dir_with_images / "diagram.png").write_bytes(b"fake png")
+ (dir_with_images / "animation.gif").write_bytes(b"fake gif")
+ (dir_with_images / "icon.webp").write_bytes(b"fake webp")
+ result = count_images_in_directory(dir_with_images)
+ assert result == 5
+
+ def test_ignores_non_image_files(self, tmp_path: Path):
+ dir_with_mixed = tmp_path / "mixed"
+ dir_with_mixed.mkdir()
+ (dir_with_mixed / "image.png").write_bytes(b"fake png")
+ (dir_with_mixed / "README.md").write_text("# Test")
+ (dir_with_mixed / "data.txt").write_text("data")
+ result = count_images_in_directory(dir_with_mixed)
+ assert result == 1
+
+ def test_case_insensitive_extensions(self, tmp_path: Path):
+ dir_with_images = tmp_path / "images"
+ dir_with_images.mkdir()
+ (dir_with_images / "image1.PNG").write_bytes(b"fake png")
+ (dir_with_images / "image2.Jpg").write_bytes(b"fake jpg")
+ (dir_with_images / "image3.JPEG").write_bytes(b"fake jpeg")
+ result = count_images_in_directory(dir_with_images)
+ assert result == 3
+
+
+class TestDatasetEntryCountImages:
+ def test_count_images_returns_count_from_problem_statement_dir(self, tmp_path: Path):
+ problem_dir = create_problem_statement_dir(tmp_path)
+ (problem_dir / "screenshot.png").write_bytes(b"fake png")
+ (problem_dir / "diagram.jpg").write_bytes(b"fake jpg")
+
+ entry = create_dataset_entry()
+
+ with patch.object(type(entry), "problem_statement_dir", property(lambda self: problem_dir)):
+ result = entry.count_images()
+
+ assert result == 2
+
+ def test_count_images_returns_none_for_missing_directory(self, tmp_path: Path):
+ nonexistent_dir = tmp_path / "nonexistent"
+ entry = create_dataset_entry()
+
+ with patch.object(type(entry), "problem_statement_dir", property(lambda self: nonexistent_dir)):
+ result = entry.count_images()
+
+ assert result is None
+
+ def test_count_images_returns_zero_for_directory_with_no_images(self, tmp_path: Path):
+ problem_dir = create_problem_statement_dir(tmp_path)
+ entry = create_dataset_entry()
+
+ with patch.object(type(entry), "problem_statement_dir", property(lambda self: problem_dir)):
+ result = entry.count_images()
+
+ # problem_statement_dir has README.md by default
+ assert result == 0
+
+
+class TestImageExtensionsConstant:
+ def test_contains_common_image_extensions(self):
+ assert ".png" in IMAGE_EXTENSIONS
+ assert ".jpg" in IMAGE_EXTENSIONS
+ assert ".jpeg" in IMAGE_EXTENSIONS
+ assert ".gif" in IMAGE_EXTENSIONS
+ assert ".webp" in IMAGE_EXTENSIONS
+ assert ".bmp" in IMAGE_EXTENSIONS
+ assert ".svg" in IMAGE_EXTENSIONS
From 0fb6cb3f522181976c733ea950e5e457b2934216 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Fri, 12 Dec 2025 17:17:46 +0000
Subject: [PATCH 3/6] Address code review feedback: move constant, remove
unused import, add type annotation
Co-authored-by: haoranpb <27280733+haoranpb@users.noreply.github.com>
---
src/bcbench/commands/dataset.py | 7 +++----
src/bcbench/dataset/dataset_entry.py | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/bcbench/commands/dataset.py b/src/bcbench/commands/dataset.py
index ad147dfc7..5ff7a78f5 100644
--- a/src/bcbench/commands/dataset.py
+++ b/src/bcbench/commands/dataset.py
@@ -162,7 +162,7 @@ def update_metadata(
dry_run: Annotated[bool, typer.Option(help="Print changes without writing to file")] = False,
):
"""Update metadata fields (e.g., image_count) for all dataset entries."""
- from pathlib import Path
+ from typing import Any
from rich.console import Console
from rich.table import Table
@@ -170,7 +170,7 @@ def update_metadata(
console = Console()
entries = load_dataset_entries(dataset_path)
- updated_entries: list[dict] = []
+ updated_entries: list[dict[str, Any]] = []
changes: list[tuple[str, int | None, int | None]] = []
for entry in entries:
@@ -209,8 +209,7 @@ def update_metadata(
return
# Write updated entries back to file
- output_path = Path(dataset_path)
- with output_path.open("w", encoding="utf-8") as f:
+ with dataset_path.open("w", encoding="utf-8") as f:
for entry_dict in updated_entries:
json.dump(entry_dict, f, ensure_ascii=False)
f.write("\n")
diff --git a/src/bcbench/dataset/dataset_entry.py b/src/bcbench/dataset/dataset_entry.py
index f6d47cb52..7f0fa8301 100644
--- a/src/bcbench/dataset/dataset_entry.py
+++ b/src/bcbench/dataset/dataset_entry.py
@@ -13,6 +13,9 @@
__all__ = ["IMAGE_EXTENSIONS", "DatasetEntry", "TestEntry", "count_images_in_directory"]
+# Image file extensions to count
+IMAGE_EXTENSIONS = frozenset({".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"})
+
class TestEntry(BaseModel):
model_config = ConfigDict(frozen=True)
@@ -114,10 +117,6 @@ def count_images(self) -> int | None:
return count_images_in_directory(self.problem_statement_dir)
-# Image file extensions to count
-IMAGE_EXTENSIONS = frozenset({".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"})
-
-
def count_images_in_directory(directory: Path) -> int | None:
"""Count the number of image files in a directory.
From 189fee48f1a7b0e17000d64ebd83fb15857f960b Mon Sep 17 00:00:00 2001
From: "Haoran Sun (Business Central)"
Date: Fri, 12 Dec 2025 20:09:10 +0100
Subject: [PATCH 4/6] remove update logic
---
src/bcbench/commands/dataset.py | 61 ---------------
src/bcbench/dataset/__init__.py | 3 +-
src/bcbench/dataset/dataset_entry.py | 28 +------
tests/test_image_count.py | 107 ---------------------------
4 files changed, 2 insertions(+), 197 deletions(-)
delete mode 100644 tests/test_image_count.py
diff --git a/src/bcbench/commands/dataset.py b/src/bcbench/commands/dataset.py
index 5ff7a78f5..b60d498c0 100644
--- a/src/bcbench/commands/dataset.py
+++ b/src/bcbench/commands/dataset.py
@@ -154,64 +154,3 @@ def _write_github_output(key: str, value: str) -> None:
raise ConfigurationError("GITHUB_OUTPUT environment variable not set. This feature is only available when running in GitHub Actions.")
with open(config.env.github_output, "a", encoding="utf-8") as f:
f.write(f"{key}={value}\n")
-
-
-@dataset_app.command("update-metadata")
-def update_metadata(
- dataset_path: DatasetPath = _config.paths.dataset_path,
- dry_run: Annotated[bool, typer.Option(help="Print changes without writing to file")] = False,
-):
- """Update metadata fields (e.g., image_count) for all dataset entries."""
- from typing import Any
-
- from rich.console import Console
- from rich.table import Table
-
- console = Console()
- entries = load_dataset_entries(dataset_path)
-
- updated_entries: list[dict[str, Any]] = []
- changes: list[tuple[str, int | None, int | None]] = []
-
- for entry in entries:
- # Count images in problem statement directory
- new_image_count = entry.count_images()
- old_image_count = entry.metadata.image_count
-
- # Create updated entry dict
- entry_dict = entry.model_dump(by_alias=True, mode="json")
-
- # Update metadata with new image_count
- entry_dict["metadata"]["image_count"] = new_image_count
- updated_entries.append(entry_dict)
-
- # Track changes
- if old_image_count != new_image_count:
- changes.append((entry.instance_id, old_image_count, new_image_count))
-
- # Display changes
- if changes:
- table = Table(title="Metadata Updates")
- table.add_column("Instance ID", style="cyan")
- table.add_column("Old image_count", style="red")
- table.add_column("New image_count", style="green")
-
- for instance_id, old_count, new_count in changes:
- table.add_row(instance_id, str(old_count), str(new_count))
-
- console.print(table)
- console.print(f"\n[bold]Total entries with changes: {len(changes)}[/bold]")
- else:
- console.print("[green]No changes needed - all metadata is up to date.[/green]")
-
- if dry_run:
- console.print("[yellow]Dry run - no changes written.[/yellow]")
- return
-
- # Write updated entries back to file
- with dataset_path.open("w", encoding="utf-8") as f:
- for entry_dict in updated_entries:
- json.dump(entry_dict, f, ensure_ascii=False)
- f.write("\n")
-
- console.print(f"[green]Updated {len(updated_entries)} entries in {dataset_path}[/green]")
diff --git a/src/bcbench/dataset/__init__.py b/src/bcbench/dataset/__init__.py
index 27bf50000..fbe6e70e8 100644
--- a/src/bcbench/dataset/__init__.py
+++ b/src/bcbench/dataset/__init__.py
@@ -1,11 +1,10 @@
"""Dataset module for querying, validating and analyze dataset entries."""
-from bcbench.dataset.dataset_entry import DatasetEntry, TestEntry, count_images_in_directory
+from bcbench.dataset.dataset_entry import DatasetEntry, TestEntry
from bcbench.dataset.dataset_loader import load_dataset_entries
__all__ = [
"DatasetEntry",
"TestEntry",
- "count_images_in_directory",
"load_dataset_entries",
]
diff --git a/src/bcbench/dataset/dataset_entry.py b/src/bcbench/dataset/dataset_entry.py
index 7f0fa8301..10e1444b4 100644
--- a/src/bcbench/dataset/dataset_entry.py
+++ b/src/bcbench/dataset/dataset_entry.py
@@ -11,10 +11,7 @@
_config = get_config()
-__all__ = ["IMAGE_EXTENSIONS", "DatasetEntry", "TestEntry", "count_images_in_directory"]
-
-# Image file extensions to count
-IMAGE_EXTENSIONS = frozenset({".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"})
+__all__ = ["DatasetEntry", "TestEntry"]
class TestEntry(BaseModel):
@@ -107,26 +104,3 @@ def extract_project_name(self) -> str:
# Fallback to the last meaningful part
return parts[-1] if parts else ""
-
- def count_images(self) -> int | None:
- """Count the number of image files in the problem statement directory.
-
- Returns:
- The count of image files, or None if the directory doesn't exist.
- """
- return count_images_in_directory(self.problem_statement_dir)
-
-
-def count_images_in_directory(directory: Path) -> int | None:
- """Count the number of image files in a directory.
-
- Args:
- directory: The directory to search for images.
-
- Returns:
- The count of image files, or None if the directory doesn't exist.
- """
- if not directory.exists():
- return None
-
- return sum(1 for f in directory.iterdir() if f.is_file() and f.suffix.lower() in IMAGE_EXTENSIONS)
diff --git a/tests/test_image_count.py b/tests/test_image_count.py
deleted file mode 100644
index 3a788649b..000000000
--- a/tests/test_image_count.py
+++ /dev/null
@@ -1,107 +0,0 @@
-from pathlib import Path
-from unittest.mock import patch
-
-from bcbench.dataset.dataset_entry import IMAGE_EXTENSIONS, count_images_in_directory
-from tests.conftest import create_dataset_entry, create_problem_statement_dir
-
-
-class TestCountImagesInDirectory:
- def test_returns_none_for_nonexistent_directory(self, tmp_path: Path):
- nonexistent = tmp_path / "does_not_exist"
- result = count_images_in_directory(nonexistent)
- assert result is None
-
- def test_returns_zero_for_empty_directory(self, tmp_path: Path):
- empty_dir = tmp_path / "empty"
- empty_dir.mkdir()
- result = count_images_in_directory(empty_dir)
- assert result == 0
-
- def test_returns_zero_for_directory_with_no_images(self, tmp_path: Path):
- dir_with_files = tmp_path / "files"
- dir_with_files.mkdir()
- (dir_with_files / "README.md").write_text("# Test")
- (dir_with_files / "data.json").write_text("{}")
- result = count_images_in_directory(dir_with_files)
- assert result == 0
-
- def test_counts_png_files(self, tmp_path: Path):
- dir_with_images = tmp_path / "images"
- dir_with_images.mkdir()
- (dir_with_images / "image1.png").write_bytes(b"fake png")
- (dir_with_images / "image2.png").write_bytes(b"fake png")
- result = count_images_in_directory(dir_with_images)
- assert result == 2
-
- def test_counts_various_image_extensions(self, tmp_path: Path):
- dir_with_images = tmp_path / "images"
- dir_with_images.mkdir()
- (dir_with_images / "photo.jpg").write_bytes(b"fake jpg")
- (dir_with_images / "screenshot.jpeg").write_bytes(b"fake jpeg")
- (dir_with_images / "diagram.png").write_bytes(b"fake png")
- (dir_with_images / "animation.gif").write_bytes(b"fake gif")
- (dir_with_images / "icon.webp").write_bytes(b"fake webp")
- result = count_images_in_directory(dir_with_images)
- assert result == 5
-
- def test_ignores_non_image_files(self, tmp_path: Path):
- dir_with_mixed = tmp_path / "mixed"
- dir_with_mixed.mkdir()
- (dir_with_mixed / "image.png").write_bytes(b"fake png")
- (dir_with_mixed / "README.md").write_text("# Test")
- (dir_with_mixed / "data.txt").write_text("data")
- result = count_images_in_directory(dir_with_mixed)
- assert result == 1
-
- def test_case_insensitive_extensions(self, tmp_path: Path):
- dir_with_images = tmp_path / "images"
- dir_with_images.mkdir()
- (dir_with_images / "image1.PNG").write_bytes(b"fake png")
- (dir_with_images / "image2.Jpg").write_bytes(b"fake jpg")
- (dir_with_images / "image3.JPEG").write_bytes(b"fake jpeg")
- result = count_images_in_directory(dir_with_images)
- assert result == 3
-
-
-class TestDatasetEntryCountImages:
- def test_count_images_returns_count_from_problem_statement_dir(self, tmp_path: Path):
- problem_dir = create_problem_statement_dir(tmp_path)
- (problem_dir / "screenshot.png").write_bytes(b"fake png")
- (problem_dir / "diagram.jpg").write_bytes(b"fake jpg")
-
- entry = create_dataset_entry()
-
- with patch.object(type(entry), "problem_statement_dir", property(lambda self: problem_dir)):
- result = entry.count_images()
-
- assert result == 2
-
- def test_count_images_returns_none_for_missing_directory(self, tmp_path: Path):
- nonexistent_dir = tmp_path / "nonexistent"
- entry = create_dataset_entry()
-
- with patch.object(type(entry), "problem_statement_dir", property(lambda self: nonexistent_dir)):
- result = entry.count_images()
-
- assert result is None
-
- def test_count_images_returns_zero_for_directory_with_no_images(self, tmp_path: Path):
- problem_dir = create_problem_statement_dir(tmp_path)
- entry = create_dataset_entry()
-
- with patch.object(type(entry), "problem_statement_dir", property(lambda self: problem_dir)):
- result = entry.count_images()
-
- # problem_statement_dir has README.md by default
- assert result == 0
-
-
-class TestImageExtensionsConstant:
- def test_contains_common_image_extensions(self):
- assert ".png" in IMAGE_EXTENSIONS
- assert ".jpg" in IMAGE_EXTENSIONS
- assert ".jpeg" in IMAGE_EXTENSIONS
- assert ".gif" in IMAGE_EXTENSIONS
- assert ".webp" in IMAGE_EXTENSIONS
- assert ".bmp" in IMAGE_EXTENSIONS
- assert ".svg" in IMAGE_EXTENSIONS
From 8b245c54b73794be632e9f1d4c3a53d40067253d Mon Sep 17 00:00:00 2001
From: "Haoran Sun (Business Central)"
Date: Fri, 12 Dec 2025 20:21:18 +0100
Subject: [PATCH 5/6] --all-extras do not include --all-groups
---
.github/actions/setup-python-uv/action.yml | 2 +-
.github/workflows/copilot-setup-steps.yml | 6 ++--
notebooks/dataset.ipynb | 32 ++++++++++++++++++++++
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/.github/actions/setup-python-uv/action.yml b/.github/actions/setup-python-uv/action.yml
index 7f5170fe7..6cba597ab 100644
--- a/.github/actions/setup-python-uv/action.yml
+++ b/.github/actions/setup-python-uv/action.yml
@@ -20,5 +20,5 @@ runs:
shell: pwsh
- name: Install bcbench package
- run: uv sync --no-group analysis ${{ inputs.all-extras == 'true' && '--all-extras' || '' }}
+ run: uv sync ${{ inputs.all-extras == 'true' && '--all-extras' || '' }}
shell: pwsh
diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml
index dd3b9cdb1..d4dcdecdb 100644
--- a/.github/workflows/copilot-setup-steps.yml
+++ b/.github/workflows/copilot-setup-steps.yml
@@ -11,10 +11,10 @@ on:
paths: [".github/workflows/copilot-setup-steps.yml"]
jobs:
- copilot-setup-steps: # The job MUST be called this
+ copilot-setup-steps: # The job MUST be called this
runs-on: ubuntu-latest
permissions:
- contents: read # Needed for checkout
+ contents: read # Needed for checkout
steps:
- name: Checkout code
@@ -29,7 +29,7 @@ jobs:
run: uv python install
- name: Install bcbench package with all dependencies
- run: uv sync --all-extras
+ run: uv sync --all-groups
- name: Install pre-commit hooks
run: uv run pre-commit install
diff --git a/notebooks/dataset.ipynb b/notebooks/dataset.ipynb
index bbb5b6fb4..b8f4d1fff 100644
--- a/notebooks/dataset.ipynb
+++ b/notebooks/dataset.ipynb
@@ -188,6 +188,38 @@
"\n",
"print(f\"Solution requires ~{mean(lines_of_code_changed):.1f} LoC across ~{mean(files_changed):.1f} files on average\")"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b7e4e23b",
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "",
+ "evalue": "",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31mRunning cells with 'bcbench (Python 3.13.7)' requires the ipykernel package.\n",
+ "\u001b[1;31mInstall 'ipykernel' into the Python environment. \n",
+ "\u001b[1;31mCommand: 'c:/depot/BC-Bench/.venv/Scripts/python.exe -m pip install ipykernel -U --force-reinstall'"
+ ]
+ }
+ ],
+ "source": [
+ "image_counts: list[int] = [entry.metadata.image_count or 0 for entry in bcbench_dataset]\n",
+ "\n",
+ "bins = [0, 1, 2, 3, 5, 10, float(\"inf\")]\n",
+ "labels = [\"0\", \"1\", \"2\", \"3-5\", \"6-10\", \"10+\"]\n",
+ "bucketed = pd.cut(image_counts, bins=bins, labels=labels, right=False)\n",
+ "\n",
+ "image_count_df = pd.DataFrame({\"Bucket\": bucketed}).value_counts().reset_index(name=\"Count\")\n",
+ "image_count_df = image_count_df.sort_values(\"Bucket\")\n",
+ "image_count_df[\"Percentage\"] = (image_count_df[\"Count\"] / image_count_df[\"Count\"].sum() * 100).round(1)\n",
+ "\n",
+ "print(\"Image Count Distribution:\")\n",
+ "print(image_count_df.to_string(index=False))"
+ ]
}
],
"metadata": {
From 2edc6d321e7c3e4cad371b1f2cc1fa5662daeb60 Mon Sep 17 00:00:00 2001
From: "Haoran Sun (Business Central)"
Date: Fri, 12 Dec 2025 20:28:08 +0100
Subject: [PATCH 6/6] include image count distribution
---
notebooks/dataset.ipynb | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/notebooks/dataset.ipynb b/notebooks/dataset.ipynb
index b8f4d1fff..72a39ff9b 100644
--- a/notebooks/dataset.ipynb
+++ b/notebooks/dataset.ipynb
@@ -143,7 +143,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Bucket Count Percentage\n",
+ " LoC Count Percentage\n",
" 1-5 22 40.0\n",
" 6-10 6 10.9\n",
" 11-20 10 18.2\n",
@@ -160,8 +160,8 @@
"labels = [\"1-5\", \"6-10\", \"11-20\", \"21-50\", \"51-100\", \"100+\"]\n",
"bucketed = pd.cut(lines_of_code_changed, bins=bins, labels=labels)\n",
"\n",
- "lines_of_code_changed_df = pd.DataFrame({\"Bucket\": bucketed}).value_counts().reset_index(name=\"Count\")\n",
- "lines_of_code_changed_df = lines_of_code_changed_df.sort_values(\"Bucket\")\n",
+ "lines_of_code_changed_df = pd.DataFrame({\"LoC\": bucketed}).value_counts().reset_index(name=\"Count\")\n",
+ "lines_of_code_changed_df = lines_of_code_changed_df.sort_values(\"LoC\")\n",
"lines_of_code_changed_df[\"Percentage\"] = (lines_of_code_changed_df[\"Count\"] / lines_of_code_changed_df[\"Count\"].sum() * 100).round(1)\n",
"\n",
"print(lines_of_code_changed_df.to_string(index=False))"
@@ -191,33 +191,33 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"id": "b7e4e23b",
"metadata": {},
"outputs": [
{
- "ename": "",
- "evalue": "",
- "output_type": "error",
- "traceback": [
- "\u001b[1;31mRunning cells with 'bcbench (Python 3.13.7)' requires the ipykernel package.\n",
- "\u001b[1;31mInstall 'ipykernel' into the Python environment. \n",
- "\u001b[1;31mCommand: 'c:/depot/BC-Bench/.venv/Scripts/python.exe -m pip install ipykernel -U --force-reinstall'"
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Image Count Count Percentage\n",
+ " 0 26 47.3\n",
+ " 1-5 9 16.4\n",
+ " 6-10 13 23.6\n",
+ " 10+ 7 12.7\n"
]
}
],
"source": [
"image_counts: list[int] = [entry.metadata.image_count or 0 for entry in bcbench_dataset]\n",
"\n",
- "bins = [0, 1, 2, 3, 5, 10, float(\"inf\")]\n",
- "labels = [\"0\", \"1\", \"2\", \"3-5\", \"6-10\", \"10+\"]\n",
- "bucketed = pd.cut(image_counts, bins=bins, labels=labels, right=False)\n",
+ "bins = [-1, 0, 5, 10, float(\"inf\")]\n",
+ "labels = [\"0\", \"1-5\", \"6-10\", \"10+\"]\n",
+ "bucketed = pd.cut(image_counts, bins=bins, labels=labels)\n",
"\n",
- "image_count_df = pd.DataFrame({\"Bucket\": bucketed}).value_counts().reset_index(name=\"Count\")\n",
- "image_count_df = image_count_df.sort_values(\"Bucket\")\n",
+ "image_count_df = pd.DataFrame({\"Image Count\": bucketed}).value_counts().reset_index(name=\"Count\")\n",
+ "image_count_df = image_count_df.sort_values(\"Image Count\")\n",
"image_count_df[\"Percentage\"] = (image_count_df[\"Count\"] / image_count_df[\"Count\"].sum() * 100).round(1)\n",
"\n",
- "print(\"Image Count Distribution:\")\n",
"print(image_count_df.to_string(index=False))"
]
}