Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0019547Openbravo ERPA. Platformpublic2012-01-24 10:142012-03-02 15:33
jecharri 
alostale 
urgentmajoralways
closedfixed 
5
pi 
3.0MP93.0MP9 
Google Chrome
Core
No
0019547: Problems with autosave
Problems with autosave.
Sometimes the autosave process does not work.
**
No tags attached.
Issue History
2012-01-24 10:14jecharriNew Issue
2012-01-24 10:14jecharriAssigned To => alostale
2012-01-24 10:14jecharriWeb browser => Google Chrome
2012-01-24 10:14jecharriModules => Core
2012-01-24 10:23jpcalventeIssue Monitored: jpcalvente
2012-01-24 10:26alostaleNote Added: 0044499
2012-01-25 09:49alostaleWeb browserGoogle Chrome => Google Chrome
2012-01-25 09:49alostaleNote Added: 0044535
2012-01-25 09:49alostalePriorityimmediate => urgent
2012-01-30 08:33alostaleWeb browserGoogle Chrome => Google Chrome
2012-01-30 08:33alostaleNote Added: 0044676
2012-01-30 08:33alostaleTarget Version3.0MP8 => 3.0MP9
2012-01-30 10:21alostaleNote Added: 0044679
2012-02-01 14:31mtaalNote Added: 0044774
2012-02-01 16:08hgbotCheckin
2012-02-01 16:08hgbotNote Added: 0044775
2012-02-01 16:08hgbotStatusnew => resolved
2012-02-01 16:08hgbotResolutionopen => fixed
2012-02-01 16:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9117c245d78dcd3f113f7d00560824793ea57646 [^]
2012-02-01 16:37hgbotCheckin
2012-02-01 16:37hgbotNote Added: 0044778
2012-02-28 12:08AugustoMauchNote Added: 0045524
2012-02-28 12:08AugustoMauchStatusresolved => closed
2012-02-28 12:08AugustoMauchFixed in Version => 3.0MP9
2012-03-02 15:33hudsonbotCheckin
2012-03-02 15:33hudsonbotNote Added: 0045721
2012-03-02 15:33hudsonbotCheckin
2012-03-02 15:33hudsonbotNote Added: 0045722

Notes
(0044499)
alostale   
2012-01-24 10:26   
It happens randomly. When it occurs OBStandardWindow.isAutoSaveEnabled function returns false because autoSave porperty is not set in the OBStandardWindow, which should had been set by WindowSettingsActionHandler.
(0044535)
alostale   
2012-01-25 09:49   
Downgrading priority because we are not able to reproduce it.

We think this problem could be caused by a javascript exception when setting values returned by window settings action handler. But we were not able to get this error.

In case you can reproduce it it would be very helpful to get the stack trace of it. Note the error should occur not when the popup is shown but when the window is opened.
(0044676)
alostale   
2012-01-30 08:33   
Postponing to mp9 as it is not possible to reproduce it.
(0044679)
alostale   
2012-01-30 10:21   
This is the error shown in mp6.1 when opening the window in chrome:

 Uncaught TypeError: Cannot read property '0' of undefined
isc_c_Class_fireCallbackISC_Combined.js:299
isc_c_Comm__fireXMLCallbackISC_Combined.js:1235
_12
(0044774)
mtaal   
2012-02-01 14:31   
I was able to get a debug breakpoint at the point where it seems to fail:
isc_ResultSet_get() at ISC_Combined.js:14962
isc_ListGrid_setSelectedState() at ISC_Combined.js:7349
isc_ListGrid_setViewState() at ISC_Combined.js:7362
isc_c_Class_invokeSuper() at ISC_Combined.js:282
isc_c_Class_Super() at ISC_Combined.js:274
$LAB.script.wait.$LAB.script.wait.isc.OBViewGrid.addProperties.setViewState() at 95a14375df364b2101416b535cce4031.js:1136
$LAB.script.wait.$LAB.script.wait.isc.OBStandardWindow.addProperties.setPersonalization() at 95a14375df364b2101416b535cce4031.js:743
$LAB.script.wait.$LAB.script.wait.isc.OBStandardWindow.addProperties.initWidget() at 95a14375df364b2101416b535cce4031.js:733
isc_Canvas_init() at ISC_Combined.js:1998
isc_Class_completeCreation() at ISC_Combined.js:341
isc_c_Class_create() at ISC_Combined.js:211
showTab() at 95a14375df364b2101416b535cce4031.js:1688
getView() at 95a14375df364b2101416b535cce4031.js:1699
$LAB.script.wait.$LAB.script.wait.$LAB.script.wait.ViewManager.openView() at 95a14375df364b2101416b535cce4031.js:1700
$LAB.script.wait.$LAB.script.wait.$LAB.script.wait.ViewManager.openView.isc.Canvas.create.openView() at 95a14375df364b2101416b535cce4031.js:1687
isc_c_Class_fireCallback() at ISC_Combined.js:299
isc_c_Class__fireActionsOnPause() at ISC_Combined.js:306
isc_c_Class_fireCallback() at ISC_Combined.js:299
isc_c_Timer__fireTimeout() at ISC_Combined.js:1269
(anonymous function)() at :1

At that location there is this call:
this.getRange(_1,_1+1)[0]

This happens when the viewstate is set, the viewstate in previous mp's also included the selected record. This does not work nicely though as the selected record may not have been loaded yet.

The viewstate which the system tries to restore in the above case is this one:
["({selected:"[{id:\"FF80808131B9A70F0131B9BA18730058\"}]",field:"[{name:\"_editLink\",frozen:true,width:58},{name:\"active\",width:null},{name:\"module\",visible:false,width:null},{name:\"propertyList\",width:null},{name:\"selected\",width:null},{name:\"property\",width:200},{name:\"window\",width:100},{name:\"attribute\",width:200},{name:\"searchKey\",visible:false,width:null},{name:\"visibleAtClient\",width:100},{name:\"visibleAtOrganization\",width:100},{name:\"userContact\",width:100},{name:\"visibleAtRole\",width:100},{name:\"client\",visible:false,width:null},{name:\"organization\",visible:false,width:null},{name:\"creationDate\",width:100},{name:\"createdBy\",width:100},{name:\"updated\",width:100},{name:\"updatedBy\",width:100}]",sort:"({fieldName:null,sortDir:true,sortSpecifiers:[{property:\"window._identifier\",direction:\"ascending\"}]})",hilite:null,group:""})"]

At the point that the viewstate is restored no data is yet loaded, so the selected record is not yet there.
In current pi, the selected state is not stored anymore, but to support older version of the selected state we need to make changes.

In ob-view-grid.js in the setViewState method the following has to be changed:

Instead of this line:
this.Super('setViewState', arguments);

the following has to be done (inside the if):
delete localState.selected
this.Super('setViewState', ['(' + isc.Comm.serialize(localState,false) + ')']);

To prevent this the viewstate which is being restored should not have the selected property anymore. The change needs to be done

To prevent the autosave problem when there are errors in the personalization also the following change can be done:

in ob-standard-window.js in the setWindowSettings method:
- move these lines before the if (data && data.personalization):
    this.getClass().windowSettingsRead = true;

    this.getClass().uiPattern = data.uiPattern;
    this.getClass().autoSave = data.autoSave;
    this.getClass().showAutoSaveConfirmation = data.showAutoSaveConfirmation;




gr. Martin
(0044775)
hgbot   
2012-02-01 16:08   
Repository: erp/devel/pi
Changeset: 9117c245d78dcd3f113f7d00560824793ea57646
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Feb 01 16:07:16 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9117c245d78dcd3f113f7d00560824793ea57646 [^]

fixed bug 19547: Problems with autosave

  Grid preferences of previos versions stored selected records, this caused random failures
  in case this selection was tried to be applied to a grid that hadn't receive data yet.

  This fix makes this old preference not to be applied in any case.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
M modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java
---
(0044778)
hgbot   
2012-02-01 16:37   
Repository: erp/devel/pi
Changeset: f7124e0c9192e270befee99c1e4b09625700e12d
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Feb 01 16:36:27 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/f7124e0c9192e270befee99c1e4b09625700e12d [^]

related to issue 19547: reverted unrelated changeset

---
M modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java
---
(0045524)
AugustoMauch   
2012-02-28 12:08   
Code reviewed and verified
(0045721)
hudsonbot   
2012-03-02 15:33   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/544d64e0c159 [^]

Maturity status: Test
(0045722)
hudsonbot   
2012-03-02 15:33   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/544d64e0c159 [^]

Maturity status: Test