Openbravo Issue Tracking System - Retail Modules
View Issue Details
0033841Retail ModulesDiscounts and Promotionspublic2016-08-29 13:532017-08-09 10:47
aaroncalero 
rqueralta 
highmajoralways
newopen 
5
 
 
jorge-garcia
No
0033841: Free Products per Total Amount discount removes other discounts
When several discounts* are applied on the ticket, applying a 'Free Products per Total Amount' discount removes other discounts from the ticket.

* This issue has been reproduced with a combo and a two families combo, but it might be reproducible with other types of discounts.
Using modules sampledata, define the following discounts:
1. Type: Combo
Name: Ski combo
Valid start/end dates
Family 1: Name: Electronics, Qty: 1, Discount type: percentage, 20%
*Product(s): Digital Altimeter
Family 2: Name: Ski, Qty: 1, Discount type: percentage, 10%
*Product(s): Alpine ski boot

2. Type: Two Families Discount
Name: Camping Combo
Valid start/end dates
Priority: 10
Family 1, Qty: 1, Discount type: Fixed discount, amt: 0
*Product(s):Down sleeping bag 500; Down sleeping bag 700
Family 2, Qty: 1, Discount type: Fixed discount, amt: 50
*Product(s): Compression sacks cordura; Down sleeping bag 500

3. Type: Free Products per Total Amount
Name: Gift over 500 €
Valid start/end dates
Priority: 100
Total receipt: 500
Free Products subtab: Adhesive body warmers; Camera bag.
------------------------------------------------------------

Steps to reproduce:
login in web pos and create a new ticket
Add the following products:
3 Avalanche transceivers (total: 451.5€)
3 Digital altimeter blue
2 Alpine Ski boot
>> (2x) Ski combo applied to lines 2 & 3
1 Down sleeping bag 700
1 Compression sacks cordura
>> Camping combo applied to lines 4 & 5
1 Adhesive body warmer
>> 'Gift over 500€' applied to line 6 (-3.60€)

Add another Adhesive body warmer.
The 'Gift over 500€' discount will update to -7.20€
>> Error: The Camping combo is removed from lines 4 & 5
No tags attached.
Issue History
2016-08-29 13:53aaroncaleroNew Issue
2016-08-29 13:53aaroncaleroAssigned To => Retail
2016-08-29 13:53aaroncaleroTriggers an Emergency Pack => No
2017-05-03 15:02rqueraltaAssigned ToRetail => rqueralta
2017-05-03 15:02rqueraltaStatusnew => scheduled
2017-06-21 17:22hgbotCheckin
2017-06-21 17:22hgbotNote Added: 0097560
2017-06-21 17:22hgbotStatusscheduled => resolved
2017-06-21 17:22hgbotResolutionopen => fixed
2017-06-21 17:22hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/9dfc6be7748bec06136ed19e3c04b9cd23d02e5d [^]
2017-06-22 12:32SandrahuguetReview Assigned To => Sandrahuguet
2017-06-22 16:29gorka_gilNote Added: 0097590
2017-06-22 16:29gorka_gilStatusresolved => new
2017-06-22 16:29gorka_gilResolutionfixed => open
2017-06-22 16:43gorka_gilNote Added: 0097591
2017-06-28 10:42SandrahuguetReview Assigned ToSandrahuguet =>
2017-07-03 21:22hgbotCheckin
2017-07-03 21:22hgbotNote Added: 0097811
2017-07-03 21:22hgbotStatusnew => resolved
2017-07-03 21:22hgbotResolutionopen => fixed
2017-07-03 21:22hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/9dfc6be7748bec06136ed19e3c04b9cd23d02e5d [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8acd99aa5aadb65397bb525b79988bd6cbb29b99 [^]
2017-07-06 15:49hgbotCheckin
2017-07-06 15:49hgbotNote Added: 0097918
2017-07-10 15:39hgbotCheckin
2017-07-10 15:39hgbotNote Added: 0097980
2017-07-10 15:39hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8acd99aa5aadb65397bb525b79988bd6cbb29b99 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/26b89dcf502a32e389862264d038960c668bb149 [^]
2017-07-11 20:01hgbotCheckin
2017-07-11 20:01hgbotNote Added: 0098027
2017-08-08 11:59jorge-garciaReview Assigned To => jorge-garcia
2017-08-09 10:47jorge-garciaNote Added: 0098446
2017-08-09 10:47jorge-garciaStatusresolved => new
2017-08-09 10:47jorge-garciaResolutionfixed => open
2017-08-09 10:47jorge-garciaNote Edited: 0098446bug_revision_view_page.php?bugnote_id=0098446#r15630
2017-08-09 10:48jorge-garciaNote Edited: 0098446bug_revision_view_page.php?bugnote_id=0098446#r15631

Notes
(0097560)
hgbot   
2017-06-21 17:22   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 9dfc6be7748bec06136ed19e3c04b9cd23d02e5d
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Wed May 10 13:34:11 2017 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/9dfc6be7748bec06136ed19e3c04b9cd23d02e5d [^]

Fixed issue 33841: Free Products per Total Amount discount removes other
discounts

Removed the addition of a promotion with amt 0

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
---
(0097590)
gorka_gil   
2017-06-22 16:29   
Reopening because it is breaking these tests:
- SplitLineWithAutomaticPromoFreeProdScaledPriceAndManualPromo
- SplitLineWithPromoComboFamilyComboFreeProd

Not seen in try-retail because have a wait for this issue to be resolved:
@TestAnnotations(waitFixOf = 33841)
(0097591)
gorka_gil   
2017-06-22 16:43   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 47dd5621d628
Author: Gorka Gil <gorka.gil@openbravo.com>
Date: Thu Jun 22 16:37:34 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/47dd5621d628 [^]

Backed out changeset 9dfc6be7748b . Because break test: SplitLineWithAutomaticPromoFreeProdPerTotalAmt

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
---
(0097811)
hgbot   
2017-07-03 21:22   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 8acd99aa5aadb65397bb525b79988bd6cbb29b99
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Wed May 10 13:34:11 2017 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8acd99aa5aadb65397bb525b79988bd6cbb29b99 [^]

Fixed issue 33841: Free Products per Total Amount discount removes other
discounts

Removed the addition of a promotion with amt 0 and verify if discount was aplied
before

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
---
(0097918)
hgbot   
2017-07-06 15:49   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 715caf71759c37a5e5726e784c536d424a1488f2
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Thu Jul 06 09:19:56 2017 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/715caf71759c37a5e5726e784c536d424a1488f2 [^]

Related to issue 33841: Free Products per Total Amount discount removes other
discounts

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
---
(0097980)
hgbot   
2017-07-10 15:39   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 26b89dcf502a32e389862264d038960c668bb149
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Tue Jun 27 14:25:25 2017 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/26b89dcf502a32e389862264d038960c668bb149 [^]

Fixed issue 33841: Free Products per Total Amount discount removes other
discounts

- Not apply discount again if the order lines have changed
- Clear discountedUnits array after apply promotions finished

---
M web/org.openbravo.retail.posterminal/js/model/discounts.js
---
(0098027)
hgbot   
2017-07-11 20:01   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 4f3a4d425ed45de89f959b8c388abfe34ef72322
Author: Rafael Queralta Pozo <rqueralta <at> nauta.cu>
Date: Tue Jul 11 13:11:25 2017 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/4f3a4d425ed45de89f959b8c388abfe34ef72322 [^]

Related to issue 33841: Free Products per Total Amount discount removes other
discounts

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0098446)
jorge-garcia   
2017-08-09 10:47   
(edited on: 2017-08-09 10:48)
The patch is not correct for two reasons:

* It's not a good practice to add in posterminal a reference to a discount rule not included in the pack
  + OB.Model.Discounts.discountRules['4755A35B4DA34F6CB08F15462BA123CF'].discountedUnits = {};
    
* The hidden promotions are necessary to "reserve" the untis from other lines in promotions that could affect to more than one line (such as combos, twofamilies combo, by total, etc.)
http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8acd99aa5aadb65397bb525b79988bd6cbb29b99 [^]