Skip to content

Commit

Permalink
feat(Banking Settings): show field label instead of name
Browse files Browse the repository at this point in the history
(cherry picked from commit d0b2d43)
  • Loading branch information
barredterra authored and mergify[bot] committed Dec 12, 2024
1 parent d311583 commit 5e196fe
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,29 @@ frappe.ui.form.on('Banking Reference Mapping', {
});

function set_field_options(frm, cdt, cdn) {
let doc = frappe.get_doc(cdt, cdn);
let document_type = doc.document_type || "Sales Invoice";
const doc = frappe.get_doc(cdt, cdn);
const document_type = doc.document_type || "Sales Invoice";

// set options for `field_name`
frappe.model.with_doctype(document_type, () => {
let meta = frappe.get_meta(document_type);
let fields = meta.fields.filter((field) => {
const meta = frappe.get_meta(document_type);
const fields = meta.fields.filter((field) => {
return (
["Link", "Data"].includes(field.fieldtype)
&& field.is_virtual === 0
);
});
let fieldnames = fields.map((field) => field.fieldname).sort();

let grid = frm.fields_dict.reference_fields.grid;
grid.update_docfield_property("field_name", "options", fieldnames);
frm.fields_dict.reference_fields.grid.update_docfield_property(
"field_name",
"options",
fields.map((field) => {
return {
value: field.fieldname,
label: __(field.label),
}
}).sort((a, b) => a.label.localeCompare(b.label))
);
frm.refresh_field("reference_fields");
});
}
Expand Down

0 comments on commit 5e196fe

Please sign in to comment.