details: https://code.openbravo.com/erp/devel/pi/rev/e282c64e6e90 changeset: 26166:e282c64e6e90 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Mar 12 10:39:35 2015 +0100 summary: Fixes issue 29092: Inconsistent data is not shown in the form view
This issue was reproduced in the following scenario: - A subtab is open in form view - A change is done in its parent tab. That change (either through an event handler or through a trigger) deletes the record selected in the subtab and creates a new one - The subtab is automatically refreshed. When the tab is refreshed: * The whole grid is reloaded, it now contains all the current records * The form view is shown again, and it tries to obtain the updated records from the grid. As the record selected in the form view is not present in the grid, the form view contains the old values To fix this, when the record that was selected in the form view is no longer contained in the grid after the tab is refreshed, the form view is not shown. This was the grid view will be visible, and it will show the updated info. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (25 lines): diff -r ac9670b7bfdd -r e282c64e6e90 modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Wed Mar 11 13:23:31 2015 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js Thu Mar 12 10:39:35 2015 +0100 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2014 Openbravo SLU + * All portions are Copyright (C) 2010-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -1228,7 +1228,11 @@ me.viewGrid.selectRecord(recordIndex); } if (me.formVisibleBeforeRefresh) { - me.switchFormGridVisibility(); + if (me.viewGrid.getRecordIndex(me.viewForm.getValues()) !== -1) { + // it might be that the record selected in the form is no longer present in the grid after being refreshed, due to having been deleted + // in that case do not switch to form view, and keep the grid view to show the currently existing records + me.switchFormGridVisibility(); + } } delete me.formVisibleBeforeRefresh; delete me.viewGrid.recordsSelectedBeforeRefresh; ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits