Openbravo Issue Tracking System - Retail Modules |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0034968 | Retail Modules | Web POS | public | 2017-01-16 16:45 | 2017-02-10 13:03 |
|
Reporter | aaroncalero | |
Assigned To | mario_castello | |
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | RR17Q2 | |
Merge Request Status | |
Review Assigned To | marvintm |
OBNetwork customer | OBPS |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0034968: Using pay open tickets option might end up with non synchronized receipts |
Description | If there is any asynchronous implementation of the OBPOS_PreOrderSave hook, paying two tickets with the Pay Open Ticket option will result in one of the tickets synchronized to the backend, and the other ticket pending in web pos, although apparently removed (it is visible after refreshing the pos). |
Steps To Reproduce | Verify that the Web POS Synchronized Mode is not active.
Login in web pos
Using the browser console, add the following hook:
OB.UTIL.HookManager.registerHook('OBPOS_PreOrderSave', function (args, callback) {
setTimeout(function(){
OB.UTIL.HookManager.callbackExecutor(args, callback);
}, 0)
});
Create a new ticket and add a product. Do not pay it.
Create a second ticket and add a product.
Open the menu and click on the pay open tickets option.
Search and select both of the tickets created.
Click on Done.
Pay the multiorder.
Go to the backend and verify that only one of the receipts is there.
Refresh the pos and verify that the missing ticket is still there. |
Proposed Solution | The code which closes all the receipts that are part of a multiorder is the following:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/19f6ed6b5883/web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-model.js#l586 [^]
This code triggers the close event and immediately calls another function, which eventually adds an empty new ticket.
Adding that extra asynchrony with the hook causes the addNewOrder function to modify one of the current receipts, changing the hasbeenpaid value to N and preventing the synchronization. |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2017-01-16 16:45 | aaroncalero | New Issue | |
2017-01-16 16:45 | aaroncalero | Assigned To | => Retail |
2017-01-16 16:45 | aaroncalero | OBNetwork customer | => Yes |
2017-01-16 16:45 | aaroncalero | Resolution time | => 1485730800 |
2017-01-16 16:45 | aaroncalero | Triggers an Emergency Pack | => No |
2017-01-17 15:10 | mario_castello | Assigned To | Retail => mario_castello |
2017-01-17 15:11 | mario_castello | Status | new => acknowledged |
2017-01-17 15:11 | mario_castello | Status | acknowledged => scheduled |
2017-01-26 15:38 | hgbot | Checkin | |
2017-01-26 15:38 | hgbot | Note Added: 0093843 | |
2017-01-26 15:38 | hgbot | Status | scheduled => resolved |
2017-01-26 15:38 | hgbot | Resolution | open => fixed |
2017-01-26 15:38 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/7f1ed45fd2517cfda1a1fe2d7534f724e4b183be [^] |
2017-01-26 15:39 | hgbot | Checkin | |
2017-01-26 15:39 | hgbot | Note Added: 0093844 | |
2017-01-26 18:08 | marvintm | Note Added: 0093851 | |
2017-01-26 18:08 | marvintm | Status | resolved => new |
2017-01-26 18:08 | marvintm | Resolution | fixed => open |
2017-01-26 18:14 | hgbot | Checkin | |
2017-01-26 18:14 | hgbot | Note Added: 0093852 | |
2017-01-26 18:17 | mario_castello | Status | new => acknowledged |
2017-01-26 18:17 | mario_castello | Status | acknowledged => scheduled |
2017-01-26 18:18 | mario_castello | Note Added: 0093853 | |
2017-02-04 18:00 | hgbot | Checkin | |
2017-02-04 18:00 | hgbot | Note Added: 0094056 | |
2017-02-04 18:00 | hgbot | Status | scheduled => resolved |
2017-02-04 18:00 | hgbot | Resolution | open => fixed |
2017-02-04 18:00 | hgbot | Fixed in SCM revision | http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/7f1ed45fd2517cfda1a1fe2d7534f724e4b183be [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/16f53f09075de0565263f7311a7f7de75aa0a26a [^] |
2017-02-06 10:13 | marvintm | Note Added: 0094064 | |
2017-02-06 10:13 | marvintm | Status | resolved => new |
2017-02-06 10:13 | marvintm | Resolution | fixed => open |
2017-02-07 23:07 | hgbot | Checkin | |
2017-02-07 23:07 | hgbot | Note Added: 0094137 | |
2017-02-07 23:07 | hgbot | Status | new => resolved |
2017-02-07 23:07 | hgbot | Resolution | open => fixed |
2017-02-07 23:07 | hgbot | Fixed in SCM revision | http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/16f53f09075de0565263f7311a7f7de75aa0a26a [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/3a29833e5de41e3461855ef23d67b6f444fa8fdb [^] |
2017-02-08 09:18 | marvintm | Review Assigned To | => marvintm |
2017-02-08 09:18 | marvintm | Status | resolved => closed |
2017-02-08 09:18 | marvintm | Fixed in Version | => RR17Q2 |
2017-02-08 17:24 | marvintm | Note Added: 0094154 | |
2017-02-08 17:24 | marvintm | Status | closed => new |
2017-02-08 17:24 | marvintm | Resolution | fixed => open |
2017-02-08 17:24 | marvintm | Fixed in Version | RR17Q2 => |
2017-02-08 17:34 | mario_castello | Status | new => acknowledged |
2017-02-08 17:34 | mario_castello | Status | acknowledged => scheduled |
2017-02-09 14:36 | hgbot | Checkin | |
2017-02-09 14:36 | hgbot | Note Added: 0094179 | |
2017-02-09 14:37 | hgbot | Checkin | |
2017-02-09 14:37 | hgbot | Note Added: 0094180 | |
2017-02-09 14:37 | hgbot | Status | scheduled => resolved |
2017-02-09 14:37 | hgbot | Resolution | open => fixed |
2017-02-09 14:37 | hgbot | Fixed in SCM revision | http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/3a29833e5de41e3461855ef23d67b6f444fa8fdb [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8f3c0f3dfbde2d6c3a04d402456966e974e92bac [^] |
2017-02-10 13:03 | marvintm | Status | resolved => closed |
2017-02-10 13:03 | marvintm | Fixed in Version | => RR17Q2 |
Notes |
|
(0093843)
|
hgbot
|
2017-01-26 15:38
|
|
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 7f1ed45fd2517cfda1a1fe2d7534f724e4b183be
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Thu Jan 26 08:10:43 2017 -0600
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/7f1ed45fd2517cfda1a1fe2d7534f724e4b183be [^]
Fixed issue 0034968: Using pay open tickets option might end up with non synchronized receipts
- Moved the code that set all properties of the receipt inside the hook OBPOS_PreOrderSave
---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
---
|
|
|
(0093844)
|
hgbot
|
2017-01-26 15:39
|
|
|
|
|
The solution is not correct, because it changes the API of the hook (now the hook wouldn't receive the properties which have been moved to the hook callback).
A different solution based on callbacks of the function which iterates all receipts of the main multiorder should be implemented instead. |
|
|
(0093852)
|
hgbot
|
2017-01-26 18:14
|
|
|
|
|
|
|
(0094056)
|
hgbot
|
2017-02-04 18:00
|
|
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 16f53f09075de0565263f7311a7f7de75aa0a26a
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Thu Feb 02 09:51:53 2017 -0600
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/16f53f09075de0565263f7311a7f7de75aa0a26a [^]
Fixed issue 0034968: Using pay open tickets option might end up with non synchronized receipts
- Added syncronization to save multiorder process
- Execute the readyToSendFunction only one time to prevent create more than one empty receipt
---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
M web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-model.js
---
|
|
|
|
The solution now seems to work correctly, but still, executing the call to readyToSendFunction in the first element of the collection instead of the last is a bit weird, and may cause problems in the future:
me.get('multiOrders').trigger('closed', receiptMulti, function () {
if (index === 0) {
readyToSendFunction();
}
});
Instead of doing this, it would be better if the readyToSendFunction is called at the end of the collection. |
|
|
(0094137)
|
hgbot
|
2017-02-07 23:07
|
|
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 3a29833e5de41e3461855ef23d67b6f444fa8fdb
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Mon Feb 06 09:08:24 2017 -0600
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/3a29833e5de41e3461855ef23d67b6f444fa8fdb [^]
Fixed issue 0034968: Using pay open tickets option might end up with non synchronized receipts
- Changes the validation in function readyToSendFunction
- Called readyToSendFunction when all pending ticket have been processed
---
M web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-model.js
---
|
|
|
|
A small change is still required. Currently the recursive call to setMultiOrderCashUpReport is being done out of the callback of the trigger('closed') call, and this means that every 'closed' event will be generated without waiting for the previous one to finish. This should be changed.
Another thing which should also be changed is that the callback of the multiOrdersFunction function in dataordersave.js file should be called inside the callback of the OB.Dal.get call. |
|
|
(0094179)
|
hgbot
|
2017-02-09 14:36
|
|
|
|
(0094180)
|
hgbot
|
2017-02-09 14:37
|
|
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 8f3c0f3dfbde2d6c3a04d402456966e974e92bac
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Wed Feb 08 10:47:32 2017 -0600
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8f3c0f3dfbde2d6c3a04d402456966e974e92bac [^]
Fixed issue 34968: Using pay open tickets option might end up with non synchronized receipts
- Execute one callback in case that the hook PreOrderSave failed
- Moved the callback from the OB.Dal.Save to OB.Dal.Get
- Moved the call function setMultiOrderCashUpReport to inside the callback of trigger closed
---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
M web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-model.js
---
|
|