Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0021137Openbravo ERP06. Material requirement planning (MRP)public2012-07-18 11:032012-07-26 11:17
dmiguelez 
dmiguelez 
normalmajoralways
closedfixed 
20Community Appliance
pi 
 
Core
No
0021137: Net Unit Price Of Costing Tab In Product Window is not correctly calculated.
In Product Window, in Costing Tab, there are two fields, Cost and Net Unit Price.
Following the steps to Reproduce, both should be 27.50, but Net Unit Price is 28.
This is due to a problem when rounding the quantity.
Login as:

Username: Openbravo
Password: openbravo

[Average Cost Per Invoice Price module must be installed]

Create the Product

Go to Master Data Management || Product:
Click New and select:

"Organization": USA
"Search Key": CostingProduct
"Name": CostingProduct

Go to Price List:
Select "Be Soft Drinker Price List"
Go to Price List Version tab and select "Be Soft Drinker Price List"
Go to Product Price tab. Click new and select:

"Product": CostingProduct
"Unit Price": 50.00
"List Price": 50.00
Create the Costing Rule

Create the Costing Rule

Go to Master Data Management || Product Setup || Costing Rules:
Click New and select:

"Organization": USA
"Costing Algorithm": Average per Invoice Price
"Starting Date": Today's date
"Warehouse Dimension": Unchecked
Click on "Validate Costing Rule" and then OK.

Create a Purchase Order.

Go to Procurement Management || Transactions || Purchase Order:
Click New and select:

"Organization": USA
“Business Partner”: Costing Business Partner
Move to Lines. Click new and select:

“Product”: CostingACPIProduct
“Order Quantity”: 100
Click the “Book” button. Click OK.

Create a Goods Receipt.

Go to Procurement Management || Transactions || Goods Receipt:
Click New and select:

"Organization": USA
“Business Partner”: Costing Business Partner
Click on Create Lines From:

"Order": The Order created in [ACIa040]
Select the line that appears and set:

"Storage Bin": Costing Warehouse
Click the “Complete” button. Click OK.

Create a Purchase Invoice.

Go to Sales Management || Transactions || Purchase Invoice:
Click New and select:

"Organization": USA
“Business Partner”: Costing Business Partner
Click on Create Lines From:

"Shipment/Receipt": The Goods Receipt created in [ACIa050]
Select the line that appears.
Move to Lines and select the line.

Modify the "Invoiced Quantity": 50
Click the “Complete” button. Click OK.

Create a Purchase Invoice.

Go to Sales Management || Transactions || Purchase Invoice:
Click New and select:

"Organization": USA
“Business Partner”: Costing Business Partner
Click on Create Lines From:

"Shipment/Receipt": The Goods Receipt created in [ACIa050]
Select the line that appears.
Move to Lines and select the line.

Modify the "Net Unit Price": 5.00

Reschedule the Process

Go to General Setup || Process Scheduling || Process Request:
Select the process Costing Background Process.
Click on "Reschedule Process"

A popup should appear with the message:
"Process completed succesfully"
Click the “Complete” button. Click OK.

Check

Go to Product:
Select CostingProduct.
Move to Costing Tab and check that Cost is 27.50 and Net Unit Price is 28
diff --git a/src/org/openbravo/costing/AverageAlgorithm.java b/src/org/openbravo/costing/AverageAlgorithm.java
--- a/src/org/openbravo/costing/AverageAlgorithm.java
+++ b/src/org/openbravo/costing/AverageAlgorithm.java
@@ -138,7 +138,7 @@
       cost.setPrice(newCost);
     } else {
       cost.setPrice(trxCost.divide(transaction.getMovementQuantity(), costCurrency
- .getCostingPrecision().intValue()));
+ .getPricePrecision().intValue(), BigDecimal.ROUND_HALF_UP));
     }
     cost.setCostType("AVA");
     cost.setManual(false);
No tags attached.
Issue History
2012-07-18 11:03dmiguelezNew Issue
2012-07-18 11:03dmiguelezAssigned To => mirurita
2012-07-18 11:03dmiguelezModules => Core
2012-07-18 16:25dmiguelezAssigned Tomirurita => dmiguelez
2012-07-18 16:25dmiguelezStatusnew => scheduled
2012-07-18 16:25dmiguelezfix_in_branch => pi
2012-07-18 16:27hgbotCheckin
2012-07-18 16:27hgbotNote Added: 0050731
2012-07-18 16:27hgbotStatusscheduled => resolved
2012-07-18 16:27hgbotResolutionopen => fixed
2012-07-18 16:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/d1623e828d4d8d2947c472a47469ae42bcf7f690 [^]
2012-07-26 02:42hudsonbotCheckin
2012-07-26 02:42hudsonbotNote Added: 0050852
2012-07-26 11:17eduardo_ArgalNote Added: 0050894
2012-07-26 11:17eduardo_ArgalStatusresolved => closed

Notes
(0050731)
hgbot   
2012-07-18 16:27   
Repository: erp/devel/pi
Changeset: d1623e828d4d8d2947c472a47469ae42bcf7f690
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Wed Jul 18 16:25:58 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d1623e828d4d8d2947c472a47469ae42bcf7f690 [^]

Fixes issue 0021137: Fixes rounding problems.

---
M src/org/openbravo/costing/AverageAlgorithm.java
---
(0050852)
hudsonbot   
2012-07-26 02:42   
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/5edf203d5780 [^]

Maturity status: Test
(0050894)
eduardo_Argal   
2012-07-26 11:17   
Code reviewed, fixes possible exception when dividing a BigDecimal