fix: update default probability from deal status
This commit is contained in:
parent
144470877d
commit
c96e5ff6c5
@ -142,8 +142,16 @@ class CRMDeal(Document):
|
|||||||
if self.status == "Won" and not self.close_date:
|
if self.status == "Won" and not self.close_date:
|
||||||
self.close_date = frappe.utils.nowdate()
|
self.close_date = frappe.utils.nowdate()
|
||||||
|
|
||||||
|
def update_default_probability(self):
|
||||||
|
"""
|
||||||
|
Update the default probability based on the status.
|
||||||
|
"""
|
||||||
|
if not self.probability or self.probability == 0:
|
||||||
|
self.probability = frappe.db.get_value("CRM Deal Status", self.status, "probability") or 0
|
||||||
|
|
||||||
def validate_forcasting_fields(self):
|
def validate_forcasting_fields(self):
|
||||||
self.update_close_date()
|
self.update_close_date()
|
||||||
|
self.update_default_probability()
|
||||||
if frappe.db.get_single_value("FCRM Settings", "enable_forecasting"):
|
if frappe.db.get_single_value("FCRM Settings", "enable_forecasting"):
|
||||||
if not self.deal_value or self.deal_value == 0:
|
if not self.deal_value or self.deal_value == 0:
|
||||||
frappe.throw(_("Deal Value is required."), frappe.MandatoryError)
|
frappe.throw(_("Deal Value is required."), frappe.MandatoryError)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user