Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042237Retail ModulesWeb POSpublic2019-11-08 13:292019-11-28 19:00
ngarcia 
rqueralta 
urgentmajoralways
closedfixed 
5
 
RR20Q1 
marvintm
No
0042237: Discount value is not recalculated when opening a layaway with a price modification and editing it (not standard)
Discount value is not recalculated when opening a layaway with a price modification and editing it (not standard).

The discountPercentage is recalculated in adjustPrices function if the following condition is fulfilled:

          (line.get('product').get('standardPrice') &&
            line.get('product').get('standardPrice') !== price) ||
          (_.isNumber(line.get('discountedLinePrice')) &&
            line.get('discountedLinePrice') !==
              line.get('product').get('standardPrice'))
        )

When loading an editable layaway (customization), the standardPrice and the price are equals and discountLinePrice is undefined, so discountPercentage is not recalculated.

discountLinePrice is not calculated when loading an editable layaway
In the POS:
   Create a receipt
   Layaway this receipt
   Add a Adhesive body warmers product
   Reduce its price to 2
   Layaway

In the backoffice:
   Check the Gross Unit Price and Gross List price are different and the Discount is different from 0 (44.44%). This is correct

   Open Receipt
   Select previously created layaway
 
Note: layaways cannot be edited so we should force it to be editable. Moreover, the discountLinePrice is calculated only for not editable receipts when they are loaded, so we should force it was editable before loading

Open Developers' tools and do the following instruction

OB.MobileApp.model.receipt.turnEditable()
OB.MobileApp.model.receipt.attributes.lines.models[0].attributes.discountedLinePrice = undefined

In the POS:
   Change the price of the line to the original one (3.60)
   Pay it

In the backoffice:
   Check the Gross Unit Price and Gross List are equal and the Discount didn't change. It should have been recalculated
No tags attached.
related to defect 0041582 closed rqueralta Wrong discount information in JSON if a layaway includes a discount and the price in the backoffice is changed before paying it 
Issue History
2019-11-08 13:29ngarciaNew Issue
2019-11-08 13:29ngarciaAssigned To => Retail
2019-11-08 13:29ngarciaResolution time => 1574982000
2019-11-08 13:29ngarciaTriggers an Emergency Pack => No
2019-11-08 13:29ngarciaIssue Monitored: networkb
2019-11-08 13:37ngarciaRelationship addedrelated to 0041582
2019-11-13 22:08rqueraltaAssigned ToRetail => rqueralta
2019-11-13 22:08rqueraltaStatusnew => scheduled
2019-11-21 09:56ngarciaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=19747#r19747
2019-11-23 14:35hgbotCheckin
2019-11-23 14:35hgbotNote Added: 0115781
2019-11-23 14:35hgbotStatusscheduled => resolved
2019-11-23 14:35hgbotResolutionopen => fixed
2019-11-23 14:35hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/109ef7129404f8b17104c2b65b9b473ea0cd4ca7 [^]
2019-11-28 19:00marvintmReview Assigned To => marvintm
2019-11-28 19:00marvintmStatusresolved => closed
2019-11-28 19:00marvintmFixed in Version => RR20Q1

Notes
(0115781)
hgbot   
2019-11-23 14:35   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 109ef7129404f8b17104c2b65b9b473ea0cd4ca7
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Thu Nov 21 10:26:53 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/109ef7129404f8b17104c2b65b9b473ea0cd4ca7 [^]

Fixed issue 42237: Discount value is not recalculated when opening a layaway
with a price modification and editing it (not standard)

- If dicountedLinePrice is undefined and grossListPrice is different to
grossUnitPrice of the line recalculate the discount is requiered

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