Merge pull request #31817 from ruthra-kumar/fix_pos_recent_order_crash_due_to_large_data

fix: limit pos recent order page result
This commit is contained in:
ruthra kumar 2022-08-10 15:48:28 +05:30 committed by GitHub
commit 5018472840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,16 +253,20 @@ def get_past_order_list(search_term, status, limit=20):
"POS Invoice", "POS Invoice",
filters={"customer": ["like", "%{}%".format(search_term)], "status": status}, filters={"customer": ["like", "%{}%".format(search_term)], "status": status},
fields=fields, fields=fields,
page_length=limit,
) )
invoices_by_name = frappe.db.get_all( invoices_by_name = frappe.db.get_all(
"POS Invoice", "POS Invoice",
filters={"name": ["like", "%{}%".format(search_term)], "status": status}, filters={"name": ["like", "%{}%".format(search_term)], "status": status},
fields=fields, fields=fields,
page_length=limit,
) )
invoice_list = invoices_by_customer + invoices_by_name invoice_list = invoices_by_customer + invoices_by_name
elif status: elif status:
invoice_list = frappe.db.get_all("POS Invoice", filters={"status": status}, fields=fields) invoice_list = frappe.db.get_all(
"POS Invoice", filters={"status": status}, fields=fields, page_length=limit
)
return invoice_list return invoice_list