Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing deleted product from Shopify #337

Open
Igniteou5 opened this issue Oct 22, 2024 · 0 comments
Open

Syncing deleted product from Shopify #337

Igniteou5 opened this issue Oct 22, 2024 · 0 comments

Comments

@Igniteou5
Copy link

Is it possible to sync an order which contains a deleted product to ERPNext?

It seems like that's not the case. I get the following error when it tries to sync an order containing a deleted product variant.
image

Traceback (most recent call last):
  File "apps/ecommerce_integrations/ecommerce_integrations/shopify/order.py", line 55, in sync_sales_order
    create_order(order, setting)
  File "apps/ecommerce_integrations/ecommerce_integrations/shopify/order.py", line 73, in create_order
    create_delivery_note(order, setting, so)
  File "apps/ecommerce_integrations/ecommerce_integrations/shopify/fulfillment.py", line 45, in create_delivery_note
    dn = make_delivery_note(so.name)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py", line 1009, in make_delivery_note
    target_doc = get_mapped_doc("Sales Order", so.name, mapper, target_doc)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/mapper.py", line 152, in get_mapped_doc
    map_child_doc(source_d, target_doc, table_map, source_doc)
  File "apps/frappe/frappe/model/mapper.py", line 268, in map_child_doc
    map_doc(source_d, target_d, table_map, source_parent)
  File "apps/frappe/frappe/model/mapper.py", line 177, in map_doc
    table_map["postprocess"](source_doc, target_doc, source_parent)
  File "apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py", line 986, in update_item
    item = get_item_defaults(target.item_code, source_parent.company)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/item/item.py", line 1269, in get_item_defaults
    item = frappe.get_cached_doc("Item", item_code)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1214, in get_cached_doc
    doc = get_doc(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1340, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 85, in get_doc
    return controller(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 126, in __init__
    self.load_from_db()
  File "apps/frappe/frappe/model/document.py", line 172, in load_from_db
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 652, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 617, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 568, in _raise_exception
    raise exc
frappe.exceptions.DoesNotExistError: Item None not found

I have tried manually creating the product on ERPNext by using the same id and variant id as was the deleted item on Shopify as per the request data, but it still gives the same error.

I assume the Item here refers to the product itself and not something else that is missing? Is anyone else experiencing a similar issue?

I am running self-hosted ERPNext version 15 branch & the main branch for ecommerce_integrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant