fix(UX): set default print language from print format
This commit is contained in:
parent
c293a35dda
commit
c00a34d023
1 changed files with 18 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ frappe.views.CommunicationComposer = class {
|
|||
}
|
||||
|
||||
get_fields() {
|
||||
let me = this;
|
||||
const fields = [
|
||||
{
|
||||
label: __("To"),
|
||||
|
|
@ -144,6 +145,9 @@ frappe.views.CommunicationComposer = class {
|
|||
label: __("Select Print Format"),
|
||||
fieldtype: "Select",
|
||||
fieldname: "select_print_format",
|
||||
onchange: function () {
|
||||
me.guess_language();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: __("Print Language"),
|
||||
|
|
@ -195,6 +199,19 @@ frappe.views.CommunicationComposer = class {
|
|||
return fields;
|
||||
}
|
||||
|
||||
guess_language() {
|
||||
// when attach print for print format changes try to guess language
|
||||
// if print format has language then set that else boot lang.
|
||||
let lang = frappe.boot.lang;
|
||||
|
||||
let print_format = this.dialog.get_value("select_print_format");
|
||||
|
||||
if (print_format != "Standard") {
|
||||
lang = frappe.get_doc("Print Format", print_format)?.default_print_language || lang;
|
||||
}
|
||||
this.dialog.set_value("print_language", lang);
|
||||
}
|
||||
|
||||
toggle_more_options(show_options) {
|
||||
show_options = show_options || this.dialog.fields_dict.more_options.df.hidden;
|
||||
this.dialog.set_df_property("more_options", "hidden", !show_options);
|
||||
|
|
@ -504,6 +521,7 @@ frappe.views.CommunicationComposer = class {
|
|||
} else {
|
||||
$(fields.attach_document_print.wrapper).toggle(false);
|
||||
}
|
||||
this.guess_language();
|
||||
}
|
||||
|
||||
setup_attach() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue