mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-22 02:40:02 +00:00
chore: remove all six compat code
This commit is contained in:
@@ -20,7 +20,6 @@ from frappe.utils import (
|
||||
nowdate,
|
||||
today,
|
||||
)
|
||||
from six import text_type
|
||||
|
||||
import erpnext
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
||||
@@ -1080,7 +1079,7 @@ class AccountsController(TransactionBase):
|
||||
stock_items = [r[0] for r in frappe.db.sql("""
|
||||
select name from `tabItem`
|
||||
where name in (%s) and is_stock_item=1
|
||||
""" % (", ".join((["%s"] * len(item_codes))),), item_codes)]
|
||||
""" % (", ".join(["%s"] * len(item_codes)),), item_codes)]
|
||||
|
||||
return stock_items
|
||||
|
||||
@@ -1789,7 +1788,7 @@ def get_payment_terms(terms_template, posting_date=None, grand_total=None, base_
|
||||
@frappe.whitelist()
|
||||
def get_payment_term_details(term, posting_date=None, grand_total=None, base_grand_total=None, bill_date=None):
|
||||
term_details = frappe._dict()
|
||||
if isinstance(term, text_type):
|
||||
if isinstance(term, str):
|
||||
term = frappe.get_doc("Payment Term", term)
|
||||
else:
|
||||
term_details.payment_term = term.payment_term
|
||||
|
||||
@@ -8,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
|
||||
@@ -30,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:
|
||||
@@ -54,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:
|
||||
@@ -156,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)
|
||||
@@ -179,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:
|
||||
@@ -196,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)
|
||||
|
||||
@@ -176,7 +176,7 @@ class calculate_taxes_and_totals(object):
|
||||
self.doc.round_floats_in(tax)
|
||||
|
||||
def determine_exclusive_rate(self):
|
||||
if not any((cint(tax.included_in_print_rate) for tax in self.doc.get("taxes"))):
|
||||
if not any(cint(tax.included_in_print_rate) for tax in self.doc.get("taxes")):
|
||||
return
|
||||
|
||||
for item in self.doc.get("items"):
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
|
||||
import frappe
|
||||
from six import string_types
|
||||
|
||||
from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code
|
||||
from erpnext.stock.doctype.item.test_item import set_item_variant_settings
|
||||
@@ -20,7 +18,7 @@ class TestItemVariant(unittest.TestCase):
|
||||
self.assertEqual(variant.get("quality_inspection_template"), "_Test QC Template")
|
||||
|
||||
def create_variant_with_tables(item, args):
|
||||
if isinstance(args, string_types):
|
||||
if isinstance(args, str):
|
||||
args = json.loads(args)
|
||||
|
||||
qc_name = make_quality_inspection_template()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import unittest
|
||||
from uuid import uuid4 as _uuid4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user