communication is now created when email is sent
This commit is contained in:
parent
94c336cc58
commit
bc62349441
4 changed files with 36 additions and 7 deletions
|
|
@ -39,7 +39,9 @@ sendmail = function(emailto, emailfrom, cc, subject, message, fmt, with_attachme
|
|||
'full_domain': wn.urllib.get_base_url(),
|
||||
'with_attachments':with_attachments ? 1 : 0,
|
||||
'dt':cur_frm.doctype,
|
||||
'dn':cur_frm.docname
|
||||
'dn':cur_frm.docname,
|
||||
'customer': cur_frm.doc.customer || '',
|
||||
'supplier': cur_frm.doc.supplier || ''
|
||||
},
|
||||
function(r, rtxt) {
|
||||
//
|
||||
|
|
|
|||
|
|
@ -110,7 +110,8 @@ def get_contact_list():
|
|||
Returns contacts (from autosuggest)
|
||||
"""
|
||||
|
||||
cond = ['`%s` like "%s%%"' % (f, webnotes.form.getvalue('txt')) for f in webnotes.form.getvalue('where').split(',')]
|
||||
cond = ['`%s` like "%s%%"' % (f,
|
||||
webnotes.form.getvalue('txt')) for f in webnotes.form.getvalue('where').split(',')]
|
||||
cl = webnotes.conn.sql("select `%s` from `tab%s` where %s" % (
|
||||
webnotes.form.getvalue('select')
|
||||
,webnotes.form.getvalue('from')
|
||||
|
|
|
|||
|
|
@ -141,10 +141,6 @@ class FormEmail:
|
|||
# form itself (only in the html message)
|
||||
html_message += self.body
|
||||
|
||||
# form link
|
||||
html_message += self.get_form_link()
|
||||
text_message += self.get_form_link()
|
||||
|
||||
# footer
|
||||
footer = get_footer()
|
||||
if footer:
|
||||
|
|
@ -155,7 +151,34 @@ class FormEmail:
|
|||
# message as text
|
||||
self.email.set_text(html2text(unicode(text_message, 'utf-8')))
|
||||
self.email.set_html(html_message)
|
||||
|
||||
|
||||
def make_communication(self):
|
||||
"""make email communication"""
|
||||
from webnotes.model.doc import Document
|
||||
comm = Document('Communication')
|
||||
comm.communication_medium = 'Email'
|
||||
comm.subject = self.subject
|
||||
comm.content = self.message
|
||||
comm.category = 'Sent Mail'
|
||||
comm.action = 'Sent Mail'
|
||||
comm.naming_series = 'COMM-'
|
||||
try:
|
||||
comm_cols = [c[0] for c in webnotes.conn.sql("""desc tabCommunication""")]
|
||||
|
||||
# tag to record
|
||||
if self.dt in comm_cols:
|
||||
comm.fields[self.dt] = self.dn
|
||||
|
||||
# tag to customer, supplier (?)
|
||||
if self.customer:
|
||||
comm.customer = self.customer
|
||||
if self.supplier:
|
||||
comm.supplier = self.supplier
|
||||
|
||||
comm.save(1)
|
||||
except Exception, e:
|
||||
if e.args[0]!=1146: raise e
|
||||
|
||||
def send(self):
|
||||
"""
|
||||
Send the form with html attachment
|
||||
|
|
@ -182,4 +205,6 @@ class FormEmail:
|
|||
self.email.cc = [self.cc]
|
||||
|
||||
self.email.send(send_now=1)
|
||||
self.make_communication()
|
||||
|
||||
webnotes.msgprint('Sent')
|
||||
|
|
|
|||
1
wnf.py
1
wnf.py
|
|
@ -95,6 +95,7 @@ def pull(remote, branch):
|
|||
os.chdir('..')
|
||||
|
||||
def apply_latest_patches():
|
||||
import webnotes.modules.patch_handler
|
||||
webnotes.modules.patch_handler.run_all()
|
||||
print '\n'.join(webnotes.modules.patch_handler.log_list)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue