Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ecommerce_integrations/shopify/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def create_sales_order(shopify_order, setting, company=None):

return so


def get_order_items(order_items, setting, delivery_date, taxes_inclusive):
items = []
all_product_exists = True
Expand All @@ -151,6 +150,9 @@ def get_order_items(order_items, setting, delivery_date, taxes_inclusive):

if all_product_exists:
item_code = get_item_code(shopify_item)
erp_item = frappe.get_doc('Item', item_code)
suppliers = erp_item.get("supplier_items")
drop_shipped = erp_item.get("delivered_by_supplier") and len(suppliers) > 0
items.append(
{
"item_code": item_code,
Expand All @@ -160,6 +162,8 @@ def get_order_items(order_items, setting, delivery_date, taxes_inclusive):
"qty": shopify_item.get("quantity"),
"stock_uom": shopify_item.get("uom") or "Nos",
"warehouse": setting.warehouse,
"delivered_by_supplier": 1 if drop_shipped else 0,
"supplier": suppliers[0] if drop_shipped else "",
Copy link
Copy Markdown

@Karuppasamy923 Karuppasamy923 May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Siryancy,

This line assigns the object of the first row rather than the actual supplier name, which may cause issues during sales order creation.

Recommended correction:
"supplier": suppliers[0].supplier if drop_shipped else "",

Update the line as shown above, and can you also rebase the branch with the latest changes from develop?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and fixed. Let me know if I did that incorrectly.

ORDER_ITEM_DISCOUNT_FIELD: (
_get_total_discount(shopify_item) / cint(shopify_item.get("quantity"))
),
Expand All @@ -170,7 +174,6 @@ def get_order_items(order_items, setting, delivery_date, taxes_inclusive):

return items


def _get_item_price(line_item, taxes_inclusive: bool) -> float:
price = flt(line_item.get("price"))
qty = cint(line_item.get("quantity"))
Expand Down