Merge pull request #23409 from AfshanKhan/fix-report-gp

fix: escape apostrophe in cost centre and project if exist
This commit is contained in:
Marica 2020-09-23 15:37:28 +05:30 committed by GitHub
commit 5a4725cac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,9 +268,9 @@ class GrossProfitGenerator(object):
def get_last_purchase_rate(self, item_code, row):
condition = ''
if row.project:
condition += " AND a.project='%s'" % (row.project)
condition += " AND a.project=%s" % (frappe.db.escape(row.project))
elif row.cost_center:
condition += " AND a.cost_center='%s'" % (row.cost_center)
condition += " AND a.cost_center=%s" % (frappe.db.escape(row.cost_center))
if self.filters.to_date:
condition += " AND modified='%s'" % (self.filters.to_date)