Openbravo Issue Tracking System - Retail Modules
View Issue Details
0047741Retail ModulesDiscounts and Promotionspublic2021-09-22 20:472021-10-20 08:34
lbressan 
ranjith_qualiantech_com 
normalmajoralways
closedfixed 
5
RR20Q2.2 
RR22Q1 
marvintm
2021-10-08
No
0047741: Problem with discount aplication
Problem when applying a discount of the 3x2 type, when loading 3 units of the promotional product it is applied correctly but when loading more than 3 units a second discount of 10 percent applies, which is not applicable.
1. Create promotion of type 'Fixed Percentage Discount' with the check of 'Apply Next Discount / Promotions' activated.
2. Create promotion of type 'Buy X and pay Y of same product' with the check of 'Apply Next Discount / Promotions' deactivated.
3. In the POS, generate a sales order for the product in promotion, set the number of units of this product to 3, the corresponding promotion will appear.
4. Then, change the number of units for one greater than 3 and it will be observed that a second discount is applied when it should not because the check mentioned above is deactivated.
No tags attached.
zip promotions_error.zip (3,095,131) 2021-09-22 20:47
https://issues.openbravo.com/file_download.php?file_id=16217&type=bug
Issue History
2021-09-22 20:47lbressanNew Issue
2021-09-22 20:47lbressanAssigned To => Retail
2021-09-22 20:47lbressanFile Added: promotions_error.zip
2021-09-22 20:47lbressanRegression date => 2021-10-08
2021-09-22 20:47lbressanTriggers an Emergency Pack => No
2021-09-27 16:56marvintmReview Assigned To => marvintm
2021-09-27 16:56marvintmNote Added: 0132032
2021-09-27 16:56marvintmStatusnew => closed
2021-09-27 16:56marvintmResolutionopen => no change required
2021-09-29 15:45marvintmNote Added: 0132070
2021-09-29 15:45marvintmStatusclosed => new
2021-09-29 15:45marvintmResolutionno change required => open
2021-10-05 06:00ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2021-10-07 07:35hgbotNote Added: 0132227
2021-10-10 08:13ranjith_qualiantech_comStatusnew => scheduled
2021-10-18 07:56hgbotResolutionopen => fixed
2021-10-18 07:56hgbotStatusscheduled => closed
2021-10-18 07:56hgbotFixed in Version => RR22Q1
2021-10-18 07:56hgbotNote Added: 0132375
2021-10-18 07:56hgbotNote Added: 0132376
2021-10-19 08:20ranjith_qualiantech_comFile Added: 47741_discounts_20Q1.diff
2021-10-19 10:40ranjith_qualiantech_comFile Deleted: 47741_discounts_20Q1.diff
2021-10-20 07:56ranjith_qualiantech_comNote Added: 0132469
2021-10-20 07:56ranjith_qualiantech_comStatusclosed => new
2021-10-20 07:56ranjith_qualiantech_comResolutionfixed => open
2021-10-20 07:56ranjith_qualiantech_comFixed in VersionRR22Q1 =>
2021-10-20 08:04hgbotNote Added: 0132474
2021-10-20 08:04ranjith_qualiantech_comStatusnew => scheduled
2021-10-20 08:34hgbotNote Added: 0132475
2021-10-20 08:34hgbotResolutionopen => fixed
2021-10-20 08:34hgbotStatusscheduled => closed
2021-10-20 08:34hgbotFixed in Version => RR22Q1
2021-10-20 08:34hgbotNote Added: 0132476

Notes
(0132032)
marvintm   
2021-09-27 16:56   
For lines with multiple units, the check "apply next discount" applies only to the units that have received the discount.

In the example shown, when there is 4 units, 3 of them are consumed by the 3x2 discount, but the fourth one is "free", and therefore it receives the 10% discount. This is the intended behaviour.
(0132070)
marvintm   
2021-09-29 15:45   
Actually we checked again, and even though the second discount should be applied (because there is a free unit in the line), the amount of this discount is incorrect, because it is calculated from the discounted amount of the line (after applying the first discount), while instead it should be calculated from the available units.
(0132227)
hgbot   
2021-10-07 07:35   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/38 [^]
(0132375)
hgbot   
2021-10-18 07:56   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts [^]
Changeset: 3c0f20ac8152b046e41c940fd5c3cefc993777e8
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 2021-10-16T17:06:10+05:30
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/commit/3c0f20ac8152b046e41c940fd5c3cefc993777e8 [^]

Fixed ISSUE-47741: FixedPercentage discount should be applied only for available quantity
* If ticket line qty was consumed by previous discount,
  then fixed percentage discount should be applied only for available quantity

---
A src-test/org/openbravo/retail/discounts/test/unittests/combined/I47741_VerifyDiscountAfterQtyConsumed.java
M web/org.openbravo.retail.discounts/app/model/business-logic/discounts-engine/engine/discount-engine.js
M web/org.openbravo.retail.discounts/app/model/business-logic/discounts-engine/engine/discount-rules.js
M web/org.openbravo.retail.discounts/app/model/business-logic/discounts-engine/engine/rules/fixed-percentage-discount.js
M web/org.openbravo.retail.discounts/app/model/business-logic/discounts-engine/engine/rules/price-adjustment-discount.js
M web/org.openbravo.retail.discounts/app/model/business-logic/discounts-engine/interface/discount-posinterface.js
---
(0132376)
hgbot   
2021-10-18 07:56   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/38 [^]
(0132469)
ranjith_qualiantech_com   
2021-10-20 07:56   
Price Adjustment calculation is not working after the changes for the following case
Backoffice
1) Create New discount with Type - Price Adjustment
2) Add Fixed Unit Price as 90 and Min Quantity as 2
POS
1) Add 5 Quantity of Product Bottles
2) Change price from 9.5 to 100
3x2 Bottle discount will be applied
Newly created discount should be applied. But its not
(0132474)
hgbot   
2021-10-20 08:04   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/39 [^]
(0132475)
hgbot   
2021-10-20 08:34   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/39 [^]
(0132476)
hgbot   
2021-10-20 08:34   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts [^]
Changeset: 54074d545dffe8139da3ec967c8565a2bedda9db
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 2021-10-20T11:29:11+05:30
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/commit/54074d545dffe8139da3ec967c8565a2bedda9db [^]

Fixed ISSUE-47741: Updated Discount calculation for Price Adjustment
* For Price Adjustment Fixed Unit price calculation,
  discount should be applied for availableUnitPrice instead of unitPrice

---
M src-test/org/openbravo/retail/discounts/test/unittests/DiscountsUnitTestSuite.java
M src-test/org/openbravo/retail/discounts/test/unittests/combined/I47741_VerifyDiscountAfterQtyConsumed.java
M web/org.openbravo.retail.discounts/app/model/business-logic/discounts-engine/engine/rules/price-adjustment-discount.js
---