Openbravo Issue Tracking System - Retail Modules
View Issue Details
0038825Retail ModulesWeb POSpublic2018-06-25 13:272018-06-27 08:59
aaroncalero 
jorge-garcia 
highcriticalalways
closedfixed 
5
 
RR18Q3 
marvintm
Pre packaging ( pi )
2018-05-18
pi
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/69f7c826e004 [^]
No
0038825: Order not saved in WebSQL if the customer is changed while the first product is being added.
When we have a new order in web pos (without an id) and the first action is adding a product, if this process to add a product is slow and, before it is finished, the customer of the ticket is changed, the order is never saved in WebSQL.
When this happens, the WebPOS will continue to work with the receipt object stored in memory, but if the application is refreshed (F5) or the ticket is completed, since there is no WebSQL information for the ticket, it is forever lost.
Login in Web POS
Open developer tools/browser console and execute the following code:

OB.UTIL.HookManager.registerHook('OBPOS_PreCheckDiscount', function(a,b){
setTimeout(function(){
  OB.UTIL.HookManager.callbackExecutor(a,b);
}, 7000);
});
This will delay the execution of the calculateReceipt function for 7 seconds for testing purposes.

Create a new ticket
Add a product
Before the process has finished, change the customer of the receipt.
After the calculateReceipt has finished and the webpos is fully usable again, verify in devtools that the following error is shown:

[checkBlocked][no-transaction] No result after getInTransaction for [A113684D86C8CE63428A4BAFA0B0D3A1][VBS1/0000108]. This update doesnt make sense - Caller: G.d.save (https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:27693:16 [^]) - callerInfo:
Object.OB.Dal.save (https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:5440:22 [^]);
G.d.save (https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:27693:16 [^]);
saveAndTriggerEvents (https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:27897:16 [^]);
https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:27937:11; [^]
https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:43118:9; [^] line: https://livebuilds.openbravo.com/retail_pi_pgsql/web/js/gen/11b2a41537f5f5d36ddd165e9ed3dfa3.js:5716:18 [^] (*,+)

Finally verify that the c_order table in WebSQL is empty
Move the checking of this.pendingCalculateReceipt (and also OB.MobileApp.model.get('preventOrderSave') as potentially it can provoke the same error) to a few lines earlier, so that the if wraps also the generation of the id in case it doesn't exist.
No tags attached.
caused by defect 0038573 closed asiermartirena The save action of the ticket is being executed more times that should 
? issue_38825.export (3,225) 2018-06-25 16:35
https://issues.openbravo.com/file_download.php?file_id=11896&type=bug
Issue History
2018-06-25 13:27aaroncaleroNew Issue
2018-06-25 13:27aaroncaleroAssigned To => Retail
2018-06-25 13:27aaroncaleroResolution time => 1499551200
2018-06-25 13:27aaroncaleroTriggers an Emergency Pack => No
2018-06-25 15:35aaroncaleroRegression level => Pre packaging ( pi )
2018-06-25 15:35aaroncaleroRegression date => 2018-05-18
2018-06-25 15:35aaroncaleroRegression introduced in release => pi
2018-06-25 15:35aaroncaleroRegression introduced by commit => https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/69f7c826e004 [^]
2018-06-25 15:36aaroncaleroRelationship addedcaused by 0038573
2018-06-25 15:38aaroncaleroProposed Solution updated
2018-06-25 16:35asiermartirenaFile Added: issue_38825.export
2018-06-25 17:40jorge-garciaStatusnew => scheduled
2018-06-25 17:40jorge-garciaAssigned ToRetail => jorge-garcia
2018-06-26 08:26hgbotCheckin
2018-06-26 08:26hgbotNote Added: 0105377
2018-06-26 08:26hgbotStatusscheduled => resolved
2018-06-26 08:26hgbotResolutionopen => fixed
2018-06-26 08:26hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/50cea6ba09ebc4b135a52aa89224fc28abcbd8e7 [^]
2018-06-27 08:59marvintmReview Assigned To => marvintm
2018-06-27 08:59marvintmStatusresolved => closed
2018-06-27 08:59marvintmFixed in Version => RR18Q3

Notes
(0105377)
hgbot   
2018-06-26 08:26   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 50cea6ba09ebc4b135a52aa89224fc28abcbd8e7
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Tue Jun 26 08:26:36 2018 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/50cea6ba09ebc4b135a52aa89224fc28abcbd8e7 [^]

Fixed issue 38825: Ensure that an order is going to be saved before setting the id

In Web POS, when doing a save action, if the order doesn't have an ID, the ID is
generated and then the order is saved. But there can be the situation in which
the ID is set and the order is not saved, so that order won't be saved again.

Now, before setting the ID, it is verified that the order will be saved.

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