fix: customer credit limit report

This commit is contained in:
Mangesh-Khairnar
2019-08-29 19:51:38 +05:30
parent 79525327f0
commit 5755d2d32f
2 changed files with 16 additions and 9 deletions

View File

@@ -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