Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035077Retail ModulesWeb POSpublic2017-01-19 09:342017-03-15 14:11
marvintm 
ranjith_qualiantech_com 
urgentmajoralways
closedfixed 
5
 
RR17Q1RR17Q1 
guilleaer
No
0035077: Discounts priority is not properly taken into account if incremental refresh updates the discount information
Discounts defined in the system should be applied following order of priority. When the Web POS is initially loaded, this works correctly. However, if incremental refresh later on updates some discounts, this may stop working properly.

The reason for this is that the query executed in the client-side doesn't contain an explicit order, which means that it implicitly uses the "_idx" property, automatically generated when records are loaded from the backend. The query in the backed does have proper order, so it works correctly on the first load.

However, if incremental refresh is triggered and it either adds new discounts, or updates previously existing discounts, their corresponding value for the idx column will reset to 0, and in this case, their effective priority will no longer be valid.
- Define two discounts over the same product, disc1 and disc2 (disc1 priority=20, disc2 priority=40). They should not have the "apply next discount" checked.
- Log in the Web POS. Add the product to the ticket. Notice that the disc1 is applied. Delete the ticket.
- Go to the backend. Change the disc2 name and save.
- Go back to the web pos, and refresh the page (F5).
- Add the same product again. Notice that now the disc2 is applied instead. This is wrong.
In the executor.js file, in the query executed for the Discounts, an orderby of priority and id should be added. Once this is done, the problem will no longer happen.
No tags attached.
blocks defect 0035006 closed ranjith_qualiantech_com Discounts priority is not properly taken into account if incremental refresh updates the discount information 
Issue History
2017-01-30 09:46marvintmTypedefect => backport
2017-01-30 09:46marvintmTarget Version => RR17Q1
2017-01-30 12:57hgbotCheckin
2017-01-30 12:57hgbotNote Added: 0093930
2017-01-30 12:57hgbotStatusscheduled => resolved
2017-01-30 12:57hgbotResolutionopen => fixed
2017-01-30 12:57hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c22376541cdcaed876f82bac2cb2faa2a87a08da [^] => http://code.openbravo.com/retail/backports/3.0RR17Q1/org.openbravo.retail.posterminal/rev/e4d2663673c31535c305556f157652706534358a [^]
2017-01-30 12:58hgbotCheckin
2017-01-30 12:58hgbotNote Added: 0093931
2017-02-02 11:31guilleaerReview Assigned To => guilleaer
2017-02-02 11:31guilleaerStatusresolved => closed
2017-02-02 11:31guilleaerFixed in Version => RR17Q1
2017-03-15 14:11hgbotCheckin
2017-03-15 14:11hgbotNote Added: 0095040

Notes
(0093930)
hgbot   
2017-01-30 12:57   
Repository: retail/backports/3.0RR17Q1/org.openbravo.retail.posterminal
Changeset: e4d2663673c31535c305556f157652706534358a
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jan 30 17:27:00 2017 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR17Q1/org.openbravo.retail.posterminal/rev/e4d2663673c31535c305556f157652706534358a [^]

Fixes issue 35077 : Adding orderClause for Discount

* default orderClause "_idx" is not stable when incremental refresh happens.
So for discount calcualtion, discount should be ordered by priority and idx

---
M web/org.openbravo.retail.posterminal/js/model/executor.js
---
(0093931)
hgbot   
2017-01-30 12:58   
Repository: retail/backports/3.0RR17Q1/pi-mobile
Changeset: e9dd08353b96729ad73cdcbe106eacd1d9ebd817
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jan 30 17:21:08 2017 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR17Q1/pi-mobile/rev/e9dd08353b96729ad73cdcbe106eacd1d9ebd817 [^]

Verifies issue 35077 : Added automated test 'I35077_VerifyDiscountPriorityOnUpdate'

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I35077_VerifyDiscountPriorityOnUpdate.java
---
(0095040)
hgbot   
2017-03-15 14:11   
Repository: tools/automation/pi-mobile
Changeset: e9dd08353b96729ad73cdcbe106eacd1d9ebd817
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jan 30 17:21:08 2017 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/e9dd08353b96729ad73cdcbe106eacd1d9ebd817 [^]

Verifies issue 35077 : Added automated test 'I35077_VerifyDiscountPriorityOnUpdate'

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/discountsandpromotions/I35077_VerifyDiscountPriorityOnUpdate.java
---