Merge pull request #48715 from wojosc/patch-44

refactor: remove default value for opportunity type
This commit is contained in:
ruthra kumar
2025-08-12 10:49:16 +05:30
committed by GitHub
3 changed files with 9 additions and 2 deletions

View File

@@ -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"));
}
if (this.frm.is_new() && this.frm.doc.opportunity_type === undefined) {
this.frm.doc.opportunity_type = __("Sales");
}
this.setup_queries();
}

View File

@@ -152,7 +152,6 @@
"no_copy": 1
},
{
"default": "Sales",
"fieldname": "opportunity_type",
"fieldtype": "Link",
"in_list_view": 1,
@@ -670,4 +669,4 @@
"title_field": "title",
"track_seen": 1,
"track_views": 1
}
}

View File

@@ -126,6 +126,7 @@ class Opportunity(TransactionBase, CRMNote):
link_communications(self.opportunity_from, self.party_name, self)
def validate(self):
self.set_opportunity_type()
self.make_new_lead_if_required()
self.validate_item_details()
self.validate_uom_is_integer("uom", "qty")
@@ -150,6 +151,10 @@ class Opportunity(TransactionBase, CRMNote):
except Exception:
continue
def set_opportunity_type(self):
if self.is_new() and not self.opportunity_type:
self.opportunity_type = _("Sales")
def set_exchange_rate(self):
company_currency = frappe.get_cached_value("Company", self.company, "default_currency")
if self.currency == company_currency: