Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 09. Financial managementmajorunable to reproduce2024-06-25 13:292024-07-18 15:03
ReportersdossantosView Statuspublic 
Assigned Toaferraz 
PriorityhighResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionPR22Q2SCM revision 
Review Assigned To
Web browser
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

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
frank_gonzalez (developer)
2024-06-25 13:53

Jira: [^]
hgbot (developer)
2024-07-04 13:50

Merge Request created: [^]

- 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

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker