fix: shipping_address for non-drop shipping item
This commit is contained in:
parent
9858d9d968
commit
67a7ccf3ce
@ -1024,6 +1024,15 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
|
|||||||
]
|
]
|
||||||
items_to_map = list(set(items_to_map))
|
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):
|
def set_missing_values(source, target):
|
||||||
target.supplier = ""
|
target.supplier = ""
|
||||||
target.apply_discount_on = ""
|
target.apply_discount_on = ""
|
||||||
@ -1031,6 +1040,14 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
|
|||||||
target.discount_amount = 0.0
|
target.discount_amount = 0.0
|
||||||
target.inter_company_order_reference = ""
|
target.inter_company_order_reference = ""
|
||||||
target.shipping_rule = ""
|
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("set_missing_values")
|
||||||
target.run_method("calculate_taxes_and_totals")
|
target.run_method("calculate_taxes_and_totals")
|
||||||
|
|
||||||
@ -1057,11 +1074,9 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
|
|||||||
"contact_email",
|
"contact_email",
|
||||||
"contact_person",
|
"contact_person",
|
||||||
"taxes_and_charges",
|
"taxes_and_charges",
|
||||||
|
"shipping_address",
|
||||||
"terms",
|
"terms",
|
||||||
],
|
],
|
||||||
"field_map": [
|
|
||||||
["shipping_address_name", "shipping_address"],
|
|
||||||
],
|
|
||||||
"validation": {"docstatus": ["=", 1]},
|
"validation": {"docstatus": ["=", 1]},
|
||||||
},
|
},
|
||||||
"Sales Order Item": {
|
"Sales Order Item": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user