Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ table 20400 "Qlty. Management Setup"
{
Caption = 'Inspection Creation Option';
ToolTip = 'Specifies whether and how a new quality inspection is created if existing inspections are found.';
InitValue = "Use existing open inspection if available";
}
field(5; "Inspection Search Criteria"; Enum "Qlty. Inspect. Search Criteria")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ codeunit 139966 "Qlty. Tests - Prod. Integr."
var
ReUsedProdOrderLine: Record "Prod. Order Line";
LibraryAssert: Codeunit "Library Assert";
LibrarySetupStorage: Codeunit "Library - Setup Storage";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
GenQltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
LibraryInventory: Codeunit "Library - Inventory";
Expand Down Expand Up @@ -2070,6 +2071,7 @@ codeunit 139966 "Qlty. Tests - Prod. Integr."
Item: Record Item;
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyManagementSetup: Record "Qlty. Management Setup";
BeforeCount: Integer;
CountOfRoutingLines: Integer;
begin
Expand All @@ -2078,6 +2080,10 @@ codeunit 139966 "Qlty. Tests - Prod. Integr."

// [GIVEN] Quality management setup exists
QltyInspectionUtility.EnsureSetupExists();
LibrarySetupStorage.Save(Database::"Qlty. Management Setup");
QltyManagementSetup.Get();
QltyManagementSetup."Inspection Creation Option" := QltyManagementSetup."Inspection Creation Option"::"Always create new inspection";
QltyManagementSetup.Modify();

// [GIVEN] A quality inspection template is created with 3 lines
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 3);
Expand Down Expand Up @@ -2107,6 +2113,8 @@ codeunit 139966 "Qlty. Tests - Prod. Integr."

// [THEN] Inspections are created for each routing line
LibraryAssert.AreEqual(BeforeCount + CountOfRoutingLines, QltyInspectionHeader.Count(), 'Inspection(s) was not created.');

LibrarySetupStorage.Restore();
end;

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ codeunit 139958 "Qlty. Tests - Receiving Integ."
LibraryAssert: Codeunit "Library Assert";
LibraryERMCountryData: Codeunit "Library - ERM Country Data";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
LibrarySetupStorage: Codeunit "Library - Setup Storage";
IsInitialized: Boolean;

[Test]
Expand Down Expand Up @@ -1332,6 +1333,7 @@ codeunit 139958 "Qlty. Tests - Receiving Integ."
QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
QltyInspectionHeader: Record "Qlty. Inspection Header";
QltyManagementSetup: Record "Qlty. Management Setup";
Item: Record Item;
Vendor: Record Vendor;
PurOrderPurchaseHeader: Record "Purchase Header";
Expand All @@ -1349,6 +1351,11 @@ codeunit 139958 "Qlty. Tests - Receiving Integ."
Initialize();
LibraryWarehouse.CreateLocationWMS(Location, false, false, false, false, false);
QltyInspectionUtility.EnsureSetupExists();
LibrarySetupStorage.Save(Database::"Qlty. Management Setup");
QltyManagementSetup.Get();
QltyManagementSetup."Inspection Creation Option" := QltyManagementSetup."Inspection Creation Option"::"Always create new inspection";
QltyManagementSetup.Modify();

QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 3);
QltyInspectionGenRule.DeleteAll();
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Purchase Line", QltyInspectionGenRule);
Expand Down Expand Up @@ -1387,6 +1394,8 @@ codeunit 139958 "Qlty. Tests - Receiving Integ."
LibraryAssert.AreEqual(QltyInspectionTemplateHdr.Code, QltyInspectionHeader."Template Code", 'Template code should match provided template');
LibraryAssert.AreEqual(50, QltyInspectionHeader."Source Quantity (Base)", 'Inspection quantity(base) should match reservation entry quantity, not qty. to receive.');
until QltyInspectionHeader.Next() = 0;

LibrarySetupStorage.Restore();
end;

[Test]
Expand Down
Loading