-
-
Notifications
You must be signed in to change notification settings - Fork 759
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
[12.0][FIX] account_asset_management: asset table wrong leapyear calc #925
[12.0][FIX] account_asset_management: asset table wrong leapyear calc #925
Conversation
One more remark: |
@JordiBForgeFlow I think you changed this algorithm, isn't it? |
This part of the code have not been touched by the changes of @JordiBForgeFlow |
All unit tests are green and new unit test added for deviating fiscal years with leap year in the table. |
@@ -619,8 +619,8 @@ def _get_fy_duration(self, fy, option='days'): | |||
elif option == 'years': | |||
year = fy_date_start.year | |||
cnt = fy_date_stop.year - fy_date_start.year + 1 | |||
cy_days = isleap(fy) and 366 or 365 |
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.
cy_days = calendar.isleap(fy) and 366 or 365
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.
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.
Build wasn't successful in Odoo.sh. See the error.
@@ -619,8 +619,8 @@ def _get_fy_duration(self, fy, option='days'): | |||
elif option == 'years': | |||
year = fy_date_start.year | |||
cnt = fy_date_stop.year - fy_date_start.year + 1 | |||
cy_days = isleap(fy) and 366 or 365 |
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.
@mromdhane |
@mmotahar-ia |
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.
Monthly depreciation is calculating correctly, with the exception of the first entry on some assets which is showing as negative.
From my test cases, this happens when fiscal year is set to 1 Jul – 30 June and the start date of the asset is on the 31st of any month.
@hioppolo-ia When you start your fiscal year at july 1st you have 184 in your first half FY and only 181 in the second half. The old calculation resulted in a negative amount when there was only one day in the first depreciation period. The new calculation in this PR is better but leads of course to a different result for the first period in case of 'prorata temporis' without days_calc. The FY amount remains untouched, only the spreading over the FY periods is different. As a consequence I needed to adapt 'test_02_prorata_basic'. Concretely: @kittiu @JordiBForgeFlow @pedrobaeza
|
@luc-demeyer The first and end period calcs in the first year ONLY are not calculating correctly. I noticed on your screenshot above that period 1 calculates correctly (can't see period 12), but this doesn't seem to be the same in my instance. I tested this with Jan-Dec fiscal year and this did not work either. This is happening for both linear and degressive assets and i haven't been able to isolate it to any particular configuration. I will email you for access to our test DB so you can investigate and see if there is any difference in the config to help isolate the issue. |
@hioppolo-ia The first period calc is wrong for asset 74421. This one is degressive. Can you doublecheck is there are still some problems in case of linear depreciation ? And if so, let me know the asset reference on your test db so that I can check. |
@hioppolo-ia |
First period is fixed, however final period in first year is still facing some issues. For degressive For Linear I will send you our test DB by email again. |
@hioppolo-ia If you have and asset of 3000 EUR that is depreciated over 3 years than there is a depreciation of 1000 EUR per year. This is what we typically see with customers who work with an external account to maintain the asset calculation. Those accountants usually make year end accounting entry with in this example 1000 EUR of depreciation. |
@luc-demeyer isn't interesting to include such explanation of the computation in the module's README? |
@luc-demeyer Is the module working in a way that the prorata amount from the first period is being applied to the last period of the first year instead of the last period of the whole calculation? For example using the above for asset 74426 and assuming the asset life was 3 years, the depreciation amounts should be as follows: Fiscal Year 1 Year2 Year3 Year4 it looks like some of this prorata amount is being applied to the last period in the first year instead of the last period in the whole calculation. What are your thoughts? |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Related issue to this PR opened in #1712 /ocabot rebase |
@rafaelbn The rebase process failed, because command
|
@luc-demeyer could you please rebase? |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
This PR fixes the following 'leap year' calculation error:
Consider an asset of 5000 EUR, depreciated of 5 years, pro-rata temporis, linear depreciation.
Fiscal year terminates at june 30.
Asset start date is 2015-01-28.
The pro-rata temporis calc should result in the following depreciation amounts:
2015-06-30: 421.92 EUR
2016-06-30 up to 20106-30 : 1000 EUR
2020-06-30: 578,08 EUR
But is goes wrong (without this patch) because 2016 is a leap year.