Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2879ddb
Added dimension setup to fixed assets
Nov 5, 2025
e4c3ea2
Added InsertFixedAsset function that takes FA Posting Group parameter
Nov 5, 2025
122e0f8
Added FA posting group to fixed asset dataset
Nov 5, 2025
b183a44
Added codeunits to generate FA journal lines & posted entries
Nov 5, 2025
63d9a69
Merged PR 38641: Dimension setup & posted entries for Fixed Assets
Nov 7, 2025
1b8a435
Sorted variables and usings
Dec 12, 2025
36102d0
Merge remote-tracking branch 'origin/main' into uptake/fixed-asset-up…
Jan 8, 2026
7cf988d
Updated Fixed Asset object IDs
Jan 8, 2026
1d4ce41
Added GetCashAccountNo function
Jan 8, 2026
a66dec4
Updated FA journal lines creation
Jan 8, 2026
b03351a
Implemented Cash account for fixed asset acquisitions in CZ
Jan 8, 2026
2421faf
Added CreateFAJournalSetups function
Jan 8, 2026
3c9f7c9
Implemented Cash account for fixed asset acquisitions in DK
Jan 8, 2026
8f5845d
Implemented Cash account for fixed asset acquisitions in NL
Jan 8, 2026
6620676
Corrected namespace reference for codeunit "Create NL GL Accounts"
Jan 8, 2026
9e69bb1
Merge remote-tracking branch 'origin/main' into uptake/fixed-asset-up…
Jan 22, 2026
e7b5230
Updated G/L account used to acquire fixed assets in DK
Jan 22, 2026
30f4605
Moved FA journal lines coduenit to Historical folder
Jan 30, 2026
1b2b9f9
Moved InsertFAGenJournalLine function to Contoso FA codeunit
Jan 30, 2026
12b4c58
Merge remote-tracking branch 'origin/main' into uptake/fixed-asset-up…
Jan 30, 2026
83304f1
Replaced GetCashAccountNo by Cash account directly for W1
Jan 30, 2026
68eacee
Removed GetCashAccountNo function & OnBeforeGetCashAccountForFixedAss…
Jan 30, 2026
ef62bbc
Removed OnBeforeGetCashAccountForFixedAssetAcquisition subscriber fro…
Jan 30, 2026
59f2c70
Added OnBeforeInsertGenJournalLineCZ subscriber to populate Cash acco…
Jan 30, 2026
88c2279
Replaced OnBeforeInsertGenJournalLine subscriber to populate Cash acc…
Jan 30, 2026
4f9766c
Replaced OnBeforeInsertGenJournalLine subscriber to populate Cash acc…
Jan 30, 2026
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 @@ -248,6 +248,7 @@ codeunit 31215 "Contoso CZ Localization"
Codeunit.Run(Codeunit::"Create FA Posting Group CZ");
Codeunit.Run(Codeunit::"Create FA Setup CZ");
CreateDepreciationBookCZ.DeleteDepreciationBooks();
CreateDepreciationBookCZ.CreateFAJournalSetups();
end;
Enum::"Contoso Demo Data Level"::"Master Data":
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
namespace Microsoft.DemoData.Localization;

using Microsoft.DemoData.Common;
using Microsoft.DemoData.Finance;
using Microsoft.DemoData.FixedAsset;
using Microsoft.DemoData.HumanResources;
using Microsoft.DemoData.Jobs;
using Microsoft.FixedAssets.Journal;
using Microsoft.FixedAssets.Posting;
using Microsoft.DemoData.Manufacturing;
using Microsoft.DemoData.Service;
using Microsoft.DemoTool.Helpers;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.GeneralLedger.Journal;

codeunit 31212 "Create CZ GL Accounts"
{
Expand Down Expand Up @@ -130,4 +134,19 @@ codeunit 31212 "Create CZ GL Accounts"
begin
Category := Enum::"G/L Account Category"::" ";
end;

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", OnBeforeInsertEvent, '', false, false)]
local procedure OnBeforeInsertGenJournalLineCZ(var Rec: Record "Gen. Journal Line")
var
CreateFAJnlTemplate: Codeunit "Create FA Jnl. Template";
CreateGLAccountCZ: Codeunit "Create G/L Account CZ";
begin
if (Rec."Journal Template Name" = CreateFAJnlTemplate.Assets())
and (Rec."Journal Batch Name" = CreateFAJnlTemplate.Default())
and (Rec."Account Type" = Enum::"Gen. Journal Account Type"::"Fixed Asset")
and (Rec."Bal. Account Type" = Enum::"Gen. Journal Account Type"::"G/L Account")
and (Rec."FA Posting Type" = Enum::"Gen. Journal Line FA Posting Type"::"Acquisition Cost")
then
Rec.Validate("Bal. Account No.", CreateGLAccountCZ.Cashtransfer());
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ codeunit 31183 "Create Depreciation Book CZ"
ContosoFixedAsset.InsertDepreciationBook(CreateFADepreciationBook.Company(), '', false, false, false, false, false, false, false, false, false, 0);
end;

internal procedure CreateFAJournalSetups()
var
ContosoFixedAsset: Codeunit "Contoso Fixed Asset";
CreateFAJnlTemplate: Codeunit "Create FA Jnl. Template";
CreateFAInsTemplate: Codeunit "Create FA Ins Jnl. Template";
begin
ContosoFixedAsset.InsertFAJournalSetup('', FirstAccount(), CreateFAJnlTemplate.Assets(), CreateFAInsTemplate.Default(), CreateFAJnlTemplate.Assets(), CreateFAInsTemplate.Default(), CreateFAInsTemplate.Insurance(), CreateFAJnlTemplate.Default());
ContosoFixedAsset.InsertFAJournalSetup('', SecondTax(), CreateFAJnlTemplate.Assets(), CreateFAInsTemplate.Default(), CreateFAJnlTemplate.Assets(), CreateFAInsTemplate.Default(), CreateFAInsTemplate.Insurance(), CreateFAJnlTemplate.Default());
end;

var
FirstAccountLbl: Label '1-ACCOUNT', MaxLength = 10;
SecondTaxLbl: Label '2-TAX', MaxLength = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Microsoft.DemoData.FixedAsset;

using Microsoft.DemoData.Finance;
using Microsoft.FixedAssets.Setup;

codeunit 11715 "Create FA Setup CZ"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace Microsoft.DemoData.FixedAsset;

using Microsoft.DemoData.Finance;
using Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;

codeunit 13742 "Create FA Depreciation Book DK"
{
Expand All @@ -29,4 +32,19 @@ codeunit 13742 "Create FA Depreciation Book DK"
begin
DepreciationBook.Validate("Default Final Rounding Amount", DefaultFinalRoundingAmount);
end;

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", OnBeforeInsertEvent, '', false, false)]
local procedure OnBeforeInsertGenJournalLineDK(var Rec: Record "Gen. Journal Line")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This subscribes to an event from a BaseApp table and will be executed too many times without being used.
Also, we really want to limit the use of events in these demo data app in general.

If the goal is to use the value from the DK GL account instead of the one from W1, this is what the localization of GL Account is already guaranteeing us: https://github.com/microsoft/ALAppExtensions/blob/main/Apps/DK/ContosoCoffeeDemoDatasetDK/app/DemoData/Finance/1.Setup%20Data/CreateGLAccDK.Codeunit.al

That means that all the inserts done in W1 using W1's GL accounts will actually be using DK's GL accounts (if they have been overwritten in the codeunit linked above).

For specific scenarios where the W1 GL account cannot be localized (e.g. the account only exists in the localization), then one option is to find the data that was inserted in W1, and either delete it and insert it with the localization's values, or modify it.

Hopefully the Contoso Coffee Demo Dataset apps (W1 and all the localizations) provide extensive examples on how to do it.

Note that this also applies to other localized files where this pattern is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@attilatoury Thanks for the suggestions.

Just wanted to clarify the above G/L account creation pattern and my PR scenario. This "Create G/L " codeunit is designed to create localized G/L accounts which I totally understand.

In my case, I want to call the localized account that's already been created for the specific country and use it on the FA journal lines. I'm not creating any new account for DK.

For example, W1 cash account = 1234, whereas DK cash account = 6789, my code here calls the DK cash account (6789) and populate on the FA journal lines when generating Fixed Assets data only. The codeunit itself is manual binding so it isn't triggered outside the scope of creating Fixed Assets demo data module.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuan-nguyen-fenwick If the account has already been localized, then calling the W1 account will return the DK account (when called from the DK localized app). So, intercepting the data before it is inserted to overwrite the account number should not be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@attilatoury

You're right, calling the W1 cash account CreateGLAccount.Cash() works for all countries except for DK, NL and CZ. It returns a blank value because these countries have different name and account number for the Cash account. And when the balancing account is blank on the Gen. Jnl. Line, it causes out of balance during posting.

And for that reason, I had to call the specific localized account in DK, NL and CZ.

Let me know your thoughts to get this PR moving.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuan-nguyen-fenwick In that case, the pattern we use for demo data is "For specific scenarios where the W1 GL account cannot be localized (e.g. the account only exists in the localization), then one option is to find the data that was inserted in W1, and either delete it and insert it with the localization's values, or modify it."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@attilatoury
For example in CZ, it is already been done here in the account localization codeunit where it clears W1 Cash account number (that's same as intercepting and deleting it from CZ environment) and then replaces it the localized account.

image

https://github.com/microsoft/ALAppExtensions/blob/main/Apps/CZ/ContosoCoffeeDemoDatasetCZ/app/DemoData/Finance/1.%20Setup%20Data/CreateGLAccountCZ.Codeunit.al

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuan-nguyen-fenwick Right so can you use the same pattern for the other countries that you are modifying?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@attilatoury Since we're approaching the v28 branching date, I don’t think it’s the right time to change how the localized Cash account is created for these countries in this PR. Adjusting this behaviour will require more planning as it may impact other areas of the local Demo Data apps.

There may also be valid functional reasons behind why Cash account is set up differently in these countries, so this needs a broader review if we proceed.

var
CreateFAJnlTemplate: Codeunit "Create FA Jnl. Template";
CreateGLAccDK: Codeunit "Create GL Acc. DK";
begin
if (Rec."Journal Template Name" = CreateFAJnlTemplate.Assets())
and (Rec."Journal Batch Name" = CreateFAJnlTemplate.Default())
and (Rec."Account Type" = Enum::"Gen. Journal Account Type"::"Fixed Asset")
and (Rec."Bal. Account Type" = Enum::"Gen. Journal Account Type"::"G/L Account")
and (Rec."FA Posting Type" = Enum::"Gen. Journal Line FA Posting Type"::"Acquisition Cost")
then
Rec.Validate("Bal. Account No.", CreateGLAccDK.Bank());
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

namespace Microsoft.DemoData.FixedAsset;

using Microsoft.DemoData.Localization;
using Microsoft.Finance.GeneralLedger.Journal;
using Microsoft.FixedAssets.Depreciation;
using Microsoft.FixedAssets.Journal;

codeunit 11505 "Create FA Depreciation Book NL"
{
Expand All @@ -29,4 +32,19 @@ codeunit 11505 "Create FA Depreciation Book NL"
begin
DepreciationBook.Validate("Default Final Rounding Amount", DefaultFinalRoundingAmount);
end;

[EventSubscriber(ObjectType::Table, Database::"Gen. Journal Line", OnBeforeInsertEvent, '', false, false)]
local procedure OnBeforeInsertGenJournalLineNL(var Rec: Record "Gen. Journal Line")
var
CreateFAJnlTemplate: Codeunit "Create FA Jnl. Template";
CreateNLGLAccounts: Codeunit "Create NL GL Accounts";
begin
if (Rec."Journal Template Name" = CreateFAJnlTemplate.Assets())
and (Rec."Journal Batch Name" = CreateFAJnlTemplate.Default())
and (Rec."Account Type" = Enum::"Gen. Journal Account Type"::"Fixed Asset")
and (Rec."Bal. Account Type" = Enum::"Gen. Journal Account Type"::"G/L Account")
and (Rec."FA Posting Type" = Enum::"Gen. Journal Line FA Posting Type"::"Acquisition Cost")
then
Rec.Validate("Bal. Account No.", CreateNLGLAccounts.PettyCash());
end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace Microsoft.DemoData.FixedAsset;

using Microsoft.DemoData.Finance;
using Microsoft.DemoTool.Helpers;
using Microsoft.Finance.Dimension;
using Microsoft.FixedAssets.FixedAsset;

codeunit 5614 "Create FA Dimension Value"
{
InherentEntitlements = X;
InherentPermissions = X;

trigger OnRun()
var
ContosoDimension: Codeunit "Contoso Dimension";
CreateDimension: Codeunit "Create Dimension";
CreateDimensionValue: Codeunit "Create Dimension Value";
CreateFixedAsset: Codeunit "Create Fixed Asset";
begin
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000010(), CreateDimension.DepartmentDimension(), CreateDimensionValue.AdministrationDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000020(), CreateDimension.DepartmentDimension(), CreateDimensionValue.AdministrationDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000030(), CreateDimension.DepartmentDimension(), CreateDimensionValue.ProductionDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000040(), CreateDimension.DepartmentDimension(), CreateDimensionValue.ProductionDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000050(), CreateDimension.DepartmentDimension(), CreateDimensionValue.ProductionDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000060(), CreateDimension.DepartmentDimension(), CreateDimensionValue.ProductionDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000070(), CreateDimension.DepartmentDimension(), CreateDimensionValue.ProductionDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000080(), CreateDimension.DepartmentDimension(), CreateDimensionValue.ProductionDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
ContosoDimension.InsertDefaultDimensionValue(Database::"Fixed Asset", CreateFixedAsset.FA000090(), CreateDimension.DepartmentDimension(), CreateDimensionValue.AdministrationDepartment(), Enum::"Default Dimension Value Posting Type"::" ");
end;
}
Loading
Loading