Skip to content

[main] bug 642230 - Enhance FA General Report logic and add tests for Tax Deprec. Group and FA Posting Group handling#9687

Merged
DavidHolusa merged 5 commits into
mainfrom
bugs/643230-main-DeletingFAPostGroupFromFACard
Jul 23, 2026
Merged

[main] bug 642230 - Enhance FA General Report logic and add tests for Tax Deprec. Group and FA Posting Group handling#9687
DavidHolusa merged 5 commits into
mainfrom
bugs/643230-main-DeletingFAPostGroupFromFACard

Conversation

@DavidHolusa

@DavidHolusa DavidHolusa commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What & why

The SetFAPostingGroup procedure in codeunit "FA General Report" (and the analogous SetFATaxDeprGroup in CZ localization codeunit "FA General Report CZF") could overwrite the "FA Posting Group" (or "Tax Deprec. Group Code CZF") on the Fixed Asset card with a blank value. This happened when the related FA Depreciation Book record had an empty posting group — the code only checked whether the values differed, without verifying that the source value was non-blank. As a result, running reports like "Fixed Asset - G/L Analysis" with Group Totals set to "FA Posting Group" (or "Tax Depreciation Group") would silently clear the field on the FA card.

The fix adds a guard condition (FADeprBook."FA Posting Group" <> '') (and (FADepreciationBook."Tax Deprec. Group Code CZF" <> '') for CZ) so that the field is only updated when the depreciation book carries a meaningful value. Direct unit tests for both SetFAPostingGroup and SetFATaxDeprGroup are added to cover the regression.

Linked work

Fixes AB#643230

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome

  • Created a Fixed Asset with FA Posting Group "EQUIPMENT", then created an FA Depreciation Book with blank FA Posting Group. Before the fix, running "Fixed Asset - G/L Analysis" cleared the FA Posting Group on the card. After the fix, the value remains "EQUIPMENT".
  • Created a Fixed Asset with FA Posting Group "EQUIPMENT", then set a different non-blank FA Posting Group "VEHICLES" on the FA Depreciation Book. After running the report, the FA card correctly updated to "VEHICLES".
  • Same scenarios validated for CZ localization with Tax Deprec. Group Code CZF field.
  • Added 2 new direct unit tests in W1 (SetFAPostingGroupDoesNotClearFAPostingGroupWhenDepreciationBookPostingGroupIsBlank, SetFAPostingGroupUpdatesFAPostingGroupWhenDepreciationBookPostingGroupIsDifferentAndNotBlank) — both pass.
  • Added 2 new direct unit tests in CZ (SetFATaxDeprGroupDoesNotClearTaxDepreciationGroupWhenDepreciationBookTaxDepGroupIsBlank, SetFATaxDeprGroupUpdatesTaxDepreciationGroupWhenDepreciationBookTaxDepGroupIsDifferentAndNotBlank) — both pass.

Risk & compatibility

None. The change is additive — it only prevents a destructive side effect (clearing a field). No breaking changes, no data migration needed, no new permissions required. The guard condition is consistent with the existing pattern where other "Set*" procedures in the same codeunit already validate before modifying.

@DavidHolusa
DavidHolusa requested a review from a team July 23, 2026 10:19
@github-actions github-actions Bot added the Finance GitHub request for Finance area label Jul 23, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 23, 2026
@DavidHolusa DavidHolusa changed the title Bugs/643230 main deleting fa post group from fa card [main] bug 642230 - Enhance FA General Report logic and add tests for Tax Deprec. Group and FA Posting Group handling Jul 23, 2026
@DavidHolusa
DavidHolusa enabled auto-merge July 23, 2026 12:14
@DavidHolusa
DavidHolusa added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit 59750d5 Jul 23, 2026
341 of 345 checks passed
@DavidHolusa
DavidHolusa deleted the bugs/643230-main-DeletingFAPostGroupFromFACard branch July 23, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants