Openbravo Issue Tracking System - Retail Modules
View Issue Details
0037674Retail ModulesWeb POSpublic2017-12-05 16:202018-01-25 11:26
aaroncalero 
ranjith_qualiantech_com 
normalmajorhave not tried
closedfixed 
5
 
RR18Q1RR18Q1 
marvintm
No
0037674: 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.
blocks defect 0037436 closed ranjith_qualiantech_com The cancellation of the OBPOS_PreOrderSave hook is not correctly handled in Pay Open Tickets 
Issue History
2018-01-18 18:32marvintmTypedefect => backport
2018-01-18 18:32marvintmTarget Version => RR18Q1
2018-01-19 15:10hgbotCheckin
2018-01-19 15:10hgbotNote Added: 0101803
2018-01-19 15:10hgbotStatusscheduled => resolved
2018-01-19 15:10hgbotResolutionopen => fixed
2018-01-19 15:10hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/5d2c8347e44c29bd53a4130dbb341602d46a1695 [^] => http://code.openbravo.com/retail/backports/3.0RR18Q1/org.openbravo.retail.posterminal/rev/f881064aaca4b0fe0da323aba49b74ad47b3d8a6 [^]
2018-01-25 11:26marvintmReview Assigned To => marvintm
2018-01-25 11:26marvintmStatusresolved => closed
2018-01-25 11:26marvintmFixed in Version => RR18Q1

Notes
(0101803)
hgbot   
2018-01-19 15:10   
Repository: retail/backports/3.0RR18Q1/org.openbravo.retail.posterminal
Changeset: f881064aaca4b0fe0da323aba49b74ad47b3d8a6
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Jan 19 19:40:28 2018 +0530
URL: http://code.openbravo.com/retail/backports/3.0RR18Q1/org.openbravo.retail.posterminal/rev/f881064aaca4b0fe0da323aba49b74ad47b3d8a6 [^]

Fixed issue 37674 : 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
* Refactored multiorder close function, (validate multiorder with PreOrderSave hook, save receipt, runSyncProcess)

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