Skip to content

Commit

Permalink
fix: shipping_address for non-drop shipping item
Browse files Browse the repository at this point in the history
(cherry picked from commit 67a7ccf)
  • Loading branch information
s-aga-r authored and mergify[bot] committed Dec 26, 2022
1 parent 0cf9702 commit 19feebb
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions erpnext/selling/doctype/sales_order/sales_order.py
Expand Up @@ -1090,13 +1090,30 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
]
items_to_map = list(set(items_to_map))

def is_drop_ship_order(target):
drop_ship = True
for item in target.items:
if not item.delivered_by_supplier:
drop_ship = False
break

return drop_ship

def set_missing_values(source, target):
target.supplier = ""
target.apply_discount_on = ""
target.additional_discount_percentage = 0.0
target.discount_amount = 0.0
target.inter_company_order_reference = ""
target.shipping_rule = ""

if is_drop_ship_order(target):
target.customer = source.customer
target.customer_name = source.customer_name
target.shipping_address = source.shipping_address_name
else:
target.customer = target.customer_name = target.shipping_address = None

target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")

Expand All @@ -1123,11 +1140,9 @@ def update_item_for_packed_item(source, target, source_parent):
"contact_email",
"contact_person",
"taxes_and_charges",
"shipping_address",
"terms",
],
"field_map": [
["shipping_address_name", "shipping_address"],
],
"validation": {"docstatus": ["=", 1]},
},
"Sales Order Item": {
Expand Down

0 comments on commit 19feebb

Please sign in to comment.