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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0038307
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 04. Warehouse managementmajoralways2018-04-10 13:462018-05-17 21:41
ReportergorkaionView Statuspublic 
Assigned Togorkaion 
PriorityurgentResolutionfixedFixed in Version3.0PR18Q3
StatusclosedFix in branchFixed in SCM revision53de8c237978
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned Toaferraz
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0038307: Wrong negative correction amount when trx has no unit cost adjustments

DescriptionConsider a receipt with a NO unit cost adjustment (a Landed Cost or Manual adjustment). If this receipt has to be also adjusted with the Negative Stock Correction the NO unit cost adjustment amount is not properly considered in the calculations and the effect in the Average Cost of the adjustment is lost.

When calculating the transaction price it should consider all adjustments except other negative stock corrections.

For example:

Scenario 1:

Receipt 1. 10 ud at 10EUR each. Avg Cost 10EUR/ud. (Trx Amt: 100EUR)
Shipment 1. -15 ud. (Trx Amt: -150EUR)
Receipt 2. 10 ud at 10EUR each. Landed Cost of 50EUR. (Trx Amt: 150EUR)

In this scenario the expected Avg Cost should be the price of the Receipt 2 taking into account the landed cost (100EUR+50EUR)/10 = 15 EUR/Ud.

But if Negative Stock Correction is enabled the trx Price is calculated considering only the Unit Cost adjustments so the average is reverted to 10EUR/Ud.

Scenario 2:
Receipt 1. 10 ud at 10EUR each. Avg Cost 10EUR/ud. (Trx Amt: 100EUR)
Shipment 1. -15 ud. (Trx Amt: -150EUR)
Receipt 2. 10 ud at 12EUR each. Landed Cost of 50EUR. (Trx Amt: 170EUR)

In this case the Price of the Receipt 2 should be 170EUR/10Ud = 17EUR/ud.That is the average cost that should be left after the negative stock correction.
Steps To Reproduce1. In Costing Rules window enable the Fix Backdated Transaction for 2018 in the rule of F&B Spain.
2. In Preferences window add a new preference using property "Enable Negative Stock Corrections" and value "Y" for everyone.
Logout and login.
3. Create a new Product "Test" in F&B Spain with price 10EUR.
4. Create a Physical Inventory of 10ud with cost 10EUR.
5. Create another Physical Inventory that adds another 10ud with cost 10EUR and movement date 5 days after the first inventory.
6. Execute the Costing Background process.
7. In Product -> Transactions tab for the New product. Select the second inventory transaction and add a Manual Cost Adjustment. Amount 50EUR, incremental: Yes, unit cost: No.
8. Check that the costing of the inventory changes to 12.5 EUR/Ud.
9. Create a shipment with movement date between both physical inventories. Add the Test Product, quantity 15 Ud.
10. Execute the Costing Background process.
11. Check the Costing tab of the product and see that the second average cost has changed to 10EUR/Ud.
12. Check the Transaction Costs of the second inventory and see that there is a line related to a negative correction of -50EUR which should be -25EUR. To ensure that the average cost is 15EUR as the price of the inventory plus the manual adjustment.
Proposed SolutionWhen calculating the trxPrice we should also add the adjustment amounts that have Unit Cost = No and Is Negative Correction = No.

Or alternatively calculate it using the trxCost and subtracting the adjustment amounts with Unit Cost = No and Is Negative Correction = Yes
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0038203 closedAtulOpenbravo Permanently adjusted transactions wrongly included in Cost Adjustment process. 

-  Notes
(0104492)
gorkaion (developer)
2018-05-14 12:46

I sent a proposal patch to the team last friday. I'm not expecting more actions on my side.
(0104561)
hgbot (developer)
2018-05-17 13:14

Repository: erp/devel/pi
Changeset: 53de8c2379789a5560e17f93b26dc20895e10ed4
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed May 16 18:30:19 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/53de8c2379789a5560e17f93b26dc20895e10ed4 [^]

Fixes issue 38307: Wrong NSC when trx has no unit cost adjustments

When calculating the trxPrice we should take into account every adjustment amount (unit cost or not unit cost), but negative stock corrections.

---
M src-test/src/org/openbravo/test/costing/TestCostingLandedCost.java
M src-test/src/org/openbravo/test/costing/TestCostingNoSourceAdjustments.java
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0104562)
hgbot (developer)
2018-05-17 13:14

Repository: erp/devel/pi
Changeset: 6d9d6f5386411139029decf2b1304ed74779e098
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu May 17 13:14:16 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/6d9d6f5386411139029decf2b1304ed74779e098 [^]

Related to issue 38307: Remove unused prices in TestCostingLandedCost.java

---
M src-test/src/org/openbravo/test/costing/TestCostingLandedCost.java
---
(0104563)
aferraz (manager)
2018-05-17 13:15

Fix done by gorkaion.
(0104564)
aferraz (manager)
2018-05-17 13:15

Code review + Testing OK
(0104580)
hudsonbot (developer)
2018-05-17 21:41

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4e28963f0fe6 [^]
Maturity status: Test
(0104581)
hudsonbot (developer)
2018-05-17 21:41

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/4e28963f0fe6 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2018-04-10 13:46 gorkaion New Issue
2018-04-10 13:46 gorkaion Assigned To => Triage Finance
2018-04-10 13:46 gorkaion Modules => Core
2018-04-10 13:46 gorkaion Resolution time => 1525125600
2018-04-10 13:46 gorkaion Triggers an Emergency Pack => No
2018-04-10 13:46 gorkaion Issue generated from 0038203
2018-04-10 13:46 gorkaion Relationship added related to 0038203
2018-04-10 16:16 aferraz Assigned To Triage Finance => collazoandy4
2018-04-18 02:36 collazoandy4 Status new => scheduled
2018-04-26 16:55 ngarcia Issue Monitored: ngarcia
2018-05-11 14:01 vmromanos Assigned To collazoandy4 => gorkaion
2018-05-14 12:45 gorkaion Assigned To gorkaion => Triage Finance
2018-05-14 12:46 gorkaion Note Added: 0104492
2018-05-17 12:51 gorkaion Steps to Reproduce Updated View Revisions
2018-05-17 13:14 hgbot Checkin
2018-05-17 13:14 hgbot Note Added: 0104561
2018-05-17 13:14 hgbot Status scheduled => resolved
2018-05-17 13:14 hgbot Resolution open => fixed
2018-05-17 13:14 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/53de8c2379789a5560e17f93b26dc20895e10ed4 [^]
2018-05-17 13:14 hgbot Checkin
2018-05-17 13:14 hgbot Note Added: 0104562
2018-05-17 13:15 aferraz Assigned To Triage Finance => gorkaion
2018-05-17 13:15 aferraz Note Added: 0104563
2018-05-17 13:15 aferraz Review Assigned To => aferraz
2018-05-17 13:15 aferraz Note Added: 0104564
2018-05-17 13:15 aferraz Status resolved => closed
2018-05-17 13:15 aferraz Fixed in Version => 3.0PR18Q3
2018-05-17 21:41 hudsonbot Checkin
2018-05-17 21:41 hudsonbot Note Added: 0104580
2018-05-17 21:41 hudsonbot Checkin
2018-05-17 21:41 hudsonbot Note Added: 0104581


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker