diff --git a/erpnext/erpnext_integrations/connectors/shopify_connection.py b/erpnext/erpnext_integrations/connectors/shopify_connection.py index 1d6e8917f5..ed531666c9 100644 --- a/erpnext/erpnext_integrations/connectors/shopify_connection.py +++ b/erpnext/erpnext_integrations/connectors/shopify_connection.py @@ -246,6 +246,7 @@ def update_taxes_with_shipping_lines(taxes, shipping_lines, shopify_settings): return taxes def get_tax_account_head(tax): + return tax_title = tax.get("title").encode("utf-8") tax_account = frappe.db.get_value("Shopify Tax Account", \ diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py b/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py index 5570e6903a..bde101123d 100644 --- a/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py +++ b/erpnext/erpnext_integrations/doctype/shopify_settings/sync_product.py @@ -1,13 +1,14 @@ from __future__ import unicode_literals import frappe from frappe import _ +from erpnext import get_default_company from frappe.utils import cstr, cint, get_request_session from erpnext.erpnext_integrations.doctype.shopify_settings.shopify_settings import get_shopify_url, get_header shopify_variants_attr_list = ["option1", "option2", "option3"] def sync_item_from_shopify(shopify_settings, item): - url = get_shopify_url("/admin/products/{0}.json".format(item.get("product_id")), shopify_settings) + url = get_shopify_url("admin/api/2019-04/products/{0}.json".format(item.get("product_id")), shopify_settings) session = get_request_session() try: @@ -107,7 +108,12 @@ def create_item(shopify_item, warehouse, has_variant=0, attributes=None,variant_ "image": get_item_image(shopify_item), "weight_uom": shopify_item.get("weight_unit"), "weight_per_unit": shopify_item.get("weight"), - "default_supplier": get_supplier(shopify_item) + "default_supplier": get_supplier(shopify_item), + "item_defaults": [ + { + "company": get_default_company() + } + ] } if not is_item_exists(item_dict, attributes, variant_of=variant_of): @@ -116,7 +122,7 @@ def create_item(shopify_item, warehouse, has_variant=0, attributes=None,variant_ if not item_details: new_item = frappe.get_doc(item_dict) - new_item.insert() + new_item.insert(ignore_permissions=True, ignore_mandatory=True) name = new_item.name if not name: diff --git a/erpnext/erpnext_integrations/utils.py b/erpnext/erpnext_integrations/utils.py index 6acb241d51..84f7f5a5d4 100644 --- a/erpnext/erpnext_integrations/utils.py +++ b/erpnext/erpnext_integrations/utils.py @@ -36,8 +36,8 @@ def get_webhook_address(connector_name, method, exclude_uri=False): try: url = frappe.request.url except RuntimeError: - url = frappe.utils.get_url() + url = "http://localhost:8000" server_url = '{uri.scheme}://{uri.netloc}/api/method/{endpoint}'.format(uri=urlparse(url), endpoint=endpoint) - return server_url \ No newline at end of file + return server_url