-
Notifications
You must be signed in to change notification settings - Fork 688
Added dimension setup & posted entries for fixed assets #29390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tuan-nguyen-fenwick
wants to merge
26
commits into
microsoft:main
Choose a base branch
from
tuan-nguyen-fenwick:uptake/fixed-asset-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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
e4c3ea2
Added InsertFixedAsset function that takes FA Posting Group parameter
122e0f8
Added FA posting group to fixed asset dataset
b183a44
Added codeunits to generate FA journal lines & posted entries
63d9a69
Merged PR 38641: Dimension setup & posted entries for Fixed Assets
1b8a435
Sorted variables and usings
36102d0
Merge remote-tracking branch 'origin/main' into uptake/fixed-asset-up…
7cf988d
Updated Fixed Asset object IDs
1d4ce41
Added GetCashAccountNo function
a66dec4
Updated FA journal lines creation
b03351a
Implemented Cash account for fixed asset acquisitions in CZ
2421faf
Added CreateFAJournalSetups function
3c9f7c9
Implemented Cash account for fixed asset acquisitions in DK
8f5845d
Implemented Cash account for fixed asset acquisitions in NL
6620676
Corrected namespace reference for codeunit "Create NL GL Accounts"
9e69bb1
Merge remote-tracking branch 'origin/main' into uptake/fixed-asset-up…
e7b5230
Updated G/L account used to acquire fixed assets in DK
30f4605
Moved FA journal lines coduenit to Historical folder
1b2b9f9
Moved InsertFAGenJournalLine function to Contoso FA codeunit
12b4c58
Merge remote-tracking branch 'origin/main' into uptake/fixed-asset-up…
83304f1
Replaced GetCashAccountNo by Cash account directly for W1
68eacee
Removed GetCashAccountNo function & OnBeforeGetCashAccountForFixedAss…
ef62bbc
Removed OnBeforeGetCashAccountForFixedAssetAcquisition subscriber fro…
59f2c70
Added OnBeforeInsertGenJournalLineCZ subscriber to populate Cash acco…
88c2279
Replaced OnBeforeInsertGenJournalLine subscriber to populate Cash acc…
4f9766c
Replaced OnBeforeInsertGenJournalLine subscriber to populate Cash acc…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...offeeDemoDataset/app/DemoData/FixedAsset/2.Master Data/CreateFADimensionValue.Codeunit.al
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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.
https://github.com/microsoft/ALAppExtensions/blob/main/Apps/CZ/ContosoCoffeeDemoDatasetCZ/app/DemoData/Finance/1.%20Setup%20Data/CreateGLAccountCZ.Codeunit.al
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.