Skip to content

Commit

Permalink
FIX Dolibarr#26017 ASSET: annual depreciation starting year
Browse files Browse the repository at this point in the history
When using annual depreciation of an Asset, the depreciation table now begins with the fiscal year when the asset was put in service or acquired (whichever occurred first) instead of the fiscal year of the current (server time) moment. This allows you to regenerate the depreciation table properly if you need to modify the acquisition or in-service date.

The choice of using the earliest of acquisition date or in-service date is based on the calculation of $depreciation_date_start later in the function.
  • Loading branch information
BurksEngineering committed Sep 30, 2023
1 parent a0c1553 commit 4d83d99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htdocs/asset/class/asset.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ public function calculationDepreciation()
// Get fiscal period
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
$dates = getDefaultDatesForTransfer();
$dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition);
$init_fiscal_period_start = $dates['date_start'];
$init_fiscal_period_end = $dates['date_end'];
if (empty($init_fiscal_period_start) || empty($init_fiscal_period_end)) {
Expand Down

0 comments on commit 4d83d99

Please sign in to comment.