summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-12-01 16:59:33 +0100
committerChristophe Simonis <chs@odoo.com>2016-12-01 16:59:33 +0100
commit5dc1c576011d801bf5f6bbb977cdd5373d178b54 (patch)
tree435e972f3d575db7d04773465871b2e9821872bb /addons/web/static/src/js/framework
parent4f43ec4fcf924441ef1cdeebb14ee05970a2ee1b (diff)
parent7842498934fbc9a1bf925bde4815b6a63ec81440 (diff)
[MERGE] forward port branch saas-11 up to 7842498
Diffstat (limited to 'addons/web/static/src/js/framework')
-rw-r--r--addons/web/static/src/js/framework/formats.js12
-rw-r--r--addons/web/static/src/js/framework/translation.js4
2 files changed, 11 insertions, 5 deletions
diff --git a/addons/web/static/src/js/framework/formats.js b/addons/web/static/src/js/framework/formats.js
index 7a47d7076c4..d084b285f6c 100644
--- a/addons/web/static/src/js/framework/formats.js
+++ b/addons/web/static/src/js/framework/formats.js
@@ -164,16 +164,24 @@ function parse_value (value, descriptor, value_if_empty) {
if (datetime.isValid())
return time.datetime_to_str(datetime.toDate());
datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601]);
- if (datetime.isValid())
+ if (datetime.isValid()) {
+ if (datetime.year() === 0) {
+ datetime.year(moment.utc().year());
+ }
return time.datetime_to_str(datetime.toDate());
+ }
throw new Error(_.str.sprintf(_t("'%s' is not a correct datetime"), value));
case 'date':
var date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601], true);
if (date.isValid())
return time.date_to_str(date.toDate());
date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601]);
- if (date.isValid())
+ if (date.isValid()) {
+ if (date.year() === 0) {
+ date.year(moment.utc().year());
+ }
return time.date_to_str(date.toDate());
+ }
throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value));
case 'time':
var _time = moment(value, [time_pattern, time_pattern_wo_zero, moment.ISO_8601], true);
diff --git a/addons/web/static/src/js/framework/translation.js b/addons/web/static/src/js/framework/translation.js
index e02553ad203..f2bad0db4ee 100644
--- a/addons/web/static/src/js/framework/translation.js
+++ b/addons/web/static/src/js/framework/translation.js
@@ -28,9 +28,7 @@ var TranslationDataBase = Class.extend(/** @lends instance.TranslationDataBase#
});
if (translation_bundle.lang_parameters) {
this.parameters = translation_bundle.lang_parameters;
- if (typeof(py) !== "undefined") {
- this.parameters.grouping = py.eval(this.parameters.grouping);
- }
+ this.parameters.grouping = JSON.parse(this.parameters.grouping);
}
},
add_module_translation: function(mod) {