Resolves Issue #12630 -Added Filters to AR
- Added Territory Filter to AR report - Added Sales partner filter - Added Sales person filter -Terrtory filter is needed since if you need to see AR in North Inda you get with filter not with column -Similarly there was a need for Sales Partner and sales person filter in the AR report which is being fulfilled now.
This commit is contained in:
parent
8df0556af5
commit
2136a7bded
@ -28,6 +28,24 @@ frappe.query_reports["Accounts Receivable"] = {
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Payment Terms Template"
|
"options": "Payment Terms Template"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"territory",
|
||||||
|
"label": __("Territory"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Territory"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"sales_partner",
|
||||||
|
"label": __("Sales Partner"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Sales Partner"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"sales_person",
|
||||||
|
"label": __("Sales Person"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Sales Person"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fieldtype": "Break",
|
"fieldtype": "Break",
|
||||||
},
|
},
|
||||||
|
@ -282,11 +282,27 @@ class ReceivablePayableReport(object):
|
|||||||
conditions.append("""party in (select name from tabCustomer
|
conditions.append("""party in (select name from tabCustomer
|
||||||
where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1}
|
where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1}
|
||||||
and name=tabCustomer.customer_group))""".format(lft, rgt))
|
and name=tabCustomer.customer_group))""".format(lft, rgt))
|
||||||
|
|
||||||
|
if self.filters.get("territory"):
|
||||||
|
lft, rgt = frappe.db.get_value("Territory",
|
||||||
|
self.filters.get("territory"), ["lft", "rgt"])
|
||||||
|
|
||||||
|
conditions.append("""party in (select name from tabCustomer
|
||||||
|
where exists(select name from `tabTerritory` where lft >= {0} and rgt <= {1}
|
||||||
|
and name=tabCustomer.territory))""".format(lft, rgt))
|
||||||
|
|
||||||
if self.filters.get("payment_terms_template"):
|
if self.filters.get("payment_terms_template"):
|
||||||
conditions.append("party in (select name from tabCustomer where payment_terms=%s)")
|
conditions.append("party in (select name from tabCustomer where payment_terms=%s)")
|
||||||
values.append(self.filters.get("payment_terms_template"))
|
values.append(self.filters.get("payment_terms_template"))
|
||||||
|
|
||||||
|
if self.filters.get("sales_partner"):
|
||||||
|
conditions.append("party in (select name from tabCustomer where default_sales_partner=%s)")
|
||||||
|
values.append(self.filters.get("sales_partner"))
|
||||||
|
|
||||||
|
if self.filters.get("sales_person"):
|
||||||
|
conditions.append("party in (select parent from `tabSales Team` where sales_person=%s and \
|
||||||
|
parenttype = 'Customer')")
|
||||||
|
values.append(self.filters.get("sales_person"))
|
||||||
return " and ".join(conditions), values
|
return " and ".join(conditions), values
|
||||||
|
|
||||||
def get_gl_entries_for(self, party, party_type, against_voucher_type, against_voucher):
|
def get_gl_entries_for(self, party, party_type, against_voucher_type, against_voucher):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user