Skip to content

Commit

Permalink
fix: payment term when creating PO from SO (frappe#41376)
Browse files Browse the repository at this point in the history
* fix: payment term when creating PO from SO

* fix: payment term when creating PO from SO

* fix: payment term when creating PO from SO

* fix: payment term when creating PO from SO
  • Loading branch information
Nihantra-Patel committed Jun 3, 2024
1 parent 4f0214d commit 441596f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions erpnext/selling/doctype/sales_order/sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,11 +1239,19 @@ def set_missing_values(source, target):
target.discount_amount = 0.0
target.inter_company_order_reference = ""
target.shipping_rule = ""
target.tc_name = ""
target.terms = ""
target.payment_terms_template = ""
target.payment_schedule = []

default_price_list = frappe.get_value("Supplier", supplier, "default_price_list")
if default_price_list:
target.buying_price_list = default_price_list

default_payment_terms = frappe.get_value("Supplier", supplier, "payment_terms")
if default_payment_terms:
target.payment_terms_template = default_payment_terms

if any(item.delivered_by_supplier == 1 for item in source.items):
if source.shipping_address_name:
target.shipping_address = source.shipping_address_name
Expand Down Expand Up @@ -1295,7 +1303,6 @@ def update_item(source, target, source_parent):
"contact_person",
"taxes_and_charges",
"shipping_address",
"terms",
],
"validation": {"docstatus": ["=", 1]},
},
Expand Down Expand Up @@ -1363,6 +1370,10 @@ def set_missing_values(source, target):
target.discount_amount = 0.0
target.inter_company_order_reference = ""
target.shipping_rule = ""
target.tc_name = ""
target.terms = ""
target.payment_terms_template = ""
target.payment_schedule = []

if is_drop_ship_order(target):
target.customer = source.customer
Expand Down Expand Up @@ -1398,7 +1409,6 @@ def update_item_for_packed_item(source, target, source_parent):
"contact_person",
"taxes_and_charges",
"shipping_address",
"terms",
],
"validation": {"docstatus": ["=", 1]},
},
Expand Down

0 comments on commit 441596f

Please sign in to comment.