Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][ADD] web_translate_dialog: remove hidden field from wizzard #2992

Open
wants to merge 1 commit into
base: 12.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (modifier.node.tag == 'field' && evaluatedmodifier && evaluatedmodifier.hasOwnProperty("invisible") && evaluatedmodifier.invisible == true){
if (modifier.node.tag == 'field' && evaluatedmodifier?.invisible){

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
Loading