Openbravo Issue Tracking System - Retail Modules
View Issue Details
0051763Retail ModulesWeb POSpublic2023-03-02 16:442023-03-29 09:49
Benjamin Molin 
ranjith_qualiantech_com 
normalmajoralways
closedfixed 
30Openbravo Appliance 14.04
pi 
RR23Q2 
No
0051763: Problem with SVAP adjust price when you put a modification price reason
When discounting (price modification reason) 1 product with at least 2 products on the ticket, SVAP does not adjust the price for the modified product.
The addition is of these 2 back office preferences to enable SVAP:

Web POS Sales Loss Approval.
Configure it as follows:
Customer: White Valley Group
Organization: Vall Blanca Store
Property: Approval of lost sales on the Web POS
Value: Y

In the Visibility section
Visible in the client: The White Valley Group
Visible in the role: VallBlancaUser

Register


Web POS Enable sales at a loss
Configure it as follows:
Client: White Valley Group
Organization: Vall Blanca store
Property: Losses due to Web POS activation
Value: Y

In the Visibility section
Visible to the client: The White Valley Group
Visible to the Organization: Vall Blanca Store

Save

Window Price modification reason, activate or add 1 modification reason and check the box verifi price limit

Web POS:

add a product with a price limit set its price to 10 euros
add another product
press payment
press Adjust
the product with the modified price does not have its price to change.
We found this error on Weldom and we found this solution.

Please let me know if I can offer this solution to Weldom.

The error is reproducible on the livebuild.

Code:
 OB.UTIL.LossSaleUtils.adjustPriceOnLossSaleLines = function(lossSaleLines) {
    var order = OB.MobileApp.model.receipt;
    lossSaleLines.forEach(function(lossSaleLine) {
      var line = order
          .get('lines')
          .models.find(l => l.get('id') === lossSaleLine.lineId),
        discountedPrice = line.get('discountedPrice'),
        productPriceLimit = line.get('product').get('priceLimit');
      if (line.get('promotions') && line.get('promotions').length) {
        line.get('promotions').forEach(function(p) {
          if (discountedPrice < productPriceLimit) {
            var promoAmtDiffToLimit = OB.Discounts.discountRules[p.discountType]
              .isPriceAdjustmentByProduct
              ? OB.DEC.sub(productPriceLimit, discountedPrice) * line.get('qty')
              : Math.min(
                  p.actualAmt,
                  OB.DEC.sub(productPriceLimit, discountedPrice) *
                    line.get('qty')
                );

            p.amt = p.fullAmt = p.actualAmt = p.displayedTotalAmount = OB.DEC.sub(
              p.actualAmt,
              promoAmtDiffToLimit
            );
            p.identifier =
              p.name +
              ' - ' +
              (p.manual
                ? OB.I18N.getLabel('OBPOS_LblSVAP')
                : OB.I18N.getLabel('OBPOS_LblLimitPrice'));
            discountedPrice += promoAmtDiffToLimit;
          }
        });
      } else {
        order.setPrices([line], productPriceLimit);
      }
      order.calculateGross();
    });
  };
No tags attached.
related to defect 0051761pi closed ranjith_qualiantech_com Problem with SVAP adjust price 
related to defect 0052111 closed ranjith_qualiantech_com Problem with SVAP adjust price with price Modification & Discount 
Issue History
2023-03-02 16:44Benjamin MolinNew Issue
2023-03-02 16:44Benjamin MolinAssigned To => Retail
2023-03-02 16:44Benjamin MolinTriggers an Emergency Pack => No
2023-03-03 09:57Benjamin MolinSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=25630#r25630
2023-03-08 10:00egoitzSeverityminor => major
2023-03-15 13:00ngarciaProjectPOS2 => Retail Modules
2023-03-15 13:00ngarciaCategoryPOS => Web POS
2023-03-16 13:34ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2023-03-16 13:34ranjith_qualiantech_comStatusnew => scheduled
2023-03-20 05:58hgbotNote Added: 0147674
2023-03-28 16:56hgbotNote Added: 0148033
2023-03-28 16:56hgbotResolutionopen => fixed
2023-03-28 16:56hgbotStatusscheduled => closed
2023-03-28 16:56hgbotFixed in Version => RR23Q2
2023-03-28 16:56hgbotNote Added: 0148034
2023-03-29 09:49ranjith_qualiantech_comRelationship addedrelated to 0051761
2023-04-12 17:47ranjith_qualiantech_comRelationship addedrelated to 0052111

Notes
(0147674)
hgbot   
2023-03-20 05:58   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1106 [^]
(0148033)
hgbot   
2023-03-28 16:56   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1106 [^]
(0148034)
hgbot   
2023-03-28 16:56   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: f054115f7e68bf38cff9b6c53ac97431f3172a64
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 28-03-2023 16:34:52
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/f054115f7e68bf38cff9b6c53ac97431f3172a64 [^]

Fixed ISSUE-51763: Price should be updated when adjusting during sales loss
* Sales Loss should be validated for the discount with price limit is enabled
* When receipt line has price modification, then line price should be updated
  when adjusting during sales loss validation

---
M web/org.openbravo.retail.posterminal/js/components/modalPriceModification.js
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/toolbar-left.js
M web/org.openbravo.retail.posterminal/js/utils/lossSalesUtils.js
---