[minor] custom script to create issue, lead, opportunity from email
This commit is contained in:
parent
f86d73fdc8
commit
f54b1047b8
@ -21,6 +21,10 @@ app_include_css = "assets/css/erpnext.css"
|
||||
web_include_js = "assets/js/erpnext-web.min.js"
|
||||
web_include_css = "assets/erpnext/css/website.css"
|
||||
|
||||
doctype_js = {
|
||||
"Communication": "public/js/communication.js",
|
||||
}
|
||||
|
||||
# setup wizard
|
||||
setup_wizard_requires = "assets/erpnext/js/setup_wizard.js"
|
||||
setup_wizard_complete = "erpnext.setup.setup_wizard.setup_wizard.setup_complete"
|
||||
|
73
erpnext/public/js/communication.js
Normal file
73
erpnext/public/js/communication.js
Normal file
@ -0,0 +1,73 @@
|
||||
frappe.ui.form.on("Communication", {
|
||||
refresh: function(frm) {
|
||||
if(frm.doc.reference_doctype !== "Issue") {
|
||||
frm.add_custom_button(__("Issue"), function() {
|
||||
frappe.confirm("Are you sure you want to create Issue from this email", function(){
|
||||
frm.trigger('make_issue_from_communication');
|
||||
})
|
||||
}, "Make");
|
||||
}
|
||||
|
||||
if(!inList(["Lead", "Opportunity"], frm.doc.reference_doctype)) {
|
||||
frm.add_custom_button(__("Lead"), function() {
|
||||
frappe.confirm("Are you sure you want to create Lead from this email", function(){
|
||||
frm.trigger('make_lead_from_communication');
|
||||
})
|
||||
}, "Make");
|
||||
|
||||
frm.add_custom_button(__("Opportunity"), function() {
|
||||
frappe.confirm("Are you sure you want to create Opportunity from this email", function(){
|
||||
frm.trigger('make_opportunity_from_communication');
|
||||
})
|
||||
}, "Make");
|
||||
}
|
||||
|
||||
|
||||
frm.page.set_inner_btn_group_as_primary(__("Make"));
|
||||
},
|
||||
|
||||
make_lead_from_communication: function(frm) {
|
||||
return frappe.call({
|
||||
method: "frappe.email.inbox.make_lead_from_communication",
|
||||
args: {
|
||||
communication: frm.doc.name
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
frm.reload_doc()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
make_issue_from_communication: function(frm) {
|
||||
return frappe.call({
|
||||
method: "frappe.email.inbox.make_issue_from_communication",
|
||||
args: {
|
||||
communication: frm.doc.name
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
frm.reload_doc()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
make_opportunity_from_communication: function(frm) {
|
||||
return frappe.call({
|
||||
method: "frappe.email.inbox.make_opportunity_from_communication",
|
||||
args: {
|
||||
communication: frm.doc.name
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
frm.reload_doc()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user