Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0039993
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 04. Warehouse managementmajoralways2019-01-22 11:142019-03-28 14:56
ReporterngarciaView Statuspublic 
Assigned ToAtulOpenbravo 
PriorityurgentResolutionfixedFixed in Version3.0PR19Q2
StatusclosedFix in branchFixed in SCM revision94c8cd7d1c55
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned ToSandrahuguet
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0039993: / by zero error in Costing Background Process with backdated and negative stock correction and voided goods receipt

Description/ by zero error in Costing Background Process with backdated and negative stock correction and voided goods receipt
Steps To ReproduceAs group admin role:
   Set the 'Enable Negative Stock Corrections' to Y
   Log out and log in

   Go to Costing Rules window, select 'F&B España, S.A', launch 'Fix Backdated Transactions' process with '01-01-2019' starting date

   Create a new product
   Set a price of 5 in Tarifa Bebidas Alegres

   Create a new goods receipt with '16-01-2019' movement date and 2 units of the product
   Create a new goods shipment with '17-01-2019' movement date and 2 units of the product
   Void the goods receipt with a movement date of 'today'

   Create a purchase order with '16-01-2019' movement date and 2 units of the product. Increase its price to 7
   Create the related goods receipt with a movement date of '16-01-2019'

   Launch the Costing Background Process and check the following message is shown in Process Log field:
     / by zero

The log shows:
   [DefaultQuartzScheduler_Worker-8] ERROR org.openbravo.costing.CostingBackground - / by zero
java.lang.ArithmeticException: / by zero
    at java.math.BigDecimal.divideAndRound(BigDecimal.java:4106) ~[?:1.8.0_171]
    at java.math.BigDecimal.divide(BigDecimal.java:5183) ~[?:1.8.0_171]
    at java.math.BigDecimal.divide(BigDecimal.java:1561) ~[?:1.8.0_171]
    at java.math.BigDecimal.divide(BigDecimal.java:1591) ~[?:1.8.0_171]
    at org.openbravo.costing.AverageCostAdjustment.getRelatedTransactionsByAlgorithm(AverageCostAdjustment.java:376) ~[AverageCostAdjustment.class:?]
    at org.openbravo.costing.CostingAlgorithmAdjustmentImp.searchRelatedTransactionCosts(CostingAlgorithmAdjustmentImp.java:164) ~[CostingAlgorithmAdjustmentImp.class:?]
    at org.openbravo.costing.CostAdjustmentProcess.calculateAdjustmentAmount(CostAdjustmentProcess.java:235) ~[CostAdjustmentProcess.class:?]
    at org.openbravo.costing.CostAdjustmentProcess.processCostAdjustment(CostAdjustmentProcess.java:86) ~[CostAdjustmentProcess.class:?]
    at org.openbravo.costing.CostAdjustmentProcess.doProcessCostAdjustment(CostAdjustmentProcess.java:339) ~[CostAdjustmentProcess.class:?]
    at org.openbravo.costing.CostingServer.createAdjustment(CostingServer.java:385) ~[CostingServer.class:?]
    at org.openbravo.costing.CostingServer.checkCostAdjustments(CostingServer.java:313) ~[CostingServer.class:?]
    at org.openbravo.costing.CostingServer.process(CostingServer.java:136) ~[CostingServer.class:?]
    at org.openbravo.costing.CostingBackground.doExecute(CostingBackground.java:137) [CostingBackground.class:?]
    at org.openbravo.service.db.DalBaseProcess.execute(DalBaseProcess.java:84) [DalBaseProcess.class:?]
    at org.openbravo.scheduling.DefaultJob.execute(DefaultJob.java:64) [DefaultJob.class:?]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-1.6.2.jar:1.6.2]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) [quartz-1.6.2.jar:1.6.2]
      
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0109294)
AtulOpenbravo (developer)
2019-01-29 09:40

- Login as F&B International Group admin role:
- Set the 'Enable Negative Stock Corrections' to Y
  Log out and log in

- Go to Costing Rules window, select 'F&B España, S.A', launch 'Fix Backdated Transactions' process with '01-01-2019' starting date

- Create a new product
- Set a price of 5 in Tarifa Bebidas Alegres

- Create a new goods receipt with '16-01-2019' movement date and 2 units of the product
- Create a new goods shipment with '17-01-2019' movement date and 2 units of the product
- Void the goods receipt with '16-01-2019' movement date and in pop up enter void date as 'today'. (This step will raise error for insufficient stock. To avoid this error, change status of storage to Undefined - OverIssue)
- Create a purchase order with '16-01-2019' movement date and 2 units of the product. Increase its price to 7
- Create the related goods receipt with a movement date of '16-01-2019'
- Launch the Costing Background Process and check the following message is shown in process log is Process completed successfully.
(0109600)
hgbot (developer)
2019-02-05 17:40

Repository: erp/devel/pi
Changeset: 94c8cd7d1c55e39587b68a2fe4e3a67b7e79bac9
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Tue Jan 29 23:13:57 2019 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/94c8cd7d1c55e39587b68a2fe4e3a67b7e79bac9 [^]

Fixes Issue 0039993: / by zero error in Costing Background Process
with backdated and negative stock correction and voided goods
receipt

In case of negative stock correction, handle divide by zero when
currentStock value is zero

---
M src/org/openbravo/costing/AverageCostAdjustment.java
---
(0109601)
Sandrahuguet (developer)
2019-02-05 17:42

Code review + testing OK
(0110797)
hudsonbot (developer)
2019-03-28 14:56

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/b2fbc1588df4 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2019-01-22 11:14 ngarcia New Issue
2019-01-22 11:14 ngarcia Assigned To => Triage Finance
2019-01-22 11:14 ngarcia Modules => Core
2019-01-22 11:14 ngarcia Triggers an Emergency Pack => No
2019-01-22 11:15 ngarcia Issue Monitored: networkb
2019-01-22 11:45 Practics Issue Monitored: Practics
2019-01-24 16:53 Sandrahuguet Assigned To Triage Finance => AtulOpenbravo
2019-01-28 16:50 ngarcia Steps to Reproduce Updated View Revisions
2019-01-29 09:40 AtulOpenbravo Status new => scheduled
2019-01-29 09:40 AtulOpenbravo Note Added: 0109294
2019-02-05 17:40 hgbot Checkin
2019-02-05 17:40 hgbot Note Added: 0109600
2019-02-05 17:40 hgbot Status scheduled => resolved
2019-02-05 17:40 hgbot Resolution open => fixed
2019-02-05 17:40 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/94c8cd7d1c55e39587b68a2fe4e3a67b7e79bac9 [^]
2019-02-05 17:42 Sandrahuguet Review Assigned To => Sandrahuguet
2019-02-05 17:42 Sandrahuguet Note Added: 0109601
2019-02-05 17:42 Sandrahuguet Status resolved => closed
2019-02-05 17:42 Sandrahuguet Fixed in Version => 3.0PR19Q2
2019-03-28 14:56 hudsonbot Checkin
2019-03-28 14:56 hudsonbot Note Added: 0110797


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker