[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
This commit is contained in:
Denis Ledoux 2014-06-17 12:56:13 +02:00
parent 63ea0df73f
commit a32e989fba
1 changed files with 3 additions and 2 deletions

View File

@ -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");
}