[communication] [minor] cleaed model

This commit is contained in:
Rushabh Mehta
2013-09-02 17:04:27 +05:30
parent 04c4e2aea3
commit 96690ebd0f
21 changed files with 92 additions and 51 deletions

View File

@@ -12,9 +12,6 @@ class DocType(TransactionBase):
self.doc = doc
self.doclist = doclist
def onload(self):
self.add_communication_list()
def on_communication_sent(self, comm):
webnotes.conn.set(self.doc, 'status', 'Replied')

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:32",
"docstatus": 0,
"modified": "2013-07-05 14:32:19",
"modified": "2013-09-02 16:26:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -225,6 +225,14 @@
"oldfieldtype": "Small Text",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "communications",
"fieldtype": "Table",
"hidden": 1,
"label": "Communications",
"options": "Communication"
},
{
"cancel": 1,
"doctype": "DocPerm",

View File

@@ -229,20 +229,7 @@ class TransactionBase(StatusUpdater):
if int(webnotes.conn.get_value("Notification Control", None, dt) or 0):
self.doc.fields["__notification_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):
if not self.doc.posting_time:
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')