Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028301Openbravo ERP04. Warehouse managementpublic2014-11-27 12:462014-12-30 23:26
psanjuan 
umartirena 
urgentmajoralways
closedfixed 
20Ubuntu 8.04.1
 
3.0PR15Q1 
Sandrahuguet
No
Core
No
0028301: [Costing] Cost not properly calculated after booking two backdated transactions
[Costing] Cost not properly calculated after booking two backdated transactions
In QA testing client go to Product window.
Create a new product named KDK01 for Spain org. Navigate to price tab and select purchase price list. Enter a unit/list price of 10.00 €

Go to purchase order and create a new one dated on 19-11-2014. PO 1. Select Spain org and vendor A. Enter 200 units. Book the order.

Go to goods receipt window and create a new one dated on 19-11-2014 by selecting purchase order above. GR 01. Receipt 200 units. Enter an storage bin. Complete the receipt.

Go to process request window and run costing background process.

Go back to the goods receipt and get it posted. Realize that value posted is 2000 (200 units * 10 €/unit)

Go to purchase order window and create a new one for Spain org, KDK01 product, vendor A, dated on 20-11-2014. PO 2. Enter 300 units a 10.00 price. Book the order and leave it there.

Create a new purchase order for all the same dated on 26-11-2014. PO 3. Enter 400 units and change the price to 12. Book the order.

Go to goods receipt and create a new one dated on 26-11-2014. Use create lines from and select purchase order PO3 dated on 26-11-2014. Receipt 380 units. Complete.

Go to process request window and run costing background process.

Go back to goods receipt and get it posted. Realize that value posted is 4560.00 (380 units * 12 €/unit)

Navigate to product window, search product KDK01 and go to costing tab.
Realize that there are two cost related lines.
Line related to inventory trans dated on 19-11-2014 - cost 10 units 200
Line related to inventory trans dated on 26-11-2014 - cost 11.3103 units 580

Go to goods receipt window and create a new one dated on 17-11-2014. Use create lines from and select purchase order PO2 dated on 20-11-2014. Receipt 100 units.

Go to process request window and run costing background process.

Go back to goods receipt and get the one dated on 17-11-2014 posted. Realize that value posted is 1000 (100 units x 10 €/unit)

Go to product window, search by product KDK01 and navigate to costing tab. Realize that there are 3 lines.
Line related to inventory trans dated on 17-11-2014 - cost 10 units 680
Line related to inventory trans dated on 19-11-2014 - cost 10 units 200
Line related to inventory trans dated on 26-11-2014 - cost 11.3103 units 580

(A backdated transaction has been created in cost adjustment window dated on 17-11-2014 window which is correct, for an amount = 0.00)

Go to goods receipt window and create a new one dated on 02-11-2014, use create lines from and select PO 3 dated on 26-11-2014. Receipt 10 units. Complete.

Run costing background process.

Go back to goods receipt dated on 02-11-2014 and get it posted. Realize that value posted is 120 (10 units x 12 €/unit)

Go to product window and search KDK01 product, navigate to costing tab.
There are 5 lines there which is not correct.

See image KDK01_Cost_before Landed Cost

Line related to inventory trans 02-11-2014 - cost 12 - units 690 - correct
Line related to inventory trans 17-11-2014 - cost 10.1818 - units 680 - correct
Line related to inventory trans 19-11-2014 - cost 10.0645 - units 200 - correct
Line related to inventory trans 26-11-2014 - cost 11.1304 - units 580 - this one is not correct because the cost is not correct.

And a Line related to no inventory trans - cost 11.1304 - net unit price 11.13 - this is not correct. This line should not be there.

Enter now a landed cost dated on 26-11-2014. Navigate to Cost tab and select two landed cost :Fees for an amount of 200 € and Transportation Cost for an amount of 950€. Total 1150. Go to Receipt tab and select the receipt dated on 26-11-2014. Process. A cost adjustment is created for the product and for an amount of 1150.

Go to product window, search the product and navigate to costing tab. There are 6 lines there which is not correct.

See image KDK01_Cost_after Landed Cost

Line related to inventory trans 02-11-2014 - cost 12 - units 690 - correct
Line related to inventory trans 17-11-2014 - cost 10.1818 - units 680 - correct
Line related to inventory trans 19-11-2014 - cost 10.0645 - units 200 - correct
Line related to inventory trans 26-11-2014 - cost 12.7971 - net unit price 15.03 - units 580 - this one is not totally correct net unit price should be 12

Line related to no inventory trans - cost 11.1304 - net unit price 11.13 - this is not correct. This line should not be there.
Line related to no inventory trans - cost 12.7971 - net unit price 12.80 - this one is not correct. this line should not be there.
Booking order:
date//units//price//otal value
19-11//200//10 //2000
26-11 // 380 // 12 // 4560
17-11 // 100 // 10 // 1000
02-11 // 10 // 12 // 120

Correct costing calculation (before landed cost booking) should be:

Line related to inventory trans 02-11-2014 - cost 12 - net unit price 12 - units 690
Line related to inventory trans 17-11-2014 - cost 10.1818 - net unit price 10 - units 680
Line related to inventory trans 19-11-2014 - cost 10.0645 - net unit price 10 - units 200
Line related to inventory trans 26-11-2014 - cost 11.1304 - net unit price 12 - units 580

02/11/2014 = 12 €/ud => 10 uds x 12 €/ud
17/11/2014 = 10.1818 €/ud => (120 € + 1000 €)/110 units
19/11/2014 = 10.0645 => (110*10.1818) + 2000 / 310 units
26/11/2014 = 11.1304 => (310*10.0645) + 4560 / 690 units

Correct cost calculation after landed cost is:

Line related to inventory trans 02-11-2014 - cost 12 - net unit price 12 - units 690
Line related to inventory trans 17-11-2014 - cost 10.1818 - net unit price 10 - units 680
Line related to inventory trans 19-11-2014 - cost 10.0645 - net unit price 10 - units 200
Line related to inventory trans 26-11-2014 - cost 12.7971 - net unit price 12 - units 580

02/11/2014 = 12 €/ud => 10 uds x 12 €/ud
17/11/2014 = 10.1818 €/ud => (120 € + 1000 €)/110 units
19/11/2014 = 10.0645 => (110*10.1818) + 2000 / 310 units
26/11/2014 = 12.7971 => (310*10.0645) + 4560 + 1150 / 690 units
No tags attached.
related to defect 0028192 closed umartirena [Costing] Net Unit Price field in Costing tab is not properly calculated 
png KDD01_Cost_beforeLandedCost.png (121,547) 2014-11-27 13:20
https://issues.openbravo.com/file_download.php?file_id=7552&type=bug
png

png KDD01_cost_afterLandedCost.png (92,851) 2014-11-27 13:20
https://issues.openbravo.com/file_download.php?file_id=7553&type=bug
png
Issue History
2014-11-27 12:46psanjuanNew Issue
2014-11-27 12:46psanjuanAssigned To => dmiguelez
2014-11-27 12:46psanjuanOBNetwork customer => No
2014-11-27 12:46psanjuanModules => Core
2014-11-27 12:46psanjuanTriggers an Emergency Pack => No
2014-11-27 12:49psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7161#r7161
2014-11-27 12:55psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7162#r7162
2014-11-27 12:55psanjuanProposed Solution updated
2014-11-27 13:09psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7163#r7163
2014-11-27 13:09psanjuanProposed Solution updated
2014-11-27 13:13psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7164#r7164
2014-11-27 13:13psanjuanProposed Solution updated
2014-11-27 13:19psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=7165#r7165
2014-11-27 13:19psanjuanProposed Solution updated
2014-11-27 13:19psanjuanRelationship addedrelated to 0028113
2014-11-27 13:19psanjuanAssigned Todmiguelez => Sandrahuguet
2014-11-27 13:20psanjuanFile Added: KDD01_Cost_beforeLandedCost.png
2014-11-27 13:20psanjuanFile Added: KDD01_cost_afterLandedCost.png
2014-12-01 10:40psanjuanRelationship deletedrelated to 0028113
2014-12-01 10:40psanjuanRelationship addedrelated to 0028192
2014-12-04 11:38hgbotCheckin
2014-12-04 11:38hgbotNote Added: 0072274
2014-12-04 11:38hgbotStatusnew => resolved
2014-12-04 11:38hgbotResolutionopen => fixed
2014-12-04 11:38hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/cc0f6b428be860e58b5708d67220832aef3ee83e [^]
2014-12-05 08:35hgbotCheckin
2014-12-05 08:35hgbotNote Added: 0072299
2014-12-05 11:06psanjuanProposed Solution updated
2014-12-05 11:12psanjuanProposed Solution updated
2014-12-05 11:14psanjuanProposed Solution updated
2014-12-05 11:17psanjuanProposed Solution updated
2014-12-05 11:19psanjuanProposed Solution updated
2014-12-05 11:25psanjuanProposed Solution updated
2014-12-05 11:25psanjuanProposed Solution updated
2014-12-05 11:26psanjuanNote Added: 0072307
2014-12-11 16:45SandrahuguetReview Assigned To => Sandrahuguet
2014-12-11 16:45SandrahuguetNote Added: 0072432
2014-12-11 16:45SandrahuguetStatusresolved => closed
2014-12-11 16:45SandrahuguetFixed in Version => 3.0PR15Q1
2014-12-11 18:12SandrahuguetNote Deleted: 0072432
2014-12-11 18:13SandrahuguetStatusclosed => new
2014-12-11 18:13SandrahuguetResolutionfixed => open
2014-12-11 18:13SandrahuguetFixed in Version3.0PR15Q1 =>
2014-12-11 18:13SandrahuguetStatusnew => scheduled
2014-12-11 18:13Sandrahuguetfix_in_branch => pi
2014-12-11 18:13SandrahuguetAssigned ToSandrahuguet => umartirena
2014-12-11 18:13SandrahuguetStatusscheduled => resolved
2014-12-11 18:13SandrahuguetResolutionopen => fixed
2014-12-11 18:15SandrahuguetReview Assigned ToSandrahuguet =>
2014-12-11 18:15Sandrahuguetfix_in_branchpi =>
2014-12-12 12:35SandrahuguetReview Assigned To => gorkaion
2014-12-19 11:13SandrahuguetReview Assigned Togorkaion => Sandrahuguet
2014-12-19 11:13SandrahuguetNote Added: 0072725
2014-12-19 11:13SandrahuguetStatusresolved => closed
2014-12-19 11:13SandrahuguetFixed in Version => 3.0PR15Q1
2014-12-30 23:26hudsonbotCheckin
2014-12-30 23:26hudsonbotNote Added: 0073169
2014-12-30 23:26hudsonbotCheckin
2014-12-30 23:26hudsonbotNote Added: 0073180

Notes
(0072274)
hgbot   
2014-12-04 11:38   
Repository: erp/devel/pi
Changeset: cc0f6b428be860e58b5708d67220832aef3ee83e
Author: Unai Martirena <unai.martirena <at> openbravo.com>
Date: Thu Dec 04 11:37:10 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/cc0f6b428be860e58b5708d67220832aef3ee83e [^]

Fixes Issue 28301: Cost is properly calculated after two backdated transactions.

The problem was in updateBDCostingTimeRange function. While updating the backdated average costing time, if a previous costing record was found, the future ending date was assigned to backdated costing record, not to the current costing, leaving as current costing the backdated costing record, and this is wrong.

---
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0072299)
hgbot   
2014-12-05 08:35   
Repository: erp/devel/pi
Changeset: 8c12e7511fd536e0baf208db846c027431365f7d
Author: Unai Martirena <unai.martirena <at> openbravo.com>
Date: Fri Dec 05 08:33:57 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/8c12e7511fd536e0baf208db846c027431365f7d [^]

Related to Issue 28301: Fix on updateBDCostingTimeRange function.

If the movement date of the inventory transaction related to current costing record is before the movement date of the inventory transaction related to backdated costing record, then the backdated costing record would be the current costing record. In other case the current costing record would remain as current costing record.

---
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0072307)
psanjuan   
2014-12-05 11:26   
Verified.
Just Code review missing. Once done this issue can be closed.
(0072725)
Sandrahuguet   
2014-12-19 11:13   
Code review done
(0073169)
hudsonbot   
2014-12-30 23:26   
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/6525fe229e06 [^]
Maturity status: Test
(0073180)
hudsonbot   
2014-12-30 23:26   
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/6525fe229e06 [^]
Maturity status: Test