diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 8f1dfbc26ed..a617de3ba76 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -121,7 +121,12 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company allow_cost_center_in_entry_of_bs_account = get_allow_cost_center_in_entry_of_bs_account() - if cost_center and (allow_cost_center_in_entry_of_bs_account or acc.report_type =='Profit and Loss'): + if account: + report_type = acc.report_type + else: + report_type = "" + + if cost_center and (allow_cost_center_in_entry_of_bs_account or report_type =='Profit and Loss'): cc = frappe.get_doc("Cost Center", cost_center) if cc.is_group: cond.append(""" exists ( @@ -138,7 +143,7 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company if not frappe.flags.ignore_account_permission: acc.check_permission("read") - if acc.report_type == 'Profit and Loss': + if report_type == 'Profit and Loss': # for pl accounts, get balance within a fiscal year cond.append("posting_date >= '%s' and voucher_type != 'Period Closing Voucher'" \ % year_start_date) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 47c9f0a4ce3..57c063a72ae 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -207,10 +207,10 @@ def bom(doctype, txt, searchfield, start, page_len, filters): idx desc, name limit %(start)s, %(page_len)s """.format( fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'), - mcond=get_match_cond(doctype), - key=frappe.db.escape(searchfield)), + mcond=get_match_cond(doctype).replace('%', '%%'), + key=searchfield), { - 'txt': "%"+frappe.db.escape(txt)+"%", + 'txt': '%' + txt + '%', '_txt': txt.replace("%", ""), 'start': start or 0, 'page_len': page_len or 20 diff --git a/erpnext/hr/doctype/loan_application/loan_application.py b/erpnext/hr/doctype/loan_application/loan_application.py index 67be9f2a1ca..58a362d0864 100644 --- a/erpnext/hr/doctype/loan_application/loan_application.py +++ b/erpnext/hr/doctype/loan_application/loan_application.py @@ -33,8 +33,8 @@ class LoanApplication(Document): if self.repayment_amount - min_repayment_amount < 0: frappe.throw(_("Repayment Amount must be greater than " \ + str(flt(min_repayment_amount, 2)))) - self.repayment_periods = math.ceil(math.log(self.repayment_amount) - - math.log(self.repayment_amount - min_repayment_amount) /(math.log(1 + monthly_interest_rate))) + self.repayment_periods = math.ceil((math.log(self.repayment_amount) - + math.log(self.repayment_amount - min_repayment_amount)) /(math.log(1 + monthly_interest_rate))) else: self.repayment_periods = self.loan_amount / self.repayment_amount diff --git a/erpnext/hr/report/loan_repayment/loan_repayment.py b/erpnext/hr/report/loan_repayment/loan_repayment.py index 9e310de48c9..beca776964e 100644 --- a/erpnext/hr/report/loan_repayment/loan_repayment.py +++ b/erpnext/hr/report/loan_repayment/loan_repayment.py @@ -73,7 +73,7 @@ def create_columns(): def get_record(): data = [] loans = frappe.get_all("Loan", - filters=[("status", "=", "Fully Disbursed")], + filters=[("status", "=", "Disbursed")], fields=["applicant", "applicant_name", "name", "loan_amount", "rate_of_interest", "total_payment", "monthly_repayment_amount", "total_amount_paid"] )