Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0031080Openbravo ERP04. Warehouse managementpublic2015-10-07 09:152015-11-23 21:17
VictorVillar 
aferraz 
immediatemajoralways
closedfixed 
5
pi 
 
dmiguelez
Core
No
0031080: Standard Algorithm is not working with Cost Adjustment: Inventory Amount Update and Manual Cost Correction
Standard Algorithm is not working with Cost Adjustment: it should work with Inventory Amount Update and Manual Cost Correction, it means that is necessary to generate adjustments when the user is indicating a cost in the past or is changing a transaction in the past
Standard Algorithm is not working with Cost Adjustment: it should work with Inventory Amount Update and Manual Cost Correction, it means that is necessary to generate adjustments when the user is indicating a cost in the past or is changing a transaction in the past
No tags attached.
caused by defect 0029730 closed aferraz [Cost Adjustments] It should not be possible to manually correct the cost of a transaction valued at Standard Cost. 
? Issue31080-TestPlan2B&2C.odt (62,022) 2015-11-06 09:47
https://issues.openbravo.com/file_download.php?file_id=8694&type=bug
? Issue31080-TestPlan3B&3C.odt (60,631) 2015-11-11 13:23
https://issues.openbravo.com/file_download.php?file_id=8713&type=bug
Issue History
2015-10-07 09:15VictorVillarNew Issue
2015-10-07 09:15VictorVillarAssigned To => Triage Finance
2015-10-07 09:15VictorVillarModules => Core
2015-10-07 09:15VictorVillarTriggers an Emergency Pack => No
2015-10-09 10:06VictorVillarSummaryStandard Algorithm is not working with Cost Adjustment => Standard Algorithm is not working with Cost Adjustment: Inventory Amount Update and Manual Cost Correction
2015-10-09 10:06VictorVillarDescription Updatedbug_revision_view_page.php?rev_id=9657#r9657
2015-10-09 10:06VictorVillarSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9659#r9659
2015-10-09 10:58VictorVillarTypedesign defect => defect
2015-10-09 10:58VictorVillarRelationship addedcaused by 0029730
2015-10-09 13:27aferrazNote Added: 0080914
2015-10-09 13:27aferrazAssigned ToTriage Finance => aferraz
2015-10-09 13:27aferrazStatusnew => feedback
2015-10-13 09:35VictorVillarResolution time => 1444946400
2015-10-13 09:35VictorVillarDescription Updatedbug_revision_view_page.php?rev_id=9669#r9669
2015-10-13 09:35VictorVillarSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9670#r9670
2015-10-19 14:07psanjuanNote Added: 0081087
2015-10-19 14:34psanjuanNote Edited: 0081087bug_revision_view_page.php?bugnote_id=0081087#r9709
2015-10-23 12:28psanjuanNote Edited: 0081087bug_revision_view_page.php?bugnote_id=0081087#r9843
2015-10-26 15:05psanjuanNote Added: 0081314
2015-10-26 18:33aferrazStatusfeedback => scheduled
2015-10-27 08:43psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9882
2015-10-27 08:49psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9883
2015-10-27 08:53psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9884
2015-10-27 08:54psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9885
2015-10-27 08:56psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9886
2015-10-27 09:01psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9887
2015-10-27 09:11psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9888
2015-10-27 09:13psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9889
2015-10-27 09:15psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9890
2015-10-27 09:18psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9891
2015-10-27 09:26psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9892
2015-10-27 09:31psanjuanNote Edited: 0081314bug_revision_view_page.php?bugnote_id=0081314#r9893
2015-10-27 10:05psanjuanNote Added: 0081336
2015-11-02 10:39aferrazNote Added: 0081415
2015-11-02 10:40aferrazNote Added: 0081416
2015-11-02 11:27aferrazNote Added: 0081419
2015-11-02 11:29aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r9975
2015-11-02 12:49aferrazNote Edited: 0081415bug_revision_view_page.php?bugnote_id=0081415#r9978
2015-11-02 12:49aferrazNote Deleted: 0081416
2015-11-02 12:50aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r9979
2015-11-02 13:10aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r9984
2015-11-02 21:23aferrazNote Added: 0081442
2015-11-02 22:01aferrazNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r9998
2015-11-02 22:02aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r9999
2015-11-02 22:13aferrazNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10000
2015-11-03 10:49aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10003
2015-11-03 11:07aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10006
2015-11-03 11:09aferrazNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10007
2015-11-03 11:33aferrazNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10008
2015-11-03 12:09aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10012
2015-11-03 12:09aferrazNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10013
2015-11-03 12:10aferrazNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10014
2015-11-03 13:02aferrazNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10015
2015-11-04 11:15psanjuanNote Edited: 0081415bug_revision_view_page.php?bugnote_id=0081415#r10049
2015-11-04 11:19psanjuanNote Edited: 0081415bug_revision_view_page.php?bugnote_id=0081415#r10050
2015-11-04 12:38psanjuanNote Edited: 0081415bug_revision_view_page.php?bugnote_id=0081415#r10051
2015-11-04 13:18psanjuanNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10052
2015-11-04 13:23psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10053
2015-11-04 13:42psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10054
2015-11-04 13:56psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10055
2015-11-04 14:11psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10056
2015-11-04 14:41psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10057
2015-11-04 14:47psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10058
2015-11-04 14:54psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10059
2015-11-04 15:03psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10060
2015-11-04 15:09psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10061
2015-11-04 15:17psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10062
2015-11-04 15:19psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10063
2015-11-05 09:03psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10067
2015-11-05 09:06psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10068
2015-11-05 09:12psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10069
2015-11-05 09:16psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10070
2015-11-05 13:51psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10081
2015-11-06 08:40psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10082
2015-11-06 09:47psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10085
2015-11-06 09:47psanjuanFile Added: Issue31080-TestPlan2B&2C.odt
2015-11-06 09:58psanjuanNote Edited: 0081419bug_revision_view_page.php?bugnote_id=0081419#r10086
2015-11-06 10:00psanjuanNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10089
2015-11-06 10:01psanjuanNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10090
2015-11-06 13:08psanjuanNote Edited: 0081442bug_revision_view_page.php?bugnote_id=0081442#r10095
2015-11-11 13:23psanjuanFile Added: Issue31080-TestPlan3B&3C.odt
2015-11-11 13:25psanjuanNote Added: 0081705
2015-11-16 13:41hgbotCheckin
2015-11-16 13:41hgbotNote Added: 0081879
2015-11-16 13:41hgbotCheckin
2015-11-16 13:41hgbotNote Added: 0081880
2015-11-16 13:51hgbotCheckin
2015-11-16 13:51hgbotNote Added: 0081881
2015-11-16 13:51hgbotStatusscheduled => resolved
2015-11-16 13:51hgbotResolutionopen => fixed
2015-11-16 13:51hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/8b4787d9d03031c1ff8dac78feab532a9da4f07a [^]
2015-11-16 13:52hgbotCheckin
2015-11-16 13:52hgbotNote Added: 0081882
2015-11-16 13:52dmiguelezReview Assigned To => dmiguelez
2015-11-16 13:52dmiguelezNote Added: 0081883
2015-11-16 13:52dmiguelezStatusresolved => closed
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082234
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082235
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082236
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082237

Notes
(0080914)
aferraz   
2015-10-09 13:27   
Correct behaviour should be discussed internally.
Also, a more detailed description in the issue would help to understand which is the real problem.
(0081087)
psanjuan   
2015-10-19 14:07   
(edited on: 2015-10-23 12:28)
Proposed Solution:

(1) Manual Cost Adjustment does not need to be modified as it should not be possible to adjust a transaction valued at "Standard" cost by definition and also to get inventory and accounting balanced.

(2) Inventory Amount Update:

- "Backdated Transactions Fix" flag and "Fix Backdated From" button need to be shown always, even when the "Standard" algorithm is use, because....

- Inventory Amount Update process can create "backdated" adjustments regardless "Backdated Transactions Fix" flag is active or not in the costing rule (for both average and standard), if

- For both average and standard regardless "Backdated Transactions Fix" flag is active or not, if a backdated transaction is booked all opening inventory created by an Inventory Amount Update dated after the backdated transaction, will have to be adjusted. (to be detailed for both Standard and Average, and in the case "Backdated Transactions Fix" flag is active or not)

Example: (to be created).

- For both average and standard regardless "Backdated Transactions Fix" flag is active or not, if an Inventory Amount Update is created in the past, the behavior should be the same as above. (to be detailed for both Standard and Average, and in the case "Backdated Transactions Fix" flag is active or not).

Example: (to be created).

Besides the above, and in the case of "Average" + "Backdated Transactions Fix" flag active, all transactions needs to be adjusted. Current behavior.

(0081314)
psanjuan   
2015-10-26 15:05   
(edited on: 2015-10-27 09:31)
New meeting to discuss about the topic. New conclusions are:

(1) No need required for Manual Cost Adjustment

(2) It should be possible to book Inventory Amount Updates "As of Date" in the past, for "Standard" Algorithm.

It should not be necessary to enable "Fix Backdated From" feature in the Costing Rule, for this scenario to work.

As a consequence of this, existing "outgoing" transactions valued at a given standard cost and dated after "backdated" IAU (and before next IAU If any), will have to be adjusted to the new cost.

Same way "closing" transactions created by Inventory Amount Updates booked after "backdated" IAU, at a different cost, will also have to be adjusted (as a way to get that the "opening" transaction created by IAU keeps the new standard cost entered by the end-user).

Example:

dated on 01-01-2015 - receipt of 10 units at a standard cost = 1.00 - Total value of the inventory = 10.00

dated on 02-02-2015 - shipment of 5 units at the standard cost = -5.00

dated on 03-03-2015 - there is an inventory Amount Update that changes the standard cost to 3.00, therefore new value of the stock is 15.00 (5 units * 3.00 €/ud).

dated on 04-04-2015 an Inventory Amount Update is booked in the system as a backdated transaction. Movement date is 15-01-2015, just after the first receipt. Standard Cost booked = 2.00

Adjustments:

- The shipment valued at 1.00 (-5) should have been valued at 2.00 (-10), therefore an adjustment = -5.00 needs to be created.

- Closing inventory transaction of the "IAU" dated on 03-03-2015, should have been valued at -10.00; therefore another adjustment = -5.00 needs to be created and related to this transaction.

- Finally, Opening inventory transaction of the "IAU" dated on 03-03-2015 remains as it is, valued at a standard cost = 3.00. All transactions booked in the system starting from 03-03-2015 should be valued at a standard cost = 3.00


(3) It should be possible to book "Backdated" transactions that adjust "Opening Inventory" transactions created by an Inventory Amount Update that changes the standard cost, if any, on an later date, therefore the new standard cost remains.

It is necessary to enable "Fix Backdated From" feature in the Costing Rule, for this scenario to work, otherwise the transaction process date of the backdated transaction will be the one to take into account, instead movement date, therefore no adjustment would be needed.

Example:

dated on 01-01-2015 - receipt of 10 units at a standard cost = 1.00 - Total value of the inventory = 10.00 - Stock 10

dated on 02-02-2015 - "IAU" that changes the standard cost to 2.00 - Total value of the inventory = 20.00 - Stock 10

dated on 03-03-2015 - shipment of 5 units at a standard cost of 2.00 - -10.00

dated on 04-04-2015 - "IAU" that changes the standard cost to 3.00 - Stock = 5

dated on 05-05-2015 - shipment of 2 units, with a movement date in the past 15-01-2015 (backdated transaction) just after first receipt

Adjustments:

Qty /// Cost/// Acc.Cost /// Stock
+10 /// +10.00 /// 10.00 /// 10 - receipt of 10 units st = 1.00

-10 /// -10.00 /// 0.00 /// 0 - "closing" IAU st = 1.00
+10 /// +20.00 /// 20.00 /// 10 - "opening" IAU st = 2.00

-5 /// -10.00 /// 10.00 /// 5 - shipment of 2 units st = 2.0
-5 /// -10.00 /// 0.00 /// 0 - "closing" IAU st = 2.00
+5 /// +15.00 /// 15.00 /// 5 - "opening" IAU st = 3.00

dated on 05-05-2015 - shipment of 2 units, with a movement date in the past 15-01-2015 (backdated transaction) just after first receipt

Qty Cost Acc.Cost Stock
+10/// +10.00 /// 10.00 /// 10 - receipt of 10 units st = 1.00
-2 /// -2.00/// 8.00/// 8 - shipment of 2 units st = 1.00
-10/// -10.00 /// 0.00/// -2 - "closing" IAU st = 1.00
+10 /// +20.00 /// 18.00 /// 8 - "opening" IAU st = 2.00

-5 /// -10.00 /// 10.00 /// 3 - shipment of 2 units st = 2.0
-5 /// -10.00/// 0.00/// -2 - "closing" IAU st = 2.00
+5 /// +15.00/// 15.00 /// 3 - "opening" IAU st = 3.00

First Opening IAU adjustment - Set Standard Cost = 2.00

Sum Cost = 10.00-2.00-10.00+20.00 = 18.00
Sum Qty = 10-2-10+10 = 8

There are 8 units valued at 18.00, while there should be 8 units valued at 2.00 = 16.00. Therefore an adjustment related to the opening IAU transaction = -2.00 is needed.

Second Opening IAU adjustment - Set Standard Cost = 3.00

Sum Cost = 10.00-2.00-10.00+18.00-10.00-10.00+15.00 = 11.00
Sum Qty = 10-2-10+10-5-5+5 = 3

There are 3 units valued at 11.00, while there should be 3 units valued at 3.00 = 9.00. Therefore an adjustment related to the opening IAU transaction = -2.00 is needed.

(0081336)
psanjuan   
2015-10-27 10:05   
This issue as well as its resolution only refers to Standard.
A different issue will be created to handle same scenarios for Average algorithm.
(0081415)
aferraz   
2015-11-02 10:39   
(edited on: 2015-11-04 12:38)
Test plan 1 ("Backdated Transactions Fixed" flag and "Fix Backdated Transactions" button in Costing Rule window):

As QA Admin:

Test Scenario 1

- Go to Process Request window and run costing background process for QA Testing Client. Check that the process ends successfully.
- Go to Costing Rule window
- Create a new one for "Spain" organization and "Standard" algorithm.
- Check "Warehouse Dimension" flag.
- Realize "Backdated Transactions Fixed" flag is displayed.
- Check "Backdated Transactions Fixed" flag.
- Realize that "Fix Backdated From" field is displayed.
- Enter a "Fix Backdated From" date = 01-01-2001.
- Check that below error message is shown, which is correct:
"Fix Backdated from date should be equal or later than the starting date of the costing rule. If this not the first costing rule, current date will be taken as starting date. Same way if no date is entered in the fix backdated from date, current date will be taken."
- Leave Fix Backdated From field empty
- Click on "Validate Costing Rule"
- Check that Costing Rule can be validated.

Test Scenario 2
- Go to Costing Rule window
- Create a new one for "USA" organization and "Standard" algorithm.
- Check "Warehouse Dimension" flag.
- Realize "Backdated Transactions Fixed" flag is displayed.
- Do Not check "Backdated Transactions Fixed" flag.
- Click on "Validate Costing Rule"
- Check that Costing Rule can be validated.
- Realize "Fix Backdated Transactions" button is displayed.
- Click on "Fix Backdated Transactions" button.
- Enter a "Fix Backdated From" date that is one day before current date. Press done.
- Check that below error message is shown, which is correct:
"Fix Backdated from date should be equal or later than the starting date of the costing rule. If this not the first costing rule, current date will be taken as starting date. Same way if no date is entered in the fix backdated from date, current date will be taken."
- Click on "Fix Backdated Transactions" button one again.
- Enter 04-11-2015. Realize that this is a date/time field, therefore time gets 00:00:00 value
- Press done.
- Check that below error message is shown, which is correct because we are entering a time in the past.
"Fix Backdated from date should be equal or later than the starting date of the costing rule. If this not the first costing rule, current date will be taken as starting date. Same way if no date is entered in the fix backdated from date, current date will be taken."
- Click on "Fix Backdated Transactions" button one again.
- Leave "Fix Backdated From" empty. Press Done.
- Realize that the costing rule can be successfully validated and the date/time shown in the Fix Backdated From field is exactly the same as the one set in Costing Rule "Starting Date".

(0081419)
aferraz   
2015-11-02 11:27   
(edited on: 2015-11-06 09:58)
Test plan 2 (Backdated transaction):

As QA Admin:

- Run "Costing Background" process for QA Testing client. Verify it ends successfully.

- Create a new Costing Rule for Spain and Standard algorithm, with warehouse dimension disabled and backdated fixed enabled. Validate it.

- Create a new Product named "Test31080-2". Add a Standard cost of 5 from 01/01/2001 to 31/12/9999 and warehouse empty. Enter a price of 7, Price List Version “Purchase Spain”

- Create a purchase order for Spain org and Vendor A, Price List Purchase Sapin. Product “Test31080-2”, Ordered Qty = 210. Net unit price = 7.00. Book the order.

- Create a new Receipt dated on 01/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-2", quantity = 10, locator = L01, warehouse = Spain warehouse (transaction cost should be 10 * 5).
  Product: "Test31080-2", quantity = 20, storage bin = L02, warehouse = Spain warehouse (transaction cost should be 20 * 5).
  Product: "Test31080-2", quantity = 30, storage bin = L03, warehouse = Spain warehouse (transaction cost should be 30 * 5).
  Product: "Test31080-2", quantity = 40, storage bin = T04, warehouse = Spain warehouse (transaction cost should be 40 * 5).
  Product: "Test31080-2", quantity = 50, storage bin = M01, warehouse = Spain East warehouse (transaction cost should be 50 * 5).
  Product: "Test31080-2", quantity = 60, storage bin = Return bin, warehouse = Spain East warehouse (transaction cost should be 60 * 5).
  
- Create a new Inventory Amount Update dated on 05/12/2015 for "Test31080-2" product. Current Inventory Amount = 1050 (210*5.00). Set new cost = 6 (current cost should be 5). Complete it and run Costing Background process (closing transactions cost should be quantity * 5 and opening transactions cost should be quantity * 6).

- Create a new Shipment dated on 10/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-2", quantity = 10, locator = L01, warehouse = Spain warehouse (transaction cost should be 10 * 6).
  
- Create a new Inventory Amount Update dated on 15/12/2015 for "Test31080-2" product. Set new cost = 7 (Current Inventory Amount = 1200 (200 * 6.00), as current cost should be 6. Complete it and run Costing Background process (closing transactions cost should be quantity * 6 and opening transactions cost should be quantity * 7).

- Create a new Receipt dated on 20/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-2", quantity = 5, locator = L01, warehouse = Spain warehouse (transaction cost should be 5 * 7).

- Create a new Shipment dated on 20/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-2", quantity = 50, locator = M01, warehouse = Spain East warehouse (transaction cost should be 50 * 7).
  Product: "Test31080-2", quantity = 60, locator = Return Bin, warehouse = Spain East warehouse (transaction cost should be 60 * 7).
  
- Create a new Inventory Amount Update dated on 25/12/2015 for "Test31080-2" product. Set new cost = 8 (current cost should be 7). Complete it and run Costing Background process (closing transactions cost should be quantity * 7 and opening transactions cost should be quantity * 8).

- Create a new Shipment dated on 05/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-2", quantity = 20, locator = L02, warehouse = Spain warehouse (transaction cost should be 20 * 6).

- Go to Cost Adjustment window. Realize a new BDT adjustment has been created with today reference date and following lines:

  Inventory transaction: shipment dated on 05/12/2015, adjustment amount = 0.00, is source = yes, unit cost = yes, parent cost adjustment line = empty, accounting date = 05/12/2015.

  Inventory transaction: opening inventory dated on 15/12/2015, adjustment amount = -20.00, is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 15/12/2015.

    Adjustment amount calculation:
    Sum Cost= 1050.00-1050.00+1260.00-120.00-60.00-1200.00+1400.00= 1280.00
    Sum Qty = 210-210+210-20-10-200+200=180

    There are 180 units valued at 1280.00, while there should be 180 units
    valued at 1260.00 (180 * 7.00 =1260.00).
    Therefore an adjustment of -20.00 is needed.

  Inventory transaction: opening inventory dated on 25/12/2015, adjustment amount = -20.00, is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 25/12/2015.

    Adjustment amount calculation:
    Sum Cost= 1260.00+35.00-770.00-665.00+760.00=620.00
    Sum Qty = 180+5-110-75+75=75

   There are 75 units valued at 620.00, while there should be 75 units
   valued at 600.00 (75 * 8.00 =600.00).
   Therefore an adjustment of -20.00 is needed.

- Create a new Inventory Amount Update for "Test31080-2" product, but do not complete it. Realize depending on the date you will get the following current unit costs:
  [01/12/2015, 05/12/2015): current unit cost = 5
  [05/12/2015, 15/12/2015): current unit cost = 6
  [15/12/2015, 25/12/2015]: current unit cost = 7
  [25/12/2015, 31/12/9999]: current unit cost = 8

- Create a new Receipt dated on 05/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-2", quantity = 1, locator = L02, warehouse = Spain warehouse (transaction cost should be 1 * 6).

- Go to Cost Adjustment window. Realize a new BDT adjustment has been created with today reference date and following lines:

  Inventory transaction: receipt dated on 05/12/2015, adjustment amount = 0.00, is source = yes, unit cost = yes, parent cost adjustment line = empty, accounting date = 05/12/2015.

  Inventory transaction: opening inventory dated on 15/12/2015, adjustment amount = +1.00, is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 15/12/2015.

    Adjustment amount calculation:
    Sum Cost= 1260.00+6.00=1266.00
    Sum Qty = 180+1=181

    There are 181 units valued at 1266.00, while there should be 181 units
    valued at 1267.00 (181 * 7.00 =1267.00).
    Therefore an adjustment of +1.00 is needed.

  Inventory transaction: opening inventory dated on 25/12/2015, adjustment amount = +1.00, is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 25/12/2015.

    Adjustment amount calculation:
    Sum Cost= 1267.00+35.00-770.00-665.00+760.00-20=607.00
    Sum Qty = 181+5-110-75+75=76

   There are 76 units valued at 607.00, while there should be 76 units
   valued at 608.00 (76 * 8.00 =608.00).
   Therefore an adjustment of +1.00 is needed.


- Create a new Inventory Amount Update for "Test31080-2" product, but do not complete it. Realize depending on the date you will get the following current unit costs:
  [01/12/2015, 05/12/2015): current unit cost = 5
  [05/12/2015, 15/12/2015): current unit cost = 6
  [15/12/2015, 25/12/2015]: current unit cost = 7
  [25/12/2015, 31/12/9999]: current unit cost = 8

- Go to Product window. Select "Test31080-2".
  Move to Costing tab and review costing lines:
    Starting date = 01/01/2001, ending date = 05/12/2015, cost = 5.
    Starting date = 05/12/2015, ending date = 15/12/2015, cost = 6.
    Starting date = 15/12/2015, ending date = 25/12/2015, cost = 7.
    Starting date = 25/12/2015, ending date = 31/12/9999, cost = 8.
  Move to Transaction tab and review transaction lines.
  Move to Stock tab and realize current stock is the following:
    Warehouse = Spain warehouse, locator = L01, quantity = 5
    Warehouse = Spain warehouse, locator = L02, quantity = 1
    Warehouse = Spain warehouse, locator = L03, quantity = 30
    Warehouse = Spain warehouse, locator = T04, quantity = 40
    Warehouse = Spain East warehouse, locator = M01, quantity = 0
    Warehouse = Spain East warehouse, locator = Return Bin, quantity = 0


Do a similar test but with a Costing Rule with warehouse dimension flag enabled, and backdated transactions fixed flag enable, check that it is working properly. Test Plan 2B.

Do a similar test but with a Costing Rule with warehouse dimension flag disable and backdated transactions fixed flag disabled, and check that it is working properly. Test Plan 2C.

See file attached "Issue31080-TestPlan2B&2C"

(0081442)
aferraz   
2015-11-02 21:23   
(edited on: 2015-11-06 13:08)
Test plan 3 (Backdated Inventory Amount Update):

As QA Admin:

- Create a new Costing Rule for Spain and Standard algorithm, with warehouse dimension disabled and backdated fixed enabled. Validate it.

- Create a new Product named "Test31080-3". Add a Standard cost of 5 from 01/01/2001 to 31/12/9999 and warehouse empty. Enter a price of 5, Price List Version “Purchase Spain”

- Create a purchase order for Spain org and Vendor A, Price List Purchase Sapin. Product “Test31080-2”, Ordered Qty = 210. Net unit price = 5.00. Book the order.

- Create a new Receipt dated on 01/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-3", quantity = 10, locator = L01, warehouse = Spain warehouse (transaction cost should be 10 * 5).
  Product: "Test31080-3", quantity = 20, storage bin = L02, warehouse = Spain warehouse (transaction cost should be 20 * 5).
  Product: "Test31080-3", quantity = 30, storage bin = L03, warehouse = Spain warehouse (transaction cost should be 30 * 5).
  Product: "Test31080-3", quantity = 40, storage bin = T04, warehouse = Spain warehouse (transaction cost should be 40 * 5).
  Product: "Test31080-3", quantity = 50, storage bin = M01, warehouse = Spain East warehouse (transaction cost should be 50 * 5).
  Product: "Test31080-3", quantity = 60, storage bin = Return bin, warehouse = Spain East warehouse (transaction cost should be 60 * 5).

- Create a new Shipment dated on 05/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-3", quantity = 10, locator = L01, warehouse = Spain warehouse (transaction cost should be 10 * 5).

- Create a new Receipt dated on 10/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-3", quantity = 5, locator = L01, warehouse = Spain warehouse (transaction cost should be 5 * 5).
  Product: "Test31080-3", quantity = 5, locator = L02, warehouse = Spain warehouse (transaction cost should be 5 * 5).

- Create a new Shipment dated on 15/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-3", quantity = 50, locator = M01, warehouse = Spain East warehouse (transaction cost should be 50 * 5).
  Product: "Test31080-3", quantity = 60, locator = Return bin, warehouse = Spain East warehouse (transaction cost should be 60 * 5).

- Create a new Inventory Amount Update dated on 20/12/2015 for "Test31080-3" product. Set new cost = 6 (current cost should be 5). Complete it and run Costing Background process (closing transactions cost should be quantity * 5 and opening transactions cost should be quantity * 6).

- Create a new Receipt dated on 25/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-3", quantity = 1, locator = L02, warehouse = Spain warehouse (transaction cost should be 1 * 6).

- Create a new Shipment dated on 25/12/2015. Add the following lines, complete it and run Costing Background process:
  Product: "Test31080-3", quantity = 25, locator = L02, warehouse = Spain warehouse (transaction cost should be 25 * 6).

- Create a new Inventory Amount Update dated on 05/12/2015 for "Test31080-3" product. Set new cost = 8 (current cost should be 5). Complete it and run Costing Background process (closing transactions cost should be quantity * 5 and opening transactions cost should be quantity * 8).

- Go to Cost Adjustment window. Realize a new BDT adjustment has been created with today reference date and following lines:
  Inventory transaction: last opening inventory dated on 05/12/2015, adjustment amount = 0.00, is source = yes, unit cost = yes, accounting date = 05/12/2015.
  Inventory transaction: first line of receipt dated on 10/12/2015, adjustment amount = +15.00 ((+5 * 8) - (+5 * 5)), is source = no, unit cost = yes, accounting date = 10/12/2015.
  Inventory transaction: second line of receipt dated on 10/12/2015, adjustment amount = +15.00 ((+5 * 8) - (+5 * 5)), is source = no, unit cost = yes, accounting date = 10/12/2015.
  Inventory transaction: second line of shipment dated on 15/12/2015, adjustment amount = +180.00 ((+60 * 8) - (+60 * 5)), is source = no, unit cost = yes, parent cost adjustment line = empty, accounting date = 15/12/2015.
  Inventory transaction: first line of shipment dated on 15/12/2015, adjustment amount = +150.00 ((+50 * 8) - (+50 * 5)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 15/12/2015.
  Inventory transaction: last closing inventory dated on 20/12/2015, adjustment amount = +90.00 ((+30 * 8) - (+30 * 5)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.
  Inventory transaction: second closing inventory dated on 20/12/2015, adjustment amount = +75.00 ((+25 * 8) - (+25 * 5)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.
  Inventory transaction: first closing inventory dated on 20/12/2015, adjustment amount = +15.00 ((+5 * 8) - (+5 * 5)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.
  Inventory transaction: third closing inventory dated on 20/12/2015, adjustment amount = +120.00 ((+40 * 8) - (+40 * 5)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.

- Create a new Inventory Amount Update for "Test31080-3" product, but do not complete it. Realize depending on the date you will get the following current unit costs:
  [01/12/2015, 05/12/2015): current unit cost = 5
  [05/12/2015, 20/12/2015): current unit cost = 8
  [20/12/2015, 31/12/9999]: current unit cost = 6

- Create a new Inventory Amount Update dated on 05/12/2015 for "Test31080-3" product. Set new cost = 3 (current cost should be 8). Complete it and run Costing Background process (closing transactions cost should be quantity * 8 and opening transactions cost should be quantity * 3).

- Go to Cost Adjustment window. Realize a new BDT adjustment has been created with today reference date and following lines:
  Inventory transaction: last opening inventory dated on 05/12/2015, adjustment amount = 0.00, is source = yes, unit cost = yes, parent cost adjustment line = empty, accounting date = 05/12/2015.
  Inventory transaction: first line of receipt dated on 10/12/2015, adjustment amount = -25.00 ((+5 * 3) - (+5 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 10/12/2015.
  Inventory transaction: second line of receipt dated on 10/12/2015, adjustment amount = -25.00 ((+5 * 3) - (+5 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 10/12/2015.
  Inventory transaction: second line of shipment dated on 15/12/2015, adjustment amount = -300.00 ((+60 * 3) - (+60 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 15/12/2015.
  Inventory transaction: first line of shipment dated on 15/12/2015, adjustment amount = -250.00 ((+50 * 3) - (+50 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 15/12/2015.
  Inventory transaction: last closing inventory dated on 20/12/2015, adjustment amount = -150.00 ((+30 * 3) - (+30 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.
  Inventory transaction: second closing inventory dated on 20/12/2015, adjustment amount = −125.00 ((+25 * 3) - (+25 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.
  Inventory transaction: first closing inventory dated on 20/12/2015, adjustment amount = −25.00 ((+5 * 3) - (+5 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.
  Inventory transaction: third closing inventory dated on 20/12/2015, adjustment amount = −200.00 ((+40 * 3) - (+40 * 8)), is source = no, unit cost = yes, parent cost adjustment line = first line, accounting date = 20/12/2015.

- Create a new Inventory Amount Update for "Test31080-3" product, but do not complete it. Realize depending on the date you will get the following current unit costs:
  [01/12/2015, 05/12/2015): current unit cost = 5
  [05/12/2015, 20/12/2015): current unit cost = 3
  [20/12/2015, 31/12/9999]: current unit cost = 6

- Go to Product window. Select "Test31080-3".
  Move to Costing tab and review costing lines:
    Starting date = 01/01/2001, ending date = 05/12/2015, cost = 5.
    Starting date = 05/12/2015, ending date = 20/12/2015, cost = 8.
    Starting date = 05/12/2015, ending date = 20/12/2015, cost = 3.
    Starting date = 20/12/2015, ending date = 31/12/9999, cost = 6.
  Move to Transaction tab and review transaction lines.
  Move to Stock tab and realize current stock is the following:
    Warehouse = Spain warehouse, locator = L01, quantity = 5
    Warehouse = Spain warehouse, locator = L02, quantity = 1
    Warehouse = Spain warehouse, locator = L03, quantity = 30
    Warehouse = Spain warehouse, locator = T04, quantity = 40
    Warehouse = Spain East warehouse, locator = M01, quantity = 0
    Warehouse = Spain East warehouse, locator = Return Bin, quantity = 0

Do a similar test but with a Costing Rule with warehouse dimension flag enabled, and check that it is working properly.

Do a similar test but with a Costing Rule with backdated transactions fixed flag disabled, and check that it is working properly.

See file attached "Issue31080-TestPlan3B&3C"

(0081705)
psanjuan   
2015-11-11 13:25   
All test plan above verified. Issue can be code review and closed.
(0081879)
hgbot   
2015-11-16 13:41   
Repository: erp/devel/pi
Changeset: f96d16904892cffc15dc9f6890ee851056f84b84
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Nov 13 13:33:58 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/f96d16904892cffc15dc9f6890ee851056f84b84 [^]

Issue 31080

---
M src-db/database/sourcedata/AD_FIELD.xml
M src/org/openbravo/costing/CostAdjustmentProcess.java
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
M src/org/openbravo/costing/CostingServer.java
M src/org/openbravo/costing/CostingUtils.java
M src/org/openbravo/costing/StandardAlgorithm.java
M src/org/openbravo/costing/StandardCostAdjustment.java
---
(0081880)
hgbot   
2015-11-16 13:41   
Repository: erp/devel/pi
Changeset: 54816dff1cfbc9490bc2a4f887322efcf82e617e
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Mon Nov 16 12:31:48 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/54816dff1cfbc9490bc2a4f887322efcf82e617e [^]

Related to Issue 31080. Code Review changes.

Takes into account if a Product is defined as Production when
filtering the queries by Organization and Warehouse.

---
M src/org/openbravo/costing/CostAdjustmentProcess.java
M src/org/openbravo/costing/StandardCostAdjustment.java
---
(0081881)
hgbot   
2015-11-16 13:51   
Repository: erp/devel/pi
Changeset: 8b4787d9d03031c1ff8dac78feab532a9da4f07a
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Nov 11 11:30:33 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/8b4787d9d03031c1ff8dac78feab532a9da4f07a [^]

Fixes issue 31080: Standard Algorithm is not working with Inventory Amount Update

Display "Backdated Transactions Fixed" flag and "Fix Backdated Transactions" button in Costing Rule window, also with "Standard Algorithm".
With Standard cost, when creating a backdated transaction (which modifies the stock in the past) and in case we have "Backdated Transactions Fixed" flag activated, a BDT adjustment will be created related to any of the opening inventory transactions of each Inventory Amount Update created after backdated transaction.
With Standard cost, when creating a backdated Inventory Amount Update (which modifies the cost in the past), a BDT adjustment will be created related to each transaction created after backdated Inventory Amount Update and before next Inventory Amount Update created, including closing inventory transactions related to next Inventory Amount Update created.

---
M src-db/database/sourcedata/AD_FIELD.xml
M src/org/openbravo/costing/CostAdjustmentProcess.java
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
M src/org/openbravo/costing/CostingServer.java
M src/org/openbravo/costing/CostingUtils.java
M src/org/openbravo/costing/StandardAlgorithm.java
M src/org/openbravo/costing/StandardCostAdjustment.java
---
(0081882)
hgbot   
2015-11-16 13:52   
Repository: erp/devel/pi
Changeset: 4e1551494c0e6507b2d35caf2cbf65fcc77487c6
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Mon Nov 16 12:31:48 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/4e1551494c0e6507b2d35caf2cbf65fcc77487c6 [^]

Related to Issue 31080. Code Review changes.

Takes into account if a Product is defined as Production when
filtering the queries by Organization and Warehouse.

---
M src/org/openbravo/costing/CostAdjustmentProcess.java
M src/org/openbravo/costing/StandardCostAdjustment.java
---
(0081883)
dmiguelez   
2015-11-16 13:52   
Code Review + Testing Ok
(0082234)
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
(0082235)
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
(0082236)
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
(0082237)
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