Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035703Retail ModulesWeb POSpublic2017-04-05 15:462017-04-27 11:48
aaroncalero 
migueldejuana 
highmajorrandom
closedfixed 
5
 
RR17Q3 
guilleaer
No
0035703: It is possible to count the same ticket twice on the same paymentmethodcashup
When a ticket is closed in web pos (i.e. by clicking on Done) several sql queries are executed on the local database before finally sending the ticket to the backend (cashup update, document number update, the final save of the receipt object).
These queries must be executed inside a single sql transaction, in order to ensure that, if anything goes wrong or the user refreshes the application during the process, everything is rolled back and the pos remains as if the Done button was never pressed.
However the function which is in charge of updating the cashup report is placed outside the sql transaction, which means that a well timed refresh can leave inconsistent data (the cashup will be updated but the ticket will remain still on the screen).
Login in web pos and perform a cashup keeping nothing.
Verify using the Cash Up Partial window that all expected amounts are 0.
Open the browser console and set a breakpoint exactly after the cashup has been updated after closing a ticket:
  -locate the mainReceiptCloseFunction
  -inside that function, find the call to OB.UTIL.cashUpReport
  -place the breakpoint on the first line of its callback
Create a new ticket, add a product, click on the total amount button and then finish the ticket by clicking on Done.
Once the execution stops on the breakpoint, refresh the page.
After reloading the page, open the Cashu Up partial window again and verify that the expected amount is no longer 0.
The solution for this issue is to "swap" the calls to OB.UTIL.cashUpReport and OB.Dal.transaction, so the cashup report is updated inside the same sql transaction.
No tags attached.
related to defect 0035745 closed ranjith_qualiantech_com Add a transaction where it is needed 
Issue History
2017-04-05 15:46aaroncaleroNew Issue
2017-04-05 15:46aaroncaleroAssigned To => Retail
2017-04-05 15:46aaroncaleroResolution time => 1492552800
2017-04-05 15:46aaroncaleroTriggers an Emergency Pack => No
2017-04-10 17:14migueldejuanaRelationship addedrelated to 0035745
2017-04-10 17:46migueldejuanaAssigned ToRetail => migueldejuana
2017-04-10 17:46migueldejuanaStatusnew => acknowledged
2017-04-10 17:47migueldejuanaStatusacknowledged => scheduled
2017-04-11 09:18hgbotCheckin
2017-04-11 09:18hgbotNote Added: 0095962
2017-04-11 09:18hgbotStatusscheduled => resolved
2017-04-11 09:18hgbotResolutionopen => fixed
2017-04-11 09:18hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/75bef8ae5e995bfe303d0c7a9f6277c607088528 [^]
2017-04-27 11:48guilleaerReview Assigned To => guilleaer
2017-04-27 11:48guilleaerStatusresolved => closed
2017-04-27 11:48guilleaerFixed in Version => RR17Q3

Notes
(0095962)
hgbot   
2017-04-11 09:18   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 75bef8ae5e995bfe303d0c7a9f6277c607088528
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Mon Apr 10 17:41:42 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/75bef8ae5e995bfe303d0c7a9f6277c607088528 [^]

Fixed issue 0035703: It is possible to count the same ticket twice on the same paymentmethodcashup

- The change is just few lines. Put OB.UTIL.cashuReport call inside the transaction to be able to do rollback of cashupinfo

---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
---