diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index 9560b2a23d1..70f193e787b 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -8,6 +8,7 @@ frappe.query_reports["Accounts Payable"] = { "label": __("Company"), "fieldtype": "Link", "options": "Company", + "reqd": 1, "default": frappe.defaults.get_user_default("Company") }, { diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js index 27c7993f4dd..3661afe7977 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js @@ -8,6 +8,7 @@ frappe.query_reports["Accounts Receivable"] = { "label": __("Company"), "fieldtype": "Link", "options": "Company", + "reqd": 1, "default": frappe.defaults.get_user_default("Company") }, { diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 71276639386..f0769f68c9d 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -541,10 +541,11 @@ class ReceivablePayableReport(object): conditions.append("""cost_center in (select name from `tabCost Center` where lft >= {0} and rgt <= {1})""".format(lft, rgt)) - accounts = [d.name for d in frappe.get_all("Account", - filters={"account_type": account_type, "company": self.filters.company})] - conditions.append("account in (%s)" % ','.join(['%s'] *len(accounts))) - values += accounts + if self.filters.company: + accounts = [d.name for d in frappe.get_all("Account", + filters={"account_type": account_type, "company": self.filters.company})] + conditions.append("account in (%s)" % ','.join(['%s'] *len(accounts))) + values += accounts return " and ".join(conditions), values