Get text from link formatter in indicator formatter function (#6266)
This commit is contained in:
parent
04d255bc5f
commit
3e694eb8ff
1 changed files with 10 additions and 1 deletions
|
|
@ -446,12 +446,21 @@ _f.Frm.prototype.set_indicator_formatter = function(fieldname, get_color, get_te
|
|||
frappe.meta.docfield_map[doctype][fieldname].formatter =
|
||||
function(value, df, options, doc) {
|
||||
if(value) {
|
||||
var label;
|
||||
if(get_text) {
|
||||
label = get_text(doc);
|
||||
} else if(frappe.form.link_formatters[df.options]) {
|
||||
label = frappe.form.link_formatters[df.options](value, doc);
|
||||
} else {
|
||||
label = value;
|
||||
}
|
||||
|
||||
const escaped_name = encodeURIComponent(value);
|
||||
return repl('<a class="indicator %(color)s" href="#Form/%(doctype)s/%(name)s">%(label)s</a>', {
|
||||
color: get_color(doc || {}),
|
||||
doctype: df.options,
|
||||
name: escaped_name,
|
||||
label: get_text ? get_text(doc) : value
|
||||
label: label
|
||||
});
|
||||
} else {
|
||||
return '';
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue