Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033197Openbravo ERP04. Warehouse managementpublic2016-06-08 18:162016-06-21 14:48
ngarcia 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR16Q3 
aferraz
Core
No
0033197: / by zero error when processing a landed cost with a goods receipt with more than one line and 0 cost
/ by zero error when processing a landed cost with a goods receipt with more than one line and 0 cost
As group admin role:
   Create two products
   Add a purchase price list of 0 to them
   Create a goods receipt and include both products
   Launch the Costing Background Process and check the cost of the associated transactions is 0
   Create a Landed Cost Type:
      Landed Cost Distribution Algorithm: Distribution by Amount
   Create a Landed Cost
   Add a cost to it and select the previously created type
   Add the previously created goods receipt
   Try to process it and check the following error message is shown: / by zero

   The log shows:

ERROR org.openbravo.costing.LandedCostProcessHandler - Error in LandedCostProcessHandler: / by zero
java.lang.ArithmeticException: / by zero
    at java.math.BigDecimal.divideAndRound(BigDecimal.java:1424)
    at java.math.BigDecimal.divide(BigDecimal.java:1398)
    at java.math.BigDecimal.divide(BigDecimal.java:1513)
    at org.openbravo.costing.LandedCostDistributionByAmount.distributeAmount(LandedCostDistributionByAmount.java:110)
    at org.openbravo.costing.LandedCostProcess.distributeAmounts(LandedCostProcess.java:191)
    at org.openbravo.costing.LandedCostProcess.processLandedCost(LandedCostProcess.java:98)
    at org.openbravo.costing.LandedCostProcess.doProcessLandedCost(LandedCostProcess.java:298)
No tags attached.
related to defect 00300173.0PR15Q3 closed aferraz Should not be possible to select negative receipts when registering a Landed Cost 
Issue History
2016-06-08 18:16ngarciaNew Issue
2016-06-08 18:16ngarciaAssigned To => Triage Finance
2016-06-08 18:16ngarciaModules => Core
2016-06-08 18:16ngarciaResolution time => 1467151200
2016-06-08 18:16ngarciaTriggers an Emergency Pack => No
2016-06-08 18:16ngarciaIssue Monitored: networkb
2016-06-09 10:06aferrazAssigned ToTriage Finance => markmm82
2016-06-13 18:19markmm82Statusnew => scheduled
2016-06-13 18:19markmm82Note Added: 0087209
2016-06-17 13:32aferrazRelationship addedrelated to 0030017
2016-06-17 14:32hgbotCheckin
2016-06-17 14:32hgbotNote Added: 0087401
2016-06-17 14:32hgbotStatusscheduled => resolved
2016-06-17 14:32hgbotResolutionopen => fixed
2016-06-17 14:32hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/fc24781d4355e9d02c456de93fed1230403fc2b5 [^]
2016-06-17 14:32hgbotCheckin
2016-06-17 14:32hgbotNote Added: 0087402
2016-06-17 14:33aferrazReview Assigned To => aferraz
2016-06-17 14:33aferrazNote Added: 0087403
2016-06-17 14:33aferrazStatusresolved => closed
2016-06-17 14:33aferrazFixed in Version => 3.0PR16Q3
2016-06-21 14:48hudsonbotCheckin
2016-06-21 14:48hudsonbotNote Added: 0087726
2016-06-21 14:48hudsonbotCheckin
2016-06-21 14:48hudsonbotNote Added: 0087727

Notes
(0087209)
markmm82   
2016-06-13 18:19   
Test Plan:
As group admin role:
   Create two products
   Add a purchase price list of 0 to both
   Create a goods receipt and include both products
   Launch the Costing Background Process and check the cost of the associated transactions is 0.00
   Create a Landed Cost Type:
      Landed Cost Distribution Algorithm: Distribution by Amount
   Create a Landed Cost
   Add a cost of 0 to it and select the previously created type
   Add the previously created goods receipt
   Try to process it and check the process is completed successfully and a new Cost adjustment is created.
   No error by /zero is shown.
(0087401)
hgbot   
2016-06-17 14:32   
Repository: erp/devel/pi
Changeset: fc24781d4355e9d02c456de93fed1230403fc2b5
Author: Mark <markmm82 <at> gmail.com>
Date: Sat Jun 11 18:58:10 2016 -0400
URL: http://code.openbravo.com/erp/devel/pi/rev/fc24781d4355e9d02c456de93fed1230403fc2b5 [^]

Fixes issue 33197: Avoided / by zero error when processing a landed cost

Avoided / by zero error when processing a landed cost

---
M src/org/openbravo/costing/LandedCostDistributionByAmount.java
---
(0087402)
hgbot   
2016-06-17 14:32   
Repository: erp/devel/pi
Changeset: a4b0ffea953bc74625be777d96029a9ba777f04e
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri Jun 17 14:03:50 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a4b0ffea953bc74625be777d96029a9ba777f04e [^]

Related to issue 33197: Code review improvements

Take receipt line amount and receipt amount as absolute values to calculate correct landed cost receipt amount in case we have one receipt with two lines with the same amount but one positive and the other negative.

---
M src/org/openbravo/costing/LandedCostDistributionByAmount.java
---
(0087403)
aferraz   
2016-06-17 14:33   
Code review + Testing OK
(0087726)
hudsonbot   
2016-06-21 14:48   
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/7f9896fd81e9 [^]
Maturity status: Test
(0087727)
hudsonbot   
2016-06-21 14:48   
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/7f9896fd81e9 [^]
Maturity status: Test