Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0021290Openbravo ERPB. User interfacepublic2012-08-02 13:362012-08-22 09:51
caristu 
AugustoMauch 
highminorsometimes
closedfixed 
5
pi 
3.0MP16 
caristu
Mozilla Firefox
Core
No
0021290: Unresponsive Script when creating the first record
When using Mozilla Firefox, if you create the first children record in a window, using the "Create One" green link the application is stopped and after a few seconds the "Unresponsive Script" Warning of Firefox appears.
The steps to reproduce are applicable in almost every window. We take the Sales Invoice, for example:

1) Using Firefox, go to [Sales Invoice] window
2) Create a new record. Save it.
3) In the [Lines] tab, click in the "Create One" link. The application is stopped and the warning appears.
4) If you use the toolbar button in order to create the first children record, the problem does not happen.
No tags attached.
Issue History
2012-08-02 13:36caristuNew Issue
2012-08-02 13:36caristuAssigned To => dbaz
2012-08-02 13:36caristuWeb browser => Mozilla Firefox
2012-08-02 13:36caristuModules => Core
2012-08-02 13:36caristuResolution time => 1350424800
2012-08-02 13:36caristuIssue Monitored: networkb
2012-08-02 14:03caristuWeb browserMozilla Firefox => Mozilla Firefox
2012-08-02 14:03caristuDescription Updatedbug_revision_view_page.php?rev_id=3692#r3692
2012-08-02 14:03caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3694#r3694
2012-08-09 21:43dbazNote Added: 0051226
2012-08-10 16:18dbazAssigned Todbaz => AugustoMauch
2012-08-10 16:31dbazNote Added: 0051249
2012-08-14 09:29AugustoMauchNote Added: 0051274
2012-08-14 10:03hgbotCheckin
2012-08-14 10:03hgbotNote Added: 0051275
2012-08-14 10:03hgbotStatusnew => resolved
2012-08-14 10:03hgbotResolutionopen => fixed
2012-08-14 10:03hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/433a0c50b71c27f0b1fc8225f7f17fdf7cb965ae [^]
2012-08-14 14:33AugustoMauchNote Added: 0051293
2012-08-14 14:33AugustoMauchStatusresolved => new
2012-08-14 14:33AugustoMauchResolutionfixed => open
2012-08-14 14:36AugustoMauchClosed by => migueldejuana
2012-08-14 14:36AugustoMauchWeb browserMozilla Firefox => Mozilla Firefox
2012-08-14 14:36AugustoMauchStatusnew => scheduled
2012-08-14 14:36AugustoMauchfix_in_branch => pi
2012-08-14 14:36AugustoMauchStatusscheduled => resolved
2012-08-14 14:36AugustoMauchResolutionopen => fixed
2012-08-21 02:01eintelauIssue Monitored: eintelau
2012-08-22 09:51caristuClosed bymigueldejuana => caristu
2012-08-22 09:51caristuNote Added: 0051446
2012-08-22 09:51caristuStatusresolved => closed

Notes
(0051226)
dbaz   
2012-08-09 21:43   
I can not reproduce the issue. Even more, the "Create one" action is defined in:

/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js

Line 900 inside "dataArrived" function:
      this.noDataEmptyMessage = '<span class="' + this.emptyMessageStyle + '">' + OB.I18N.getLabel('OBUIAPP_GridNoRecords') + '</span>' + '<span onclick="window[\'' + this.ID + '\'].view.newRow();" class="' + this.emptyMessageLinkStyle + '">' + OB.I18N.getLabel('OBUIAPP_GridCreateOne') + '</span>';


And as you can see this is a "view.newRow()" call.

Looking to the "New Row" toolbar button (that the issue description says that always work) is defined in:

/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js

Line 115 inside "NEW_ROW_BUTTON_PROPERTIES:" function:
        view.newRow();

So at the end the same function is called.
(0051249)
dbaz   
2012-08-10 16:31   
What I have noticed is that sometimes it adds two new rows, it is like the onclick happens twice. To fix it change line 900 (ob-view-grid.js) by


      this.noDataEmptyMessage = '<span class="' + this.emptyMessageStyle + '">' + OB.I18N.getLabel('OBUIAPP_GridNoRecords') + '</span>' + '<span onclick="this.onclick = new Function(); window[\'' + this.ID + '\'].view.newRow(); return false;" class="' + this.emptyMessageLinkStyle + '">' + OB.I18N.getLabel('OBUIAPP_GridCreateOne') + '</span>';

Note that I overwrite the onclick function in the same onclick, to ensure it is executed just one time.


Also in an environment where the issue can be reproduced, a test to try if the issue is fixed could be change line 900 by:

      this.noDataEmptyMessage = '<span class="' + this.emptyMessageStyle + '">' + OB.I18N.getLabel('OBUIAPP_GridNoRecords') + '</span>' + '<span onclick="this.onclick = new Function(); setTimeout(function() { window[\'' + this.ID + '\'].view.newRow(); }, 50); return false;" class="' + this.emptyMessageLinkStyle + '">' + OB.I18N.getLabel('OBUIAPP_GridCreateOne') + '</span>';

(it adds a timeout)
(0051274)
AugustoMauch   
2012-08-14 09:29   
The timeout fix that dbaz suggested works. I tried to fix it by forcing the focus of the tab before creating the new row, but it did not work:

'<span onclick="this.onclick = new Function();window[\'' + this.ID + '\'].view.parentTabSet.selectTab(window[\'' + this.ID + '\'].view.parentTabSet.getTabNumber(window[\'' + this.ID + '\'].view.tab));window[\'' + this.ID + '\'].view.newRow();"

dbaz fix will be used, along with the patch to prevent multiple clicks on the Create One button
(0051275)
hgbot   
2012-08-14 10:03   
Repository: erp/devel/pi
Changeset: 433a0c50b71c27f0b1fc8225f7f17fdf7cb965ae
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Aug 14 09:57:47 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/433a0c50b71c27f0b1fc8225f7f17fdf7cb965ae [^]

Fixes issue 21290: Creating first record no longer unresponsive

If a new record was created in a parent tab, and then the Create One record in the child tab was pushed while the focus was still in the parent tab, then the browser would freeze for a while and the Unresponsive Script warning would be shown (only in Firefox).

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
(0051293)
AugustoMauch   
2012-08-14 14:33   
Issue reopened to enter Closed by field
(0051446)
caristu   
2012-08-22 09:51   
Verified