@@ -39,11 +39,10 @@ def get_customer_supplier(args=None): | |||||
@webnotes.whitelist() | @webnotes.whitelist() | ||||
def make(doctype=None, name=None, content=None, subject=None, | def make(doctype=None, name=None, content=None, subject=None, | ||||
sender=None, recipients=None, contact=None, lead=None, | |||||
sender=None, recipients=None, contact=None, lead=None, company=None, | |||||
communication_medium="Email", send_email=False, print_html=None, | communication_medium="Email", send_email=False, print_html=None, | ||||
attachments='[]', send_me_a_copy=False, set_lead=True, date=None): | attachments='[]', send_me_a_copy=False, set_lead=True, date=None): | ||||
# add to Communication | # add to Communication | ||||
sent_via = None | sent_via = None | ||||
d = webnotes.doc('Communication') | d = webnotes.doc('Communication') | ||||
@@ -53,6 +52,7 @@ def make(doctype=None, name=None, content=None, subject=None, | |||||
d.recipients = recipients | d.recipients = recipients | ||||
d.lead = lead | d.lead = lead | ||||
d.contact = contact | d.contact = contact | ||||
d.company = company | |||||
if date: | if date: | ||||
d.creation = date | d.creation = date | ||||
if doctype: | if doctype: | ||||
@@ -113,6 +113,14 @@ def set_lead_and_contact(d): | |||||
if not d.lead: | if not d.lead: | ||||
d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr[1]}, | d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr[1]}, | ||||
"name") or None | "name") or None | ||||
if not d.company: | |||||
if d.lead: | |||||
company = webnotes.conn.get_value("Lead", d.lead, "company") | |||||
elif d.contact: | |||||
company = webnotes.conn.get_value("Contact", d.contact, "company") | |||||
d.company = company or webnotes.conn.get_default("company") | |||||
class DocType(): | class DocType(): | ||||
def __init__(self, doc, doclist=[]): | def __init__(self, doc, doclist=[]): | ||||
@@ -1,8 +1,8 @@ | |||||
[ | [ | ||||
{ | { | ||||
"creation": "2013-01-28 17:06:59", | |||||
"creation": "2013-01-29 10:47:14", | |||||
"docstatus": 0, | "docstatus": 0, | ||||
"modified": "2013-01-28 15:29:13", | |||||
"modified": "2013-05-21 12:19:45", | |||||
"modified_by": "Administrator", | "modified_by": "Administrator", | ||||
"owner": "Administrator" | "owner": "Administrator" | ||||
}, | }, | ||||
@@ -26,14 +26,14 @@ | |||||
"permlevel": 0 | "permlevel": 0 | ||||
}, | }, | ||||
{ | { | ||||
"create": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"name": "__common__", | "name": "__common__", | ||||
"parent": "Communication", | "parent": "Communication", | ||||
"parentfield": "permissions", | "parentfield": "permissions", | ||||
"parenttype": "DocType", | "parenttype": "DocType", | ||||
"permlevel": 0, | |||||
"read": 1, | "read": 1, | ||||
"report": 1, | |||||
"submit": 0, | |||||
"write": 1 | "write": 1 | ||||
}, | }, | ||||
{ | { | ||||
@@ -53,7 +53,6 @@ | |||||
"doctype": "DocField", | "doctype": "DocField", | ||||
"fieldname": "subject", | "fieldname": "subject", | ||||
"fieldtype": "Data", | "fieldtype": "Data", | ||||
"in_list_view": 1, | |||||
"label": "Subject", | "label": "Subject", | ||||
"reqd": 1 | "reqd": 1 | ||||
}, | }, | ||||
@@ -175,14 +174,12 @@ | |||||
"doctype": "DocField", | "doctype": "DocField", | ||||
"fieldname": "recipients", | "fieldname": "recipients", | ||||
"fieldtype": "Data", | "fieldtype": "Data", | ||||
"in_list_view": 1, | |||||
"label": "Recipients" | "label": "Recipients" | ||||
}, | }, | ||||
{ | { | ||||
"doctype": "DocField", | "doctype": "DocField", | ||||
"fieldname": "sender", | "fieldname": "sender", | ||||
"fieldtype": "Data", | "fieldtype": "Data", | ||||
"in_list_view": 1, | |||||
"label": "Sender" | "label": "Sender" | ||||
}, | }, | ||||
{ | { | ||||
@@ -233,6 +230,13 @@ | |||||
"fieldtype": "Column Break", | "fieldtype": "Column Break", | ||||
"label": "On" | "label": "On" | ||||
}, | }, | ||||
{ | |||||
"doctype": "DocField", | |||||
"fieldname": "company", | |||||
"fieldtype": "Link", | |||||
"label": "Company", | |||||
"options": "Company" | |||||
}, | |||||
{ | { | ||||
"default": "Today", | "default": "Today", | ||||
"doctype": "DocField", | "doctype": "DocField", | ||||
@@ -250,53 +254,46 @@ | |||||
"print_hide": 1 | "print_hide": 1 | ||||
}, | }, | ||||
{ | { | ||||
"create": 1, | |||||
"doctype": "DocPerm", | |||||
"permlevel": 0, | |||||
"role": "Support Team" | |||||
}, | |||||
{ | |||||
"create": 1, | |||||
"amend": 0, | |||||
"cancel": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"permlevel": 0, | |||||
"role": "Sales Manager" | |||||
"report": 1, | |||||
"role": "Support Team", | |||||
"submit": 0 | |||||
}, | }, | ||||
{ | { | ||||
"create": 1, | |||||
"amend": 0, | |||||
"cancel": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"permlevel": 0, | |||||
"role": "Sales User" | |||||
"report": 1, | |||||
"role": "Sales Manager", | |||||
"submit": 0 | |||||
}, | }, | ||||
{ | { | ||||
"amend": 0, | "amend": 0, | ||||
"cancel": 0, | |||||
"create": 0, | |||||
"cancel": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"match": "", | |||||
"permlevel": 1, | |||||
"role": "Sales Manager" | |||||
"report": 1, | |||||
"role": "Sales User", | |||||
"submit": 0 | |||||
}, | }, | ||||
{ | { | ||||
"amend": 0, | |||||
"cancel": 0, | |||||
"create": 0, | |||||
"cancel": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"match": "", | |||||
"permlevel": 1, | |||||
"role": "Support Manager" | |||||
"report": 1, | |||||
"role": "Support Manager", | |||||
"submit": 0 | |||||
}, | }, | ||||
{ | { | ||||
"cancel": 1, | "cancel": 1, | ||||
"create": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"permlevel": 0, | |||||
"role": "Support Manager" | |||||
"report": 1, | |||||
"role": "System Manager", | |||||
"submit": 0 | |||||
}, | }, | ||||
{ | { | ||||
"cancel": 1, | |||||
"create": 1, | |||||
"doctype": "DocPerm", | "doctype": "DocPerm", | ||||
"permlevel": 0, | |||||
"role": "System Manager" | |||||
"match": "owner", | |||||
"role": "Sales Representative" | |||||
} | } | ||||
] | ] |
@@ -229,6 +229,7 @@ wn.views.CommunicationComposer = Class.extend({ | |||||
name: me.doc.name, | name: me.doc.name, | ||||
lead: me.doc.lead, | lead: me.doc.lead, | ||||
contact: me.doc.contact, | contact: me.doc.contact, | ||||
company: me.doc.company || sys_defaults.company, | |||||
send_me_a_copy: form_values.send_me_a_copy, | send_me_a_copy: form_values.send_me_a_copy, | ||||
send_email: form_values.send_email, | send_email: form_values.send_email, | ||||
print_html: print_html, | print_html: print_html, | ||||