[FIX] web: focus field in editable listview
If one click on empty area of button at that time we should set focus of the field based on field order. Do not evict record from dataset, otherwise it will go to read from database and will do server call for read, if user is cancelling in one2many then there is no need to read record from database, this will also fix the issue of unorder execution of event trigger. (opw 613100)
This commit is contained in:
committed by
Martin Trigaux
parent
bae5a75ce1
commit
f8b48c8d61
@@ -4487,9 +4487,11 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
||||
window.confirm = confirm;
|
||||
}
|
||||
},
|
||||
reload_record: function (record) {
|
||||
// Evict record.id from cache to ensure it will be reloaded correctly
|
||||
this.dataset.evict_record(record.get('id'));
|
||||
reload_record: function (record, options) {
|
||||
if (!options || !options['do_not_evict']) {
|
||||
// Evict record.id from cache to ensure it will be reloaded correctly
|
||||
this.dataset.evict_record(record.get('id'));
|
||||
}
|
||||
|
||||
return this._super(record);
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
$recordRow.addClass('oe_edition');
|
||||
self.resize_fields();
|
||||
var focus_field = options && options.focus_field ? options.focus_field : undefined;
|
||||
if (!focus_field){
|
||||
if (!focus_field || !fields[focus_field]){
|
||||
focus_field = _.find(self.editor.form.fields_order, function(field){ return fields[field] && fields[field].$el.is(':visible:has(input)'); });
|
||||
}
|
||||
if (focus_field && fields[focus_field]) fields[focus_field].$el.find('input').select();
|
||||
@@ -364,7 +364,7 @@
|
||||
// Record removed by third party during edition
|
||||
return;
|
||||
}
|
||||
return self.reload_record(record);
|
||||
return self.reload_record(record, {do_not_evict: true});
|
||||
}
|
||||
var to_delete = self.records.find(function (r) {
|
||||
return !r.get('id');
|
||||
@@ -805,7 +805,7 @@
|
||||
var record_id = $(event.currentTarget).data('id');
|
||||
return this.view.start_edition(
|
||||
record_id ? this.records.get(record_id) : null, {
|
||||
focus_field: $(event.target).data('field')
|
||||
focus_field: $(event.target).not(".oe_readonly").data('field')
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user