Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042649Retail ModulesDiscounts and Promotionspublic2019-12-26 05:082020-01-03 10:11
jorgewederago 
ranjith_qualiantech_com 
highmajoralways
closedfixed 
5
 
RR20Q2 
marvintm
No
0042649: User defined amount discounts may not work properly under certain circumstances
When a user defined amount discount was configured initially as user defined % and had a default value on it. If used on ticket that requires to reload the information from the discount the values are wrongly calculated.
Backend:
-Create a new discount as User Defined % and set 10 as default value
-Change the type of the discount to User Defined Amount


There are two ways to reproduce the issue:

Original issue:
-Add a product to the ticket and apply the discount with value 10
-Close the transaction as layaway
-Load the receipt and execute in the console OB.MobileApp.model.receipt.turnEditable()
-Add a new discount
-The previous discount value will be recalculated wrongly

How to reproduce it in PI:
-Add a product to the ticket and apply the discount with value 10
-Close the transaction as layaway
-Load the receipt
-Execute cancel and replace
-Add an extra unit of the product
-The discount will be recalculated wrongly
The issue is related to the following line in order.js

if (discount.get('obdiscPercentage')) {

Even if the discount type is one which does not need the value of obdiscPercentage since it is present in the discount saved in the local database it is used and thus the discount is wrongly set.

The proposed solution would be to add an extra check based on the discount type to avoid this behavior.
No tags attached.
related to defect 0042630 closed rqueralta Variable Percentage Discount per Total Amount uses hidden percentage discount as default percentage 
patch issue 42649 source discounts.patch (3,465) 2019-12-27 13:18
https://issues.openbravo.com/file_download.php?file_id=13737&type=bug
Issue History
2019-12-26 05:08jorgewederagoNew Issue
2019-12-26 05:08jorgewederagoAssigned To => Retail
2019-12-26 05:08jorgewederagoResolution time => 1579129200
2019-12-26 05:08jorgewederagoTriggers an Emergency Pack => No
2019-12-26 05:09jorgewederagoRelationship addedrelated to 0042630
2019-12-26 11:10ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2019-12-26 11:10ranjith_qualiantech_comStatusnew => scheduled
2019-12-27 13:18ranjith_qualiantech_comFile Added: issue 42649 source discounts.patch
2020-01-03 07:19hgbotCheckin
2020-01-03 07:19hgbotNote Added: 0116613
2020-01-03 07:19hgbotCheckin
2020-01-03 07:19hgbotNote Added: 0116614
2020-01-03 07:19hgbotStatusscheduled => resolved
2020-01-03 07:19hgbotResolutionopen => fixed
2020-01-03 07:19hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/1b526cc30575c0011c3f81ef5665f9e985b60c65 [^]
2020-01-03 10:11marvintmReview Assigned To => marvintm
2020-01-03 10:11marvintmStatusresolved => closed
2020-01-03 10:11marvintmFixed in Version => RR20Q2

Notes
(0116613)
hgbot   
2020-01-03 07:19   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 4d4c1b6672615aed5bf69cb5d18edd32526f8269
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Jan 03 11:48:46 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/4d4c1b6672615aed5bf69cb5d18edd32526f8269 [^]

Related to issue 42649 : Added DiscountType Validation when loading receipt

* When loading the receipt/layaway, promotion should be updated
  when DiscountType is related to percentage

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0116614)
hgbot   
2020-01-03 07:19   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: 1b526cc30575c0011c3f81ef5665f9e985b60c65
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Jan 03 11:49:07 2020 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/1b526cc30575c0011c3f81ef5665f9e985b60c65 [^]

Fixed issue 42649 : Updated MOffer EventHandler for Discount Amount and Percentage

---
M src/org/openbravo/retail/discounts/event/MOfferEventHandler.java
---