Try ERPNext Buy Support Partners Foundation

Add values to select options child table

frappe.ui.form.on('Clauses Contrat', {

doc_type: function(cur_frm, cdt, cdn) {
   let row = frappe.get_doc(cdt, cdn);		
       if (!row.doc_type) {
		frappe.msgprint(__("Select Document Type."));
		return;
    }
    frappe.model.with_doctype(row.doc_type, function() {
	var options = $.map(frappe.get_meta(row.doc_type).fields,
			function(d) {
			if(d.fieldname && frappe.model.no_value_type.indexOf(d.fieldtype)===-1) {
			return d.fieldname;
		        }
			return null;
			}
		);
          console.log('test options select field' + options);

          frappe.meta.get_docfield("Clauses Contrat", "fields", cur_frm.doc.name).options = [""].concat(options);
          cur_frm.refresh_field("fields");


	});
}

 });

I return values in console but not added to the select options the problem in this line I dont know how can i resolve the problem

     frappe.meta.get_docfield("Clauses Contrat", "fields", cur_frm.doc.name).options = [""].concat(options);
     cur_frm.refresh_field("fields");

testttingggg
any help please

As you have discovered there is little to no documentation on any of this. I would suggest assigning your options list to a variable you can console log to check.

It only worked for us by using a newline character (\n) between option values

thank you for your reply I resolve the problem

For benefit of others that may run across same situation it is appreciated if you post the solution/correction resolved the issue.

I just a dd the value to fields

frappe.model.set_value(cdt, cdn,"fields", options);

to become

frappe.meta.get_docfield("DoctypeName", "fields", cur_frm.doc.name).options = [""].concat(options);
frappe.model.set_value(cdt, cdn,"fields", options);
cur_frm.refresh_field("fields");