Openbravo Issue Tracking System - Retail Modules
View Issue Details
0030542Retail ModulesWeb POSpublic2015-08-11 09:442015-09-07 12:02
yogaskarnik 
jorge-garcia 
highmajoralways
closedfixed 
5
RR15Q2.2 
RR15Q4 
marvintm
No
0030542: Problem for discount calculation : buy x and pay Y differents products
For the discount "buy x and pay y of different products and If "apply to lowest price" is active, the lowest price is multiplied by the quantity of "gift"
products without checking the quantity selling for the the product.

If i have sell 10 and pay 8, apply to the lowest price :

i sell :
- 3 products at 50 €
- 6 procucts at 40 €
- 1 product at 30 €

The system do discount 2*30 € or i need 1*30 € and 1*40€ because i have only 1 product at 30 and the second "lowest price" is 40 €

See the screen in attachment

In this use case i need to have 1*4,80 and 1*7,20 and not 2*4,80
configure the promotion "Buy X and pay Y" as X=10 , Y=8.

In the web pos add 3 proucts to the order, (note following is just an example)
p1 - 6 qty - price for each qty is 25,
p2 - 3 qty - price for each qty is 15,
p3 - 1 qty - price for each qty is 5

the promotion is calculated as 2*5 = 10 ie., promotion is calculated only based on the product with the lowest price (2* price of p3).
No tags attached.
related to defect 0030446 closed jorge-garcia Discount : Buy X pay Y of different product don't apply to lowest price 
Issue History
2015-08-11 09:44yogaskarnikNew Issue
2015-08-11 09:44yogaskarnikAssigned To => Retail
2015-08-11 09:44yogaskarnikResolution time => 1442613600
2015-08-11 09:44yogaskarnikTriggers an Emergency Pack => No
2015-08-13 18:04ddeyrisIssue Monitored: ddeyris
2015-08-21 14:08egoitzIssue Monitored: egoitz
2015-08-26 10:13jorge-garciaAssigned ToRetail => jorge-garcia
2015-09-01 15:23jorge-garciaStatusnew => scheduled
2015-09-04 13:28hgbotCheckin
2015-09-04 13:28hgbotNote Added: 0080113
2015-09-04 13:28hgbotStatusscheduled => resolved
2015-09-04 13:28hgbotResolutionopen => fixed
2015-09-04 13:28hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/af93adc5dc20b0d7a71879615dbc09ec39d06fe5 [^]
2015-09-04 13:28hgbotCheckin
2015-09-04 13:28hgbotNote Added: 0080114
2015-09-04 13:30hgbotCheckin
2015-09-04 13:30hgbotNote Added: 0080122
2015-09-07 10:49jorge-garciaRelationship addedrelated to 0030446
2015-09-07 12:02marvintmReview Assigned To => marvintm
2015-09-07 12:02marvintmStatusresolved => closed
2015-09-07 12:02marvintmFixed in Version => RR15Q4

Notes
(0080113)
hgbot   
2015-09-04 13:28   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: af93adc5dc20b0d7a71879615dbc09ec39d06fe5
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Aug 27 08:46:36 2015 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/af93adc5dc20b0d7a71879615dbc09ec39d06fe5 [^]

Fixed issue 30542: Problem for discounts: buy x and pay Y differents products

The problem is that the logic for apply discounts for differents products was
not working well. The logic implemented only applied discounts to the highest
price.

The solution is to changed the logic for apply this kind of discount. Now, the
logic applies to the lowest price only if it's defined in the backend. If
subtype field is set to null, the promotion is applied to the product with the
highest price.

The functionality of distributed between lines and apply average price doesn't
change.

---
M web/org.openbravo.retail.discounts/js/promotion-XYdifferentProduts.js
---
(0080114)
hgbot   
2015-09-04 13:28   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: 899e85a58877b66e2ce0d97dc402f33f9aebfc0c
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Sep 03 09:18:55 2015 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/899e85a58877b66e2ce0d97dc402f33f9aebfc0c [^]

Related to issue 30542: Problem for discounts: buy x and pay Y different product

In some cases, an error occurs when the logic of the discounts tries to applied
the distribution of the total amount to gift.

---
M web/org.openbravo.retail.discounts/js/promotion-XYdifferentProduts.js
---
(0080122)
hgbot   
2015-09-04 13:30   
Repository: tools/automation/pi-mobile
Changeset: 20ecd2dc860319ec94083b8ef0738ecb7d3f14bd
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Fri Sep 04 12:53:58 2015 +0200
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/20ecd2dc860319ec94083b8ef0738ecb7d3f14bd [^]

Verifies issue 30542: Added new tests for the Discount Logic

Four new test had been added, all related to BuyXPayY from different products
* Test for Lowest Price
* Test for Lowest Price and Distributed between lines checked
* Test for Average Price
* Test for Most Expensive Price (subtype=null)

---
M src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I30542_BuyXPayYDiffProd_Average.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I30542_BuyXPayYDiffProd_Lowest.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I30542_BuyXPayYDiffProd_LowestDistrib.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I30542_BuyXPayYDiffProd_MostExpensive.java
---