Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038157Openbravo ERP04. Warehouse managementpublic2018-03-16 10:512018-03-23 21:22
gorkaion 
collazoandy4 
immediatemajoralways
closedfixed 
5
 
3.0PR18Q2 
dmiguelez
Core
Pre packaging ( pi )
2018-01-15
pi
https://code.openbravo.com/erp/devel/pi/rev/6fc5c9829dff02db5bb10f5f3b09c2cb137ef0d0 [^]
No
0038157: Receipts originally calculated with avg and adjusted by price difference correction are readjusted if avg cost changes
Having a Goods Receipt with no related Purchase Order but a related Purchase Invoice.

When the cost of the receipt is calculated the current average is used. Later the Price Difference correction process is launched and the cost is adjusted with the invoice price.

Now a previous transaction is adjusted so the average cost changes. The Goods Receipt is adjusted again with the new average cost not taking into account the Invoice Price. This last adjustment should not happen as the cost of the receipt is not based on the average cost anymore.

After fix of issue 0037279 when a incoming transaction is calculated using the
average cost. If the average cost used to calculate it is later changed by some cost adjustment the cost of this transaction is calculated again.

For example:
- Physical Inventories that increase stock and does not have a cost defined.
- Goods Receipts without a related Purchase Order.

Enable preference to automatically execute Price Difference Correction (Property: "Enable automatic Price Difference Corrections").

On a product with an average cost.
* Create a Purchase Invoice for that product with qty 2000 and price 1.
* Create a Goods Receipt using the Create Lines From to select the created invoice and change the quantity to 1000.
* Repeat previous step to create a second Goods Receipt with the remaining 1000 qty.
* Execute Costing Background process and check in the Product -> Transactions tab that the receipts are calculated with Average Cost and adjusted with the invoice price.
* On the Transactions tab select the first Receipt and click on Manual Adjustment. Set amount=10000, incremental=Yes and Unit Cost = No.
* Check that the second receipt is adjusted again and the cost is based with the new Average Cost.
*
When checking if the transaction is based on the average cost take into account Goods Receipts that are already adjusted by the Price Difference Correction.
No tags attached.
caused by defect 0037279 closed nonofrancisco Physical Inventory lines which increase stock and do not have a cost defined are not adjusted 
Issue History
2018-03-16 10:51gorkaionNew Issue
2018-03-16 10:51gorkaionAssigned To => Triage Finance
2018-03-16 10:51gorkaionModules => Core
2018-03-16 10:51gorkaionResolution time => 1522965600
2018-03-16 10:51gorkaionRegression level => Pre packaging ( pi )
2018-03-16 10:51gorkaionRegression date => 2018-01-15
2018-03-16 10:51gorkaionRegression introduced in release => pi
2018-03-16 10:51gorkaionRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/6fc5c9829dff02db5bb10f5f3b09c2cb137ef0d0 [^]
2018-03-16 10:51gorkaionTriggers an Emergency Pack => No
2018-03-16 10:53gorkaionRelationship addedcaused by 0037279
2018-03-16 10:56aferrazAssigned ToTriage Finance => collazoandy4
2018-03-16 16:06collazoandy4Statusnew => scheduled
2018-03-19 10:14ngarciaIssue Monitored: ngarcia
2018-03-20 23:09collazoandy4Note Added: 0103380
2018-03-23 09:34hgbotCheckin
2018-03-23 09:34hgbotNote Added: 0103459
2018-03-23 09:34hgbotStatusscheduled => resolved
2018-03-23 09:34hgbotResolutionopen => fixed
2018-03-23 09:34hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/686b219d7c5e5d5c118ec449fca312a0b58921f8 [^]
2018-03-23 09:34hgbotCheckin
2018-03-23 09:34hgbotNote Added: 0103460
2018-03-23 09:34hgbotCheckin
2018-03-23 09:34hgbotNote Added: 0103462
2018-03-23 09:36dmiguelezReview Assigned To => dmiguelez
2018-03-23 09:36dmiguelezNote Added: 0103464
2018-03-23 09:36dmiguelezStatusresolved => closed
2018-03-23 09:36dmiguelezFixed in Version => 3.0PR18Q2
2018-03-23 21:22hudsonbotCheckin
2018-03-23 21:22hudsonbotNote Added: 0103478
2018-03-23 21:22hudsonbotCheckin
2018-03-23 21:22hudsonbotNote Added: 0103479
2018-03-23 21:22hudsonbotCheckin
2018-03-23 21:22hudsonbotNote Added: 0103481

Notes
(0103380)
collazoandy4   
2018-03-20 23:09   
Test Plan
  Enable preference to automatically execute Price Difference Correction (Property: "Enable automatic Price Difference Corrections").
  Create a new product with purchase price list of 5.0, set an avg cost of 7
  Create and book a Purchase Invoice for the previous product with qty 2000 and price 1.0
  Create two Goods Receipts from the previous invoice with qty 1000
  Execute Costing Background process and check in the Product -> Transactions tab that the receipts are calculated with Average Cost and adjusted with the invoice price.
  On the Transactions tab select the first Receipt and click on Manual Adjustment. Set amount=10000, incremental=Yes and Unit Cost = No.
  Check that the second receipt is not adjusted
(0103459)
hgbot   
2018-03-23 09:34   
Repository: erp/devel/pi
Changeset: 686b219d7c5e5d5c118ec449fca312a0b58921f8
Author: Armaignac <collazoandy4 <at> gmail.com>
Date: Mon Mar 19 18:11:05 2018 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/686b219d7c5e5d5c118ec449fca312a0b58921f8 [^]

Fixes issue 38157: Receipts originally calculated with avg and adjusted by price
difference correction are readjusted if avg cost changes.

Having a Goods Receipt with no related Purchase Order but a related Purchase
Invoice, when the cost of the receipt is calculated the current average is used.
If the average cost used to calculate it is later changed by some cost adjustment
the cost of this transaction is calculated again even if the receipt was adjusted
by the Price Difference Correction process.

Now when checking if the transaction is based on the average cost take into account
if the receipts are already adjusted by the Price Difference Correction.

---
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0103460)
hgbot   
2018-03-23 09:34   
Repository: erp/devel/pi
Changeset: 5117700335fbce7a2d983b4007269eaace3d4205
Author: Armaignac <collazoandy4 <at> gmail.com>
Date: Tue Mar 20 18:01:55 2018 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/5117700335fbce7a2d983b4007269eaace3d4205 [^]

Related to issue 38157: Updated test 37279 with the new behavior

The JUnit test for issue 37279 was updated to take into account the new behavior
when the Goods Receipts have not Purchase Order related and the avg cost is updated

---
M src-test/src/org/openbravo/test/costing/TestIssue37279.java
M src-test/src/org/openbravo/test/costing/utils/TestCostingUtils.java
---
(0103462)
hgbot   
2018-03-23 09:34   
Repository: erp/devel/pi
Changeset: d3cd0c58c993b0eebae2fef4e09308dbb3112be3
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Mar 23 09:34:17 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/d3cd0c58c993b0eebae2fef4e09308dbb3112be3 [^]

Related to Issue 38157. Code Review changes:

* Extracted String into constant
* In hql query, add explicit property instead of retrieving it from the object,
  it makes query easier to read

---
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0103464)
dmiguelez   
2018-03-23 09:36   
Code Review + Testing Ok
(0103478)
hudsonbot   
2018-03-23 21:22   
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/42e5233f5207 [^]
Maturity status: Test
(0103479)
hudsonbot   
2018-03-23 21:22   
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/42e5233f5207 [^]
Maturity status: Test
(0103481)
hudsonbot   
2018-03-23 21:22   
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/42e5233f5207 [^]
Maturity status: Test