Merge pull request #18117 from rohitwaghchaure/accounts_receivable_not_working_if_company_not_selected

fix: accounts receivable / payable not working if the company is not seletced in filter
This commit is contained in:
rohitwaghchaure 2019-07-01 12:05:14 +05:30 committed by GitHub
commit 9c1dbc5e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,7 @@ frappe.query_reports["Accounts Payable"] = {
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_user_default("Company")
},
{

View File

@ -8,6 +8,7 @@ frappe.query_reports["Accounts Receivable"] = {
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_user_default("Company")
},
{

View File

@ -541,6 +541,7 @@ class ReceivablePayableReport(object):
conditions.append("""cost_center in (select name from `tabCost Center` where
lft >= {0} and rgt <= {1})""".format(lft, rgt))
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)))