mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-20 03:47:11 +00:00
Merge branch 'develop' of https://github.com/frappe/erpnext into e-commerce-refactor-develop
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import copy
|
||||
import json
|
||||
@@ -9,7 +8,6 @@ import json
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cstr, flt
|
||||
from six import string_types
|
||||
|
||||
|
||||
class ItemVariantExistsError(frappe.ValidationError): pass
|
||||
@@ -31,7 +29,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, string_types):
|
||||
if isinstance(args, str):
|
||||
args = json.loads(args)
|
||||
|
||||
if not args:
|
||||
@@ -55,7 +53,7 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part
|
||||
return variant
|
||||
|
||||
def validate_item_variant_attributes(item, args=None):
|
||||
if isinstance(item, string_types):
|
||||
if isinstance(item, str):
|
||||
item = frappe.get_doc('Item', item)
|
||||
|
||||
if not args:
|
||||
@@ -157,7 +155,7 @@ def find_variant(template, args, variant_item_code=None):
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_variant(item, args):
|
||||
if isinstance(args, string_types):
|
||||
if isinstance(args, str):
|
||||
args = json.loads(args)
|
||||
|
||||
template = frappe.get_doc("Item", item)
|
||||
@@ -180,7 +178,7 @@ def create_variant(item, args):
|
||||
@frappe.whitelist()
|
||||
def enqueue_multiple_variant_creation(item, args):
|
||||
# There can be innumerable attribute combinations, enqueue
|
||||
if isinstance(args, string_types):
|
||||
if isinstance(args, str):
|
||||
variants = json.loads(args)
|
||||
total_variants = 1
|
||||
for key in variants:
|
||||
@@ -197,7 +195,7 @@ def enqueue_multiple_variant_creation(item, args):
|
||||
|
||||
def create_multiple_variants(item, args):
|
||||
count = 0
|
||||
if isinstance(args, string_types):
|
||||
if isinstance(args, str):
|
||||
args = json.loads(args)
|
||||
|
||||
args_set = generate_keyed_value_combinations(args)
|
||||
|
||||
Reference in New Issue
Block a user