added automatic lead creation for sales email id

This commit is contained in:
Rushabh Mehta
2013-01-16 11:34:26 +05:30
parent 9942987c9c
commit 2e5db35856
18 changed files with 284 additions and 101 deletions

View File

@@ -28,16 +28,12 @@ class JobsMailbox(POP3Mailbox):
return webnotes.conn.sql("select user from tabSessions where \
time_to_sec(timediff(now(), lastupdate)) < 1800")
def get_existing_application(self, email_id):
name = webnotes.conn.sql("""select name from `tabJob Applicant` where
email_id = %s""", email_id)
return name and name[0][0] or None
def process_message(self, mail):
if mail.from_email == self.settings.email_id:
return
name = self.get_existing_application(mail.from_email)
name = webnotes.conn.get_value("Job Applicant", {"email_id": mail.from_email},
"name")
if name:
applicant = webnotes.model_wrapper("Job Applicant", name)
if applicant.doc.status!="Rejected":