will fetch daily allowance. The same can be achieved also without script by customizing form and writing “country_al.daily_allowance” into options like this:
frappe.ui.form.on("Expense Claim", "get_trip_rows", function(frm, cdt, cdn){
gettripduration(frm)
frm.refresh(); // this refresh has absolutely no effect on the child
});
function gettripduration(frm){
var child = cur_frm.add_child("allowances");
frappe.model.set_value(child.doctype, child.name, "country_al", frm.doc.country);
// this refresh has absolutely no effect on the child, it is not fetching anything...
cur_frm.refresh_field("allowances");
frm.refresh();
//
}
The allowances field will not update. The script cur_frm_add_fetch nor “country_al.daily_allowance” doesn’t work anymore.
thank you for your help. Actually there are 2 issues in that script. Your input would be very appreciated.
child table will not refresh
I don’t fully understand how is this possible - see screenshot. Day Start and Day End will not refresh, but Country is refreshed?!?
When I clik inside each cell, the datetime is there, it is just not visible.
issue with aloowances - what I want to achieve is as follows:
set country by script
based on country, write daily allowances into “daily_alowance” fiels - see my first post and screenshot of the doctype.
What is working: when I don’t fill-out country in child table by script, but rather manually select country, daily_allowance field is automatically populated - I know this is because of Options: country_al.daily_allowance
what is not working: as soon as I change and put this into the script: