diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-01-23 13:39:09 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-01-23 13:39:09 +0100 |
| commit | b9374d5c2152a5142e29b1d9a1c037eeb1e72147 (patch) | |
| tree | d970dbc903c7ec029797005a5797c266fadd07a3 /addons/web/static/src/js | |
| parent | 734d9b56da5c57900171ee33b7aea3dbc1ece506 (diff) | |
| parent | 0997a1cf6dc0dbf48df93e5a708b1e823b7d725f (diff) | |
[MERGE] forward port branch 9.0 up to 0997a1cf6dc
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/framework/formats.js | 12 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/form_relational_widgets.js | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/addons/web/static/src/js/framework/formats.js b/addons/web/static/src/js/framework/formats.js index 90cecd5398d..bddc40f424d 100644 --- a/addons/web/static/src/js/framework/formats.js +++ b/addons/web/static/src/js/framework/formats.js @@ -161,26 +161,30 @@ function parse_value (value, descriptor, value_if_empty) { return parse_value(value, {type: "float"}); case 'datetime': var datetime = moment(value, [date_pattern + ' ' + time_pattern, date_pattern_wo_zero + ' ' + time_pattern_wo_zero, moment.ISO_8601], true); - if (datetime.isValid()) + if (datetime.isValid() && datetime.year() >= 1900) 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.year() === 0) { datetime.year(moment.utc().year()); } - return time.datetime_to_str(datetime.toDate()); + if (datetime.year() >= 1900) { + 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()) + if (date.isValid() && date.year() >= 1900) return time.date_to_str(date.toDate()); date = moment(value, [date_pattern, date_pattern_wo_zero, moment.ISO_8601]); if (date.isValid()) { if (date.year() === 0) { date.year(moment.utc().year()); } - return time.date_to_str(date.toDate()); + if (date.year() >= 1900) { + return time.date_to_str(date.toDate()); + } } throw new Error(_.str.sprintf(_t("'%s' is not a correct date"), value)); case 'time': diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 1a3f9e6a1cc..9a24eef6ae5 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -1061,8 +1061,10 @@ var One2ManyListView = X2ManyListView.extend({ this._dataset_changed = false; }); - this.on('warning', this, function(e) { // In case of a one2many, we do not want any warning which comes from the editor - e.stop_propagation(); + this.on('warning', this, function(e) { // In case of editable list view, we do not want any warning which comes from the editor + if (this.editable()) { + e.stop_propagation(); + } }); }, do_add_record: function () { |
