Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042168Retail ModulesDiscounts and Promotionspublic2019-10-31 17:262019-11-22 12:38
inaki_garcia 
ranjith_qualiantech_com 
immediatemajoralways
closedfixed 
5
main 
RR20Q1 
guilleaer
main
No
0042168: [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.
depends on backport 0042309RR19Q4 closed ranjith_qualiantech_com [19Q4] Gift discount amount is duplicated when splitting a multiple quantity gift item into lines 
png gift-items-correctly-discounted.png (113,045) 2019-10-31 17:26
https://issues.openbravo.com/file_download.php?file_id=13475&type=bug
png

png gift-items-discount-duplicated.png (119,226) 2019-10-31 17:27
https://issues.openbravo.com/file_download.php?file_id=13476&type=bug
png
Issue History
2019-10-31 17:26inaki_garciaNew Issue
2019-10-31 17:26inaki_garciaAssigned To => Retail
2019-10-31 17:26inaki_garciaFile Added: gift-items-correctly-discounted.png
2019-10-31 17:26inaki_garciaRegression introduced in release => main
2019-10-31 17:26inaki_garciaTriggers an Emergency Pack => No
2019-10-31 17:26inaki_garciaIssue generated from0042131
2019-10-31 17:27inaki_garciaFile Added: gift-items-discount-duplicated.png
2019-11-02 12:51PracticsIssue Monitored: Practics
2019-11-11 17:56ngarciaResolution time => 1574636400
2019-11-12 14:53rqueraltaAssigned ToRetail => rqueralta
2019-11-12 14:53rqueraltaStatusnew => scheduled
2019-11-13 15:25ranjith_qualiantech_comAssigned Torqueralta => ranjith_qualiantech_com
2019-11-18 14:54hgbotCheckin
2019-11-18 14:54hgbotNote Added: 0115661
2019-11-18 14:54hgbotStatusscheduled => resolved
2019-11-18 14:54hgbotResolutionopen => fixed
2019-11-18 14:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/21cc24482bad436f97d613d27ea6605e3f31d352 [^]
2019-11-18 15:21marvintmStatusresolved => new
2019-11-18 15:21marvintmResolutionfixed => open
2019-11-18 15:22marvintmStatusnew => scheduled
2019-11-18 15:22marvintmStatusscheduled => resolved
2019-11-18 15:22marvintmResolutionopen => fixed
2019-11-22 12:38guilleaerReview Assigned To => guilleaer
2019-11-22 12:38guilleaerStatusresolved => closed
2019-11-22 12:38guilleaerFixed in Version => RR20Q1

Notes
(0115661)
hgbot   
2019-11-18 14:54   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: 21cc24482bad436f97d613d27ea6605e3f31d352
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Nov 18 19:24:19 2019 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/21cc24482bad436f97d613d27ea6605e3f31d352 [^]

Fixed issue 42168 : 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
---