From 5755d2d32f7a17ca7d9df169249d661630e74750 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Thu, 29 Aug 2019 19:51:38 +0530 Subject: [PATCH] fix: customer credit limit report --- .../customer_credit_limit.json | 7 ++++--- .../customer_credit_balance.py | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json index bf99a58cb7d..777feea0548 100644 --- a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json +++ b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.json @@ -13,6 +13,7 @@ { "fieldname": "credit_limit", "fieldtype": "Currency", + "in_list_view": 1, "label": "Credit Limit" }, { @@ -22,6 +23,7 @@ { "fieldname": "company", "fieldtype": "Link", + "in_list_view": 1, "label": "Company", "options": "Company" }, @@ -33,7 +35,7 @@ } ], "istable": 1, - "modified": "2019-08-28 18:19:26.905239", + "modified": "2019-08-29 18:27:10.323287", "modified_by": "Administrator", "module": "Selling", "name": "Customer Credit Limit", @@ -41,6 +43,5 @@ "permissions": [], "quick_entry": 1, "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 + "sort_order": "DESC" } \ No newline at end of file diff --git a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py index ee0d72be7bb..6b8b8581d28 100644 --- a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py +++ b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py @@ -29,7 +29,7 @@ def execute(filters=None): if customer_naming_type == "Naming Series": row = [d.name, d.customer_name, credit_limit, outstanding_amt, bal, - d.bypass_credit_limit_check_at_sales_order, d.is_frozen, + d.bypass_credit_limit_check, d.is_frozen, d.disabled] else: row = [d.name, credit_limit, outstanding_amt, bal, @@ -60,9 +60,15 @@ def get_details(filters): conditions = "" if filters.get("customer"): - conditions += " where name = %(customer)s" - - return frappe.db.sql("""select name, customer_name, - bypass_credit_limit_check_at_sales_order, is_frozen, disabled from `tabCustomer` %s - """ % conditions, filters, as_dict=1) + conditions += " AND name = " + filters.get("customer") + return frappe.db.sql("""SELECT + c.name, c.customer_name, + ccl.bypass_credit_limit_check, + c.is_frozen, c.disabled + FROM `tabCustomer` c, `tabCustomer Credit Limit` ccl + WHERE + c.name = ccl.parent + AND ccl.company = %s + {0} + """.format(conditions), (filters.get("company")), as_dict=1) #nosec \ No newline at end of file