Openbravo Issue Tracking System - POS2
View Issue Details
0055331POS2POSpublic2024-04-26 08:082024-05-08 06:33
marvintm 
Rajesh_18 
normalmajorhave not tried
scheduledopen 
5
 
24Q2 
No
0055331: Error while importing generated when doing the cashup, if the connection is lost at a certain point in the process
It is possible for an Error While importing to happen in certain conditions when doing the cashup, if the connection is lost in some specific moment in time.

When this happens, the terminal will go offline, and once it is online again, the user can trigger the cashup completion again, causing an EWI due to a wrong cashup that is containing the same ids that the previously completed cashup also had.
- Login in the POS and do some sales.
- Go to the Cashup window, and count the payment methods (leaving no difference).
- When you reach the last step, add a breakpoint in this function, inside the FinishCashup.js file, in dev tools:
function addCashupId(payload) {
  return { ...payload, cashupId: OB.App.State.getState().Cashup.id };
}
- Then execute the cashup. The process will stop in the breakpoint you just added
- Go to dev tools/Network panel, and set the connectivity to "Without connection"
- Continue the process. The user action will fail as there is some post hook that requires connection
- Enable connectivity again.
- In the POS, change the terminal to online (it will work now because you just enabled connectivity).
- Now, realize you can complete the cashup again. Click on the "Finish" button again.
- Go to the back office. Verify that you now have an Error While Importing with the following message:

org.openbravo.base.exception.OBException: Cashup cannot be processed since error occurred in CashClose: A different object with the same identifier value was already associated with the session : [FIN_Reconciliation#590A06CCA2E08FD9EE354472E0ED81F1]
    at org.openbravo.retail.posterminal.ProcessCashClose.doReconciliationAndInvoices(ProcessCashClose.java:525)
    at org.openbravo.retail.posterminal.ProcessCashClose.saveRecord(ProcessCashClose.java:222)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.saveRecord(DataSynchronizationProcess.java:214)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.exec(DataSynchronizationProcess.java:165)
    at org.openbravo.mobile.core.process.DataSynchronizationProcess.exec(DataSynchronizationProcess.java:97)
    at org.openbravo.mobile.core.process.MobileImportEntryProcessorRunnable.processEntry(MobileImportEntryProcessorRunnable.java:55)
    at
Most probably the easiest solution is to review all postHooks of the action, and make sure we have proper fallbacks for all the cases where a remote request is triggered, so that the user action itself cannot fail if connection is lost at that moment.
No tags attached.
Issue History
2024-04-26 08:08marvintmNew Issue
2024-04-26 08:08marvintmAssigned To => Retail
2024-04-26 08:08marvintmTriggers an Emergency Pack => No
2024-04-26 09:05ngarciaIssue Monitored: ngarcia
2024-05-06 09:24guilleaerStatusnew => acknowledged
2024-05-06 13:01Rajesh_18Assigned ToRetail => Rajesh_18
2024-05-06 13:02Rajesh_18Statusacknowledged => scheduled
2024-05-07 16:19lorenzofidalgoTarget Version => 24Q2
2024-05-08 06:33hgbotNote Added: 0164302

Notes
(0164302)
hgbot   
2024-05-08 06:33   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.sessions/-/merge_requests/120 [^]