Openbravo Issue Tracking System - Retail Modules
View Issue Details
0027581Retail ModulesDiscounts and Promotionspublic2014-09-11 11:002014-09-11 11:00
aaroncalero 
marvintm 
lowtrivialalways
newopen 
5
pi 
 
No
0027581: When trying to apply a 'Buy X get Y as a gift' discount, a 'division by zero' raises
When trying to apply a 'Buy X get Y as a gift' discount in a Sales Order created in the ERP (during the booking process), a 'division by zero' raises with a concrete discount configuration
Define a discount:
Type: Buy X get Y as a Gift
Apply Nex Discount/Promo: False (unchecked)
Included Products: All excluding defined
Distribute Between lines: True (checked)
Leave the Products subtab empty.

Create a sales order
Add a new sales order line (the product added doesn't matter)
Book the sales order.

A "division by zero" error is raised and the process is not completed

The error is raised within the OBDISC_XY_GIFT procedure. The procedure tries to loop over the order lines with products defined in the [Products] subtab of the discount and calculates a total amount which is used later in a division.
Since there is no product defined in the [Products] subtab, the total amount is zero, causing the error.
A possible solution is to force the user to set "Included Products: Only those defined" when defining this discount type, as otherwise the discount definition is incorrect.
No tags attached.
Issue History
2014-09-11 11:00aaroncaleroNew Issue
2014-09-11 11:00aaroncaleroAssigned To => marvintm
2014-09-11 11:00aaroncaleroTriggers an Emergency Pack => No

There are no notes attached to this issue.