# HG changeset patch
# User Rafa Alonso <ral@openbravo.com>
# Date 1438346819 -7200
#      Fri Jul 31 14:46:59 2015 +0200
# Node ID c8a01eb495fed346c92a2e8ab7864d54c5ee0994
# Parent  8bc4e8c08ab7f01ff5df93950a605d42fa5969b9
Fix the incoming 'creationDate' in case it is not correct (multiorders)

diff -r 8bc4e8c08ab7 -r c8a01eb495fe web/org.openbravo.retail.posterminal/js/data/dataordersave.js
--- a/web/org.openbravo.retail.posterminal/js/data/dataordersave.js	Fri Jul 31 12:31:57 2015 +0200
+++ b/web/org.openbravo.retail.posterminal/js/data/dataordersave.js	Fri Jul 31 14:46:59 2015 +0200
@@ -219,14 +219,14 @@
           docno = this.receipt.get('documentNo'),
           isLayaway = (this.receipt.get('orderType') === 2 || this.receipt.get('isLayaway')),
           json = this.receipt.serializeToJSON(),
-          receiptId = this.receipt.get('id'),
-          creationDate = this.receipt.get('creationDate') || new Date();
+          receiptId = this.receipt.get('id');
 
-      // issue 29164: sometimes, the quotations are sync without creation date
-      if (creationDate === "Invalid Date") {
+      var creationDate = this.receipt.get('creationDate');
+      if (!creationDate || !creationDate.getTimezoneOffset) {
+        OB.info("Multiorders ticket closed: 'creationDate' set to '" + new Date() + "' (was '" + creationDate + "')");
         creationDate = new Date();
       }
-
+      
       this.receipt.set('creationDate', creationDate);
       this.receipt.set('hasbeenpaid', 'Y');
       this.context.get('multiOrders').trigger('integrityOk', this.receipt);
