Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042913Retail ModulesDiscounts and Promotionspublic2020-01-16 15:492020-01-24 15:00
malsasua 
rqueralta 
normalmajoralways
closedfixed 
5
 
RR20Q2 
marvintm
No
0042913: Performance problem with discounts
in function removePromotion, a save action is done, but it is not required, and this save action is affecting to performance
check removePromotion code:
 removePromotion: function(line, rule) {
            var promotions = line.get('promotions'), ruleId = rule.id, discountinstance = rule.discountinstance, removed = false, res = [], i;
            if (!promotions) {
                return;
            }
            for (i = 0; i < promotions.length; i++) {
                if (promotions[i].ruleId === rule.id && promotions[i].discountinstance === discountinstance) {
                    removed = true;
                } else {
                    res.push(promotions[i]);
                }
            }
            if (removed) {
                line.set('promotions', res);
                this.calculateDiscountedLinePrice(line);
                line.trigger('change');
                this.save();
            }

the line this.save() is not required
No tags attached.
Issue History
2020-01-16 15:49malsasuaNew Issue
2020-01-16 15:49malsasuaAssigned To => Retail
2020-01-16 15:49malsasuaResolution time => 1581030000
2020-01-16 15:49malsasuaTriggers an Emergency Pack => No
2020-01-22 02:45rqueraltaAssigned ToRetail => rqueralta
2020-01-22 02:45rqueraltaStatusnew => scheduled
2020-01-24 13:35hgbotCheckin
2020-01-24 13:35hgbotNote Added: 0117236
2020-01-24 13:35hgbotStatusscheduled => resolved
2020-01-24 13:35hgbotResolutionopen => fixed
2020-01-24 13:35hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/3296a0251a2fe820d4ff63c843f361f38e9ab611 [^]
2020-01-24 15:00marvintmReview Assigned To => marvintm
2020-01-24 15:00marvintmStatusresolved => closed
2020-01-24 15:00marvintmFixed in Version => RR20Q2

Notes
(0117236)
hgbot   
2020-01-24 13:35   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 3296a0251a2fe820d4ff63c843f361f38e9ab611
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Wed Jan 22 06:54:24 2020 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/3296a0251a2fe820d4ff63c843f361f38e9ab611 [^]

Fixed issue 42913: Performance problem with discounts

- Removed save action to improve the performance

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