Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036757Openbravo ERP04. Warehouse managementpublic2017-08-31 12:172017-09-21 16:49
ngarcia 
AtulOpenbravo 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q4 
aferraz
Core
No
0036757: Negative Stock Correction for remaining stock valuation not done in closing inventory lines (when validating a costing rule)
Negative Stock Correction for remaining stock valuation not done in closing inventory lines (when validating a costing rule)

The problem is that in CostingRuleProcess.updateInventoriesCostAndProcessInitInventories function the transactions related to inventory closing lines are not ordered (getInventoryLineTransactions). Then, when checking the current stock in CostingServer.checkCostAdjustments function by CostAdjustmentUtils.getStockOnTransactionDate function, only the transactions with higher movementqty are taken into account and the currentstock could never be 0
As group admin role:
   Having a product with stock in different warehouses and a current average cost different from the current cost of costing tab (in order to have a remaining value after closing inventories)
   Having a costing rule already validated with Warehouse Dimension = 'N'

   Go to Costing Rule window and validate a new rule for the same organization but with Warehouse Dimension = 'Y'

   Check no Negative Stock Correction is done for that product (it is not required to have the preference to enable it)
Add following order by to CostingRuleProcess.getInventoryLineTransactions():
where.append(" order by trx." + MaterialTransaction.PROPERTY_MOVEMENTQUANTITY + " desc");
where.append(" , trx." + MaterialTransaction.PROPERTY_ID);
No tags attached.
blocks design defect 0036758 new Triage Omni WMS After validating a costing rule with warehouse dimension, remaining stock valuation could exist on each warehouse but not global 
Issue History
2017-08-31 12:17ngarciaNew Issue
2017-08-31 12:17ngarciaAssigned To => Triage Finance
2017-08-31 12:17ngarciaModules => Core
2017-08-31 12:17ngarciaTriggers an Emergency Pack => No
2017-08-31 12:17ngarciaIssue Monitored: networkb
2017-08-31 12:18ngarciaResolution time => 1505944800
2017-08-31 12:30ngarciaRelationship addedblocks 0036642
2017-08-31 12:31ngarciaRelationship deletedblocks 0036642
2017-08-31 12:31ngarciaRelationship addedblocks 0036758
2017-08-31 13:26ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15773#r15773
2017-08-31 13:55aferrazProposed Solution updated
2017-08-31 13:56aferrazAssigned ToTriage Finance => AtulOpenbravo
2017-09-04 08:21AtulOpenbravoNote Added: 0098784
2017-09-04 14:21hgbotCheckin
2017-09-04 14:21hgbotNote Added: 0098809
2017-09-04 14:21hgbotStatusnew => resolved
2017-09-04 14:21hgbotResolutionopen => fixed
2017-09-04 14:21hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2873be0d1b66505d00e85de1ec705aa2500a7874 [^]
2017-09-04 14:21aferrazReview Assigned To => aferraz
2017-09-04 14:21aferrazNote Added: 0098810
2017-09-04 14:21aferrazStatusresolved => closed
2017-09-04 14:21aferrazFixed in Version => 3.0PR17Q4
2017-09-21 16:49hudsonbotCheckin
2017-09-21 16:49hudsonbotNote Added: 0099356

Notes
(0098784)
AtulOpenbravo   
2017-09-04 08:21   
- Login as F&B International Group Admin
- Navigate to Product window, add product
  Search Key: test costing 36757
  Name: test costing 36757
  Product Category: Others
  Product Type:Item
  Save record
- Add Prices information.
  1. Price List Version: Tarifa Bebidas Alegres, Unit Price:8.00, List Price:8.00
  2. Price List Version: Tarifa de ventas, Unit Price:10.00, List Price:10.00
- Navigate to Purchase Order, create a record for "Bebidas Alegres, S.L." in F&B Espana organization.
- Add line for product "test costing 36757", quantity 100, complete it.
- Create goods receipt for above order in F&B Espana Organization.
- Add two lines for purchase order line for product "test costing 36757" using Create Lines From process as
  1. Quantity = 50, Storage Bin = Rn-0-0-0
  2. Quantity = 50, Storage Bin = Rs-0-0-0
- Complete goods receipt.
- Generate invoice from receipt and Navigate to Purchase Invoice selecting the invoice previously created.
- Update the Invoice Line unit price to 9.00
- Complete the invoice.
- Make sure that costing background process is executed.
- In Process request, schedule Price Correction Background process with timing Run Immediately.
- Navigate to Costing Rules add record,
  Organization: F&BEspana
  Costing Algorithm: Average
  Starting Date: Today's Date
  Warehouse Dimension = Yes
- Validate costing rule and Navigate to Cost Adjustment window
- Realize that several records with Negative Stock Correction as Source process appears and there exists a record for product "test costing 36757".
(0098809)
hgbot   
2017-09-04 14:21   
Repository: erp/devel/pi
Changeset: 2873be0d1b66505d00e85de1ec705aa2500a7874
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Sep 04 14:03:39 2017 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/2873be0d1b66505d00e85de1ec705aa2500a7874 [^]

Fixes issue 36757: Negative Stock Correction for remaining stock valuation
not done in closing inventory lines (when validating a costing rule)

Add order by clause to sort movement qty desc, material transaction id

---
M src/org/openbravo/costing/CostingRuleProcess.java
---
(0098810)
aferraz   
2017-09-04 14:21   
Code review + Testing OK
(0099356)
hudsonbot   
2017-09-21 16:49   
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/9750b78d3e5c [^]
Maturity status: Test