Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034713Openbravo ERP04. Warehouse managementpublic2016-12-09 12:582016-12-16 18:39
maite 
alekosmp86 
urgentmajoralways
closedfixed 
5
 
3.0PR17Q1 
aferraz
Core
No
0034713: "getProductCost" method in AverageAlgorithm.java is checking cost per warehouse dimension for product defined as "production"
When a product is defined as "production", it is init with "costDimensions = CostingUtils.getEmptyDimensions()" in "init" method of "CostingAlgorithm.java". However, when costing is checked for that product, "getProductCost" method in AverageAlgorithm.java if filtering by "warehouse" dimension (in case costing rule is defined like this) so error "No average cost found for given product and date" is reaised when it should not
1. Create Costing rule "Average" and checked as "warehouse dimension". Validate rule
2. Create new product set as "production"=Y
3. Register new purchase order for this product. Complete
4. Register new goods receipt using "create lines from" previous order. Add record in Landed Cost tab and process receipt
5. Run Costing background process and "No average cost found for given product and date". Problem is that "getProductCost" method in AverageAlgorithm.java is searching m_costing report per warehouse when records was previously created without warehouse dimension, as it is a production record
Line 220 in AverageAlgorithm.java should be replaced by

if (costDimensions.get(CostDimension.Warehouse) != null && !product.isProduction()) {

Line 236 should be replaced by

if (costDimensions.get(CostDimension.Warehouse) != null && !product.isProduction()) {

Probably same change needs to be performed in new "getLastCumulatedCosting" method
No tags attached.
Issue History
2016-12-09 12:58maiteNew Issue
2016-12-09 12:58maiteAssigned To => Triage Finance
2016-12-09 12:58maiteModules => Core
2016-12-09 12:58maiteResolution time => 1482361200
2016-12-09 12:58maiteTriggers an Emergency Pack => No
2016-12-09 12:58maiteIssue Monitored: networkb
2016-12-12 16:23aferrazAssigned ToTriage Finance => collazoandy4
2016-12-12 17:22alekosmp86Assigned Tocollazoandy4 => alekosmp86
2016-12-12 17:23alekosmp86Statusnew => scheduled
2016-12-13 16:28alekosmp86Note Added: 0092322
2016-12-14 12:37hgbotCheckin
2016-12-14 12:37hgbotNote Added: 0092346
2016-12-14 12:37hgbotStatusscheduled => resolved
2016-12-14 12:37hgbotResolutionopen => fixed
2016-12-14 12:37hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/dd02dedae9ded134e7bf8a88975c76011dc2ad5c [^]
2016-12-14 12:37hgbotCheckin
2016-12-14 12:37hgbotNote Added: 0092347
2016-12-14 12:37aferrazReview Assigned To => aferraz
2016-12-14 12:37aferrazNote Added: 0092348
2016-12-14 12:37aferrazStatusresolved => closed
2016-12-14 12:37aferrazFixed in Version => 3.0PR17Q1
2016-12-16 18:39hudsonbotCheckin
2016-12-16 18:39hudsonbotNote Added: 0092709
2016-12-16 18:39hudsonbotCheckin
2016-12-16 18:39hudsonbotNote Added: 0092710

Notes
(0092322)
alekosmp86   
2016-12-13 16:28   
Test plan

Log in as F&B GroupAdmin
   Go to Costing Rules screen
      Create a new document
         Organization: F&B España S.A
         Costing Algorithm: Average Algorithm
         Warehouse Dimension: checked

   Go to Product screen
      Create a new document
         Organization: F&B España S.A
         Product name: Producto A
         Production: checked
      Go to Price tab
         Create a new record
            Price List Version: Tarifas Bebidas Alegres
            Unit Price: 1.5
            List Price: 1.5

   Go to Purchase Order screen
      Create a new document
         BP: Bebidas Alegres S.L
      Go to Lines tab
         Create a new record
            Product: Producto A
            Ordered Quantity: 10
         Save the record
      Book the order

   Go to Goods Receipt screen
      Create a new record
         BP: Bebidas Alegres S.L
      Run "Create Lines From"
         Select the previously created order
         Select a warehouse
         Check the order's line(s)
      Click OK
      Go to Landed Cost tab
         Create a new record
            Landed Cost Type: Any (if there's none, create a new one)
            Landed Cost Distribution Algorithm: Distribution by Amount
         Save the record
      Complete the receipt

   Go to Process Request Screen
      Create a new record
         Client: F&B International Group
         Organization: F&B España S.A
         Process: Costing background process
         Timing: Run immediately
      Save the record
   Run Schedule Process

In Eclipse IDE, notice there's no error in console.
(0092346)
hgbot   
2016-12-14 12:37   
Repository: erp/devel/pi
Changeset: dd02dedae9ded134e7bf8a88975c76011dc2ad5c
Author: Alejandro <alekosmp86 <at> gmail.com>
Date: Tue Dec 13 10:01:21 2016 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/dd02dedae9ded134e7bf8a88975c76011dc2ad5c [^]

Fixes issue 34713: getProductCost() is not checking if product is production

If a product is defined as "production", when costing is checked for
that product, "getProductCost" method in AverageAlgorithm.java was filtering by
"warehouse" dimension (in case costing rule is defined like this) so error "No
average cost found for given product and date" was raised, when it should not.
The proposed solution has been implemented, adding a validation when constructing
the "where" condition, so now there is no error.

---
M src/org/openbravo/costing/AverageAlgorithm.java
---
(0092347)
hgbot   
2016-12-14 12:37   
Repository: erp/devel/pi
Changeset: a2651b1e5d31f587634b07c4490cba3291e4ef8d
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Wed Dec 14 12:35:05 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/a2651b1e5d31f587634b07c4490cba3291e4ef8d [^]

Related to issue 34713: Code review improvements

Fix also getLastCumulatedCosting method.

---
M src/org/openbravo/costing/AverageAlgorithm.java
---
(0092348)
aferraz   
2016-12-14 12:37   
Code review + Testing OK
(0092709)
hudsonbot   
2016-12-16 18:39   
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/dc8bf00badd0 [^]
Maturity status: Test
(0092710)
hudsonbot   
2016-12-16 18:39   
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/dc8bf00badd0 [^]
Maturity status: Test