Openbravo Issue Tracking System - Retail Modules
View Issue Details
0031261Retail ModulesDiscounts and Promotionspublic2015-10-27 11:102015-12-04 16:30
jorge-garcia 
jorge-garcia 
urgentmajoralways
closedfixed 
5
 
RR16Q1 
marvintm
No
0031261: Promotions are wrong applied if there is more than one promotion for the products
Promotions are wrong applied if there is more than one promotion that can be applied for the products of the receipt. This happens even if you use priority order in the promotions.

There is also a performance problems when you have a lot of lines in the receipt.
1) Create a new promotion:
 Name: bottles called 6 x 3 - Bottles
 Type: Buy X Pay Y from different Products
 Subtype: Apply Lowest
 Distribute between lines: checked
 X: 6
 Y: 3
2) In the Products tab:
 Use the same Products of the 3 x 2 - Bottles promotion
3) Login in the Web POS
4) Add 6 products, that are included in the bottle's promotions, to the receipt.
5) See that the promotion that had been applied is 3 x 2 - Bottles (It's applied twice).
6) Try the same scenario setting priority for these promotions
 i) 3 x 2 - Bottles: 20
 ii) 6 x 4 - Bottles: 10
7) Repeat steps 3 to 5 and check the result is the same.
No tags attached.
related to defect 0030446 closed jorge-garcia Discount : Buy X pay Y of different product don't apply to lowest price 
causes defect 0035848 scheduled rqueralta The Discount Subtype "Apply Average Price" does not calculate the average of the products but discounts one entire product 
Issue History
2015-10-27 11:10jorge-garciaNew Issue
2015-10-27 11:10jorge-garciaAssigned To => jorge-garcia
2015-10-27 11:10jorge-garciaTriggers an Emergency Pack => No
2015-10-27 11:12jorge-garciaRelationship addedrelated to 0030446
2015-10-27 11:12jorge-garciaStatusnew => acknowledged
2015-10-28 11:24plujanIssue Monitored: plujan
2015-11-02 12:56hgbotCheckin
2015-11-02 12:56hgbotNote Added: 0081428
2015-11-02 12:56hgbotStatusacknowledged => resolved
2015-11-02 12:56hgbotResolutionopen => fixed
2015-11-02 12:56hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/0aa75789a053f6fd069baab3ff1509f3a827e40e [^]
2015-11-02 12:57hgbotCheckin
2015-11-02 12:57hgbotNote Added: 0081429
2015-11-02 12:57hgbotCheckin
2015-11-02 12:57hgbotNote Added: 0081430
2015-11-02 12:58hgbotCheckin
2015-11-02 12:58hgbotNote Added: 0081431
2015-11-06 14:10jorge-garciaStatusresolved => new
2015-11-06 14:10jorge-garciaResolutionfixed => open
2015-11-06 14:10jorge-garciaStatusnew => scheduled
2015-11-06 14:11jorge-garciaNote Added: 0081571
2015-11-09 12:51hgbotCheckin
2015-11-09 12:51hgbotNote Added: 0081618
2015-11-09 13:19jorge-garciaStatusscheduled => resolved
2015-11-09 13:19jorge-garciaResolutionopen => fixed
2015-11-16 14:04OrekariaReview Assigned To => marvintm
2015-12-04 16:30marvintmStatusresolved => closed
2015-12-04 16:30marvintmFixed in Version => RR16Q1
2017-04-26 13:56jorge-garciaRelationship addedcauses 0035848

Notes
(0081428)
hgbot   
2015-11-02 12:56   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: 0aa75789a053f6fd069baab3ff1509f3a827e40e
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Oct 29 18:09:00 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/0aa75789a053f6fd069baab3ff1509f3a827e40e [^]

Fixed issue 31261: Promotions are wrong applied if there is more than one
promotion for the products

Due to the changes in the perfomance and the discount rules engine, two rule's
implementations has changed:
* promotion-XYdifferentProduts.js
* promotion-pack.js

The first one has change because in some cases, the promotion doesn't apply
correctly the rule (CIG Concept Original fix).

The second one has change because of the performance fix (part of the fix for
Cig Concept issue) in the discount engine.

---
M web/org.openbravo.retail.discounts/js/promotion-XYdifferentProduts.js
M web/org.openbravo.retail.discounts/js/promotion-pack.js
---
(0081429)
hgbot   
2015-11-02 12:57   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: f229f40bfc5d8388d597bae8eb05fe97366b8bfb
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Oct 29 18:11:33 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/f229f40bfc5d8388d597bae8eb05fe97366b8bfb [^]

Related to issue 31261: Promotions are wrong applied if there is more than one
promotion for the products

Some changes in performance and discount rules are necessary.

Now there is the option to take the promotionCandidates in the implementation
of the rules.

---
M web/org.openbravo.retail.posterminal/js/model/discounts.js
M web/org.openbravo.retail.posterminal/js/model/executor.js
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0081430)
hgbot   
2015-11-02 12:57   
Repository: erp/pmods/org.openbravo.retail.sampledata
Changeset: 141d658db3bf8aa755a4aaf1fb60ee0d54ada98a
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Oct 29 18:16:58 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.sampledata/rev/141d658db3bf8aa755a4aaf1fb60ee0d54ada98a [^]

Related to issue 31261: Promotions are wrong applied if there is more than one
promotion for the products

Some changes in the sampledata are necessary for the tests.

Added three new promotions:
* 2 x 1 - Ski Touring
* 3 x 2 - Ski Touring
* 6 x 4 - Ski Touring

Note: By default, these promotions are subtype lowest and not distributed

For each promotion we add the same products seven products:
* Pole 2 section ski touring
* Ski touring bindings
* Ski touring board Dyn
* Ski touring board Pyr
* Ski touring boot alpine
* Ski touring helmet
* Ski touring pole compact

---
M referencedata/sampledata/The_White_Valley_Group/M_OFFER.xml
M referencedata/sampledata/The_White_Valley_Group/M_OFFER_PRODUCT.xml
---
(0081431)
hgbot   
2015-11-02 12:58   
Repository: tools/automation/pi-mobile
Changeset: 4841075d54192777de4a7c8d5e1e542f93014d44
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Oct 29 18:03:02 2015 +0100
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/4841075d54192777de4a7c8d5e1e542f93014d44 [^]

Verifies issue 31261: Promotions are wrong applied if there is more than one
promotion for the products

Added test to cover these scenarios:
* Three possible promotions for average subtype
* Three possible promotions for lowest subtype
* Three possible promotions for most expensive subtype
* Three possible promotions for loest distributed subtype

Note: There is two kind of test for each case: basic and advanced

Some test has been change due to this fix
* Communit6783_BuyXPayYDifferentProductCheapestDistribu
* Communit6784_BuyXPayYDifferentProductAverage
* I28120_SameProductInTwoPacks
* I30542_BuyXPayYDiffProd_Average

A new class has been added:
* OBAddProduct.java: Add products using search tab and set the qty for the
   product just added.

---
M src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/Communit6783_BuyXPayYDifferentProductCheapestDistributed.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/Communit6784_BuyXPayYDifferentProductAverage.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I28120_SameProductInTwoPacks.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I30542_BuyXPayYDiffProd_Average.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/sales/SaleWithTwentyLinesII.java
A src-test/org/openbravo/test/mobile/common/selenium/utils/OBAddProduct.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_AverageI.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_AverageII.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_LowestDistributedI.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_LowestDistributedII.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_LowestI.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_LowestII.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_MostExpensiveI.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/MultiPromotions_BuyXPayYDiffProducts_MostExpensiveII.java
---
(0081571)
jorge-garcia   
2015-11-06 14:11   
With this refactor, we notice that the old flow of discounts doesn't work, so the issue is being rescheduled
(0081618)
hgbot   
2015-11-09 12:51   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 8cd17ca7e9ad07baac12e63834f882597e0c7080
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Mon Nov 09 10:42:59 2015 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8cd17ca7e9ad07baac12e63834f882597e0c7080 [^]

Related to issue 31261: Promotions are wrong applied if there is more than one
promotion for the products

With the refactor of the discounts and promotions engine, the old flow of
discounts doesn't work properly.

Now, the problem is fixed and the old flow of discounts works fine.

---
M web/org.openbravo.retail.posterminal/js/model/discounts.js
M web/org.openbravo.retail.posterminal/js/model/executor.js
---