fix: showing error for wrong filters. (#23726)

* fix: showing error for wrong filters.

* style: formatting translation
This commit is contained in:
Afshan 2020-10-26 19:37:33 +05:30 committed by GitHub
parent 8c961938ac
commit bd987e56bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,10 +6,17 @@ import frappe
from frappe import _
def execute(filters=None):
validate_warehouse(filters)
columns = get_columns()
data = get_data(filters.warehouse)
return columns, data
def validate_warehouse(filters):
company = filters.company
warehouse = filters.warehouse
if not frappe.db.exists("Warehouse", {"name": warehouse, "company": company}):
frappe.throw(_("Warehouse: {0} does not belong to {1}").format(warehouse, company))
def get_columns():
columns = [
{