From a32e989fbadab7691191d8872e69970d4763b8fe Mon Sep 17 00:00:00 2001 From: Denis Ledoux <dle@odoo.com> Date: Tue, 17 Jun 2014 12:56:13 +0200 Subject: [PATCH] [FIX] web: save date(time) field value on key enter in editable list In editable list, on keypress enter, the _next method is called, saving the current line and starting the edition of the next one The _next is triggered before the date(time) field change event, and, therefore, the saved value of the date(time) field is the old one --- addons/web/static/src/js/view_form.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e9f195b892a1..fec7ce106075 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2422,6 +2422,7 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ type_of_date: "datetime", events: { 'change .oe_datepicker_master': 'change_datetime', + 'keypress .oe_datepicker_master': 'change_datetime', }, init: function(parent) { this._super(parent); @@ -2540,8 +2541,8 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ format_client: function(v) { return instance.web.format_value(v, {"widget": this.type_of_date}); }, - change_datetime: function() { - if (this.is_valid_()) { + change_datetime: function(e) { + if ((e.type !== "keypress" || e.which === 13) && this.is_valid_()) { this.set_value_from_ui_(); this.trigger("datetime_changed"); } -- GitLab