Fixes issue 20348: Date properly saved when using shortcut in grid
authorAugusto Mauch <augusto.mauch@openbravo.com>
Wed, 25 Apr 2012 16:55:56 +0200
changeset 16473 01ec47428462
parent 16472 3ea76694b4f9
child 16474 936e350ed6ca
Fixes issue 20348: Date properly saved when using shortcut in grid

When the row was saved using the shortcut, the new values were being obtained before the date was updated. This has been changed so that the date will be updated before the new values to be saved are obtaine
d.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js	Thu Apr 26 18:37:11 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js	Wed Apr 25 16:55:56 2012 +0200
@@ -243,7 +243,13 @@
   // update the value in update value as this is called from cellEditEnd in the
   // grid, after losing the focus on the form and when autosaving
   updateValue: function () {
-    if (this.grid && this.grid._preventDateParsing && !this.grid._autoSaving) {
+    var savingWithShortcut;
+    if (this.grid && this.grid.view && this.grid.view.savingWithShortcut) {
+      savingWithShortcut = this.grid.view.savingWithShortcut;
+    } else {
+      savingWithShortcut = false;
+    }
+    if (this.grid && this.grid._preventDateParsing && !this.grid._autoSaving && !savingWithShortcut) {
       return;
     }
     if (this.textField._textChanged) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Thu Apr 26 18:37:11 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Wed Apr 25 16:55:56 2012 +0200
@@ -32,7 +32,9 @@
 
   SAVE_BUTTON_PROPERTIES: {
     action: function () {
+      this.view.savingWithShortcut = true;
       this.view.saveRow();
+      delete this.view.savingWithShortcut;
     },
     disabled: true,
     buttonType: 'save',