Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0031318Openbravo ERP07. Sales managementpublic2015-11-02 11:022015-11-23 21:17
egoitz 
aferraz 
urgentmajoralways
closedfixed 
5
 
 
dmiguelez
Core
No
0031318: Processing landed cost is failing when there is a return material receipt voided
When processing a landed cost the process fails when some of the products have been used on a voided shipment.
The messages shown is:

It is not possible to process a Cost Adjustment that includes lines of transactions whose cost is permanently adjusted.\nLines:

That happens becuase the cost of the voided shipment is checked as permanent
1. create one receipt A.
2 create a shipment B
3.create the return from customer and the return material receipt of the shipment B.
4.- Void the Return material receipt.
5. calculate costs
6. Add landed cost to the receipt A,
Try to process it. You will receive an error:
"It is not possible to process a Cost Adjustment that includes lines of transactions whose cost is permanently adjusted.\nLines: "
The problem is in the searchReturnShipments method of the CostingAlgorithmAdjustmentImp.java

This query is taking into account the transactions related but it should not take into account, those that are voided
No tags attached.
Issue History
2015-11-02 11:02egoitzNew Issue
2015-11-02 11:02egoitzAssigned To => Triage Finance
2015-11-02 11:02egoitzModules => Core
2015-11-02 11:02egoitzResolution time => 1447974000
2015-11-02 11:02egoitzTriggers an Emergency Pack => No
2015-11-02 11:05egoitzSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9971#r9971
2015-11-09 13:47aferrazAssigned ToTriage Finance => aferraz
2015-11-09 13:47aferrazStatusnew => scheduled
2015-11-09 18:10aferrazAssigned Toaferraz => egoitz
2015-11-09 18:10aferrazStatusscheduled => feedback
2015-11-09 18:10aferrazNote Added: 0081632
2015-11-13 13:31VictorVillarNote Added: 0081823
2015-11-13 13:31VictorVillarAssigned Toegoitz => Triage Finance
2015-11-13 13:31VictorVillarStatusfeedback => new
2015-11-13 13:35VictorVillarSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=10237#r10237
2015-11-13 13:35VictorVillarProposed Solution updated
2015-11-13 14:13VictorVillarSummaryProcessing landed cost is failing when there is a shipment voided => Processing landed cost is failing when there is a return material receipt voided
2015-11-16 13:35aferrazAssigned ToTriage Finance => aferraz
2015-11-16 13:35aferrazStatusnew => scheduled
2015-11-16 19:05aferrazNote Added: 0081902
2015-11-16 20:40heccamIssue Monitored: heccam
2015-11-17 10:00psanjuanNote Added: 0081914
2015-11-17 11:36psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10259
2015-11-17 11:38psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10260
2015-11-17 12:11psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10261
2015-11-17 12:19psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10262
2015-11-17 12:22psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10263
2015-11-17 14:56psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10264
2015-11-19 08:54psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10276
2015-11-19 09:10psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10277
2015-11-19 09:11psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10278
2015-11-19 09:30psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10279
2015-11-19 09:31psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10281
2015-11-19 09:43psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10282
2015-11-19 09:43psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10283
2015-11-19 09:51psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10284
2015-11-19 09:53psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10285
2015-11-19 10:12psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10288
2015-11-19 10:12psanjuanNote Edited: 0081902bug_revision_view_page.php?bugnote_id=0081902#r10289
2015-11-19 10:12psanjuanNote Edited: 0081914bug_revision_view_page.php?bugnote_id=0081914#r10290
2015-11-19 11:57hgbotCheckin
2015-11-19 11:57hgbotNote Added: 0081982
2015-11-19 11:57hgbotStatusscheduled => resolved
2015-11-19 11:57hgbotResolutionopen => fixed
2015-11-19 11:57hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/10a0ffa315464547683c2e1701826209933eb066 [^]
2015-11-19 11:58dmiguelezReview Assigned To => dmiguelez
2015-11-19 11:58dmiguelezNote Added: 0081983
2015-11-19 11:58dmiguelezStatusresolved => closed
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082256

Notes
(0081632)
aferraz   
2015-11-09 18:10   
Not able to reproduce it
(0081823)
VictorVillar   
2015-11-13 13:31   
Updated the steps to reproduce
(0081902)
aferraz   
2015-11-16 19:05   
(edited on: 2015-11-19 10:12)
Test plan:

Test scenario 1

- Create one product for F&B US named "A 31318 positivo" for instace. Go to Price tab and select "Be Soft Drinker Price List". Enter a Unit/List price = 100.00

- Check that F&B Us Org has a costing rule assigned with below setup:
Average Algorithm
Warehouse Dimension = No
Backdated Transactions Fixed = No

- Create one receipt for the product of 10 unit on today's date. Run costing background process and check that in the Costing tab of the product, an average cost = 100.00 is shown.

- Create a shipment of the product, 5 units. Complete the shipment

- Create a return from customer for that 5 units as well as the corresponding return material receipt of the shipment

- Void the Return material receipt

- Run Costing Background process

- Check that current stock of the product is 0 and the cost is 100

- Add a landed cost of 5.00 to the receipt of the product. Process it. No error is shown. The process completes successfully and a Cost Adjustment of 5.00 is created for both the receipt (10 units adjusted by 5.00 landed cost amount) and the shipment (5 units adjusted by 2.50 landed cost amount).

- Run costing background process. Check it ends successfully.

- Check that the cost of the product is 1000.00 (10 unit x 100.00)+5=1005/10=100.5

(0081914)
psanjuan   
2015-11-17 10:00   
(edited on: 2015-11-19 10:12)
Issue verified.

Test plan above also verified.

Scenario 2

Also working in the case of getting into zero stock, that is for instance booking a goods receipt of 5 units, then a goods shipment of 5 units, and after that booking the return from customer and return material shipment of 5 units.
Once the above is done a landed cost is booked. This landed cost can be successfully booked. The cost of the product will once again be adjusted to the correct value, after booking a receipt that turns the stock of the product into a positive value.

Test scenario

- Create one product for F&B US named "A 31318 zero" for instace. Go to Price tab and select "Be Soft Drinker Price List". Enter a Unit/List price = 100.00

- Check that F&B Us Org has a costing rule assigned with below setup:
Average Algorithm
Warehouse Dimension = No
Backdated Transactions Fixed = No

- Create one receipt for the product of 5 units on today's date. Run costing background process and check that in the Costing tab of the product, an average cost = 100.00 is shown.

- Create a shipment of the product, 5 units. Complete the shipment

- Create a return from customer for that 5 units as well as the corresponding return material receipt of the shipment

- Void the Return material receipt

- Run Costing Background process

- Check that current stock of the product is 0 and the cost is 100

- Add a landed cost of 10.00 to the receipt of the product. Process it. No error is shown. The process completes successfully and a Cost Adjustment of 10.00 is created for both the receipt (5 units adjusted by 10.00 landed cost amount) and the shipment (5 units adjusted by 10.00 landed cost amount).

- Run costing background process. Check it ends successfully.

- Book a goods receipt for 5 units of the product. Complete the receipt.

- Run costing background process.

- Check that the cost of the product is once again 100.00

Scenario 3

Also working in the case of getting into negative stock, that is for instance booking a goods receipt of 5 units, then a goods shipment of 10 units, and after that booking the return from customer and return material shipment of 1 unit.
Once the above is done a landed cost is booked. This landed cost can be successfully booked. The cost of the product will once again be adjusted to the correct value, after booking a receipt that turns the stock of the product into a positive value.

Test scenario

- Create one product for F&B US named "A 31318 negative" for instace. Go to Price tab and select "Be Soft Drinker Price List". Enter a Unit/List price = 100.00

- Check that F&B Us Org has a costing rule assigned with below setup:
Average Algorithm
Warehouse Dimension = No
Backdated Transactions Fixed = No

- Create one receipt for the product of 5 units on today's date. Run costing background process and check that in the Costing tab of the product, an average cost = 100.00 is shown.

- Create a shipment of the product, 10 units. Complete the shipment

- Create a return from customer for that 1 unit as well as the corresponding return material receipt of the shipment

- Void the Return material receipt

- Run Costing Background process

- Check that current stock of the product is 0 and the cost is 100

- Add a landed cost of 10.00 to the receipt of the product. Process it. No error is shown. The process completes successfully and a Cost Adjustment is created for both the receipt (5 units adjusted by 10.00 landed cost amount) and the shipment (10 units adjusted by 20.00 landed cost amount).

- Run costing background process. Check it ends successfully.

- Book a goods receipt for 10 units of the product. Complete the receipt.

- Run costing background process.

- Check that the cost of the product is once again 100.00

(0081982)
hgbot   
2015-11-19 11:57   
Repository: erp/devel/pi
Changeset: 10a0ffa315464547683c2e1701826209933eb066
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Nov 16 18:49:39 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/10a0ffa315464547683c2e1701826209933eb066 [^]

Fixes issue 31318: Landed cost fails when there is ReturnMaterialReceipt voided

Voided shipments should be excluded when searching transactions which depend on another adjusted transaction.

---
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
---
(0081983)
dmiguelez   
2015-11-19 11:58   
Code Review + Testing Ok
(0082256)
hudsonbot   
2015-11-23 21:17   
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/7b56bebaaa88 [^]
Maturity status: Test