[communication] [minor] cleaed model
This commit is contained in:
parent
04c4e2aea3
commit
96690ebd0f
@ -18,9 +18,6 @@ class DocType(TransactionBase):
|
|||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
supp_master_name = webnotes.defaults.get_global_default('supp_master_name')
|
supp_master_name = webnotes.defaults.get_global_default('supp_master_name')
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:11",
|
"creation": "2013-01-10 16:34:11",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-08 14:22:08",
|
"modified": "2013-09-02 16:25:44",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -204,6 +204,14 @@
|
|||||||
"oldfieldname": "website",
|
"oldfieldname": "website",
|
||||||
"oldfieldtype": "Data"
|
"oldfieldtype": "Data"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
|
@ -37,7 +37,7 @@ class JobsMailbox(POP3Mailbox):
|
|||||||
mail.save_attachments_in_doc(applicant.doc)
|
mail.save_attachments_in_doc(applicant.doc)
|
||||||
|
|
||||||
make(content=mail.content, sender=mail.from_email,
|
make(content=mail.content, sender=mail.from_email,
|
||||||
doctype="Job Applicant", name=applicant.doc.name, set_lead=False)
|
doctype="Job Applicant", name=applicant.doc.name)
|
||||||
|
|
||||||
def get_job_applications():
|
def get_job_applications():
|
||||||
if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')):
|
if cint(webnotes.conn.get_value('Jobs Email Settings', None, 'extract_emails')):
|
||||||
|
@ -11,9 +11,6 @@ class DocType(TransactionBase):
|
|||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
def get_sender(self, comm):
|
def get_sender(self, comm):
|
||||||
return webnotes.conn.get_value('Jobs Email Settings',None,'email_id')
|
return webnotes.conn.get_value('Jobs Email Settings',None,'email_id')
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-29 19:25:37",
|
"creation": "2013-01-29 19:25:37",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-05 14:43:11",
|
"modified": "2013-09-02 16:26:23",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -89,6 +89,14 @@
|
|||||||
"fieldtype": "HTML",
|
"fieldtype": "HTML",
|
||||||
"label": "Thread HTML"
|
"label": "Thread HTML"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm"
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,6 @@ class DocType(TransactionBase):
|
|||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
cust_master_name = webnotes.defaults.get_global_default('cust_master_name')
|
cust_master_name = webnotes.defaults.get_global_default('cust_master_name')
|
||||||
if cust_master_name == 'Customer Name':
|
if cust_master_name == 'Customer Name':
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-06-11 14:26:44",
|
"creation": "2013-06-11 14:26:44",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-08 14:22:13",
|
"modified": "2013-09-02 16:25:13",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -348,6 +348,15 @@
|
|||||||
"options": "Customer Discount",
|
"options": "Customer Discount",
|
||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication",
|
||||||
|
"permlevel": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
|
@ -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})
|
lead_name = webnotes.conn.get_value("Lead", {"email_id": sender})
|
||||||
contact_name = webnotes.conn.get_value("Contact", {"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):
|
if not (lead_name or contact_name):
|
||||||
# none, create a new Lead
|
# none, create a new Lead
|
||||||
lead = webnotes.bean({
|
lead = webnotes.bean({
|
||||||
@ -26,11 +29,11 @@ def add_sales_communication(subject, content, sender, real_name, mail=None,
|
|||||||
lead_name = lead.doc.name
|
lead_name = lead.doc.name
|
||||||
|
|
||||||
message = make(content=content, sender=sender, subject=subject,
|
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:
|
if mail:
|
||||||
# save attachments to parent if from 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)
|
mail.save_attachments_in_doc(bean.doc)
|
||||||
|
|
||||||
class SalesMailbox(POP3Mailbox):
|
class SalesMailbox(POP3Mailbox):
|
||||||
|
@ -24,7 +24,6 @@ class DocType(SellingController):
|
|||||||
})
|
})
|
||||||
|
|
||||||
def onload(self):
|
def onload(self):
|
||||||
self.add_communication_list()
|
|
||||||
customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
|
customer = webnotes.conn.get_value("Customer", {"lead_name": self.doc.name})
|
||||||
if customer:
|
if customer:
|
||||||
self.doc.fields["__is_customer"] = customer
|
self.doc.fields["__is_customer"] = customer
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-04-10 11:45:37",
|
"creation": "2013-04-10 11:45:37",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-08 14:22:14",
|
"modified": "2013-09-02 16:16:14",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -410,6 +410,14 @@
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Blog Subscriber"
|
"label": "Blog Subscriber"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communcations",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communcations",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
@ -26,9 +26,6 @@ class DocType(TransactionBase):
|
|||||||
(not cint(self.doc.fields.get("__islocal"))) else None,
|
(not cint(self.doc.fields.get("__islocal"))) else None,
|
||||||
})
|
})
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
def get_item_details(self, item_code):
|
def get_item_details(self, item_code):
|
||||||
item = sql("""select item_name, stock_uom, description_html, description, item_group, brand
|
item = sql("""select item_name, stock_uom, description_html, description, item_group, brand
|
||||||
from `tabItem` where name = %s""", item_code, as_dict=1)
|
from `tabItem` where name = %s""", item_code, as_dict=1)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-03-07 18:50:30",
|
"creation": "2013-03-07 18:50:30",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-08 14:22:15",
|
"modified": "2013-09-02 16:27:33",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -442,6 +442,14 @@
|
|||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"width": "150px"
|
"width": "150px"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"role": "Sales User"
|
"role": "Sales User"
|
||||||
|
@ -21,9 +21,6 @@ class DocType(SellingController):
|
|||||||
self.tname = 'Quotation Item'
|
self.tname = 'Quotation Item'
|
||||||
self.fname = 'quotation_details'
|
self.fname = 'quotation_details'
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
# Get contact person details based on customer selected
|
# Get contact person details based on customer selected
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
def get_contact_details(self):
|
def get_contact_details(self):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-05-24 19:29:08",
|
"creation": "2013-05-24 19:29:08",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-09 14:46:11",
|
"modified": "2013-09-02 16:25:01",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -835,6 +835,14 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"width": "40px"
|
"width": "40px"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:24",
|
"creation": "2013-01-10 16:34:24",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-05 18:11:22",
|
"modified": "2013-09-02 16:26:54",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -160,6 +160,14 @@
|
|||||||
"options": "Budget Distribution",
|
"options": "Budget Distribution",
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"create": 0,
|
"create": 0,
|
||||||
|
@ -46,7 +46,7 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
|
|
||||||
make(content=mail.content, sender=mail.from_email, subject = ticket.doc.subject,
|
make(content=mail.content, sender=mail.from_email, subject = ticket.doc.subject,
|
||||||
doctype="Support Ticket", name=ticket.doc.name,
|
doctype="Support Ticket", name=ticket.doc.name,
|
||||||
lead = ticket.doc.lead, contact=ticket.doc.contact, date=mail.date)
|
date=mail.date)
|
||||||
|
|
||||||
if new_ticket and cint(self.email_settings.send_autoreply) and \
|
if new_ticket and cint(self.email_settings.send_autoreply) and \
|
||||||
"mailer-daemon" not in mail.from_email.lower():
|
"mailer-daemon" not in mail.from_email.lower():
|
||||||
|
@ -12,9 +12,6 @@ class DocType(TransactionBase):
|
|||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
def get_sender(self, comm):
|
def get_sender(self, comm):
|
||||||
return webnotes.conn.get_value('Email Settings',None,'support_email')
|
return webnotes.conn.get_value('Email Settings',None,'support_email')
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-02-01 10:36:25",
|
"creation": "2013-02-01 10:36:25",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-08-28 18:29:06",
|
"modified": "2013-09-02 16:24:24",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -261,6 +261,14 @@
|
|||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
"label": "Content Type"
|
"label": "Content Type"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cancel": 0,
|
"cancel": 0,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
@ -12,9 +12,6 @@ class DocType(TransactionBase):
|
|||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def onload(self):
|
|
||||||
self.add_communication_list()
|
|
||||||
|
|
||||||
def on_communication_sent(self, comm):
|
def on_communication_sent(self, comm):
|
||||||
webnotes.conn.set(self.doc, 'status', 'Replied')
|
webnotes.conn.set(self.doc, 'status', 'Replied')
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:32",
|
"creation": "2013-01-10 16:34:32",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-07-05 14:32:19",
|
"modified": "2013-09-02 16:26:13",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -225,6 +225,14 @@
|
|||||||
"oldfieldtype": "Small Text",
|
"oldfieldtype": "Small Text",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "communications",
|
||||||
|
"fieldtype": "Table",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Communications",
|
||||||
|
"options": "Communication"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
|
@ -230,19 +230,6 @@ class TransactionBase(StatusUpdater):
|
|||||||
self.doc.fields["__notification_message"] = \
|
self.doc.fields["__notification_message"] = \
|
||||||
webnotes.conn.get_value("Notification Control", None, dt + "_message")
|
webnotes.conn.get_value("Notification Control", None, dt + "_message")
|
||||||
|
|
||||||
def add_communication_list(self):
|
|
||||||
# remove communications if present
|
|
||||||
self.doclist = webnotes.doclist(self.doclist).get({
|
|
||||||
"doctype": ["!=", "Communcation"]})
|
|
||||||
|
|
||||||
comm_list = webnotes.conn.sql("""select * from tabCommunication
|
|
||||||
where %s=%s order by modified desc limit 20""" \
|
|
||||||
% (self.doc.doctype.replace(" ", "_").lower(), "%s"),
|
|
||||||
self.doc.name, as_dict=1, update={"doctype":"Communication"})
|
|
||||||
|
|
||||||
self.doclist.extend(webnotes.doclist([webnotes.doc(fielddata=d) \
|
|
||||||
for d in comm_list]))
|
|
||||||
|
|
||||||
def validate_posting_time(self):
|
def validate_posting_time(self):
|
||||||
if not self.doc.posting_time:
|
if not self.doc.posting_time:
|
||||||
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
|
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
|
||||||
|
Loading…
Reference in New Issue
Block a user