communication
diff --git a/erpnext/patches/may_2012/remove_communication_log.py b/erpnext/patches/may_2012/remove_communication_log.py
index 3e50c15..6ca05a7 100644
--- a/erpnext/patches/may_2012/remove_communication_log.py
+++ b/erpnext/patches/may_2012/remove_communication_log.py
@@ -17,6 +17,7 @@
def move_customizations():
import webnotes.model.doc
import webnotes.model.doctype
+
res = webnotes.conn.sql("""\
delete from `tabProperty Setter`
where property='previous_field'
@@ -28,15 +29,14 @@
for r in res:
d = webnotes.model.doc.Document('Custom Field', r[0])
d.dt = 'Communication'
- d.validate()
d.save()
- d.on_update()
-
+ from webnotes.model.db_schema import updatedb
+ updatedb('Communication')
+
res = webnotes.conn.sql("""\
select field_name from `tabProperty Setter`
where doc_type='Communication Log' and field_name is not null""")
-
doclist = webnotes.model.doctype.get('Communication', 0)
field_list = [d.fieldname for d in doclist if d.doctype=='DocField']
for r in res:
@@ -49,16 +49,26 @@
webnotes.conn.sql("""\
delete from `tabProperty Setter`
where doc_type='Communication Log'""")
+
+ from webnotes.utils.cache import CacheItem
+ CacheItem('Communication').clear()
def remove_communication_log():
import webnotes
import webnotes.model
import webnotes.model.doc
+ import webnotes.model.doctype
+
+ webnotes.conn.auto_commit_on_many_writes = True
# get all communication log records
comm_log_list = webnotes.conn.sql("select * from `tabCommunication Log`",
as_dict=1)
-
+
+ field_list = [d.fieldname for d in \
+ webnotes.model.doctype.get('Communication', 0) \
+ if d.doctype=='DocField']
+
# copy it to communication
for comm_log in comm_log_list:
d = webnotes.model.doc.Document('Communication')
@@ -68,9 +78,10 @@
d.fields[key] = comm_log[key]
parenttype = (comm_log.get('parenttype') or '').lower()
- if parenttype in d.fields.keys():
+ if parenttype in field_list:
d.fields[parenttype] = comm_log.get('parent')
+ d.naming_series = 'COMM-'
d.subject = 'Follow Up'
d.content = comm_log.get('notes') or ''
d.medium = comm_log.get('follow_up_type') or ''
@@ -78,7 +89,7 @@
d.communication_date = comm_log.get('date')
d.category = 'Miscellaneous'
d.action = 'No Action'
- d.save()
+ d.save(ignore_fields=1)
# delete records with parent type "Customer", "Lead", "Supplier"
webnotes.conn.sql("""\
diff --git a/erpnext/support/doctype/communication/listview.js b/erpnext/support/doctype/communication/listview.js
index 7f625f5..8d3da06 100644
--- a/erpnext/support/doctype/communication/listview.js
+++ b/erpnext/support/doctype/communication/listview.js
@@ -19,7 +19,7 @@
if(data.content && data.content.length > 50) {
data.content = '<span title="'+data.content+'">' +
- data.description.substr(0,50) + '...</span>';
+ data.content.substr(0,50) + '...</span>';
}
},
diff --git a/erpnext/support/page/support_home/support_home.html b/erpnext/support/page/support_home/support_home.html
index 3e40cb3..9404f12 100644
--- a/erpnext/support/page/support_home/support_home.html
+++ b/erpnext/support/page/support_home/support_home.html
@@ -15,13 +15,13 @@
<br>
<h4><a href="#!List/Maintenance Visit">Maintenance Visit</a></h4>
<p class="help">Visit report for maintenance visit</p>
+ <br>
+ <h4><a href="#!List/Communication">Communication</a></h4>
+ <p class="help">Communication Log</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!List/Serial No">Serial No</a></h4>
<p class="help">Single unit of an Item</p>
- <br>
- <h4><a href="#!List/Communication">Communication</a></h4>
- <p class="help">Communication Log</p>
</div>
<div style="clear: both"></div>
<hr>