mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 09:54:47 +00:00
committed by
Nabin Hait
parent
ecc6f86c7c
commit
56b2e12af8
@@ -7,6 +7,8 @@ from frappe import _
|
||||
from frappe.utils import cstr, flt
|
||||
import json, copy
|
||||
|
||||
from six import string_types
|
||||
|
||||
class ItemVariantExistsError(frappe.ValidationError): pass
|
||||
class InvalidItemAttributeValueError(frappe.ValidationError): pass
|
||||
class ItemTemplateCannotHaveStock(frappe.ValidationError): pass
|
||||
@@ -26,7 +28,7 @@ def get_variant(template, args=None, variant=None, manufacturer=None,
|
||||
return make_variant_based_on_manufacturer(item_template, manufacturer,
|
||||
manufacturer_part_no)
|
||||
else:
|
||||
if isinstance(args, basestring):
|
||||
if isinstance(args, string_types):
|
||||
args = json.loads(args)
|
||||
|
||||
if not args:
|
||||
@@ -150,7 +152,7 @@ def find_variant(template, args, variant_item_code=None):
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_variant(item, args):
|
||||
if isinstance(args, basestring):
|
||||
if isinstance(args, string_types):
|
||||
args = json.loads(args)
|
||||
|
||||
template = frappe.get_doc("Item", item)
|
||||
@@ -177,7 +179,7 @@ def enqueue_multiple_variant_creation(item, args):
|
||||
item=item, args=args, now=frappe.flags.in_test);
|
||||
|
||||
def create_multiple_variants(item, args):
|
||||
if isinstance(args, basestring):
|
||||
if isinstance(args, string_types):
|
||||
args = json.loads(args)
|
||||
|
||||
args_set = generate_keyed_value_combinations(args)
|
||||
|
||||
@@ -7,19 +7,10 @@ import unittest
|
||||
from erpnext.stock.doctype.item.test_item import set_item_variant_settings
|
||||
from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code
|
||||
|
||||
# python 3 compatibility stuff
|
||||
try:
|
||||
unicode = unicode
|
||||
except NameError:
|
||||
# Python 3
|
||||
basestring = (str, bytes)
|
||||
else:
|
||||
# Python 2
|
||||
basestring = basestring
|
||||
|
||||
from six import string_types
|
||||
|
||||
def create_variant_with_tables(item, args):
|
||||
if isinstance(args, basestring):
|
||||
if isinstance(args, string_types):
|
||||
args = json.loads(args)
|
||||
|
||||
template = frappe.get_doc("Item", item)
|
||||
|
||||
Reference in New Issue
Block a user