webnotes.model.doctype (new version)
This commit is contained in:
parent
a5d18706b7
commit
d7fe2bfe1b
@ -6,9 +6,9 @@ from webnotes.utils import formatdate, flt
|
||||
def get_template():
|
||||
"""download template"""
|
||||
template_type = webnotes.form_dict.get('type')
|
||||
from webnotes.model.doctype import get_field_property
|
||||
naming_options = get_field_property("Journal Voucher", "naming_series", "options")
|
||||
voucher_type = get_field_property("Journal Voucher", "voucher_type", "options")
|
||||
from webnotes.model.doctype import get_property
|
||||
naming_options = get_property("Journal Voucher", "naming_series", "options")
|
||||
voucher_type = get_property("Journal Voucher", "voucher_type", "options")
|
||||
if template_type=="Two Accounts":
|
||||
extra_note = ""
|
||||
columns = '''"Naming Series","Voucher Type","Posting Date","Amount","Debit Account","Credit Account","Cost Center","Against Sales Invoice","Against Purchase Invoice","Against Journal Voucher","Remarks","Due Date","Ref Number","Ref Date"'''
|
||||
|
@ -1,6 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.sql("alter table __CacheItem modify `value` longtext")
|
||||
webnotes.conn.begin()
|
@ -1,12 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
"""drop and create __CacheItem table again"""
|
||||
import webnotes
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.sql("drop table __CacheItem")
|
||||
webnotes.conn.sql("""create table __CacheItem(
|
||||
`key` VARCHAR(180) NOT NULL PRIMARY KEY,
|
||||
`value` LONGTEXT,
|
||||
`expires_on` DATETIME
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8""")
|
||||
webnotes.conn.begin()
|
@ -116,8 +116,8 @@ def create_file_list():
|
||||
obj.make_file_list()
|
||||
from webnotes.model.db_schema import updatedb
|
||||
updatedb(obj.doc.name)
|
||||
from webnotes.utils.cache import CacheItem
|
||||
CacheItem(obj.doc.name).clear()
|
||||
|
||||
webnotes.clear_cache(doctype=obj.doc.name)
|
||||
|
||||
def change_to_decimal():
|
||||
print "in change to decimal"
|
||||
|
@ -50,9 +50,8 @@ def move_customizations():
|
||||
webnotes.conn.sql("""\
|
||||
delete from `tabProperty Setter`
|
||||
where doc_type='Communication Log'""")
|
||||
|
||||
from webnotes.utils.cache import CacheItem
|
||||
CacheItem('Communication').clear()
|
||||
|
||||
webnotes.clear_cache(doctype="Communication")
|
||||
|
||||
def remove_communication_log():
|
||||
import webnotes
|
||||
|
@ -278,11 +278,6 @@ patch_list = [
|
||||
'patch_file': 'after_sync_cleanup',
|
||||
'description': 'cleanup after sync'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.april_2012',
|
||||
'patch_file': 'change_cacheitem_schema',
|
||||
'description': 'Modified datatype of `value` column from text to longtext'
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.april_2012',
|
||||
'patch_file': 'remove_default_from_rv_detail',
|
||||
@ -458,11 +453,6 @@ patch_list = [
|
||||
'patch_file': 'delete_about_contact',
|
||||
'description': "delete depracated doctypes of website module"
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.june_2012',
|
||||
'patch_file': 'cache_item_table',
|
||||
'description': "create cache item table again"
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.july_2012',
|
||||
'patch_file': 'reload_pr_po_mapper',
|
||||
|
@ -1,144 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// opts - parent, list, doc, email
|
||||
erpnext.CommunicationView = Class.extend({
|
||||
init: function(opts) {
|
||||
this.comm_list = [];
|
||||
$.extend(this, opts);
|
||||
|
||||
if(this.doc.__islocal) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.list.sort(function(a, b) { return
|
||||
(new Date(a.modified) > new Date(b.modified))
|
||||
? -1 : 1; })
|
||||
|
||||
this.make();
|
||||
},
|
||||
make: function() {
|
||||
var me = this;
|
||||
this.make_body();
|
||||
|
||||
if(this.list && this.list.length) {
|
||||
$.each(this.list, function(i, d) {
|
||||
me.prepare(d);
|
||||
me.make_line(d);
|
||||
});
|
||||
// show first
|
||||
this.comm_list[0].find('.comm-content').toggle(true);
|
||||
} else {
|
||||
this.body.remove()
|
||||
$("<div class='alert'>No Communication with this "
|
||||
+ this.doc.doctype +" yet.</div>").appendTo(this.wrapper);
|
||||
}
|
||||
|
||||
},
|
||||
make_body: function() {
|
||||
$(this.parent)
|
||||
.html("")
|
||||
.css({"margin":"10px 0px"});
|
||||
|
||||
this.wrapper = $("<div><h4>Communication History</h4>\
|
||||
<div style='margin-bottom: 8px;'>\
|
||||
<button class='btn btn-small' \
|
||||
onclick='cur_frm.communication_view.add_reply()'>\
|
||||
<i class='icon-plus'></i> Add Reply</button></div>\
|
||||
</div>")
|
||||
.appendTo(this.parent);
|
||||
|
||||
this.body = $("<table class='table table-bordered table-hover table-striped'>")
|
||||
.appendTo(this.wrapper);
|
||||
},
|
||||
add_reply: function() {
|
||||
var me = this;
|
||||
var d = new wn.ui.Dialog({
|
||||
width: 640,
|
||||
title: "Add Reply: " + (this.doc.subject || ""),
|
||||
fields: [
|
||||
{label:"Subject", fieldtype:"Data", reqd: 1},
|
||||
{label:"Message", fieldtype:"Text Editor", reqd: 1, fieldname:"content"},
|
||||
{label:"Send Email", fieldtype:"Check"},
|
||||
{label:"Add Reply", fieldtype:"Button"},
|
||||
]
|
||||
});
|
||||
|
||||
$(d.fields_dict.send_email.input).attr("checked", "checked")
|
||||
$(d.fields_dict.add_reply.input).click(function() {
|
||||
var args = d.get_values();
|
||||
if(!args) return;
|
||||
$(this).set_working();
|
||||
wn.call({
|
||||
method:"support.doctype.communication.communication.make",
|
||||
args: $.extend(args, {
|
||||
doctype: me.doc.doctype,
|
||||
name: me.doc.name,
|
||||
lead: me.doc.lead,
|
||||
contact: me.doc.contact,
|
||||
recipients: me.email
|
||||
}),
|
||||
callback: function(r) {
|
||||
d.hide();
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if(me.list.length > 0) {
|
||||
d.fields_dict.content.input.set_input("<p></p>"
|
||||
+ (wn.boot.profile.email_signature || "")
|
||||
+"<p></p>"
|
||||
+"-----In response to-----<p></p>"
|
||||
+ me.list[0].content)
|
||||
} else {
|
||||
|
||||
}
|
||||
$(d.fields_dict.subject.input).val(this.doc.subject || "").change();
|
||||
|
||||
d.show();
|
||||
},
|
||||
|
||||
prepare: function(doc) {
|
||||
//doc.when = comment_when(this.doc.modified);
|
||||
doc.when = doc.modified;
|
||||
if(doc.content.indexOf("<br>")== -1 && doc.content.indexOf("<p>")== -1) {
|
||||
doc.content = doc.content.replace(/\n/g, "<br>");
|
||||
}
|
||||
if(!doc.sender) doc.sender = "[unknown sender]";
|
||||
doc.sender = doc.sender.replace(/</, "<").replace(/>/, ">");
|
||||
doc.content = doc.content.split("-----In response to-----")[0];
|
||||
doc.content = doc.content.split("-----Original Message-----")[0];
|
||||
},
|
||||
make_line: function(doc) {
|
||||
var me = this;
|
||||
var comm = $(repl('<tr><td title="Click to Expand / Collapse">\
|
||||
<p><b>%(sender)s on %(when)s</b> \
|
||||
<a href="#Form/Communication/%(name)s" style="font-size: 90%">\
|
||||
Show Details</a></p>\
|
||||
<div class="comm-content" style="border-top: 1px solid #ddd; \
|
||||
padding: 10px; overflow-x: auto; display: none;"></div>\
|
||||
</td></tr>', doc))
|
||||
.appendTo(this.body)
|
||||
.css({"cursor":"pointer"})
|
||||
.click(function() {
|
||||
$(this).find(".comm-content").toggle();
|
||||
});
|
||||
|
||||
this.comm_list.push(comm);
|
||||
comm.find(".comm-content").html(doc.content);
|
||||
}
|
||||
})
|
@ -16,7 +16,6 @@
|
||||
|
||||
// Module CRM
|
||||
|
||||
wn.require("public/app/js/communication.js");
|
||||
wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
||||
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
@ -68,7 +67,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.refresh_custom_buttons(doc);
|
||||
erpnext.hide_naming_series();
|
||||
|
||||
cur_frm.communication_view = new erpnext.CommunicationView({
|
||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||
list: wn.model.get("Communication", {"lead": doc.name}),
|
||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||
doc: doc,
|
||||
|
@ -90,8 +90,7 @@ class DocType:
|
||||
|
||||
self.doc.set_options = "\n".join(options)
|
||||
|
||||
from webnotes.utils.cache import CacheItem
|
||||
CacheItem(doctype).clear()
|
||||
webnotes.clear_cache(doctype=doctype)
|
||||
|
||||
def check_duplicate(self):
|
||||
from core.doctype.doctype.doctype import DocType
|
||||
|
@ -20,7 +20,7 @@ import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, getchildren, make_autoname
|
||||
from webnotes.model.doc import Document, addchild, getchildren
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, msgprint, errprint
|
||||
@ -30,9 +30,6 @@ sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
@ -60,7 +57,7 @@ class DocType:
|
||||
# -------------------------------------------------------------------
|
||||
def get_permissions(self,doctype):
|
||||
import webnotes.model.doctype
|
||||
doclist = webnotes.model.doctype.get(doctype, form=0)
|
||||
doclist = webnotes.model.doctype.get(doctype)
|
||||
|
||||
ptype = [{
|
||||
'role': perm.role,
|
||||
@ -195,8 +192,7 @@ class DocType:
|
||||
sql("update tabDocType set modified = %s where name = %s",(now(), parent))
|
||||
|
||||
|
||||
from webnotes.utils.cache import CacheItem
|
||||
CacheItem(parent).clear()
|
||||
webnotes.clear_cache(doctype=parent)
|
||||
|
||||
msgprint("Permissions Updated")
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,142 +0,0 @@
|
||||
cur_frm.cscript.onload = function(doc) {
|
||||
cur_frm.fields_dict.user.get_query = function() {
|
||||
return "select name, concat_ws(' ', first_name, middle_name, last_name) \
|
||||
from `tabProfile` where ifnull(enabled, 0)=1 and docstatus < 2 and \
|
||||
(%(key)s like \"%s\" or \
|
||||
concat_ws(' ', first_name, middle_name, last_name) like \"%%%s\") \
|
||||
limit 50";
|
||||
};
|
||||
|
||||
cur_frm.fields_dict.lead.get_query = function() {
|
||||
return "select name, lead_name from `tabLead` \
|
||||
where docstatus < 2 and \
|
||||
(%(key)s like \"%s\" or lead_name like \"%%%s\" or \
|
||||
company_name like \"%%%s\") \
|
||||
order by lead_name asc limit 50";
|
||||
};
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
if(!doc.__islocal) {
|
||||
var field_list = ['lead', 'customer', 'supplier', 'contact', 'opportunity',
|
||||
'quotation', 'support_ticket'];
|
||||
var hide_list = [];
|
||||
$.each(field_list, function(i, v) {
|
||||
if(!doc[v]) hide_list.push(v);
|
||||
});
|
||||
|
||||
if(hide_list.length < field_list.length) hide_field(hide_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.make_communication_body = function() {
|
||||
var communication_wrapper = cur_frm.fields_dict.communication_html.wrapper;
|
||||
communication_wrapper.innerHTML = '';
|
||||
cur_frm.communication_html = $a(communication_wrapper, 'div');
|
||||
$(cur_frm.communication_html).css({
|
||||
'min-height': '275px',
|
||||
});
|
||||
}
|
||||
|
||||
cur_frm.cscript.render_communication_list = function(doc, dt, dn) {
|
||||
var ListView = wn.views.ListView.extend({
|
||||
init: function(doclistview) {
|
||||
this._super(doclistview);
|
||||
this.fields = this.fields.concat([
|
||||
"`tabCommunication`.communication_date",
|
||||
"`tabCommunication`.category",
|
||||
"`tabCommunication`.subject",
|
||||
"`tabCommunication`.content"
|
||||
]);
|
||||
this.order_by = "`tabCommunication`.communication_date desc";
|
||||
},
|
||||
|
||||
prepare_data: function(data) {
|
||||
this._super(data);
|
||||
this.prepare_when(data, data.creation);
|
||||
|
||||
// escape double quote
|
||||
data.content = cstr(data.subject).replace(/"/gi, '\"')
|
||||
+ " | " + cstr(data.content).replace(/"/gi, '\"');
|
||||
|
||||
if(data.content && data.content.length > 50) {
|
||||
data.content = '<span title="'+data.content+'">' +
|
||||
data.content.substr(0,50) + '...</span>';
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
columns: [
|
||||
{width: '3%', content: 'docstatus'},
|
||||
{width: '15%', content: 'name'},
|
||||
{width: '15%', content: 'category'},
|
||||
{width: '55%', content: 'content'},
|
||||
{width: '12%', content:'when',
|
||||
css: {'text-align': 'right', 'color':'#777'}}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
cur_frm.cscript.render_list(doc, 'Communication', cur_frm.communication_html,
|
||||
ListView, function(doctype) {
|
||||
var new_doc = LocalDB.create(doctype);
|
||||
new_doc = locals[doctype][new_doc];
|
||||
new_doc[doc.doctype.toLowerCase().replace(" ", "_")] = doc.name;
|
||||
loaddoc(new_doc.doctype, new_doc.name);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Render List
|
||||
cur_frm.cscript.render_list = function(doc, doctype, wrapper, ListView, make_new_doc) {
|
||||
wn.model.with_doctype(doctype, function(r) {
|
||||
if((r && r['403']) || wn.boot.profile.all_read.indexOf(doctype)===-1) {
|
||||
return;
|
||||
}
|
||||
var RecordListView = wn.views.RecordListView.extend({
|
||||
default_docstatus: ['0', '1', '2'],
|
||||
default_filters: [
|
||||
[doctype, doc.doctype.toLowerCase().replace(" ", "_"), '=', doc.name],
|
||||
],
|
||||
});
|
||||
|
||||
if (make_new_doc) {
|
||||
RecordListView = RecordListView.extend({
|
||||
make_new_doc: make_new_doc,
|
||||
});
|
||||
}
|
||||
|
||||
var record_list_view = new RecordListView(doctype, wrapper, ListView);
|
||||
if (!cur_frm[doctype.toLowerCase().replace(" ", "_") + "_list"]) {
|
||||
cur_frm[doctype.toLowerCase().replace(" ", "_") + "_list"] = record_list_view;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.contact = function(doc, dt, dn) {
|
||||
if (doc.contact) {
|
||||
wn.call({
|
||||
method: 'support.doctype.communication.communication.get_customer_supplier',
|
||||
args: {
|
||||
contact: doc.contact
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if (!r.exc && r.message) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
doc[r.message['fieldname']] = r.message['value'];
|
||||
refresh_field(r.message['fieldname']);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_dialog = function() {
|
||||
if(cur_frm.communication_list)
|
||||
cur_frm.communication_list.run();
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.model.doc import make_autoname
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_customer_supplier(args=None):
|
||||
"""
|
||||
Get Customer/Supplier, given a contact, if a unique match exists
|
||||
"""
|
||||
import webnotes
|
||||
if not args: args = webnotes.form_dict
|
||||
if not args.get('contact'):
|
||||
raise Exception, "Please specify a contact to fetch Customer/Supplier"
|
||||
result = webnotes.conn.sql("""\
|
||||
select customer, supplier
|
||||
from `tabContact`
|
||||
where name = %s""", args.get('contact'), as_dict=1)
|
||||
if result and len(result)==1 and (result[0]['customer'] or result[0]['supplier']):
|
||||
return {
|
||||
'fieldname': result[0]['customer'] and 'customer' or 'supplier',
|
||||
'value': result[0]['customer'] or result[0]['supplier']
|
||||
}
|
||||
return {}
|
||||
|
||||
@webnotes.whitelist()
|
||||
def make(doctype=None, name=None, content=None, subject=None,
|
||||
sender=None, recipients=None, contact=None, lead=None,
|
||||
communication_medium="Email", send_email=False):
|
||||
# add to Communication
|
||||
|
||||
sent_via = None
|
||||
|
||||
d = webnotes.doc('Communication')
|
||||
d.subject = subject
|
||||
d.content = content
|
||||
d.sender = sender or webnotes.conn.get_value("Profile", webnotes.session.user, "email")
|
||||
d.recipients = recipients
|
||||
d.lead = lead
|
||||
d.contact = contact
|
||||
if doctype:
|
||||
sent_via = webnotes.get_obj(doctype, name)
|
||||
d.fields[doctype.replace(" ", "_").lower()] = name
|
||||
|
||||
set_lead_and_contact(d)
|
||||
d.communication_medium = communication_medium
|
||||
if send_email:
|
||||
send_comm_email(d, sent_via)
|
||||
d.save(1)
|
||||
|
||||
def send_comm_email(d, sent_via=None):
|
||||
from webnotes.utils.email_lib import sendmail
|
||||
|
||||
if sent_via:
|
||||
if hasattr(sent_via, "get_sender"):
|
||||
d.sender = sent_via.get_sender(d)
|
||||
if hasattr(sent_via, "get_subject"):
|
||||
d.subject = sent_via.get_subject(d)
|
||||
if hasattr(sent_via, "get_content"):
|
||||
d.content = sent_via.get_content(d)
|
||||
|
||||
sendmail(\
|
||||
recipients = d.recipients.split(","), \
|
||||
sender = d.sender, \
|
||||
subject = d.subject, \
|
||||
msg= d.content)
|
||||
|
||||
if sent_via and hasattr(sent_via, 'on_communication_sent'):
|
||||
sent_via.on_communication_sent(d)
|
||||
|
||||
def set_lead_and_contact(d):
|
||||
import email.utils
|
||||
email_addr = email.utils.parseaddr(d.sender)
|
||||
# set contact
|
||||
if not d.contact:
|
||||
d.contact = webnotes.conn.get_value("Contact", {"email_id": email_addr[1]}, "name") or None
|
||||
|
||||
if not d.lead:
|
||||
d.lead = webnotes.conn.get_value("Lead", {"email_id": email_addr[1]}, "name") or None
|
||||
|
||||
if not d.lead and not d.contact:
|
||||
d.lead = make_lead(d, email_addr[0])
|
||||
|
||||
def make_lead(d, real_name):
|
||||
lead = webnotes.doc("Lead")
|
||||
lead.lead_name = real_name or d.sender
|
||||
lead.email_id = d.sender
|
||||
lead.source = "Email"
|
||||
lead.save(1)
|
||||
return lead.name
|
||||
|
||||
class DocType():
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
@ -1,347 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-11-14 12:25:16",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-11-27 18:51:01"
|
||||
},
|
||||
{
|
||||
"autoname": "naming_series:",
|
||||
"allow_attach": 1,
|
||||
"name": "__common__",
|
||||
"doctype": "DocType",
|
||||
"module": "Support",
|
||||
"in_dialog": 0,
|
||||
"document_type": "Master",
|
||||
"description": "Keep a track of all communications"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Communication",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Communication",
|
||||
"read": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "Communication",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Basic Info",
|
||||
"fieldname": "basic_info",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"default": "COMM-",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Naming Series",
|
||||
"options": "COMM-",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Subject",
|
||||
"fieldname": "subject",
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Content",
|
||||
"width": "400",
|
||||
"fieldname": "content",
|
||||
"fieldtype": "Text Editor",
|
||||
"reqd": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"options": "simple",
|
||||
"fieldname": "section_break1",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Category",
|
||||
"options": "\nSales\nComplaint\nHelp\nSuggestion\nMiscellaneous\nSent Mail",
|
||||
"fieldname": "category",
|
||||
"fieldtype": "Select",
|
||||
"reqd": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Next Communcation On",
|
||||
"fieldname": "next_communication_date",
|
||||
"fieldtype": "Date",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Action",
|
||||
"options": "\nCreated Opportunity\nSent Quotation\nCreated Support Ticket\nCreated Customer Issue\nNo Action\nSent Mail",
|
||||
"fieldname": "action",
|
||||
"fieldtype": "Select",
|
||||
"reqd": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Additional Info",
|
||||
"fieldname": "additional_info",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Lead",
|
||||
"options": "Lead",
|
||||
"fieldname": "lead",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Contact",
|
||||
"options": "Contact",
|
||||
"fieldname": "contact",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Customer",
|
||||
"options": "Customer",
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Supplier",
|
||||
"options": "Supplier",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Opportunity",
|
||||
"options": "Opportunity",
|
||||
"fieldname": "opportunity",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Quotation",
|
||||
"options": "Quotation",
|
||||
"fieldname": "quotation",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Support Ticket",
|
||||
"options": "Support Ticket",
|
||||
"fieldname": "support_ticket",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Recipients",
|
||||
"fieldname": "recipients",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Sender",
|
||||
"fieldname": "sender",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Communication Medium",
|
||||
"options": "\nChat\nPhone\nEmail\nSMS\nVisit\nOther",
|
||||
"fieldname": "communication_medium",
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Phone No.",
|
||||
"fieldname": "phone_no",
|
||||
"fieldtype": "Data",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"options": "simple",
|
||||
"fieldname": "section_break2",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "By",
|
||||
"fieldname": "column_break4",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"default": "__user",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "User",
|
||||
"options": "Profile",
|
||||
"fieldname": "user",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Sales Person",
|
||||
"options": "Sales Person",
|
||||
"fieldname": "sales_person",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "On",
|
||||
"fieldname": "column_break5",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"default": "Today",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Date",
|
||||
"fieldname": "communication_date",
|
||||
"fieldtype": "Date",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "File List",
|
||||
"fieldname": "file_list",
|
||||
"fieldtype": "Text",
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "User Tags",
|
||||
"fieldname": "_user_tags",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"role": "Support Team",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"role": "Sales Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"role": "Sales User",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"role": "Sales Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"submit": 0,
|
||||
"role": "Support Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Support Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
}
|
||||
]
|
@ -1,43 +0,0 @@
|
||||
wn.doclistviews['Communication'] = wn.views.ListView.extend({
|
||||
init: function(doclistview) {
|
||||
this._super(doclistview);
|
||||
this.fields = this.fields.concat([
|
||||
"`tabCommunication`.creation",
|
||||
"`tabCommunication`.category",
|
||||
"`tabCommunication`.subject",
|
||||
"`tabCommunication`.content"
|
||||
]);
|
||||
this.order_by = "`tabCommunication`.creation desc";
|
||||
this.stats = this.stats.concat(['category']);
|
||||
},
|
||||
|
||||
prepare_data: function(data) {
|
||||
this._super(data);
|
||||
this.prepare_when(data, data.creation);
|
||||
|
||||
// escape double quote
|
||||
data.content = cstr(data.subject)
|
||||
+ " | " + cstr(data.content);
|
||||
data.content = data.content.replace(/"/gi, '\"')
|
||||
.replace(/</gi, '<').replace(/>/gi, '>');
|
||||
|
||||
if(data.content && data.content.length > 50) {
|
||||
data.content = '<span title="'+data.content+'">' +
|
||||
data.content.substr(0,50) + '...</span>';
|
||||
}
|
||||
},
|
||||
|
||||
columns: [
|
||||
{width: '3%', content: 'check'},
|
||||
{width: '5%', content: 'avatar'},
|
||||
{width: '15%', content: 'name'},
|
||||
{width: '15%', content: 'category'},
|
||||
{width: '55%', content: 'content+tags'},
|
||||
{width: '12%', content:'when',
|
||||
css: {'text-align': 'right', 'color':'#777'}}
|
||||
],
|
||||
|
||||
make_new_doc: function(new_doctype) {
|
||||
new_doc(new_doctype, 1);
|
||||
}
|
||||
});
|
@ -14,8 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wn.require("public/app/js/communication.js");
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
@ -62,7 +60,7 @@ $.extend(cur_frm.cscript, {
|
||||
"modified": doc.creation,
|
||||
"content": doc.description});
|
||||
|
||||
cur_frm.communication_view = new erpnext.CommunicationView({
|
||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||
list: comm_list,
|
||||
parent: wrapper,
|
||||
doc: doc,
|
||||
|
@ -14,9 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
wn.require("public/app/js/communication.js");
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
||||
cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
||||
@ -26,7 +23,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function() {
|
||||
cur_frm.communication_view = new erpnext.CommunicationView({
|
||||
cur_frm.communication_view = new wn.views.CommunicationList({
|
||||
list: wn.model.get("Communication", {"contact": doc.name}),
|
||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||
doc: doc,
|
||||
|
@ -20,7 +20,7 @@ wn.doclistviews['Contact'] = wn.views.ListView.extend({
|
||||
data.fullname = (data.first_name || '') +
|
||||
(data.last_name ? ' ' + data.last_name : '');
|
||||
if(!data.fullname) data.fullname = data.name;
|
||||
data.fullname = repl("<a href='#!Form/Contact/%(name)s'>%(fullname)s\
|
||||
data.fullname = repl("<a href='#!Form/Contact/%(name)s'>%(name)s\
|
||||
</a>", data);
|
||||
|
||||
// prepare description
|
||||
|
Loading…
x
Reference in New Issue
Block a user