Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035078Retail ModulesWeb POSpublic2017-01-19 09:342017-03-03 14:31
marvintm 
ranjith_qualiantech_com 
urgentmajoralways
closedfixed 
5
 
RR16Q4.2RR16Q4.2 
marvintm
No
0035078: 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 => RR16Q4.2
2017-01-30 13:32hgbotCheckin
2017-01-30 13:32hgbotNote Added: 0093933
2017-01-30 13:32hgbotStatusscheduled => resolved
2017-01-30 13:32hgbotResolutionopen => fixed
2017-01-30 13:32hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/c22376541cdcaed876f82bac2cb2faa2a87a08da [^] => http://code.openbravo.com/retail/backports/3.0RR16Q4.2/org.openbravo.retail.posterminal/rev/733e52f859deb95d899d05221af7bdbd4eed5df1 [^]
2017-01-30 13:33hgbotCheckin
2017-01-30 13:33hgbotNote Added: 0093934
2017-03-03 14:31marvintmReview Assigned To => marvintm
2017-03-03 14:31marvintmStatusresolved => closed
2017-03-03 14:31marvintmFixed in Version => RR16Q4.2

Notes
(0093933)
hgbot   
2017-01-30 13:32   
Repository: retail/backports/3.0RR16Q4.2/org.openbravo.retail.posterminal
Changeset: 733e52f859deb95d899d05221af7bdbd4eed5df1
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jan 30 18:00:07 2017 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR16Q4.2/org.openbravo.retail.posterminal/rev/733e52f859deb95d899d05221af7bdbd4eed5df1 [^]

Fixes issue 35078 : 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
---
(0093934)
hgbot   
2017-01-30 13:33   
Repository: retail/backports/3.0RR16Q4.2/pi-mobile
Changeset: 2ea555835cac3bbd4436537cbbec2d7f45ad6368
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Jan 30 18:00:10 2017 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR16Q4.2/pi-mobile/rev/2ea555835cac3bbd4436537cbbec2d7f45ad6368 [^]

Verifies issue 35078 : Added automated test 'I35078_VerifyDiscountPriorityOnUpdate'

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