Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0032337 | Openbravo ERP | 07. Sales management | public | 2016-02-25 10:14 | 2016-03-17 10:56 |
|
Reporter | ngarcia | |
Assigned To | AtulOpenbravo | |
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR16Q2 | |
Merge Request Status | |
Review Assigned To | aferraz |
OBNetwork customer | OBPS |
Web browser | |
Modules | Core |
Support ticket | 40798 |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 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); |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | |
|
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 | OBNetwork customer | => Yes |
2016-02-25 10:14 | ngarcia | Modules | => Core |
2016-02-25 10:14 | ngarcia | Support ticket | => 40798 |
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 | bug_revision_view_page.php?bugnote_id=0084594#r11279 |
2016-03-01 10:22 | psanjuan | Note Edited: 0084594 | bug_revision_view_page.php?bugnote_id=0084594#r11280 |
2016-03-01 10:26 | psanjuan | Note Edited: 0084594 | bug_revision_view_page.php?bugnote_id=0084594#r11281 |
2016-03-01 10:27 | psanjuan | Note Edited: 0084594 | bug_revision_view_page.php?bugnote_id=0084594#r11282 |
2016-03-01 10:28 | psanjuan | Note Edited: 0084594 | bug_revision_view_page.php?bugnote_id=0084594#r11283 |
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 | |
Notes |
|
(0084594)
|
AtulOpenbravo
|
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.
|
|
|
|
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. |
|
|
|
Test Plan above verified.
Issue can be code reviewed and closed. |
|
|
(0084649)
|
hgbot
|
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
---
|
|
|
|
|
|
|
|