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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0032337
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 07. Sales managementmajoralways2016-02-25 10:142016-03-17 10:56
ReporterngarciaView Statuspublic 
Assigned ToAtulOpenbravo 
PriorityurgentResolutionfixedFixed in Version3.0PR16Q2
StatusclosedFix in branchFixed in SCM revisione86261103636
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toaferraz
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0032337: Division by zero error when completing an invoice associated to a closed order (quantity 0) with a promotion

DescriptionDivision by zero error when completing an invoice associated to a closed order (quantity 0) with a promotion
Steps To ReproduceAs group admin role:
   Create a record in the Discounts and Promotions window
   Create a Sales Order
   Configure it in order the previous discount to be applied
   Set its Invoice Terms as Immediate and book it
   Create a Sales Invoice header, select the previously created order lines but do not complete it
   Close the Sales Order and check the Ordered Quantity has been updated to 0
   Try to complete the invoice and check the following error message is shown:
      "Error: division by zero"
   If the product is set as Is Quantity Variable = 'N' the error message should be:
      "It is not possible to complete the invoice <> line <>. Order No. <>: Invoiced Quantity cannot be higher than Ordered Quantity."
Proposed SolutionThe problem is in the following lines of the m_promotion_calculate function:

v_totalamt := round(Cur_Offer.totalamt * v_qtyinvoiced / v_qtyordered, v_precision);
v_displayedtotalamt := round(Cur_Offer.displayedtotalamt * v_qtyinvoiced / v_qtyordered, v_precision);
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0084594)
AtulOpenbravo (developer)
2016-02-29 14:27
edited on: 2016-03-01 10:28

Test Plan I
- Login as Admin role
- Create a record in the Discounts and Promotions window. Set Discount Percentage as 10. Starting Date = 01-01-2015, Ending Date =3112-2016
  Include Product - Only those defined. In Product tab select Zumo de Pera.
  Include Business Partner - Only those defined. In Business Partner Tab select Business Partner "Hoteles", as this one does not have any "Basic Discount" setup.
- Create a Sales Order for Hoteles and in Lines select Product Zumo de Pera, ordered quantity = 10.
- Check that Unit Price is set as 1.02 whereas List Price is 1.13.
- Set its Invoice Terms as Immediate and book it.
- Create a Sales Invoice header, select the previously created order, do not complete it. Check that the net unit price is 1.02.
- Close the Sales Order and check the Ordered Quantity has been updated to 0
- Complete the invoice.
- Go to the Sales Invoice window and try to complete the invoice.
- Check that Sales Invoice can not be processed successfully as a valid error message regarding qty check is shown as "Invoiced Quantity cannot be higher than Ordered Quantity".

Test II
- Repeat same scenario as above but setting "Qty variable" flag of product as Yes.
- Process the Sales Invoice and check that Invoice is processed successfully.

Steps to show "Qty variable" flag in product window.
- Login as System Admin
- Set "Core" Module as "In Development" = Yes. Save.
- Go to "Windows, Tab and Fields" window, search "Product" window.
- Go to "Tab" tab, select "Product" tab.
- Go to "Field" sub-tab and remove the filter
- Search by "Is Quantity Variable" field, and set it as "Displayed" = Yes.
- Log out and Log in.

(0084612)
psanjuan (manager)
2016-03-01 09:41

Issue verified.

In the case of creating a sales order for a product/BP do not included in any Discount and Promotion, same scenario leads in below error message:

it is not possible to complete invoice 10000170 line 10. Order N1 1000165: Invoiced Quantity cannot be higher than Ordered Quantity.

Above is OK for products set as "Quantity Variable" = N, in sales.
(0084614)
psanjuan (manager)
2016-03-01 10:31

Test Plan above verified.

Issue can be code reviewed and closed.
(0084649)
hgbot (developer)
2016-03-01 19:00

Repository: erp/devel/pi
Changeset: e86261103636e5adfeb3e0f02ef7cfbb725594e2
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Feb 29 18:07:19 2016 +0530
URL: http://code.openbravo.com/erp/devel/pi/rev/e86261103636e5adfeb3e0f02ef7cfbb725594e2 [^]

Fixes Issue 32337:Division by zero error when completing an invoice
associated to a closed order (quantity 0) with a promotion

While calculating promotion if qty ordered is non zero then only
use divide by statement else set values to zero

---
M src-db/database/model/functions/M_PROMOTION_CALCULATE.xml
---
(0084650)
aferraz (manager)
2016-03-01 19:04

Code review OK
(0085177)
hudsonbot (developer)
2016-03-17 10: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/b22fb0500156 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2016-02-25 10:14 ngarcia New Issue
2016-02-25 10:14 ngarcia Assigned To => Triage Finance
2016-02-25 10:14 ngarcia Modules => Core
2016-02-25 10:14 ngarcia Resolution time => 1459202400
2016-02-25 10:14 ngarcia Triggers an Emergency Pack => No
2016-02-25 10:14 ngarcia Issue Monitored: networkb
2016-02-25 10:15 ngarcia Proposed Solution updated
2016-02-26 13:22 AtulOpenbravo Assigned To Triage Finance => AtulOpenbravo
2016-02-29 14:27 AtulOpenbravo Note Added: 0084594
2016-02-29 14:28 AtulOpenbravo Status new => scheduled
2016-03-01 09:41 psanjuan Note Added: 0084612
2016-03-01 10:17 psanjuan Note Edited: 0084594 View Revisions
2016-03-01 10:22 psanjuan Note Edited: 0084594 View Revisions
2016-03-01 10:26 psanjuan Note Edited: 0084594 View Revisions
2016-03-01 10:27 psanjuan Note Edited: 0084594 View Revisions
2016-03-01 10:28 psanjuan Note Edited: 0084594 View Revisions
2016-03-01 10:31 psanjuan Note Added: 0084614
2016-03-01 19:00 hgbot Checkin
2016-03-01 19:00 hgbot Note Added: 0084649
2016-03-01 19:00 hgbot Status scheduled => resolved
2016-03-01 19:00 hgbot Resolution open => fixed
2016-03-01 19:00 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/e86261103636e5adfeb3e0f02ef7cfbb725594e2 [^]
2016-03-01 19:04 aferraz Review Assigned To => aferraz
2016-03-01 19:04 aferraz Note Added: 0084650
2016-03-01 19:04 aferraz Status resolved => closed
2016-03-01 19:04 aferraz Fixed in Version => 3.0PR16Q2
2016-03-17 10:56 hudsonbot Checkin
2016-03-17 10:56 hudsonbot Note Added: 0085177


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker