From 8fcad571f5173865f1309dcf05e1013058d2ff84 Mon Sep 17 00:00:00 2001 From: Tyler Matteson Date: Sat, 4 May 2019 14:19:24 -0400 Subject: [PATCH] Batch naming series hotfix (#17483) * fix: not able to make sales order from quotation * fix: batch naming series unicode() call is py3 incompatible --- erpnext/stock/doctype/batch/batch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py index ef0a317d657..8ea7c44c07f 100644 --- a/erpnext/stock/doctype/batch/batch.py +++ b/erpnext/stock/doctype/batch/batch.py @@ -9,6 +9,7 @@ from frappe.model.naming import make_autoname, revert_series_if_last from frappe.utils import flt, cint from frappe.utils.jinja import render_template from frappe.utils.data import add_days +from six import string_types class UnableToSelectBatchError(frappe.ValidationError): pass @@ -60,7 +61,7 @@ def _make_naming_series_key(prefix): :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 isinstance(prefix, string_types): return '' else: return prefix.upper() + '.#####' @@ -86,7 +87,7 @@ class Batch(Document): 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: