Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0044540Openbravo ERP04. Warehouse managementpublic2020-07-02 10:572020-07-20 13:23
gorkaion 
inigo_lerga 
highmajorrandom
closedfixed 
5
 
 
Core
No
0044540: getLastCumulatedCosting returns random average when there are cost with same datefrom and dateto
When the last cost with cumulative values has the same datefrom and dateto values than others the getLastCumulatedCosting return a random average cost.

The method is only ordering by those 2 fields so in case there are several with the same values a random cost is returned.

This scenario is caused when there is a document with several lines of the same product (with different attribute or storage bin) and all of them generate an average cost. The normal situation is that from those lines the last processed one has a different dateto. If this transaction is adjusted the cumulative values are nullified so the next transaction with cumulative values have the same dateto and datefrom as other.
1. Create a document with several lines (at least 4) of the same product and quantity but different attributes or storage bin.
1.1. Issue has been detected using manufacturing but it should be reproduced also with a receipt or inventory.
2. Run the costing process.
3. Check that an average cost for each line has been created and that at least 2 of them has the same datefrom and dateto
4. Manually adjust the last calculated transactions. Identified by the average cost that has a different dateto.
5. Check that now the last average cost with cumulative values is one with the same datefrom and dateto.
6. Create a goods movement.
7. Run the background process and debug it to check that the query of getLastCumulatedCosting can return any of the costs with the same datefrom and dateto
Add an additional orderby clause by creation date so in case there are two or more costs with same datefrom and dateto the last created one is returned.
No tags attached.
Issue History
2020-07-02 10:57gorkaionNew Issue
2020-07-02 10:57gorkaionAssigned To => Triage Finance
2020-07-02 10:57gorkaionModules => Core
2020-07-02 10:57gorkaionTriggers an Emergency Pack => No
2020-07-02 10:58gorkaionResolution time => 1595455200
2020-07-02 11:30jfrancesIssue Monitored: jfrances
2020-07-03 12:48dmiguelezAssigned ToTriage Finance => inigo_lerga
2020-07-07 10:33inigo_lergaStatusnew => scheduled
2020-07-07 12:21inigo_lergaNote Added: 0121298
2020-07-09 10:31hgbotNote Added: 0121349
2020-07-20 12:21ngarciaIssue Monitored: ngarcia
2020-07-20 13:23hgbotResolutionopen => fixed
2020-07-20 13:23hgbotStatusscheduled => closed
2020-07-20 13:23hgbotNote Added: 0121529
2020-07-20 13:23hgbotNote Added: 0121530

Notes
(0121298)
inigo_lerga   
2020-07-07 12:21   
--Test Plan Mantis HQL--

As the F&B International Group Admin role in Backend:
  - Go to Goods Receipt window and create a new record for "Bebidas Alegres, S.L."
    Business Partner. Go to Lines Tab and create 4 records with "Agua sin Gas 1L"
    as Product, with the same amount of units in Movement Quantity (80 for example).
    Save and confirm the Goods Receipt.

  - Go to Process Request Window and open the "Costing Background Process" record
    and Unschedule it.
    Create a new record with "Costing Background Process" as process and Schedule it
    for "Run Immediately" Timing.

  #In this moment the modified query is executed with the new order by clause#

  - Go to Product window and open the "Agua sin Gas 1L" record.
    Go to Costing Tab and check that now the records appear with the correct order.
(0121349)
hgbot   
2020-07-09 10:31   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/97 [^]
(0121529)
hgbot   
2020-07-20 13:23   
Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 12f836e9a27b0433fc1057f7fa84280e0449cc02
Author: inigo_lerga <inigo.lerga@openbravo.com>
Date: 2020-07-20T11:23:40+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/12f836e9a27b0433fc1057f7fa84280e0449cc02 [^]

fixes BUG-44540:Added order by clause in getLastCumulatedCosting

---
M src/org/openbravo/costing/AverageAlgorithm.java
---
(0121530)
hgbot   
2020-07-20 13:23   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/97 [^]