web_translate_dialog: Display only fields displayed in the view

parent.renderer.state.fields includes all the fields in the model
whereas parent.renderer.state.getFieldNames() includes all the fields
displayed in the view.
This commit filters out fields that are not displayed in the view
to avoid the TypeError "undefined is not an object (evaluating '$('[name='+field_name+']')[0].maxLength')"
because translatable_fields did include fields that are not in the view.
pull/1699/head
Akim Juillerat 2020-10-08 17:18:05 +02:00
parent 27aa521220
commit bf06a84b9a
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ var TranslateDialog = Dialog.extend({
get_translatable_fields: function(parent) {
var field_list = [];
_.each(parent.renderer.state.fields, function(field, name){
if (field.translate == true){
if (field.translate == true && parent.renderer.state.getFieldNames().includes(name)){
field_list.push(name);
}
});