frappe / frappe/ecommerce_integrations

Syncing deleted product from Shopify

Open
#337 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
206
Forks
275
Avg merge
54m
Merged PRs (30d)
1

Description

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](https://github.com/user-attachments/assets/f9ba71cb-9082-4e2d-b101-25974afd118d)
```
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.