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.
This commit is contained in:
Akim Juillerat
2020-10-08 17:18:05 +02:00
committed by fshah
parent f2bdcdf3da
commit d4c4cbf2e0

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