Skip to content

Commit

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

* 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

(cherry picked from commit 441596f)

Co-authored-by: Nihantra C. Patel <141945075+Nihantra-Patel@users.noreply.github.com>
  • Loading branch information
mergify[bot] and Nihantra-Patel committed Jun 3, 2024
1 parent c5d72cd commit 806ff5b
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 @@ -1224,11 +1224,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 @@ -1280,7 +1288,6 @@ def update_item(source, target, source_parent):
"contact_person",
"taxes_and_charges",
"shipping_address",
"terms",
],
"validation": {"docstatus": ["=", 1]},
},
Expand Down Expand Up @@ -1348,6 +1355,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 @@ -1383,7 +1394,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 806ff5b

Please sign in to comment.