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 16515 d7a6f96f5831
parent 16514 f4c64b25b00b
child 16516 21fc11601168
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	Mon Apr 23 17:44:56 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	Mon Apr 23 17:44:56 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',