summaryrefslogtreecommitdiff
path: root/addons/document
diff options
context:
space:
mode:
authorLucas Perais <lcsperais@gmail.com>2017-10-18 14:25:22 +0200
committerGitHub <noreply@github.com>2017-10-18 14:25:22 +0200
commit6c9e45576e8de511fb5da8b2118dd844b38c4782 (patch)
tree5fc4d1cb7f4f84e814c7c21eb89e30a6960bada4 /addons/document
parent4618cbd513036220fc210fadb1024ec1facd6559 (diff)
[FIX] document: display create_date of attachment timezone aware (#20242)
Before this commit, when putting the mouse over an attachment in the attachment drop menu list, the date time displayed was UTC only. After this commit, we convert that value to the correct timezone datetime. OPW 776704
Diffstat (limited to 'addons/document')
-rw-r--r--addons/document/static/src/js/document.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js
index 5fc69141583..0af85179b49 100644
--- a/addons/document/static/src/js/document.js
+++ b/addons/document/static/src/js/document.js
@@ -5,6 +5,7 @@ var core = require('web.core');
var Dialog = require('web.Dialog');
var framework = require('web.framework');
var Sidebar = require('web.Sidebar');
+var field_utils = require('web.field_utils');
var _t = core._t;
@@ -61,6 +62,7 @@ Sidebar.include({
*/
_processAttachments: function (attachments) {
//to display number in name if more then one attachment which has same name.
+ var self = this;
_.chain(attachments)
.groupBy(function (attachment) { return attachment.name; })
.each(function (attachment) {
@@ -75,6 +77,10 @@ Sidebar.include({
if (a.type === "binary") {
a.url = '/web/content/' + a.id + '?download=true';
}
+ a.create_date = field_utils.parse.datetime(a.create_date, 'create_date', {isUTC: true});
+ a.create_date_string = field_utils.format.datetime(a.create_date, 'create_date', self.env.context.params);
+ a.write_date = field_utils.parse.datetime(a.write_date, 'write_date', {isUTC: true});
+ a.write_date_string = field_utils.format.datetime(a.write_date, 'write_date', self.env.context.params);
});
this.items.files = attachments;
},