Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042630Retail ModulesDiscounts by Totalpublic2019-12-23 14:112020-01-17 13:54
gorkaion 
rqueralta 
highmajoralways
closedfixed 
5
 
RR20Q2 
marvintm
No
0042630: Variable Percentage Discount per Total Amount uses hidden percentage discount as default percentage
On Variable Percentage Discount per Total Amount promotions.

It is possible to apply them without setting any percentage value if the Percentage Discount field is set. This field is hidden for this type of discounts so it should not use its value as default percentage.

When Discounts category for WebPOS module is installed the logic to get the default value is different and it only checks the Percentage column for a default value.
On a environment with:
- byTotal discount installed
- Discounts category for WebPOS NOT installed.
On the POS we must have a drop down instead of a popup to select the discount.

Unfortunately all environments in livebuilds with bytotal module installed has also the Discounts category module installed so it is not possible to reproduce the issue.


1. Login in backend
2. Set preference "Web POS action Advanced Discounts" with value N to enable previous discount engine.
3. Create a new Discount and Promotion.
4. Select User defined Discount and set a value of 1 in Percentage Discount field.
5. Change type to Variable Percentage Discount per Total Amount and complete the definition leaving the discount field empty.
6. On the grid check that the new promotion has the Percentage column empty and the Percentage Discount column with 1.
7. Go to the POS
8. Add a product
9. Open the discount and select the created one.
10. Try to apply it not setting any percentage.
11. It applies the discount with 1% discount.

Expected behavior is a error warning the user to enter a percentage as it should not use the Percentage Discount column as default value.
With the Discounts category for WebPOS and the popup this logic is fixed and the expected message is shown. This expected behavior can be checked in livebuilds using the retail modules environment.
No tags attached.
related to defect 0042062 closed rqueralta Different applied and shown percentage on previous discount engine. 
related to defect 0042649 closed ranjith_qualiantech_com User defined amount discounts may not work properly under certain circumstances 
related to defect 0044404 closed ranjith_qualiantech_com Crash when we try to use a promotion with a particular promotion Type 
causes defect 0043635 closed ranjith_qualiantech_com The Variable Discounts per Total do not work if amount/percentage is not defined. 
Issue History
2019-12-23 14:11gorkaionNew Issue
2019-12-23 14:11gorkaionAssigned To => Retail
2019-12-23 14:11gorkaionResolution time => 1578870000
2019-12-23 14:11gorkaionTriggers an Emergency Pack => No
2019-12-23 14:11gorkaionIssue generated from0042062
2019-12-23 14:11gorkaionRelationship addedrelated to 0042062
2019-12-23 14:55rqueraltaAssigned ToRetail => rqueralta
2019-12-26 05:09jorgewederagoRelationship addedrelated to 0042649
2020-01-03 17:59hgbotCheckin
2020-01-03 17:59hgbotNote Added: 0116635
2020-01-03 17:59hgbotStatusnew => resolved
2020-01-03 17:59hgbotResolutionopen => fixed
2020-01-03 17:59hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/85bf2b6ad07976c2ab375bf762ee9b36db53cb2a [^]
2020-01-03 17:59hgbotCheckin
2020-01-03 17:59hgbotNote Added: 0116636
2020-01-03 17:59hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/85bf2b6ad07976c2ab375bf762ee9b36db53cb2a [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/07f46ffd4cc19880c156db43666fe51078495aa7 [^]
2020-01-04 06:34hgbotCheckin
2020-01-04 06:34hgbotNote Added: 0116641
2020-01-04 15:56hgbotCheckin
2020-01-04 15:56hgbotNote Added: 0116642
2020-01-17 13:54marvintmReview Assigned To => marvintm
2020-01-17 13:54marvintmStatusresolved => closed
2020-01-17 13:54marvintmFixed in Version => RR20Q2
2020-04-07 08:50ranjith_qualiantech_comRelationship addedcauses 0043635
2020-07-10 12:04ranjith_qualiantech_comRelationship addedrelated to 0044404

Notes
(0116635)
hgbot   
2020-01-03 17:59   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 85bf2b6ad07976c2ab375bf762ee9b36db53cb2a
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Wed Dec 25 16:28:32 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/85bf2b6ad07976c2ab375bf762ee9b36db53cb2a [^]

Fixed issue 42630: Variable Percentage Discount per Total Amount uses hidden
percentage discount as default percentage

- In old discount engine check for the discount of the rule first, not only uses
hidden percentage discount

---
M web/org.openbravo.retail.discounts.bytotal/js/discountsengine/common/rules/by-total-percentage-discount.js
M web/org.openbravo.retail.discounts.bytotal/js/preApplyDiscountsHook.js
---
(0116636)
hgbot   
2020-01-03 17:59   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 07f46ffd4cc19880c156db43666fe51078495aa7
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Thu Dec 26 14:06:05 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/07f46ffd4cc19880c156db43666fe51078495aa7 [^]

Fixed issue 42630: Variable Percentage Discount per Total Amount uses hidden
percentage discount as default percentage

- In old discount engine check for the discount of the rule first, not only uses
hidden percentage discount

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/ticketdiscount.js
---
(0116641)
hgbot   
2020-01-04 06:34   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: fd8fd370b2b4eb6a4f7c8c41ce2ed8d1b0d9c8ce
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Sat Jan 04 00:33:27 2020 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/fd8fd370b2b4eb6a4f7c8c41ce2ed8d1b0d9c8ce [^]

Related to issue 42630: Variable Percentage Discount per Total Amount uses hidden
percentage discount as default percentage

- Verified the discount type for promotion to apply to take into account the
right property

---
M web/org.openbravo.retail.discounts.bytotal/js/preApplyDiscountsHook.js
---
(0116642)
hgbot   
2020-01-04 15:56   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 9d6a4913869092692f87e1e4be553496ce535112
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Sat Jan 04 09:56:22 2020 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/9d6a4913869092692f87e1e4be553496ce535112 [^]

Related to issue 42630: Variable Percentage Discount per Total Amount uses hidden
percentage discount as default percentage

- Verified a new property

---
M web/org.openbravo.retail.discounts.bytotal/js/preApplyDiscountsHook.js
---