From 747c2624cd58e11049edc3603c59ec969208aade Mon Sep 17 00:00:00 2001 From: Karthikeyan S Date: Fri, 19 Jul 2019 22:49:21 +0530 Subject: [PATCH 1/6] fix(BOM): Sever Error due in bom query to new behaviour of db.escape in v12 (#18401) fixes bug introduced by commit 6a7969117f1ec438f25ec5f8bfbbec10a04ef01d --- erpnext/controllers/queries.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index 47c9f0a4ce..57c063a72a 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 From fcdcfbf30247c881e124fc49992ee64dcdfb6973 Mon Sep 17 00:00:00 2001 From: Karthikeyan S Date: Sat, 20 Jul 2019 00:18:44 +0530 Subject: [PATCH 2/6] fix(loan): Loan Tenure Formula (#18424) --- erpnext/hr/doctype/loan_application/loan_application.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/loan_application/loan_application.py b/erpnext/hr/doctype/loan_application/loan_application.py index 67be9f2a1c..58a362d086 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 From d1d8d24d0f10f808279b328af2dd4ea603dc7fa3 Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Sat, 20 Jul 2019 06:31:22 +0530 Subject: [PATCH 3/6] fix: filters conditions in loan repayment (#18428) --- erpnext/hr/report/loan_repayment/loan_repayment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hr/report/loan_repayment/loan_repayment.py b/erpnext/hr/report/loan_repayment/loan_repayment.py index 9e310de48c..beca776964 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"] ) From 1ee3d040a12c0a3a4a4d230fc1c8d149505f3f78 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 14:46:59 +0530 Subject: [PATCH 4/6] fix: Condition fix in get_balance_on function --- erpnext/accounts/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 8f1dfbc26e..6535e4d75e 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 acc: + 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) From e097d4f470c53e529693ffd93ec1139b8a6c0042 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 14:49:32 +0530 Subject: [PATCH 5/6] fix: Assignment fix --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 6535e4d75e..abef2bd6a5 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -122,7 +122,7 @@ 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 acc: - report_type == acc.report_type + report_type = acc.report_type else: report_type = "" From 2ddbebfae07a285f35d5a916b2155fb2b15b96f8 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Sat, 20 Jul 2019 14:52:59 +0530 Subject: [PATCH 6/6] fix: Condition fix --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index abef2bd6a5..a617de3ba7 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -121,7 +121,7 @@ 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 acc: + if account: report_type = acc.report_type else: report_type = ""