Posts

Showing posts from July, 2022

Calculate Child Table Column and Sum it on Custom Field

frappe . ui . form . on ( 'Parent Doctype' , { refresh ( frm ) { frappe . ui . form . on ( 'Child Doctype' , {         child_doctype_field : function ( frm , cdt , cdn ){              var d = locals [ cdt ][ cdn ] ;              var totalx = 0 ;              frm . doc .F ield_Name_in_Parent . forEach ( function ( d ) { totalx += flt ( d . child_doctype_field ) ; }) ;              frm . set_value ( "custom_field" , totalx ) ;              refresh_field ( "custom_field" ) ;              },          table_4_remove : function ( frm , cdt , cdn ){              var d = locals [ cdt ][ cdn ] ;              var totalx = 0 ;              frm . doc .  F ield_Name_in_Parent . forEach ( function ( d ) { totalx += flt ( d . child_doctype_field ) ; }) ;              frm . set_value ( "custom_field" , totalx ) ;              refresh_field ( "custom_field" ) ;              }          }) ; });