Openbravo Issue Tracking System - Retail Modules
View Issue Details
0032415Retail ModulesWeb POSpublic2016-03-05 16:292016-03-30 18:20
Orekaria 
aaroncalero 
normalmajorsometimes
closedfixed 
5
 
RR16Q2RR16Q2 
Orekaria
No
0032415: [Services] Asynchronous processes can corrupt receipt data
Asynchronous processes can corrupt receipt data

The problem is that lasting asynchronous processes are still being executed while the application is available for user actions
A.
Apply the attached patch
Create or execute a test with a single line receipt (e.g: CreateSaleWithEAN

Verify that the console shows log similar to (tweak the patch timeouts so 'first' is before 'second'):

6478 [Thread-0] INFO CreateSaleWithEAN - Tap on 'BUTTON_PAY_DONE'
6553 [Thread-0] WARN CreateSaleWithEAN - Allowed (exclusion): http://192.168.1.35:8080/openbravo/web/js/gen/726b345e9ea7139b002dfb0550badbf2_WebPOS.js [^] 30261:17 [dev] first
6553 [Thread-0] INFO CreateSaleWithEAN - Verifying that 'LABEL_TOTALTOPAY' = '0.00'
7594 [Thread-0] WARN CreateSaleWithEAN - TestRegistry has been forced to refresh
7646 [Thread-0] WARN CreateSaleWithEAN - Allowed (exclusion): http://192.168.1.35:8080/openbravo/web/js/gen/726b345e9ea7139b002dfb0550badbf2_WebPOS.js [^] 22329:25 [dev] second
8702 [Thread-0] WARN CreateSaleWithEAN - TestRegistry has been forced to refresh
8768 [Thread-0] INFO CreateSaleWithEAN - After test verifications
8792 [Thread-0] INFO CreateSaleWithEAN - Synchronizing terminal and server
9097 [Thread-0] INFO CreateSaleWithEAN - There are no pending POST or GET requests to the server
9101 [Thread-0] INFO CreateSaleWithEAN - Waiting for the 'c_import_entry' to process all 'Initial' records
10104 [Thread-0] INFO CreateSaleWithEAN - Waiting for the 'c_import_entry' to process all 'Initial' records
12283 [main] INFO CreateSaleWithEAN - Test failed
12606 [main] INFO CreateSaleWithEAN - Screenshot taken: </tmp/tip/last-results/openbravo/screenshots/17:11:28 FAILED: CreateSaleWithEAN.png>
12606 [main] INFO CreateSaleWithEAN -

*** Error: ***

org.junit.internal.runners.model.MultipleFailureException: There were 2 errors:
  java.lang.AssertionError((1) errors in the browser log:
[2016-03-05T17:11:24+0100] [SEVERE] http://192.168.1.35:8080/openbravo/web/js/gen/726b345e9ea7139b002dfb0550badbf2_WebPOS.js [^] 2561:19 The receipt has been modified while it was being closed:
{
  "lines": {
    "0": {
      "hasRelatedServices": [
        null,
        false
      ]
    }
  }
}


B.
See also attached image
Follow the asynchronous flows of the The 'addProductToOrder' method in order.js

a- Ensure that since the method is executed until it finishes, the SynchronizationHelper is blocking the pay button

b- Deasynchronize the flow
No tags attached.
related to defect 0032070 closed aaroncalero The HasServices process should block the Pay button 
patch reproduceTheIssue.patch (12,511) 2016-03-05 17:05
https://issues.openbravo.com/file_download.php?file_id=9133&type=bug
png .png (34,991) 2016-03-05 17:26
https://issues.openbravo.com/file_download.php?file_id=9134&type=bug
png

png test failure2.png (35,199) 2016-03-05 17:35
https://issues.openbravo.com/file_download.php?file_id=9135&type=bug
png

png test failure3.png (36,389) 2016-03-05 20:02
https://issues.openbravo.com/file_download.php?file_id=9136&type=bug
png

diff FixIssue32415.diff (2,623) 2016-03-07 16:54
https://issues.openbravo.com/file_download.php?file_id=9141&type=bug
Issue History
2016-03-05 16:29OrekariaNew Issue
2016-03-05 16:29OrekariaAssigned To => Retail
2016-03-05 16:29OrekariaTriggers an Emergency Pack => No
2016-03-05 16:29OrekariaProposed Solution updated
2016-03-05 16:32OrekariaDescription Updatedbug_revision_view_page.php?rev_id=11363#r11363
2016-03-05 16:32OrekariaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11365#r11365
2016-03-05 16:32OrekariaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11366#r11366
2016-03-05 16:35OrekariaSummary[Services] The 'addProductToOrder' asynchronous processes can break the receipt coherence => [Services] The 'addProductToOrder' asynchronous processes can corrupt receipt data
2016-03-05 16:35OrekariaDescription Updatedbug_revision_view_page.php?rev_id=11367#r11367
2016-03-05 16:48OrekariaSummary[Services] The 'addProductToOrder' asynchronous processes can corrupt receipt data => [Services] Asynchronous processes can corrupt receipt data
2016-03-05 16:48OrekariaDescription Updatedbug_revision_view_page.php?rev_id=11368#r11368
2016-03-05 16:52OrekariaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11369#r11369
2016-03-05 17:05OrekariaFile Added: reproduceTheIssue.patch
2016-03-05 17:13OrekariaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11370#r11370
2016-03-05 17:26OrekariaFile Added: .png
2016-03-05 17:26OrekariaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11371#r11371
2016-03-05 17:35OrekariaFile Added: test failure2.png
2016-03-05 20:02OrekariaFile Added: test failure3.png
2016-03-07 12:09aaroncaleroFile Added: FixIssue32415.diff
2016-03-07 12:09aaroncaleroNote Added: 0084768
2016-03-07 12:12aaroncaleroRelationship addedrelated to 0032070
2016-03-07 16:53aaroncaleroFile Deleted: FixIssue32415.diff
2016-03-07 16:54aaroncaleroFile Added: FixIssue32415.diff
2016-03-10 16:39hgbotCheckin
2016-03-10 16:39hgbotNote Added: 0084870
2016-03-10 16:39hgbotStatusnew => resolved
2016-03-10 16:39hgbotResolutionopen => fixed
2016-03-10 16:39hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8fe534dc24be39218ca3f60e599a25554890c1c4 [^]
2016-03-11 09:01marvintmAssigned ToRetail => Orekaria
2016-03-18 08:43aaroncaleroReview Assigned To => Orekaria
2016-03-18 08:43aaroncaleroAssigned ToOrekaria => aaroncalero
2016-03-30 16:41OrekariaStatusresolved => new
2016-03-30 16:41OrekariaResolutionfixed => open
2016-03-30 16:41OrekariaStatusnew => scheduled
2016-03-30 16:43OrekariaNote Added: 0085343
2016-03-30 17:31hgbotCheckin
2016-03-30 17:31hgbotNote Added: 0085344
2016-03-30 17:31hgbotStatusscheduled => resolved
2016-03-30 17:31hgbotResolutionopen => fixed
2016-03-30 17:31hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8fe534dc24be39218ca3f60e599a25554890c1c4 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/410127cfc57ee72b2e4660d2a5cb1e87d04c3972 [^]
2016-03-30 18:20OrekariaStatusresolved => closed
2016-03-30 18:20OrekariaFixed in Version => RR16Q2

Notes
(0084768)
aaroncalero   
2016-03-07 12:09   
Attached possible solution. The 'blocking range' of the SynchronizationHelper has been extended while calculating if a product has services or not.
(0084870)
hgbot   
2016-03-10 16:39   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 8fe534dc24be39218ca3f60e599a25554890c1c4
Author: Aaron Calero <aaron.calero <at> openbravo.com>
Date: Wed Mar 09 09:53:33 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8fe534dc24be39218ca3f60e599a25554890c1c4 [^]

Fixed issue 32415: [Services] Asynchronous processes can corrupt receipt data

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0085343)
Orekaria   
2016-03-30 16:43   
OB.UTIL.SynchronizationHelper.finished(synchId, 'HasServices'); must be closed if the following condition is not fullfilled
  if (me.get('lines').contains(line)) {
(0085344)
hgbot   
2016-03-30 17:31   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 410127cfc57ee72b2e4660d2a5cb1e87d04c3972
Author: Aaron Calero <aaron.calero <at> openbravo.com>
Date: Wed Mar 30 17:30:05 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/410127cfc57ee72b2e4660d2a5cb1e87d04c3972 [^]

Fixed issue 32415: [Services] Asynchronous processes can corrupt receipt data

Added SynchronizationHelper closing for the HasServices process, when the line is removed during the calculateReceipt process (e.g. this can happen if taxes cannot be calculated)

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---