mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
[fix] Dont set currency and exchange rate while Quotation made from Opportunity for lead
This commit is contained in:
@@ -192,16 +192,17 @@ def make_quotation(source_name, target_doc=None):
|
|||||||
def set_missing_values(source, target):
|
def set_missing_values(source, target):
|
||||||
quotation = frappe.get_doc(target)
|
quotation = frappe.get_doc(target)
|
||||||
|
|
||||||
company_currency = frappe.db.get_value("Company", quotation.company, "default_currency")
|
if quotation.customer:
|
||||||
party_account_currency = get_party_account_currency("Customer", quotation.customer, quotation.company)
|
company_currency = frappe.db.get_value("Company", quotation.company, "default_currency")
|
||||||
|
party_account_currency = get_party_account_currency("Customer", quotation.customer, quotation.company)
|
||||||
|
|
||||||
if company_currency == party_account_currency:
|
if company_currency == party_account_currency:
|
||||||
exchange_rate = 1
|
exchange_rate = 1
|
||||||
else:
|
else:
|
||||||
exchange_rate = get_exchange_rate(party_account_currency, company_currency)
|
exchange_rate = get_exchange_rate(party_account_currency, company_currency)
|
||||||
|
|
||||||
quotation.currency = party_account_currency or company_currency
|
quotation.currency = party_account_currency or company_currency
|
||||||
quotation.conversion_rate = exchange_rate
|
quotation.conversion_rate = exchange_rate
|
||||||
|
|
||||||
quotation.run_method("set_missing_values")
|
quotation.run_method("set_missing_values")
|
||||||
quotation.run_method("calculate_taxes_and_totals")
|
quotation.run_method("calculate_taxes_and_totals")
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ def before_tests():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_exchange_rate(from_currency, to_currency):
|
def get_exchange_rate(from_currency, to_currency):
|
||||||
|
if not (from_currency and to_currency):
|
||||||
|
return
|
||||||
|
|
||||||
if from_currency == to_currency:
|
if from_currency == to_currency:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user