Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0034968
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajoralways2017-01-16 16:452017-02-10 13:03
ReporteraaroncaleroView Statuspublic 
Assigned Tomario_castello 
PriorityhighResolutionfixedFixed in VersionRR17Q2
StatusclosedFix in branchFixed in SCM revision8f3c0f3dfbde
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomarvintm
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0034968: Using pay open tickets option might end up with non synchronized receipts

DescriptionIf 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 ReproduceVerify 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 SolutionThe 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.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0093843)
hgbot (developer)
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 (developer)
2017-01-26 15:39

Repository: tools/automation/pi-mobile
Changeset: a7e79c5ed758c350d1a829cd82a1d01b7d82f39f
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Wed Jan 18 08:45:29 2017 -0600
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/a7e79c5ed758c350d1a829cd82a1d01b7d82f39f [^]

Related to issue 34968: Added automated test I34968_ReceiptPayOpenTicket

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I34968_ReceiptPayOpenTicket.java
---
(0093851)
marvintm (manager)
2017-01-26 18:08

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 (developer)
2017-01-26 18:14

Repository: tools/automation/pi-mobile
Changeset: 8918f5d32ec7476f7bb28d18b37735a3e69fda35
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Thu Jan 26 11:13:42 2017 -0600
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/8918f5d32ec7476f7bb28d18b37735a3e69fda35 [^]

Verifies issue 34968: Disable test and wait for the correct solution of issue

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I34968_ReceiptPayOpenTicket.java
---
(0093853)
mario_castello (developer)
2017-01-26 18:18

Remove the previous changes:

https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/3816e3697eca [^]
(0094056)
hgbot (developer)
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
---
(0094064)
marvintm (manager)
2017-02-06 10:13

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 (developer)
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
---
(0094154)
marvintm (manager)
2017-02-08 17:24

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 (developer)
2017-02-09 14:36

Repository: tools/automation/pi-mobile
Changeset: bf88c67eae3758f13c357cb3e2bf7dde26c36448
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Wed Feb 08 10:45:55 2017 -0600
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/bf88c67eae3758f13c357cb3e2bf7dde26c36448 [^]

Related to issue 34968: Activate test I34968_ReceiptPayOpenTicket

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I34968_ReceiptPayOpenTicket.java
---
(0094180)
hgbot (developer)
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
---

- 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 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


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker