Maximum / limitation size of data inserting into link field type

Hi,

I have stumble an issue when inserting too many data into link type field using callback method.

Scenario.

In Purchase Invoice doctyype , i have to filter item_code in items table based on Company selected. For each company, the item list may vary, some of them have just a little and some of them have qty more than 900 of items.

The problem is, whenever i select company that have alot of items to be listed into the field, ie > 900 ,the error as below persist.

Tested with company that have less items, such as 450 and below, all manage to get listed into item_code field without error.

Thanks.

Can you share your code?

Sure,

JS Script:

frappe.ui.form.on("Purchase Order", "company", function(frm) {
    cur_frm.clear_table("items");
    frappe.call({
            "method": "custom_app.custom_app.doctype.po_custom.po_custom.filter_items_by_company",

            "args": {
                    company : frm.doc.company

            },

            callback: function(d){
                console.log(d.message);
                cur_frm.set_query("item_code","items" ,function() {
                    return{
                       filters:[
                                ["Item", "name", "in", d.message]

                       ]
                    }
                });

            }

           });
    refresh_field("items")
    });

Py function:

@frappe.whitelist()
def filter_items_by_company(company):

	item_list = []

	item_by_company = frappe.db.sql("""SELECT t1.name from `tabItem`t1, `tabDefault Warehouses` t2 WHERE t2.parent = t1.name and t2.company =%s """,(company))

	for item in item_by_company:
		item_list.append(item[0])

	return item_list

You might want to try something like this instead:

https://github.com/frappe/erpnext/blob/develop/erpnext/manufacturing/doctype/bom_replace_tool/bom_replace_tool.js#L9

Thanks,

It works!..No such error when applying above method.