Hi,
I have a problem with a Link field inside a child table.
I created a doctype called Case with a field “Case Type” and it has a child table called “Status Shipping”, this child table has two fields: Item (type link to Doctype Item) and Reason (type link to Doctype Cancellation Reason, that I created too).
I need to filter the field Reason based on the field Case Type and the Item that the user selects, this is my code:
frappe.ui.form.on('Status Shipping', {
item(frm, cdt, cdn) {
const case_type = frm.doc.case_type
let item = frm.selected_doc.item
const filters = {
case_type,
item
}
frm.fields_dict.status_shipping.grid.get_field('reason').get_query = function() {
return {
query: 'zecore_crm.zecore_crm.doctype.case.case.get_item_reasons',
filters
}
}
}
})
This code is not working, because I need the filter to change when the Item changes, and this is not happening
However, if I close the modal and I re-open it, and I see the field, now the filters have been applied:
I have tried by refreshing the field, but it didn’t work, I think that a solution could be to close and re-open the modal automatically, but I don’t know how to do it either.
Is there any solution to this problem?
Thank you