fix: customer credit limit report
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 bf99a58..777feea 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 ee0d72b..6b8b858 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 @@
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 @@
conditions = ""
if filters.get("customer"):
- conditions += " where name = %(customer)s"
+ conditions += " AND name = " + filters.get("customer")
- 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)
-
+ 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