Openbravo Issue Tracking System - Retail Modules
View Issue Details
0030498Retail ModulesDiscounts and Promotionspublic2015-08-04 13:412015-11-06 11:09
malsasua 
jorge-garcia 
highmajoralways
closedfixed 
20Community Appliance
 
RR15Q4 
marvintm
No
0030498: infinite loop with discounts of type "Buy X pay Y of different product"
when there are several discounts of type "Buy X pay Y of different product", and several products are added to receipt, then the total button never is enabled. Infinite loop in discount executor

note: with old flow discount is working fine
. in back office:
 . go to discount and promotions window
 . create three new discounts:
  disc1: see disc1 attached
  disc2: see disc2 attached
  disc3: see disc3 attached

. in web pos
 . create a new receipt (see receipt.png attached). Add the products quickly

total button never is enabled
No tags attached.
depends on backport 0031390RR15Q3.3 closed jorge-garcia infinite loop with discounts of type "Buy X pay Y of different product" 
related to defect 0029522 closed jorge-garcia [RR15Q3 & RR15Q2.4] Adding products fast enough makes product discount disappear 
causes design defect 0030942RR15Q4 closed Orekaria Events are being fired when the applyDiscounts tries to prevent infinite loop 
causes defect 0030904 closed jorge-garcia Taxes and total not updated when a line is removed with the old discount flow 
png disc1.png (146,315) 2015-08-04 13:41
https://issues.openbravo.com/file_download.php?file_id=8339&type=bug
png

png dis2.png (139,264) 2015-08-04 13:41
https://issues.openbravo.com/file_download.php?file_id=8340&type=bug
png

png disc3.png (138,981) 2015-08-04 13:41
https://issues.openbravo.com/file_download.php?file_id=8341&type=bug
png

png receipt.png (315,849) 2015-08-04 13:42
https://issues.openbravo.com/file_download.php?file_id=8342&type=bug
Issue History
2015-08-04 13:41malsasuaNew Issue
2015-08-04 13:41malsasuaAssigned To => Retail
2015-08-04 13:41malsasuaFile Added: disc1.png
2015-08-04 13:41malsasuaResolution time => 1441231200
2015-08-04 13:41malsasuaTriggers an Emergency Pack => No
2015-08-04 13:41malsasuaFile Added: dis2.png
2015-08-04 13:41malsasuaFile Added: disc3.png
2015-08-04 13:42malsasuaFile Added: receipt.png
2015-08-13 18:05ddeyrisIssue Monitored: ddeyris
2015-08-21 09:28jorge-garciaAssigned ToRetail => jorge-garcia
2015-08-21 14:09egoitzIssue Monitored: egoitz
2015-09-01 15:24jorge-garciaStatusnew => scheduled
2015-09-04 13:28hgbotCheckin
2015-09-04 13:28hgbotNote Added: 0080116
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.posterminal/rev/92e150fb18152d7831b7cfbe74329e5582a0eaf9 [^]
2015-09-07 11:46marvintmReview Assigned To => marvintm
2015-09-07 11:46marvintmStatusresolved => closed
2015-09-07 11:46marvintmFixed in Version => RR15Q4
2015-09-26 22:30OrekariaRelationship addedcauses 0030942
2015-09-29 13:12OrekariaRelationship addedcauses 0030904
2015-11-06 10:11jorge-garciaRelationship addedrelated to 0029522
2015-11-06 11:01jorge-garciaStatusclosed => new
2015-11-06 11:01jorge-garciaResolutionfixed => open
2015-11-06 11:01jorge-garciaFixed in VersionRR15Q4 =>
2015-11-06 11:01jorge-garciaStatusnew => scheduled
2015-11-06 11:02jorge-garciaStatusscheduled => resolved
2015-11-06 11:02jorge-garciaResolutionopen => fixed
2015-11-06 11:02jorge-garciaStatusresolved => closed
2015-11-06 11:09jorge-garciaFixed in Version => RR15Q4

Notes
(0080116)
hgbot   
2015-09-04 13:28   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 92e150fb18152d7831b7cfbe74329e5582a0eaf9
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Fri Aug 28 08:36:38 2015 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/92e150fb18152d7831b7cfbe74329e5582a0eaf9 [^]

Fixed issue 30498: infinite loop with discounts of type "Buy X pay Y of
different product"

It's necessary to set two flags in the applyDiscounts process.
“IsBeingDiscounted” indicates that the process is running. The second,
“reApplyDiscounts” is set to true if the applyDiscounts process is called more
than once, applying the discounts only one more time.

This way, the process doesn't do an infinite loop calculating discounts.

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