Skip to content

Commit

Permalink
[12.0][ADD] web_translate_dialog: remove hidden field from wizzard
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilmanuel committed Nov 18, 2024
1 parent a896df0 commit cea087e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion web_translate_dialog/static/src/js/web_translate_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,24 @@ var TranslateDialog = Dialog.extend({
}
});
},
get_list_hidden_field_names: function(parent) {
var field_list = [];
var record_id = this.record_id;
_.each(parent.renderer.allModifiersData, function(modifier){
var evaluatedmodifier = modifier.evaluatedModifiers[record_id];
if (modifier.node.tag == 'field' && evaluatedmodifier && evaluatedmodifier.hasOwnProperty("invisible") && evaluatedmodifier.invisible == true){
field_list.push(modifier.node.attrs.name);
}
});
return field_list;
}
,
get_translatable_fields: function(parent) {
var field_list = {};
var hidden_fields = this.get_list_hidden_field_names(parent);
_.each(parent.renderer.state.fields, function(field, name){
var related_readonly = typeof field.related !== 'undefined' && field.readonly;
if (field.translate == true && !related_readonly && parent.renderer.state.getFieldNames().includes(name)){
if (field.translate == true && !related_readonly && parent.renderer.state.getFieldNames().includes(name) && !hidden_fields.includes(name)){
field_list[name] = field;
}
});
Expand Down

0 comments on commit cea087e

Please sign in to comment.