mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 21:59:13 +00:00
fix(sales_order): set valid target.currency in make_purchase_order
This commit is contained in:
@@ -1612,12 +1612,14 @@ def make_purchase_order(
|
|||||||
|
|
||||||
def set_missing_values(source, target):
|
def set_missing_values(source, target):
|
||||||
target.supplier = supplier
|
target.supplier = supplier
|
||||||
target.currency = frappe.db.get_value(
|
|
||||||
"Supplier", filters={"name": supplier}, fieldname=["default_currency"]
|
|
||||||
)
|
|
||||||
company_currency = frappe.db.get_value(
|
company_currency = frappe.db.get_value(
|
||||||
"Company", filters={"name": target.company}, fieldname=["default_currency"]
|
"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")
|
target.conversion_rate = get_exchange_rate(target.currency, company_currency, args="for_buying")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user