Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020398Openbravo ERPA. Platformpublic2012-05-03 10:292012-05-28 10:10
AugustoMauch 
dbaz 
urgentmajoralways
closedfixed 
5
pi 
3.0MP123.0MP12 
Core
No
0020398: Wrong buttons are shown when creating a new row in grid
When a new row is created in the grid by pushing the "Insert row" button with any other line previusly selected, the buttons placed in the left part of the record are "Click to open the record in a form" and the "Click to edit the record in the grid", instead of "Click to cancel your changes" and "Click to save your changes in the database".
- Open any window
- Select any row
- Create a new row in the grid using the "Insert row" button
No tags attached.
has duplicate defect 0020401 closed alostale Edited line cannot be saved 
Issue History
2012-05-03 10:29AugustoMauchNew Issue
2012-05-03 10:29AugustoMauchAssigned To => dbaz
2012-05-03 10:29AugustoMauchModules => Core
2012-05-03 13:15AugustoMauchRelationship addedhas duplicate 0020401
2012-05-03 16:17dbazNote Added: 0048344
2012-05-03 16:49dbazNote Added: 0048348
2012-05-03 16:50dbazNote Added: 0048349
2012-05-03 16:51hgbotCheckin
2012-05-03 16:51hgbotNote Added: 0048351
2012-05-03 17:06dbazDescription Updatedbug_revision_view_page.php?rev_id=3428#r3428
2012-05-03 17:06dbazSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3430#r3430
2012-05-07 21:38hgbotCheckin
2012-05-07 21:38hgbotNote Added: 0048423
2012-05-07 21:38hgbotStatusnew => resolved
2012-05-07 21:38hgbotResolutionopen => fixed
2012-05-07 21:38hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/fd786ec8e05c5ea5457f6866b80fe56a1a0c2e0d [^]
2012-05-25 12:09hudsonbotCheckin
2012-05-25 12:09hudsonbotNote Added: 0049014
2012-05-25 12:10hudsonbotCheckin
2012-05-25 12:10hudsonbotNote Added: 0049043
2012-05-28 10:10AugustoMauchNote Added: 0049338
2012-05-28 10:10AugustoMauchStatusresolved => closed
2012-05-28 10:10AugustoMauchFixed in Version => 3.0MP12

Notes
(0048344)
dbaz   
2012-05-03 16:17   
The problem is here

https://code.openbravo.com/erp/devel/pi/file/18676afefe0c/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js#l2302 [^]

And the source of the problem is quite strange

If before this line we do
  console.log(record);
  console.log(record.editColumnLayout);

we see that the first one returns an object and the second one is "undefined". But, if we unfold this record object, we see that "editColumnLayout" is there!!

If we do this
  var recordClone = {};
  for(var k in recordClone) recordClone [k]=record[k];
  console.log(record);
  console.log(recordClone);
we see that in fact, recordClone has less items that record (including editColumnLayout).

It is strange, it seems that there is any kind of delay here
  var record = this.getRecord(rowNum);
and the data is not instantly retrived.


Replacing this
  if (record && record.editColumnLayout) {
    record.editColumnLayout.showSaveCancel();
  }

by this
  setTimeout(function() {
    if (record && record.editColumnLayout) {
      record.editColumnLayout.showSaveCancel();
    }
   }, 1);

the issue would be solved, but a big research should be done in order to determine why the "getRecord" function has this strange delay.
(0048348)
dbaz   
2012-05-03 16:49   
Maybe this is somehow related:
https://code.openbravo.com/erp/devel/pi/file/18676afefe0c/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js#l1862 [^]
(0048349)
dbaz   
2012-05-03 16:50   
The setTimeout solution is going to be pushed as a "temporary" fix, in order to avoid noise and some people reporting the same thing.

Once a proper solution be implemented, this temporary fix should be reverted.
(0048351)
hgbot   
2012-05-03 16:51   
Repository: erp/devel/pi
Changeset: d11d7ecffa6f630c1047ce798aac7bdf3f6f9c16
Author: David Baz Fayos <david.baz <at> openbravo.com>
Date: Thu May 03 16:51:23 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/d11d7ecffa6f630c1047ce798aac7bdf3f6f9c16 [^]

Related to issue 20398: Temporary fix
- Read the issue comments to get all the information

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
(0048423)
hgbot   
2012-05-07 21:38   
Repository: erp/devel/pi
Changeset: fd786ec8e05c5ea5457f6866b80fe56a1a0c2e0d
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon May 07 21:38:24 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/fd786ec8e05c5ea5457f6866b80fe56a1a0c2e0d [^]

Fixes issue 20398: Wrong buttons are shown when creating a new row in grid
Set the record component in the correct state for a new record, when
the record component gets created/re-used.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
---
(0049014)
hudsonbot   
2012-05-25 12:09   
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/5401e185a8b0 [^]

Maturity status: Test
(0049043)
hudsonbot   
2012-05-25 12:10   
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/5401e185a8b0 [^]

Maturity status: Test
(0049338)
AugustoMauch   
2012-05-28 10:10   
Code reviewed and verified in pi@520938516719