fix: Add python 3 compatible string types

This commit is contained in:
Deepesh Garg 2021-06-24 19:17:58 +05:30
parent 7e006496dd
commit e21e435a0d
2 changed files with 7 additions and 7 deletions

View File

@ -288,8 +288,8 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
company: me.frm.doc.company,
tax_category: cstr(me.frm.doc.tax_category),
item_codes: item_codes,
item_tax_templates: item_tax_templates,
item_rates: item_rates
item_rates: item_rates,
item_tax_templates: item_tax_templates
},
callback: function(r) {
if (!r.exc) {

View File

@ -436,15 +436,15 @@ def get_barcode_data(items_list):
return itemwise_barcode
@frappe.whitelist()
def get_item_tax_info(company, tax_category, item_codes, item_tax_templates=None, item_rates=None):
def get_item_tax_info(company, tax_category, item_codes, item_rates=None, item_tax_templates=None):
out = {}
if isinstance(item_codes, string_types):
if isinstance(item_codes, (str,)):
item_codes = json.loads(item_codes)
if isinstance(item_rates, string_types):
if isinstance(item_rates, (str,)):
item_rates = json.loads(item_rates)
if isinstance(item_tax_templates, string_types):
if isinstance(item_tax_templates, (str,)):
item_tax_templates = json.loads(item_tax_templates)
for item_code in item_codes:
@ -514,7 +514,7 @@ def _get_item_tax_template(args, taxes, out=None, for_validate=False):
return None
# do not change if already a valid template
if args.get('item_tax_template') in [t.item_tax_template for t in taxes]:
if args.get('item_tax_template') in {t.item_tax_template for t in taxes}:
out["item_tax_template"] = args.get('item_tax_template')
return args.get('item_tax_template')