Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035006Retail ModulesWeb POSpublic2017-01-19 09:342017-01-30 09:46
marvintm 
ranjith_qualiantech_com 
urgentmajoralways
closedfixed 
5
 
RR17Q2 
marvintm
No
0035006: 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.
depends on backport 0035077RR17Q1 closed ranjith_qualiantech_com Discounts priority is not properly taken into account if incremental refresh updates the discount information 
depends on backport 0035078RR16Q4.2 closed ranjith_qualiantech_com Discounts priority is not properly taken into account if incremental refresh updates the discount information 
Issue History
2017-01-19 09:34marvintmNew Issue
2017-01-19 09:34marvintmAssigned To => Retail
2017-01-19 09:34marvintmTriggers an Emergency Pack => No
2017-01-20 09:51ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2017-01-20 09:51ranjith_qualiantech_comStatusnew => scheduled
2017-01-23 14:29hgbotCheckin
2017-01-23 14:29hgbotNote Added: 0093782
2017-01-23 14:29hgbotStatusscheduled => resolved
2017-01-23 14:29hgbotResolutionopen => fixed
2017-01-23 14:29hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c22376541cdcaed876f82bac2cb2faa2a87a08da [^]
2017-01-28 19:08hgbotCheckin
2017-01-28 19:08hgbotNote Added: 0093904
2017-01-30 09:45marvintmStatusresolved => new
2017-01-30 09:45marvintmResolutionfixed => open
2017-01-30 09:46marvintmStatusnew => scheduled
2017-01-30 09:46marvintmStatusscheduled => resolved
2017-01-30 09:46marvintmFixed in Version => RR17Q2
2017-01-30 09:46marvintmResolutionopen => fixed
2017-01-30 09:46marvintmReview Assigned To => marvintm
2017-01-30 09:46marvintmStatusresolved => closed

Notes
(0093782)
hgbot   
2017-01-23 14:29   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: c22376541cdcaed876f82bac2cb2faa2a87a08da
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jan 23 18:58:39 2017 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c22376541cdcaed876f82bac2cb2faa2a87a08da [^]

Fixes issue 35006 : 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
---
(0093904)
hgbot   
2017-01-28 19:08   
Repository: tools/automation/pi-mobile
Changeset: 1c995b9f90f38d4f28b64b15d807bbb52f023040
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Sat Jan 28 23:38:14 2017 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/1c995b9f90f38d4f28b64b15d807bbb52f023040 [^]

Verifies issue 35006 : Added automated test 'I35006_VerifyDiscountPriorityOnUpdate'

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