Skip to content

Commit

Permalink
fix: made item or warehouse filter mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure committed Jul 20, 2023
1 parent 0a6c565 commit 1649862
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@

from erpnext.stock.doctype.warehouse.warehouse import apply_warehouse_filter

SLE_COUNT_LIMIT = 10_000


def execute(filters=None):
if not filters:
filters = {}

sle_count = frappe.db.count("Stock Ledger Entry", {"is_cancelled": 0})

if sle_count > SLE_COUNT_LIMIT and not filters.get("item_code") and not filters.get("warehouse"):
frappe.throw(_("Please select either the Item or Warehouse filter to generate the report."))

if filters.from_date > filters.to_date:
frappe.throw(_("From Date must be before To Date"))

Expand Down

0 comments on commit 1649862

Please sign in to comment.