Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0055837 | Openbravo ERP | 09. Financial management | public | 2024-06-25 13:29 | 2024-07-19 14:40 |
|
Reporter | sdossantos | |
Assigned To | aferraz | |
Priority | high | Severity | major | Reproducibility | unable to reproduce |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | PR22Q2 | |
Target Version | | Fixed in Version | PR24Q4 | |
Merge Request Status | |
Review Assigned To | |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0055837: Incorrect accumulated values in CostAdjustmentUtils.getStockOnTransactionDat |
Description | In this case the problem is in AverageAlgorithm.getLastCumulatedCosting(). Following the same case of 2 lines of a receipt generating a new average cost each. Each average cost will have different cumulative values. The problem is that when getLastCumulatedCosting is called, only the transaction process date is passed (or movement date if it is backdated, which I think is not entirely correct either but it does not impact this client)
final Costing costing = AverageAlgorithm.getLastCumulatedCosting(date, trx.getProduct(), costDimensions, costorg);
This implies that the method will return the last average cost calculated for that timestamp, that is, that of the second transaction with the accumulated of the 2 transactions. If you are adjusting the first transaction, it will only take into account the amount adjusted in the first transaction, so it calculates a bad average cost. |
Steps To Reproduce | 1. Generate a purchase order and goods receipt with two lines of the same product and quantity. Price = 10, Qty = 1.
2. Calculate the cost so an average cost for each line is generated -> each transaction is calculated with cost = 10 and two average costs are calculated with cost = 10.
3. Generate the purchase invoice with different prices. Price = 50.
4. Execute the Price difference adjustment process. -> both transactions are updated with original cost = 10 and cost = 50 (this is correct), but average costs are updated with cost = 30 (first record) and cost = 36.67 (second record).
This is wrong, both average costs should be updated with cost = 50. |
Proposed Solution | To fix it there are 2 options:
- add the transaction in the call to getLastCumulatedCosting and take it into account when searching for the latest or simplest,
- subtract 1 second from the timestamp that is passed so that it looks for a previous average cost |
Additional Information | |
Tags | No tags attached. |
Relationships | related to | defect | 0055836 | | closed | aferraz | Processing order of cost adjustment lines |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2024-06-25 13:29 | sdossantos | New Issue | |
2024-06-25 13:29 | sdossantos | Assigned To | => Triage Omni OMS |
2024-06-25 13:29 | sdossantos | Modules | => Core |
2024-06-25 13:29 | sdossantos | Triggers an Emergency Pack | => No |
2024-06-25 13:53 | frank_gonzalez | Note Added: 0166308 | |
2024-06-25 13:56 | Practics | Issue Monitored: Practics | |
2024-07-04 13:50 | hgbot | Note Added: 0166683 | |
2024-07-05 08:49 | aferraz | Assigned To | Triage Omni OMS => igor_trebol |
2024-07-05 08:49 | aferraz | Relationship added | related to 0055836 |
2024-07-10 10:52 | aferraz | Description Updated | bug_revision_view_page.php?rev_id=28206#r28206 |
2024-07-10 10:52 | aferraz | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=28208#r28208 |
2024-07-12 10:04 | aferraz | Assigned To | igor_trebol => aferraz |
2024-07-18 15:03 | aferraz | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=28255#r28255 |
2024-07-19 14:40 | hgbot | Resolution | open => fixed |
2024-07-19 14:40 | hgbot | Status | new => closed |
2024-07-19 14:40 | hgbot | Fixed in Version | => PR24Q4 |
2024-07-19 14:40 | hgbot | Note Added: 0167191 | |
2024-07-19 14:40 | hgbot | Note Added: 0167192 | |