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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0055837
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 09. Financial managementmajorunable to reproduce2024-06-25 13:292024-07-19 14:40
ReportersdossantosView Statuspublic 
Assigned Toaferraz 
PriorityhighResolutionfixedFixed in VersionPR24Q4
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionPR22Q2SCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0055837: Incorrect accumulated values ​​in CostAdjustmentUtils.getStockOnTransactionDat

DescriptionIn 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 Reproduce1. 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 SolutionTo 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
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0055836 closedaferraz Processing order of cost adjustment lines 

-  Notes
(0166308)
frank_gonzalez (developer)
2024-06-25 13:53

Jira: https://openbravo.atlassian.net/browse/RM-14959 [^]
(0166683)
hgbot (developer)
2024-07-04 13:50

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/1292 [^]
(0167191)
hgbot (developer)
2024-07-19 14:40

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 9e64cefb7b5ee64cfa3adc3a6373d18da55b11af
Author: Igor Trebol <i.trebol@orisha.com>
Date: 19-07-2024 12:40:22
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/9e64cefb7b5ee64cfa3adc3a6373d18da55b11af [^]

Fixes ISSUE-55837: Incorrect accumulated values ​​in CostAdjustmentUtils.getStockOnTransactionDate

---
A src-test/src/org/openbravo/test/costing/TestIssue55837.java
M src-test/src/org/openbravo/test/costing/TestCosting.java
M src-test/src/org/openbravo/test/costing/TestCostingBase.java
M src-test/src/org/openbravo/test/costing/TestCostingLandedCost.java
M src-test/src/org/openbravo/test/costing/TestCostingNoSourceAdjustments.java
M src-test/src/org/openbravo/test/costing/TestCostingSourceAdjustments.java
M src-test/src/org/openbravo/test/costing/utils/TestCostingUtils.java
M src/org/openbravo/costing/CostAdjustmentUtils.java
---
(0167192)
hgbot (developer)
2024-07-19 14:40

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

- 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 View Revisions
2024-07-10 10:52 aferraz Steps to Reproduce Updated View Revisions
2024-07-12 10:04 aferraz Assigned To igor_trebol => aferraz
2024-07-18 15:03 aferraz Steps to Reproduce Updated View Revisions
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


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker