Openbravo Issue Tracking System - Retail Modules
View Issue Details
0037436Retail ModulesWeb POSpublic2017-12-05 16:202018-01-18 18:33
aaroncalero 
ranjith_qualiantech_com 
normalmajorhave not tried
closedfixed 
5
 
RR18Q2 
marvintm
No
0037436: The cancellation of the OBPOS_PreOrderSave hook is not correctly handled in Pay Open Tickets
The cancellation of the OBPOS_PreOrderSave hook is not handled correctly in Pay Open Tickets. Depending on which ticket cancels the hook, it might leave the previous tickets saved in websql with the hasbeenpaid attribute to 'Y', but not synchronized, making it impossible to update them afterwards.
This can lead to cashup differences if the payments change between synchronization retries (because the "locked" ticket won't be updated).
Login in web pos.
Create two tickets in draft and add products to both of them.
Go to the Menu > Pay Open Tickets and select the tickets created in the first step.
Open the browser console and execute the following:
OB.MobileApp.model.attributes.permissions["OBMOBC_SynchronizedMode"] = true
OB.FAILCONDITION = true
OB.FAILDOCNO = the_documentNo_of_the_second_ticket
OB.UTIL.HookManager.registerHook('OBPOS_PreOrderSave', function(a,b){
  if(OB.FAILCONDITION && a.receipt.get('documentNo') === OB.FAILDOCNO){
    OB.MobileApp.model.hideSynchronizingDialog();
    a.cancellation = true;
  }
  OB.UTIL.HookManager.callbackExecutor(a,b);
})

Add a full payment in Card and click on Done. The process will stop because of the hook.
Remove the Card payment.
Add a full payment in Voucher.
Execute the following in the browser console:
OB.FAILCONDITION = false;

Click on the Done button again. This time the hook will not cancel the execution and the tickets will be synchronized, although the following error will appear in the console:
[checkBlocked][no-transaction][hasbeenpaid_is_yes] Wrong write in c_order avoided.

Load both tickets again in WebPOS:
The first ticket will be paid with Card (although the card payment was completely removed).
The second ticket will be paid with Voucher.
No tags attached.
depends on backport 0037674RR18Q1 closed ranjith_qualiantech_com The cancellation of the OBPOS_PreOrderSave hook is not correctly handled in Pay Open Tickets 
patch issue 37436 posterminal.patch (1,096) 2018-01-02 16:09
https://issues.openbravo.com/file_download.php?file_id=11405&type=bug
patch issue 37436 test.patch (5,572) 2018-01-02 16:09
https://issues.openbravo.com/file_download.php?file_id=11406&type=bug
Issue History
2017-12-05 16:20aaroncaleroNew Issue
2017-12-05 16:20aaroncaleroAssigned To => Retail
2017-12-05 16:20aaroncaleroResolution time => 1513638000
2017-12-05 16:20aaroncaleroTriggers an Emergency Pack => No
2017-12-07 15:00ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2017-12-07 15:00ranjith_qualiantech_comStatusnew => scheduled
2017-12-11 08:32hgbotCheckin
2017-12-11 08:32hgbotNote Added: 0100952
2017-12-11 08:32hgbotStatusscheduled => resolved
2017-12-11 08:32hgbotResolutionopen => fixed
2017-12-11 08:32hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/556a2d5cde71d730aaad67bd86e0cea47985fa92 [^]
2017-12-20 18:47marvintmNote Added: 0101174
2017-12-20 18:47marvintmStatusresolved => new
2017-12-20 18:47marvintmResolutionfixed => open
2017-12-21 07:06ranjith_qualiantech_comStatusnew => scheduled
2018-01-02 16:09ranjith_qualiantech_comFile Added: issue 37436 posterminal.patch
2018-01-02 16:09ranjith_qualiantech_comFile Added: issue 37436 test.patch
2018-01-05 12:54hgbotCheckin
2018-01-05 12:54hgbotNote Added: 0101593
2018-01-05 12:54hgbotStatusscheduled => resolved
2018-01-05 12:54hgbotResolutionopen => fixed
2018-01-05 12:54hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/556a2d5cde71d730aaad67bd86e0cea47985fa92 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8e28db8bf44e47756d6f4e18457d03f71d105902 [^]
2018-01-05 12:55hgbotCheckin
2018-01-05 12:55hgbotNote Added: 0101594
2018-01-08 12:06marvintmNote Added: 0101618
2018-01-08 12:06marvintmStatusresolved => new
2018-01-08 12:06marvintmResolutionfixed => open
2018-01-17 07:57ranjith_qualiantech_comStatusnew => scheduled
2018-01-17 09:54hgbotCheckin
2018-01-17 09:54hgbotNote Added: 0101740
2018-01-17 09:54hgbotStatusscheduled => resolved
2018-01-17 09:54hgbotResolutionopen => fixed
2018-01-17 09:54hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8e28db8bf44e47756d6f4e18457d03f71d105902 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/5d2c8347e44c29bd53a4130dbb341602d46a1695 [^]
2018-01-17 09:54hgbotCheckin
2018-01-17 09:54hgbotNote Added: 0101741
2018-01-18 18:32marvintmStatusresolved => new
2018-01-18 18:32marvintmResolutionfixed => open
2018-01-18 18:32marvintmStatusnew => scheduled
2018-01-18 18:32marvintmStatusscheduled => resolved
2018-01-18 18:32marvintmFixed in Version => RR18Q2
2018-01-18 18:32marvintmResolutionopen => fixed
2018-01-18 18:33marvintmReview Assigned To => marvintm
2018-01-18 18:33marvintmStatusresolved => closed

Notes
(0100952)
hgbot   
2017-12-11 08:32   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 556a2d5cde71d730aaad67bd86e0cea47985fa92
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Dec 11 13:02:05 2017 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/556a2d5cde71d730aaad67bd86e0cea47985fa92 [^]

Fixed issue 37436 : Restore Receipt and Payments on PreOrderSave hook cancel

* In Pay open tickets, if PreOrderSave hook is cancelled then receipts and payments should be restored with original values

---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
---
(0101174)
marvintm   
2017-12-20 18:47   
The current fix doesn't work. I've managed to reproduce the problem with the steps to reproduce specified in the issue.

The problem is that when there is a hook which cancels the processing of the a ticket different from the first, the first ticket already has payments assigned to it, and this should be reset, so that when the process is completed again, the payments are correctly distributed among all orders again.
(0101593)
hgbot   
2018-01-05 12:54   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 8e28db8bf44e47756d6f4e18457d03f71d105902
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Jan 05 17:24:09 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8e28db8bf44e47756d6f4e18457d03f71d105902 [^]

Fixed issue 37436 : Restore Receipt and Payments in Pay Open Tickets on PreOrderSave hook cancel

* In Pay open tickets, if PreOrderSave hook is cancelled then receipts and payments should be restored with original values

---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
---
(0101594)
hgbot   
2018-01-05 12:55   
Repository: tools/automation/pi-mobile
Changeset: e63759b420d33ae9c78e94dbf521ffd3a921f272
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Jan 05 17:25:04 2018 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/e63759b420d33ae9c78e94dbf521ffd3a921f272 [^]

Verifies issue 37436 : Added automated test 'I37436_VerifyReceiptOnPreSaveHook'

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37436_VerifyReceiptOnPreSaveHook.java
---
(0101618)
marvintm   
2018-01-08 12:06   
The fix is still not fully correct. After following steps to reproduce, the payment for the first ticket is still with Card, and not Voucher, even though the Card payment was fully reverted.
(0101740)
hgbot   
2018-01-17 09:54   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 5d2c8347e44c29bd53a4130dbb341602d46a1695
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Jan 17 14:24:15 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/5d2c8347e44c29bd53a4130dbb341602d46a1695 [^]

Fixed issue 37436 : Refactored MultiOrder Close function

* Hook PreOrderSave will be validated for all receipts and then receipt sync process will be started

---
M web/org.openbravo.retail.posterminal/js/data/dataordersave.js
---
(0101741)
hgbot   
2018-01-17 09:54   
Repository: tools/automation/pi-mobile
Changeset: 089d85a5cae4a7f61a585438d70e16651db2b556
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Jan 17 14:24:35 2018 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/089d85a5cae4a7f61a585438d70e16651db2b556 [^]

Verifies issue 37436 : Modified automated test 'I37436_VerifyReceiptOnPreSaveHook'

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I37436_VerifyReceiptOnPreSaveHook.java
---