[fix] Currency and exchange rate while Quotation made from Opportunity for lead
This commit is contained in:
parent
821367fee8
commit
3950507d4b
@ -192,17 +192,18 @@ 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)
|
||||||
|
|
||||||
if quotation.customer:
|
company_currency = frappe.db.get_value("Company", quotation.company, "default_currency")
|
||||||
company_currency = frappe.db.get_value("Company", quotation.company, "default_currency")
|
party_account_currency = get_party_account_currency("Customer", quotation.customer,
|
||||||
party_account_currency = get_party_account_currency("Customer", quotation.customer, quotation.company)
|
quotation.company) if quotation.customer else company_currency
|
||||||
|
|
||||||
|
quotation.currency = party_account_currency or company_currency
|
||||||
|
|
||||||
if company_currency == party_account_currency:
|
if company_currency == quotation.currency:
|
||||||
exchange_rate = 1
|
exchange_rate = 1
|
||||||
else:
|
else:
|
||||||
exchange_rate = get_exchange_rate(party_account_currency, company_currency)
|
exchange_rate = get_exchange_rate(quotation.currency, 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")
|
||||||
|
@ -432,7 +432,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
var company_currency = this.get_company_currency();
|
var company_currency = this.get_company_currency();
|
||||||
// Added `ignore_pricing_rule` to determine if document is loading after mapping from another doc
|
// Added `ignore_pricing_rule` to determine if document is loading after mapping from another doc
|
||||||
if(this.frm.doc.currency !== company_currency && !this.frm.doc.ignore_pricing_rule) {
|
if(this.frm.doc.currency && this.frm.doc.currency !== company_currency
|
||||||
|
&& !this.frm.doc.ignore_pricing_rule) {
|
||||||
this.get_exchange_rate(this.frm.doc.currency, company_currency,
|
this.get_exchange_rate(this.frm.doc.currency, company_currency,
|
||||||
function(exchange_rate) {
|
function(exchange_rate) {
|
||||||
me.frm.set_value("conversion_rate", exchange_rate);
|
me.frm.set_value("conversion_rate", exchange_rate);
|
||||||
|
Loading…
Reference in New Issue
Block a user