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

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

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