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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0044996
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 09. Financial managementmajoralways2020-09-04 22:312020-09-09 16:15
ReporterlbressanView Statuspublic 
Assigned Toinigo_lerga 
PriorityhighResolutionfixedFixed in VersionPR20Q4
StatusclosedFix in branchFixed in SCM revision4275f8d69668
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned Todmiguelez
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

0044996: 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? file icon Openbravo - Amortization.mp4 [^] (2,873,976 bytes) 2020-09-04 22:31

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 0045017PR20Q3.1 closedinigo_lerga Error in the Recalculate Amortization process 
depends on backport 0045018PR20Q2.2 closedinigo_lerga Error in the Recalculate Amortization process 
caused by defect 0041297 closedAtulOpenbravo Not possible to recalculate an amortization 

-  Notes
(0122695)
lbressan (developer)
2020-09-04 22:51

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.
(0122758)
dmiguelez (developer)
2020-09-07 16:13

Notes about the affected data:

- Only not processed Amortizations are affected by this issue, any Amortization that was processed (therefore validated by the user) is kept as it was. Only draft Amortizations are deleted
- Periods only matter while processing an Amortization. It is possible to recalculate Amortizations for any date regardless of the status of the Period. Only when processing the Amortization the check is done
- It is possible to Recalculate the Amortization again for the missing Assets. When the lines are deleted, launching the process again for the missing Assets will include them back in the Amortization.

That last point can be used as the workaround to fix the data, as it is only necessary to launch the process again for the missing assets. Also, as explained above, only Amortizations in draft status (not validated by the user) are affected.

A script or process to fix the data should be considered only if the amount of records to be processed is big enough that is not practical to do it manually.
(0122761)
lbressan (developer)
2020-09-07 16:32

Notes about the affected data:
The client wants to note this because they have more than 2000 assets that have been affected by this issue and they need a script to solve this problem and it is not feasible for them to reinsert those lines for the periods that are already closed.
(0122792)
hgbot (developer)
2020-09-08 14:23

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/151 [^]
(0122802)
inigo_lerga (reporter)
2020-09-08 14:35

--Test Plan Mantis--

As the F&B International Group Admin role in Backend:
1º- Go to Assets window and create a new 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º- Press the Create Amortization button and OK in the popup window.

3º- Create a new record in the same Assets window with the following data:
      - 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º- Press the Create Amortization button and OK in the popup window.

5º- Now, in the second record created, press the Recalculate Amortization button.

6º- Go to the Amortization window and open the "31-12-2020" record.

    #You will see that both Assets appear in the Lines Tab as, with the fix applied,
    only the selected Asset when Recalculating Amortization process is launched
    gets his Amortization records deleted (and created again later).#
    
    #Before, both Assets' records were eliminated and only the one selected while launching the process
    was recreated later.#
(0122884)
hgbot (developer)
2020-09-09 15:39

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 4275f8d696686a8df665f8e87bda837896adbfa5
Author: Iñigo Lerga Valencia <inigo.lerga@openbravo.com>
Date: 2020-09-09T13:39:37+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/4275f8d696686a8df665f8e87bda837896adbfa5 [^]

fixes BUG-44996:Only delete records of recalculated asset

When an Asset's Amortization is recalculated, only its Amortization
records need to be deleted. Before this fix, all were deleted.

---
M src/org/openbravo/erpCommon/ad_process/assets/AssetLinearDepreciationMethodProcess.java
---
(0122885)
hgbot (developer)
2020-09-09 15:39

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/151 [^]
(0122887)
dmiguelez (developer)
2020-09-09 16:15

Code Review + Testing Ok

- Issue History
Date Modified Username Field Change
2020-09-04 22:31 lbressan New Issue
2020-09-04 22:31 lbressan Assigned To => Triage Finance
2020-09-04 22:31 lbressan File Added: Openbravo - Amortization.mp4
2020-09-04 22:31 lbressan Modules => Core
2020-09-04 22:31 lbressan Resolution time => 1597701600
2020-09-04 22:31 lbressan Triggers an Emergency Pack => No
2020-09-04 22:51 lbressan Note Added: 0122695
2020-09-04 22:51 lbressan Description Updated View Revisions
2020-09-04 22:51 lbressan Proposed Solution updated
2020-09-04 23:22 lbressan Regression introduced by commit => https://gitlab.com/openbravo/product/openbravo/-/commit/fc2fdb6259fb3cf3532e4c71f2188dcb1eb404d0 [^]
2020-09-07 09:20 dmiguelez Resolution time 1597701600 => 1600984800
2020-09-07 16:08 dmiguelez Assigned To Triage Finance => inigo_lerga
2020-09-07 16:13 dmiguelez Note Added: 0122758
2020-09-07 16:25 lbressan Regression date => 2019-08-22
2020-09-07 16:25 lbressan Regression introduced in release => 3.0PR19Q4
2020-09-07 16:32 lbressan Note Added: 0122761
2020-09-07 16:59 rafaroda Relationship added caused by 0041297
2020-09-08 08:17 inigo_lerga Status new => scheduled
2020-09-08 14:23 hgbot Note Added: 0122792
2020-09-08 14:35 inigo_lerga Note Added: 0122802
2020-09-09 15:39 hgbot Resolution open => fixed
2020-09-09 15:39 hgbot Status scheduled => closed
2020-09-09 15:39 hgbot Fixed in Version => PR20Q4
2020-09-09 15:39 hgbot Note Added: 0122884
2020-09-09 15:39 hgbot Note Added: 0122885
2020-09-09 16:13 dmiguelez Status closed => new
2020-09-09 16:13 dmiguelez Resolution fixed => open
2020-09-09 16:14 dmiguelez Fixed in Version PR20Q4 =>
2020-09-09 16:14 dmiguelez Status new => scheduled
2020-09-09 16:14 dmiguelez Status scheduled => resolved
2020-09-09 16:14 dmiguelez Fixed in Version => PR20Q4
2020-09-09 16:14 dmiguelez Fixed in SCM revision => https://gitlab.com/openbravo/product/openbravo/-/commit/4275f8d696686a8df665f8e87bda837896adbfa5 [^]
2020-09-09 16:14 dmiguelez Resolution open => fixed
2020-09-09 16:15 dmiguelez Review Assigned To => dmiguelez
2020-09-09 16:15 dmiguelez Note Added: 0122887
2020-09-09 16:15 dmiguelez Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker