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…?

Hello. Please explain how this can be done on frappe cloud.

you can create client script.

Hello @szufisher
I have done what you did, but the following message appears:
and student filter appears the right side .

Thank you bro

Hi @csampedroc
Is your problem solved ?

Hello
Is it solved or not yet?

1 Like

Hello @Syaima_Thamrin
It has not been resolved yet

Using version 15 here. My solution was to use a custom field which stores the desired field’s value. Set Is Standard Filter for the custom field as well as Hidden.

Using doc_event or client-script, the custom field value can be set ‘before_save’, ‘validate’, etc.

It is a data redundancy, I do understand, but it is a very clean and simple workaround.

I couldn’t find an API solution to the insertion of the search field. This is why I used the method above.