mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
refactor: use translated value of set default in Opportunity
This commit is contained in:
@@ -284,6 +284,9 @@ erpnext.crm.Opportunity = class Opportunity extends frappe.ui.form.Controller {
|
|||||||
this.frm.set_value("currency", frappe.defaults.get_user_default("Currency"));
|
this.frm.set_value("currency", frappe.defaults.get_user_default("Currency"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.frm.is_new() && this.frm.doc.opportunity_type === undefined) {
|
||||||
|
this.frm.doc.opportunity_type = __("Sales");
|
||||||
|
}
|
||||||
this.setup_queries();
|
this.setup_queries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,6 @@
|
|||||||
"no_copy": 1
|
"no_copy": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Sales",
|
|
||||||
"fieldname": "opportunity_type",
|
"fieldname": "opportunity_type",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@@ -657,7 +656,7 @@
|
|||||||
"icon": "fa fa-info-sign",
|
"icon": "fa fa-info-sign",
|
||||||
"idx": 195,
|
"idx": 195,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-06-26 11:16:13.665866",
|
"modified": "2025-08-11 13:35:39.476016",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Opportunity",
|
"name": "Opportunity",
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
link_communications(self.opportunity_from, self.party_name, self)
|
link_communications(self.opportunity_from, self.party_name, self)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
self.set_opportunity_type()
|
||||||
self.make_new_lead_if_required()
|
self.make_new_lead_if_required()
|
||||||
self.validate_item_details()
|
self.validate_item_details()
|
||||||
self.validate_uom_is_integer("uom", "qty")
|
self.validate_uom_is_integer("uom", "qty")
|
||||||
@@ -152,6 +153,10 @@ class Opportunity(TransactionBase, CRMNote):
|
|||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
def set_opportunity_type(self):
|
||||||
|
if self.is_new() and not self.opportunity_type:
|
||||||
|
self.opportunity_type = _("Sales")
|
||||||
|
|
||||||
def set_exchange_rate(self):
|
def set_exchange_rate(self):
|
||||||
company_currency = frappe.get_cached_value("Company", self.company, "default_currency")
|
company_currency = frappe.get_cached_value("Company", self.company, "default_currency")
|
||||||
if self.currency == company_currency:
|
if self.currency == company_currency:
|
||||||
|
|||||||
Reference in New Issue
Block a user