Warehouse Filter in a Sales Order

Can anyone help us in this Client Script on Frappe ERPNext on the Sales Order where in a Sales Order there is Field “Set Source Warehouse” should display the Warehouse “Trading Warehouse – TRD” and “Finished Goods – TRD” and also in the Sales Invoice Item Child Table, it should filter the Item lying in the warehouse “Trading Warehouse – TRD” and “Finished Goods – TRD”

Hi @jitendra,

That for, please apply the code.

frappe.ui.form.on("Sales Order", {
    refresh:function(frm) {
        frm.set_query("set_warehouse", function() {
            return {
                "filters": {
                    'name': ['in', ['Trading Warehouse – TRD', 'Finished Goods – TRD']]
                }
            };
        });
    }
});

That for customization needs with some logic.
If you haven’t checked the concept then please check the documentation.

Thank You!

Thanks, @NCP for your attention to my query.

I have tried the same code, but in the Filter, it is not displaying the Warehouse- * Finished Goods - TRD and * Trading Warehouse - TRD. It is showing Blank in the Set Warehouse Field can I add in the Child Table under the Delivery Warehouse- the same warehouse should get filtered.

Please check the warehouse name and reload and check it

Hi @jitendra,

We applied the code so it worked.

frappe.ui.form.on("Sales Order", {
    refresh:function(frm) {
        frm.set_query("set_warehouse", function() {
            return {
                "filters": {
                    'name': ['in', ['Finished Goods - N', 'Stores - N']]
                }
            };
        });
    }
});

Output:

Thank You!