Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042309Retail ModulesDiscounts and Promotionspublic2019-10-31 17:262019-11-28 17:24
inaki_garcia 
ranjith_qualiantech_com 
immediatemajoralways
closedfixed 
5
main 
RR19Q4RR19Q4 
marvintm
main
No
0042309: [19Q4] Gift discount amount is duplicated when splitting a multiple quantity gift item into lines
When creating a ticket with a product group eligible for a "Buy X and pay Y as gift", and splitting the gift product set to 2 or more units and splitting it into two or more lines with the "Split lines" feature, the description item with the discount that appears in the original is duplicated to the other line(s), and does affect the overall cost of the ticket (effectively duplicating the discount value for the gift product group). This is better described in the steps to reproduce and in the screenshot attachment below.

This is a regression introduced in the current version (19Q4), as it is not reproducible in 19Q3 and versions prior to it.
PRECONDITION: the "Discounts and Promotions" module must be installed

-- In the Backend (ERP)
0. Log in ERP as Group -Admin-The White Valley Group
1. Go to Discounts and Promotions window
2. Create new record
 - Header tab
   * Discount type: Buy X and pay Y as gift
   * Name: Free Wax
   * Starting date: today's date
   * Included Products: Only those defined
  - Products subtab
    Record 1
   * Product: All mountain ski board
   * Quantity: 1
    Record 2
   * Product: Ski wax
   * Gift product: checked
   * Gift quantity: 2

-- In the Web POS
0. Log in the POS as user "vallblanca"
1. Add 1 unit of "All mountain ski board"
2. Add 2 units of "Ski wax"
NOTICE that the 2 units of Ski wax are correctly discounted, as shown in the attached picture, "gift-items-correctly-discounted.png"
3. Click on the newly created ticket line, and click on the "Split" option in the line description pane. Click "Apply" button in the "Split" popup that appears.
NOTICE the original line discount is duplicated in the second line, in spite of having decreased in one unit per line. There's no recalculation of the discounts, and the original discount amount is duplicated and reflected in the total amount of the ticket (check the attached picture: "gift-items-discount-duplicated.png")
No tags attached.
blocks defect 0042168 closed ranjith_qualiantech_com [19Q4] Gift discount amount is duplicated when splitting a multiple quantity gift item into lines 
Issue History
2019-11-18 15:22marvintmTypedefect => backport
2019-11-18 15:22marvintmTarget Version => RR19Q4
2019-11-28 10:39hgbotCheckin
2019-11-28 10:39hgbotNote Added: 0115928
2019-11-28 10:39hgbotStatusscheduled => resolved
2019-11-28 10:39hgbotResolutionopen => fixed
2019-11-28 10:39hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/21cc24482bad436f97d613d27ea6605e3f31d352 [^] => http://code.openbravo.com/retail/backports/3.0RR19Q4/org.openbravo.retail.discounts/rev/2f4112aa5481c00714b0d41f43942313cbaf2417 [^]
2019-11-28 17:24marvintmReview Assigned To => marvintm
2019-11-28 17:24marvintmStatusresolved => closed
2019-11-28 17:24marvintmFixed in Version => RR19Q4

Notes
(0115928)
hgbot   
2019-11-28 10:39   
Repository: retail/backports/3.0RR19Q4/org.openbravo.retail.discounts
Changeset: 2f4112aa5481c00714b0d41f43942313cbaf2417
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Nov 28 15:09:44 2019 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR19Q4/org.openbravo.retail.discounts/rev/2f4112aa5481c00714b0d41f43942313cbaf2417 [^]

Fixed issue 42309 : Discount Price should be updated with proper units based on chunks and line qty

---
M src-test/org/openbravo/retail/discounts/test/unittests/DiscountBuyXGiftYTest.java
M web/org.openbravo.retail.discounts/js/discountsengine/common/rules/buy-x-gift-y-discount.js
---