|View Issue Details|
|Type||Category||Severity||Reproducibility||Date Submitted||Last Update|
|defect||[Openbravo ERP] 07. Sales management||major||always||2016-02-25 10:14||2016-03-17 10:56|
|Priority||urgent||Resolution||fixed||Fixed in Version||3.0PR16Q2|
|Status||closed||Fix in branch||Fixed in SCM revision||e86261103636|
|OS Version||Database version||Ant version|
|Product Version||SCM revision|
|Review Assigned To||aferraz|
|Regression introduced in release|
|Regression introduced by commit|
|Triggers an Emergency Pack||No|
0032337: Division by zero error when completing an invoice associated to a closed order (quantity 0) with a promotion
|Description||Division by zero error when completing an invoice associated to a closed order (quantity 0) with a promotion|
|Steps To Reproduce||As 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 Solution||The 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);
|Tags||No tags attached.|
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".
- 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.
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.
Test Plan above verified.
Issue can be code reviewed and closed.
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
|Code review OK|
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
|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||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||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||Note Added: 0085177|
|Copyright © 2000 - 2009 MantisBT Group|