-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Asset Module: Annual depreciation begins at 'current' fiscal year instead of fiscal year of in-service date #26017
Comments
Pinging @aspangaro , who seems to be a master of asset/accountancy! |
I was able to confirm that using getCurrentPeriodofFiscalYear instead of getDefaultDatesForTransfer fixes the issue. It looks like getCurrentPeriodofFiscalYear was only added for v18, while most of the depreciation stuff was from a prior version, so it make sense why the depreciation generator was not originally using the more flexible funciton. |
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.
@aspangaro : I see that you worked this one line fix into your own copy of v18. Could you please help @josett225 and the rest of the community by working it into the current version of dolibarr if you think it is appropriate? I would like to commit it myself but I don't seem to understand enough about the git workflow required to keep a dev branch up to date during the long review process. |
Bug
It appears that the depreciation table fails to generate for assets that were put in service in a prior calendar year, in cases when annual depreciation is expected. I believe that this stems from the fact that the start/end date used to calculate depreciation are always sourced from the current (server time) fiscal year, not the fiscal year associate with the in-service date of the asset.
Notes from research:
Recommendation:
Instead of using 'getDefaultDatesForTransfer()' to source '$init_fiscal_period_start' and '$init_fiscal_period_end', consider using the accountancy function 'getCurrentPeriodofFiscalYear()', with the '$from_time' argument set as the $depreciation_date_start : code
Environment Version
17.0.2
Environment OS
Linux gator3319.hostgator.com 4.19.150-76.ELK.el6.x86_64 #1 SMP Wed Oct 7 01:34:10 CDT 2020 x86_64
Environment Web server
Apache
Environment PHP
7.4.33
Environment Database
MySQL or MariaDB 5.6.41-84.1
Environment URL(s)
No response
Expected and actual behavior
On an Asset card, When setting "Depreciation type duration" to 'annual':
Actual behavior:
Expected behavior:
Notes for similar circumstances:
Steps to reproduce the behavior
Initial Conditions:
** Acquisition date and startup date in a prior calendar year
** Reversal date and reversal amount NOT set
Attached files
No response
The text was updated successfully, but these errors were encountered: