Show child field in Standard Filter

I want to show Item Code in standard filter on Sales Invoice via Customize form and check ‘In Standard Filter’ option…but its not working

It seems the feature only applied to parent doctype?

In the Standard filter, we can only add fields of the parent form. Item Code in the Sales Invoice is in the Sales Invoice Item table.

is there any possibilities in version 12 to make standard filter for field in child table?

Hello did any of you find a solution?

To add a Standard Filter for a child table?

No, this is currently not supported by Frappe Framework.

@jof2jc

  1. in custom app’s hooks.py
    uncomment and modify the line as below


    doctype_list_js = {"Sales Invoice" : "public/js/sales_invoice_list.js"}

  2. in your custom app public/js/sales_invoice_list.js file copy the code below


    frappe.listview_settings[‘Sales Invoice’] = {

     onload: function (listview) {
    
         var df = {
    
             fieldname: "item_code",
    
             label:"Item Code",
    
             fieldtype: "Link",
    
             options:"Item",
    
             onchange: function(){
    
                 listview.start = 0;
    
                 listview.refresh();
    
                 listview.on_filter_change();
    
             },
    
         }
    
         listview.page.add_field(df);
    
     }
    

    };

  3. Final result

3 Likes

This worked for me, thank you so much.

Hi, I used this solution post#6 but now I have message “Field not permitted in query”

Can anyone help me ?

Thanks

Thanks, exactly what I needed ! Is that possible to apply the solution without access to the required files ? The instance I’m working on is hosted on frappe cloud.

Yes, you can create the client script.

Can you please tell how could we add standard filter in list.js by using document’s child table…?