From 8d3fe553e578ca4dff1600e90d8570deaffeb461 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 16 Jan 2013 12:19:28 +0530 Subject: [PATCH] added automatic lead creation for sales email id --- hr/doctype/job_applicant/job_applicant.py | 3 + public/js/modules.js | 118 +--------------------- selling/doctype/lead/lead.py | 3 + 3 files changed, 7 insertions(+), 117 deletions(-) diff --git a/hr/doctype/job_applicant/job_applicant.py b/hr/doctype/job_applicant/job_applicant.py index b4db3c07f7..da722fbff4 100644 --- a/hr/doctype/job_applicant/job_applicant.py +++ b/hr/doctype/job_applicant/job_applicant.py @@ -10,6 +10,9 @@ class DocType(TransactionBase): def onload(self): self.add_communication_list() + + def get_sender(self, comm): + return webnotes.conn.get_value('Jobs Email Settings',None,'email_id') def on_communication_sent(self, comm): webnotes.conn.set(self.doc, 'status', 'Replied') diff --git a/public/js/modules.js b/public/js/modules.js index 5c572dda8e..5fcd64b5a3 100644 --- a/public/js/modules.js +++ b/public/js/modules.js @@ -97,120 +97,4 @@ $.extend(wn.modules, { }); -wn.provide('erpnext.module_page'); - -erpnext.module_page.setup_page = function(module, wrapper) { - erpnext.module_page.hide_links(wrapper); - erpnext.module_page.make_list(module, wrapper); - $(wrapper).find("a[title]").tooltip({ - delay: { show: 500, hide: 100 } - }); - wrapper.appframe.add_home_breadcrumb(); - wrapper.appframe.add_breadcrumb(wn.modules[module].icon); -} - -// hide list links where the user does -// not have read permissions - -erpnext.module_page.hide_links = function(wrapper) { - function replace_link(link) { - var txt = $(link).text(); - $(link).parent().css('color', '#999'); - $(link).replaceWith('' - +txt+''); - } - - // lists - $(wrapper).find('[href*="List/"]').each(function() { - var href = $(this).attr('href'); - var dt = href.split('/')[1]; - if(wn.boot.profile.all_read.indexOf(dt)==-1) { - replace_link(this); - } - }); - - // reports - $(wrapper).find('[data-doctype]').each(function() { - var dt = $(this).attr('data-doctype'); - if(wn.boot.profile.all_read.indexOf(dt)==-1) { - replace_link(this); - } - }); - - // single (forms) - $(wrapper).find('[href*="Form/"]').each(function() { - var href = $(this).attr('href'); - var dt = href.split('/')[1]; - if(wn.boot.profile.all_read.indexOf(dt)==-1) { - replace_link(this); - } - }); - - // pages - $(wrapper).find('[data-role]').each(function() { - // can define multiple roles - var data_roles = $.map($(this).attr("data-role").split(","), function(role) { - return role.trim(); }); - if(!has_common(user_roles, ["System Manager"].concat(data_roles))) { - var html = $(this).html(); - $(this).parent().css('color', '#999'); - $(this).replaceWith(''+html+''); - } - }); -} - -// make list of reports - -erpnext.module_page.make_list = function(module, wrapper) { - // make project listing - var $w = $(wrapper).find('.reports-list'); - var $parent1 = $('
').appendTo($w); - var $parent2 = $('
').appendTo($w); - - wrapper.list1 = new wn.ui.Listing({ - parent: $parent1, - method: 'utilities.get_sc_list', - render_row: function(row, data) { - if(!data.parent_doc_type) data.parent_doc_type = data.doc_type; - $(row).html(repl('\ - %(criteria_name)s', data)) - }, - args: { module: module }, - no_refresh: true, - callback: function(r) { - erpnext.module_page.hide_links($parent1) - } - }); - wrapper.list1.run(); - - wrapper.list2 = new wn.ui.Listing({ - parent: $parent2, - method: 'utilities.get_report_list', - render_row: function(row, data) { - data.report_type = data.is_query_report - ? "query-report" - : repl("Report2/%(ref_doctype)s", data) - - $(row).html(repl('\ - %(name)s', data)) - }, - args: { module: module }, - no_refresh: true, - callback: function(r) { - erpnext.module_page.hide_links($parent2) - } - }); - wrapper.list2.run(); - - // show link to all reports - $parent1.find('.list-toolbar-wrapper') - .prepend("
\ - [ List Of All Reports ]
"); - $parent2.find('.list-toolbar-wrapper') - .prepend("
\ - [ List Of All Reports (New) ]
"); -} \ No newline at end of file +wn.provide('erpnext.module_page'); \ No newline at end of file diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 13d1714830..dd24ff696c 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -80,6 +80,9 @@ class DocType(TransactionBase): def on_communication_sent(self, comm): webnotes.conn.set(self.doc, 'status', 'Replied') + def get_sender(self, comm): + return webnotes.conn.get_value('Sales Email Settings',None,'email_id') + def on_trash(self): webnotes.conn.sql("""delete from tabCommunication where lead=%s""", self.doc.name)