Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0045018
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] 09. Financial managementmajoralways2020-09-04 22:312020-09-10 13:21
ReporterlbressanView Statuspublic 
Assigned Toinigo_lerga 
PriorityhighResolutionfixedFixed in VersionPR20Q2.2
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget VersionPR20Q2.2
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date2019-08-22
Regression introduced in release3.0PR19Q4
Regression introduced by commithttps://gitlab.com/openbravo/product/openbravo/-/commit/fc2fdb6259fb3cf3532e4c71f2188dcb1eb404d0 [^]
Triggers an Emergency PackNo
Summary

0045018: Error in the Recalculate Amortization process

DescriptionFrom the assets window, when we select an asset record and click on the "Recalculate amortization" button, this process deletes the records associated an X amortization, including records of that amortization that correspond to other assets.

Steps To ReproduceIn the Assets window:
1. Create a record with the following data:
        Organization: F&B España, S.A
        Search Key: coche1
        Name: coche1
        Asset Category: Vehiculos
        Document No.: 10000006
        Currency: EUR
        Depreciate: true
        Depreciation Type: Linear
        Calculate Type: Time
        Usable Life - Months: 120
        Every Month Is 30Days: true
        Amortize: Monthly
        Depreciation Start Date : 01-03-2013
        Asset Value: 23000
        Residual Asset Value : 0.00
        Depreciation Amt: 23000
        Previously Depreciated Amt : 0.00

2. Then click on the button "Create Amortization"
3. Create another record idem to the previous one:

        Organization: F&B España, S.A
        Search Key: coche2
        Name: coche2
        Asset Category: Vehiculos
        Document No.: 10000007
        Currency: EUR
        Depreciate: true
        Depreciation Type: Linear
        Calculate Type: Time
        Usable Life - Months: 120
        Every Month Is 30Days: true
        Amortize: Monthly
        Depreciation Start Date : 01-03-2013
        Asset Value: 23000
        Residual Asset Value : 0.00
        Depreciation Amt: 23000
        Previously Depreciated Amt : 0.00

4. Repeat step 2.


Navigate to the Amortization window:

     1. Filter the records by the date field with value "30-07-2020"
     2. Observe that there are two records in the lines of that amortization, one corresponds to the first asset and the other to the second asset.

In the Assets window:

    1. Select the record that corresponds to the second asset created and click on the "Recalculate Amortization" button.
    2. Navigate to the Amortization window and refresh the previously filtered record.
    3. There it can be seen that the lines corresponding to the other asset have disappeared.

In conclusion, when an asset is recalculated, only the records that correspond to the depreciation of that asset should be deleted.

We attach a video with the aforementioned example.
Proposed SolutionOnly delete records that correspond to the asset that is being recalculated.
Code where the error occurs:

Class: AssetLinearDepreciationMethodProcess.java
Line numer: from 143

    // Remove unprocessed Amortization and its line when recalculating
    final List<AmortizationLine> amortizationLineListToRemove = new ArrayList<>();
    for (AmortizationLine al : amortizationLineList) {
      final Amortization amortization = OBDal.getInstance()
          .get(Amortization.class, al.getAmortization().getId());
      if (StringUtils.equals(amortization.getProcessed(), "N")) {
        amortizationLineListToRemove.add(al);
        amortization.getFinancialMgmtAmortizationLineList().clear();
        OBDal.getInstance().remove(amortization);
      }
    }
    asset.getFinancialMgmtAmortizationLineList().removeAll(amortizationLineListToRemove);
    OBDal.getInstance().flush();

It's important to have on mind:
After solving this bug, it will be necessary to have a script or method to correct the missing amounts of the records that have been eliminated from assets that were not associated with the asset in question, bearing in mind that the accounting periods have already been closed.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0044996 closedinigo_lerga Error in the Recalculate Amortization process 

-  Notes
(0122912)
hgbot (developer)
2020-09-10 11:37

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/158 [^]
(0122920)
hgbot (developer)
2020-09-10 13:21

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 71c6043c74856e7518c5f8511d055d19cf57d79b
Author: inigo_lerga <inigo.lerga@openbravo.com>
Date: 2020-09-10T11:32:23+02:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/71c6043c74856e7518c5f8511d055d19cf57d79b [^]

fixes BUG-45018:Explicit deletion of Amortization lines

When an Asset's Amortization is recalculated, only its Amortization
records need to be deleted.

Backport of Regression 44996.

---
M src/org/openbravo/erpCommon/ad_process/assets/AssetLinearDepreciationMethodProcess.java
---
(0122921)
hgbot (developer)
2020-09-10 13:21

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/158 [^]

- Issue History
Date Modified Username Field Change
2020-09-09 16:14 dmiguelez Type defect => backport
2020-09-09 16:14 dmiguelez Target Version => PR20Q2.2
2020-09-10 11:37 hgbot Note Added: 0122912
2020-09-10 13:21 hgbot Resolution open => fixed
2020-09-10 13:21 hgbot Status scheduled => closed
2020-09-10 13:21 hgbot Fixed in Version => PR20Q2.2
2020-09-10 13:21 hgbot Note Added: 0122920
2020-09-10 13:21 hgbot Note Added: 0122921


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker