Currently if you want add number of related childtables in the Doctype dashboard you do something like this:
example from item_dashboard.py
'transactions': [
{
'label': _('Traceability'),
'items': ['Serial No', 'Batch']
},
but assume that you want to count Batches that have some Custom condition like Batches with qty > 0
How this can be done “frappe / erpnext” customization way?
because now I using a combination of a callback and JQuery
refresh: function(frm){
console.log($('div[data-doctype="Batch"]').find('span').text())
frappe.call({
method: 'newmatik.api.kitting_data.item_active_batches',
freeze: true,
args: {
'item_code': frm.doc.item_code,
},
callback: function(r){
console.log(r.message.length)
$('div[data-doctype="Batch"]').find('span').text(r.message.length)
}
})
},