Describe the issue
Approved: https://github.com/microsoft/BusinessCentralApps/issues/1846
When the user changes "Location Code" on a "Prod. Order Component". Shortcut dimension 1 and 2 is blank even when dimension set id has a value. And the dimension set contains shortcut dimension 1 or 2, or both.
Expected behavior
Shortcut dimension 1 and 2 should have a value when the dimension set id contains values for one or both of these dimensions.
Steps to reproduce
Go to a released production order.
Open the card page.
Make sure the production order line has dimension set id that contains dimension 1 or 2.
On the line click the action to show components.
Add an item then change the location.
Make sure that both the item and the location does NOT have any default dimensions.
If they have a default dimension it works as expected.
Additional context
The issue seems to be that when procedure CreateDimFromDefaultDim is called in table "Prod. Order Component", every place except after calling the procedure from OnValidate on the "Location Code" field. This line is called after.
DimMgt.UpdateGlobalDimFromDimSetID("Dimension Set ID", "Shortcut Dimension 1 Code", "Shortcut Dimension 2 Code");
This procedure updates shortcut dimension 1 and 2. Because this is missing, they are never updated.
From OnValidate for the "Location Code" field.
field(30; "Location Code"; Code[10])
{
Caption = 'Location Code';
TableRelation = Location where("Use As In-Transit" = const(false));
trigger OnValidate()
begin
if Item."No." <> "Item No." then
Item.Get("Item No.");
UpdateUnitCost();
Validate("Expected Quantity");
if Item.IsInventoriableType() then begin
GetDefaultBin();
ProdOrderWarehouseMgt.ProdComponentVerifyChange(Rec, xRec);
end;
ProdOrderCompReserve.VerifyChange(Rec, xRec);
GetUpdateFromSKU();
CreateDimFromDefaultDim();
end;
}
field(31; "Shortcut Dimension 1 Code"; Code[20])
The procedure GetRecDefaultDimID, called from CreateDim, that is called from CreateDimFromDefaultDim, manages to update shortcut dimension 1 and 2, only if the dimension sources (item or location) has default dimension. Since the prod. order line has dimension set id, the prod. order component tries to inherit the dimensions of the prod. order line. But because of this bug, only the dimension set id is updated.
I will provide a fix for a bug
Describe the issue
Approved: https://github.com/microsoft/BusinessCentralApps/issues/1846
When the user changes "Location Code" on a "Prod. Order Component". Shortcut dimension 1 and 2 is blank even when dimension set id has a value. And the dimension set contains shortcut dimension 1 or 2, or both.
Expected behavior
Shortcut dimension 1 and 2 should have a value when the dimension set id contains values for one or both of these dimensions.
Steps to reproduce
Go to a released production order.
Open the card page.
Make sure the production order line has dimension set id that contains dimension 1 or 2.
On the line click the action to show components.
Add an item then change the location.
Make sure that both the item and the location does NOT have any default dimensions.
If they have a default dimension it works as expected.
Additional context
The issue seems to be that when procedure CreateDimFromDefaultDim is called in table "Prod. Order Component", every place except after calling the procedure from OnValidate on the "Location Code" field. This line is called after.
This procedure updates shortcut dimension 1 and 2. Because this is missing, they are never updated.
From OnValidate for the "Location Code" field.
The procedure GetRecDefaultDimID, called from CreateDim, that is called from CreateDimFromDefaultDim, manages to update shortcut dimension 1 and 2, only if the dimension sources (item or location) has default dimension. Since the prod. order line has dimension set id, the prod. order component tries to inherit the dimensions of the prod. order line. But because of this bug, only the dimension set id is updated.
I will provide a fix for a bug