Skip to content

[Fixed Assets] Fix Straight-Line % depreciation to use basis reduced by bonus depreciation#8912

Open
dcenic wants to merge 2 commits into
mainfrom
bugs/640613FABonusDeprWithStraightLineDepr2
Open

[Fixed Assets] Fix Straight-Line % depreciation to use basis reduced by bonus depreciation#8912
dcenic wants to merge 2 commits into
mainfrom
bugs/640613FABonusDeprWithStraightLineDepr2

Conversation

@dcenic

@dcenic dcenic commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Fixes AB#640613

Bonus depreciation reduces book value but not the depreciable basis, so the straight-line base must be lowered by the bonus amount each period. Applies the reduction in CalcSLAmount across W1/FR/GB/IT/RU and adds a W1 test.

What & why

Bonus depreciation reduces book value but not the depreciable basis, so the straight-line base must be lowered by the bonus amount each period. Applies the reduction in CalcSLAmount across W1/FR/GB/IT/RU and adds a W1 test.

Linked work

Fixes AB#640613

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 (required — be specific: scenarios, commands, screenshots for UI changes)

I made automated tests that make sure that straight-line depreciation method uses the bonus-reduced acquisition cost as the basis for the first and any further depreciation.

Risk & compatibility

…iation (640613)

Bonus depreciation reduces book value but not the depreciable basis, so the straight-line base must be lowered by the bonus amount each period. Applies the reduction in CalcSLAmount across W1/FR/GB/IT/RU and adds a W1 test.
@dcenic dcenic requested a review from a team June 30, 2026 10:28
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 30, 2026

if SLPercent > 0 then begin
Result := (-SLPercent / 100) * (NumberOfDays / DaysInFiscalYear) * DeprBasis;
Result := (-SLPercent / 100) * (NumberOfDays / DaysInFiscalYear) * (DeprBasis - StraightLineBonusBaseReduction());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

$\textbf{🟡\ Medium\ Severity\ —\ Style} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

StraightLineBonusBaseReduction() is a local procedure of codeunit 5611 'Calculate Normal Depreciation' and is called from CalcSLAmount without the 'this.' prefix.

CodeCop AA0248 requires self-referencing calls inside a codeunit to be prefixed with 'this.' to make the resolution unambiguous. Replace StraightLineBonusBaseReduction() with this.StraightLineBonusBaseReduction().

Suggested change
Result := (-SLPercent / 100) * (NumberOfDays / DaysInFiscalYear) * (DeprBasis - StraightLineBonusBaseReduction());
Result := (-SLPercent / 100) * (NumberOfDays / DaysInFiscalYear) * (DeprBasis - this.StraightLineBonusBaseReduction());

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 3 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

@dcenic dcenic closed this Jun 30, 2026
@dcenic dcenic reopened this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant