fix(sales_order): set valid target.currency in make_purchase_order

This commit is contained in:
diptanilsaha
2026-03-01 01:34:50 +05:30
parent 6aaca38ce3
commit 24f5fb7b44

View File

@@ -1612,12 +1612,14 @@ def make_purchase_order(
def set_missing_values(source, target):
target.supplier = supplier
target.currency = frappe.db.get_value(
"Supplier", filters={"name": supplier}, fieldname=["default_currency"]
)
company_currency = frappe.db.get_value(
"Company", filters={"name": target.company}, fieldname=["default_currency"]
)
supplier_currency = frappe.db.get_value(
"Supplier", filters={"name": supplier}, fieldname=["default_currency"]
)
target.currency = supplier_currency if supplier_currency else company_currency
target.conversion_rate = get_exchange_rate(target.currency, company_currency, args="for_buying")