File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 11
11
from next_crm .ncrm .doctype .crm_service_level_agreement .utils import get_sla
12
12
from next_crm .ncrm .doctype .crm_status_change_log .crm_status_change_log import add_status_change_log
13
13
14
+ from erpnext .crm .utils import (
15
+ copy_comments ,
16
+ link_communications ,
17
+ link_open_events ,
18
+ link_open_tasks ,
19
+ )
14
20
15
21
class Opportunity (Opportunity ):
16
22
@@ -23,14 +29,20 @@ def validate(self):
23
29
if not self .is_new () and self .has_value_changed ("opportunity_owner" ) and self .opportunity_owner :
24
30
self .share_with_agent (self .opportunity_owner )
25
31
self .assign_agent (self .opportunity_owner )
26
- # if self.has_value_changed("status"):
27
- # add_status_change_log(self)
32
+ if self .has_value_changed ("status" ):
33
+ add_status_change_log (self )
28
34
super ().validate ()
29
35
30
36
def after_insert (self ):
31
37
if self .opportunity_owner :
32
38
self .assign_agent (self .opportunity_owner )
33
- super ().after_insert ()
39
+
40
+ if self .opportunity_from == "Lead" :
41
+ link_open_tasks (self .opportunity_from , self .party_name , self )
42
+ link_open_events (self .opportunity_from , self .party_name , self )
43
+ if frappe .db .get_single_value ("CRM Settings" , "carry_forward_communication_and_comments" ):
44
+ copy_comments (self .opportunity_from , self .party_name , self )
45
+ link_communications (self .opportunity_from , self .party_name , self )
34
46
35
47
def before_save (self ):
36
48
self .apply_sla ()
You can’t perform that action at this time.
0 commit comments