Raees
October 22, 2018, 12:00pm
1
Is it possible to add indicators in a form next to a field and update it to a different color depending what the field text is equal to?
For example in Issue doctype i have a field percentage. If the percentage is 100 then indicator will be green, if % is less than 70 then indicator is orange and so…
frm.set_indicator_formatter('item_code',
function(doc) {
return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
})
frappe.provide("erpnext.stock.delivery_note");
frappe.provide("erpnext.accounts.dimensions");
frappe.ui.form.on("Delivery Note", {
setup: function(frm) {
frm.custom_make_buttons = {
'Packing Slip': 'Packing Slip',
'Installation Note': 'Installation Note',
'Sales Invoice': 'Sales Invoice',
'Stock Entry': 'Return',
'Shipment': 'Shipment'
},
frm.set_indicator_formatter('item_code',
function(doc) {
return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
})
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});
erpnext.queries.setup_warehouse_query(frm);
Raees
October 22, 2018, 12:27pm
3
Will this indicator be added next to the field name percentage?
frm.set_indicator_formatter(‘percentage’,
function(doc) {
return (doc.percentage==“100” || doc.percentage==“65”) ? “green” : “red”
})