Hi,
I’ve searched on existing posts but I didn’t find the solution.
I’ve a structure like this:
Parent DocType: Brand
Field 1: Brand name (data field)
Field 2: Model (a Table field)
Child DocType: Model (set as Child Table)
Field 1: Model name (data field)
So I have a simple structure where I can add a Brand and inside it add multiple Models see image:
I have created a DocType where I have 2 fields:
Field 1: Brand (link field)
Field 2: Model (link field)
What I need is to filter Model items by Brand selected field (if I select Brand 1, I want that Model field shows only Models from Brand 1)
I think that the script in my form would be something similar:
brand(frm) {
frm.set_query("model", (doc) => {
return {
filters: {
"brand_field": doc.brand
}
}
});
}
Instead of “brand_field” I need to refer to the parent brand field of the model doctype, but model doctype doesn’t have a brand field, because it is a child table. How can I filter the child doctype based on the brand selected field?
I’ve tried using “parentfield” (Child / Table DocType) but it doesn’t work.
Thanks
