fix(py3): Use six.text_type instead of unicode
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 2f2c40e..976b24f 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
import json
+from six import text_type
from frappe import _
from frappe.utils import flt, get_datetime, getdate, date_diff, cint, nowdate
from frappe.model.document import Document
@@ -591,10 +592,10 @@
@frappe.whitelist()
def add_timesheet_detail(timesheet, args):
- if isinstance(timesheet, unicode):
+ if isinstance(timesheet, text_type):
timesheet = frappe.get_doc('Timesheet', timesheet)
- if isinstance(args, unicode):
+ if isinstance(args, text_type):
args = json.loads(args)
timesheet.append('time_logs', args)
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index ef0a317..71fd821 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+from six import text_type
import frappe
from frappe import _
from frappe.model.document import Document
@@ -60,7 +61,7 @@
:param prefix: Naming series prefix gotten from Stock Settings
:return: The derived key. If no prefix is given, an empty string is returned
"""
- if not unicode(prefix):
+ if not text_type(prefix):
return ''
else:
return prefix.upper() + '.#####'
@@ -86,7 +87,7 @@
def autoname(self):
"""Generate random ID for batch if not specified"""
if not self.batch_id:
- create_new_batch, batch_number_series = frappe.db.get_value('Item', self.item,
+ create_new_batch, batch_number_series = frappe.db.get_value('Item', self.item,
['create_new_batch', 'batch_number_series'])
if create_new_batch:
diff --git a/erpnext/templates/pages/search_help.py b/erpnext/templates/pages/search_help.py
index 4a4b0db..887d8f4 100644
--- a/erpnext/templates/pages/search_help.py
+++ b/erpnext/templates/pages/search_help.py
@@ -3,6 +3,7 @@
from frappe import _
from jinja2 import utils
from html2text import html2text
+from six import text_type
from frappe.utils import sanitize_html
from frappe.utils.global_search import search
@@ -12,7 +13,7 @@
query = str(utils.escape(sanitize_html(frappe.form_dict.q)))
context.title = _('Help Results for')
context.query = query
-
+
context.route = '/search_help'
d = frappe._dict()
d.results_sections = get_help_results_sections(query)
@@ -73,7 +74,7 @@
for topic in topics_data:
route = api.base_url + '/' + (api.post_route + '/' if api.post_route else "")
for key in api.post_route_key_list.split(','):
- route += unicode(topic[key])
+ route += text_type(topic[key])
results.append(frappe._dict({
'title': topic[api.post_title_key],