mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 20:59:11 +00:00
[communication] [minor] cleaed model
This commit is contained in:
@@ -12,6 +12,9 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
|
||||
lead_name = webnotes.conn.get_value("Lead", {"email_id": sender})
|
||||
contact_name = webnotes.conn.get_value("Contact", {"email_id": sender})
|
||||
|
||||
parent_doctype = "Contact" if contact_name else "Lead"
|
||||
parent_name = contact_name or lead_name
|
||||
|
||||
if not (lead_name or contact_name):
|
||||
# none, create a new Lead
|
||||
lead = webnotes.bean({
|
||||
@@ -26,11 +29,11 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
|
||||
lead_name = lead.doc.name
|
||||
|
||||
message = make(content=content, sender=sender, subject=subject,
|
||||
lead=lead_name, contact=contact_name, date=date)
|
||||
doctype = parent_doctype, name = parent_name, date=date)
|
||||
|
||||
if mail:
|
||||
# save attachments to parent if from mail
|
||||
bean = webnotes.bean("Contact" if contact_name else "Lead", contact_name or lead_name)
|
||||
bean = webnotes.bean(parent_doctype, parent_name)
|
||||
mail.save_attachments_in_doc(bean.doc)
|
||||
|
||||
class SalesMailbox(POP3Mailbox):
|
||||
|
||||
@@ -24,7 +24,6 @@ class DocType(SellingController):
|
||||
})
|
||||
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
|
||||
if customer:
|
||||
self.doc.fields["__is_customer"] = customer
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-04-10 11:45:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-08 14:22:14",
|
||||
"modified": "2013-09-02 16:16:14",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -410,6 +410,14 @@
|
||||
"fieldtype": "Check",
|
||||
"label": "Blog Subscriber"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "communcations",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Communcations",
|
||||
"options": "Communication"
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"doctype": "DocPerm",
|
||||
|
||||
Reference in New Issue
Block a user