Merge pull request #23355 from Anurag810/accounts_recievable
fix: Cost Center filter in accounts receivable and payable report
This commit is contained in:
commit
5c8dd6a0ed
@ -34,7 +34,7 @@ frappe.query_reports["Accounts Receivable"] = {
|
||||
filters: {
|
||||
'company': company
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -617,9 +617,19 @@ class ReceivablePayableReport(object):
|
||||
elif party_type_field=="supplier":
|
||||
self.add_supplier_filters(conditions, values)
|
||||
|
||||
if self.filters.cost_center:
|
||||
self.get_cost_center_conditions(conditions)
|
||||
|
||||
self.add_accounting_dimensions_filters(conditions, values)
|
||||
return " and ".join(conditions), values
|
||||
|
||||
def get_cost_center_conditions(self, conditions):
|
||||
lft, rgt = frappe.db.get_value("Cost Center", self.filters.cost_center, ["lft", "rgt"])
|
||||
cost_center_list = [center.name for center in frappe.get_list("Cost Center", filters = {'lft': (">=", lft), 'rgt': ("<=", rgt)})]
|
||||
|
||||
cost_center_string = '", "'.join(cost_center_list)
|
||||
conditions.append('cost_center in ("{0}")'.format(cost_center_string))
|
||||
|
||||
def get_order_by_condition(self):
|
||||
if self.filters.get('group_by_party'):
|
||||
return "order by party, posting_date"
|
||||
|
Loading…
x
Reference in New Issue
Block a user