Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027879Openbravo ERP04. Warehouse managementpublic2014-10-15 16:212014-10-28 10:38
psanjuan 
umartirena 
urgentmajoralways
closedfixed 
20Ubuntu 8.04.1
 
 
Core
No
0027879: Inventory Amount seems to be creating wrong calculated backdated transactions
Inventory Amount seems to be creating wrong calculated backdated transactions
Select QA Testing client.
Make sure you have a costing rule pointing to an Average costing rule.
Costing rule needs also to have enabled "Fixed Backdated Transactions" check.

Go to Product window and create a new product named Costing F2.
Go to lines tab, select "Purchase" price list and enter a unit/list price of 1230.

Go to purchase order and create a new one for Spain org and the product just created. Go to lines tab and enter 185 units. Book the order.

Go to goods receipt and create a new one dated on a later date than the order. Create receipt lines from the order. Complete.

Go to Process Request window and execute costing background process.

Go to back to the receipt and post it. Realize that value posted to the ledger is 227550 (185*1230)

Go to Goods Shipment window and create a new one for Spain org and the product. Goods shipment date needs to be after receipt date.
 
Ship an amount of 85 units. Complete.

Go to Process Request window and execute costing background process.

Go to back to the shipment and post it. Realize that value posted to the ledger is 104550 (85*1230)

Go to Inventory Amount Update window and create a new one dated before the shipment and after the receipt.

Go to lines and enter same reference date as the one enter in the header. Select the product (Costing F2) and realize that Openbravo shows below values:

- Current inventory amount = 227550
- On hand qty = 185

Enter 1200 in the field "Unit Cost", therefore Inventory Amount field is automatically populated with a value of 222000

Process Inventory Amount Update.

Go to Process Request window and execute costing background process.

Back to Inventory Amount Update window realize that a closing and an opening inventory have been created in "Inventories" tab. Navigate to closing one and post it.

Posting would look like:
Debit: Inventory Loss 227550
Credit: Product Asset 227550

Navigate to Opening one and post it. Posting would look like:
Debit: Product Asset 222000
Credit: Inventory Loss 222000

Navigate to Cost Adjustment window and realize that two backdated transactions cost adjustments have been created.

First one adjust closing inventory (I+ -185) by removing total current inventory value. Adjustment Amount is -227550.

(I think the adjustment amount of this transaction should be 0,00 because otherwise we get into a double posting:

Closing inventory posting = Backdated transaction posting
Debit: Inventory Loss 227550
Credit: Product Asset 227550)

Second one adjust:
- opening inventory (I+ 185) for an 0 adjustment, as opening inventory has already increased inventory by new inventory amount value 222000
- and the shipment (C -85), however this adjustment is not correct.

Adjusted amount is 102000. This is not correct.

Navigate to product window, search by the product and go to Costing tab. Realize that new cost shown is not 1200 but the sum of 1200+1230)2430

 
Adjusted amount should be the difference between 85*1200 and 85*1230 = 2550

New costing should be 1200

No tags attached.
Issue History
2014-10-15 16:21psanjuanNew Issue
2014-10-15 16:21psanjuanAssigned To => dmiguelez
2014-10-15 16:21psanjuanModules => Core
2014-10-15 16:21psanjuanTriggers an Emergency Pack => No
2014-10-15 16:27psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6791#r6791
2014-10-15 16:35psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6792#r6792
2014-10-15 16:35psanjuanProposed Solution updated
2014-10-15 16:50psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6793#r6793
2014-10-24 08:57psanjuanAssigned Todmiguelez => umartirena
2014-10-24 14:05hgbotCheckin
2014-10-24 14:05hgbotNote Added: 0071171
2014-10-24 14:05hgbotStatusnew => resolved
2014-10-24 14:05hgbotResolutionopen => fixed
2014-10-24 14:05hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/cf6c89b67300b9aa326ee675fac42153b1e347c2 [^]
2014-10-28 10:38psanjuanNote Added: 0071212
2014-10-28 10:38psanjuanStatusresolved => closed

Notes
(0071171)
hgbot   
2014-10-24 14:05   
Repository: erp/devel/pi
Changeset: cf6c89b67300b9aa326ee675fac42153b1e347c2
Author: Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
Date: Fri Oct 24 14:05:00 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/cf6c89b67300b9aa326ee675fac42153b1e347c2 [^]

Fixed 27879.Properly calculate adj amount on backdated inventory amt update.

3 changes have been applied to fix the issue:
- Consider the possibility of having average costing not related to
  transactions.
- Properly calculate the adjustment amount of closing inventories. The transaction
  that is being adjusted is already calculated and included in the
  currentBalanceAmount so no need to compare against it.
- It was checking the fix backdated transactions flag using the fix backdated
  transactions process button property instead of the flag's property.

---
M src/org/openbravo/costing/AverageCostAdjustment.java
M src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java
M src/org/openbravo/costing/InventoryAmountUpdateProcess.java
---
(0071212)
psanjuan   
2014-10-28 10:38   
Verified it is now working properly