Changes to support refactor in frappe pg-poc branch (#15287)

* Remove quotes from sql to make it compatible with postgres as well

* Fix queries
- Replace mysql specifc queries with standard ones

* Make repo URL chages to test pg-poc

* Add root passowrd to test site config

* Fix quotes issue

* Remove debug flag from a pricing rule query

* Remove python 3.6 version from travis.yml

* Fix improper query issue

* Fix incorrect query

* Fix a query

- This fix need to be changed when we will  start supporting postgres
since date_format is not supported by postgres

* Get price list map as dict

* Convert price_list_currency_map to dict
This commit is contained in:
Suraj Shetty
2018-09-21 10:20:52 +05:30
committed by Rushabh Mehta
parent f9b3511880
commit bfc195dd8b
53 changed files with 189 additions and 182 deletions

View File

@@ -208,9 +208,9 @@ def bom(doctype, txt, searchfield, start, page_len, filters):
limit %(start)s, %(page_len)s """.format(
fcond=get_filters_cond(doctype, filters, conditions),
mcond=get_match_cond(doctype),
key=frappe.db.escape(searchfield)),
key=searchfield),
{
'txt': "%%%s%%" % frappe.db.escape(txt),
'txt': frappe.db.escape('%' + txt + '%'),
'_txt': txt.replace("%", ""),
'start': start or 0,
'page_len': page_len or 20
@@ -353,7 +353,7 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
{condition} {match_condition}
order by idx desc, name"""
.format(condition=condition, match_condition=get_match_cond(doctype), key=searchfield), {
'txt': "%%%s%%" % frappe.db.escape(txt),
'txt': frappe.db.escape('%' + txt + '%'),
'company': filters.get("company", "")
})
@@ -375,10 +375,10 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
and tabAccount.docstatus!=2
and tabAccount.{key} LIKE %(txt)s
{condition} {match_condition}"""
.format(condition=condition, key=frappe.db.escape(searchfield),
.format(condition=condition, key=searchfield,
match_condition=get_match_cond(doctype)), {
'company': filters.get("company", ""),
'txt': "%%%s%%" % frappe.db.escape(txt)
'txt': frappe.db.escape('%' + txt + '%')
})
@@ -406,7 +406,7 @@ def warehouse_query(doctype, txt, searchfield, start, page_len, filters):
{start}, {page_len}
""".format(
sub_query=sub_query,
key=frappe.db.escape(searchfield),
key=searchfield,
fcond=get_filters_cond(doctype, filter_dict.get("Warehouse"), conditions),
mcond=get_match_cond(doctype),
start=start,
@@ -430,9 +430,9 @@ def get_batch_numbers(doctype, txt, searchfield, start, page_len, filters):
query = """select batch_id from `tabBatch`
where disabled = 0
and (expiry_date >= CURDATE() or expiry_date IS NULL)
and name like '{txt}'""".format(txt = frappe.db.escape('%{0}%'.format(txt)))
and name like {txt}""".format(txt = frappe.db.escape('%{0}%'.format(txt)))
if filters and filters.get('item'):
query += " and item = '{item}'".format(item = frappe.db.escape(filters.get('item')))
query += " and item = {item}".format(item = frappe.db.escape(filters.get('item')))
return frappe.db.sql(query, filters)