From f41690538dc15ecee2918a316f52c03683e88004 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 25 Oct 2017 14:13:36 +0200 Subject: [PATCH] [FIX] point_of_sale: date string ECMA 5.1 in Date() Before this commit, when opening the POS in IE11, then the customer list, the list was empty. This was due to condition that was wrongly evaluated as false due to the fact that IE11 apparently only wants ECMA5.1 to deal with constructing Date() from a string. After this commit, we construct the Date() object with the right string, and the list of customers doesn't disappear. OPW 776463 For reference: http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15 closes #20468 --- addons/point_of_sale/static/src/js/db.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/db.js b/addons/point_of_sale/static/src/js/db.js index 8c61f5ff6ae..4fdaa652a82 100644 --- a/addons/point_of_sale/static/src/js/db.js +++ b/addons/point_of_sale/static/src/js/db.js @@ -255,10 +255,12 @@ var PosDB = core.Class.extend({ for(var i = 0, len = partners.length; i < len; i++){ partner = partners[i]; - if ( this.partner_write_date && + var local_partner_date = (this.partner_write_date || '').replace(/^(\d{4}-\d{2}-\d{2}) ((\d{2}:?){3})$/, '$1T$2Z'); + var dist_partner_date = (partner.write_date || '').replace(/^(\d{4}-\d{2}-\d{2}) ((\d{2}:?){3})$/, '$1T$2Z'); + if ( this.partner_write_date && this.partner_by_id[partner.id] && - new Date(this.partner_write_date).getTime() + 1000 >= - new Date(partner.write_date).getTime() ) { + new Date(local_partner_date).getTime() + 1000 >= + new Date(dist_partner_date).getTime() ) { // FIXME: The write_date is stored with milisec precision in the database // but the dates we get back are only precise to the second. This means when // you read partners modified strictly after time X, you get back partners that were