I am trying to pass the value from the field named “Region” in parent doctype “Stationery Request” to the child doctype named “Item List” which show as table in the parent with the field
Region (hidden)
Location (show in list view)
QTY (show in list view)
Price (show in list view)
I already written the filter for the other fields based on the Region which populate data from another doctype.
Region must contain the same value as parent doctype so the filter would work please let me know how to pass the value for the one field.
Thks for the response. But I looking for creating a child table with 8 columns. Once user clicks the add row product line column need to appear by default and other columns need to populate based on the selection.
Product Line - which depends on parent doctype
Category - which need to populate with select datatype populate with filtering targeting the column " product line" as primary key and produce the category from another doctype named “Category”
Sub Category - Once Category field selected then using the value from Category child field it need to populate the Sub category by filtering another doctype named Sub category… Same goes on for other fields
When using the child table event and clicking on “add row”, the data will automatically populate based on the scenario.
items_add(frm, cdt, cdn) { // "items" is the name of the table field in XYZ DocType, "_add" is the event
frappe.model.set_value(row.doctype, row.name, 'product_line', frm.doc.product_line);
}
please check your child table name and set it in the script according to the scenario.
Hi thks could u pls brief in where I need to define this function I am using the javascript and I don’t have the permission for the client script currently let me know whether it can be achieved thks in advance
I m beginner level in frappe, I know but currently we are facing some issue with server so they restricted for now will receive in later stage.
I came with the alternative solution created the section with all the values with one button which could push the value to the table.
but here also I am facing issue.
Pls advise as the button not getting triggered second time
add_item: function(frm) {
// Add a new row to the child table with values from the parent document
var new_row = frm.add_child('item_list');
new_row.category = frm.doc.category;
new_row.sub_category = frm.doc.sub_category;
// Add more fields as needed
// Refresh the child table to show the new row
frm.refresh_field('item_list');
frm.refresh();
}
Thks for the response but I want this button to act as the same as add new in the child table i.e., Inserting the row in the child table whether it is capable or not as it didnt work for me.