Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
0b00b46a99
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -52,7 +52,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
cur_frm.cscript.hide_unhide_group_ledger = function(doc) {
|
||||||
hide_field(['convert_to_group', 'convert_to_ledger']);
|
hide_field(['convert_to_group', 'convert_to_ledger']);
|
||||||
if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
|
if (cstr(doc.group_or_ledger) == 'Group') unhide_field('convert_to_ledger');
|
||||||
else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_ledger');
|
else if (cstr(doc.group_or_ledger) == 'Ledger') unhide_field('convert_to_group');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert group to ledger
|
// Convert group to ledger
|
||||||
|
@ -485,7 +485,8 @@ def manage_recurring_invoices():
|
|||||||
and notify the concerned people
|
and notify the concerned people
|
||||||
"""
|
"""
|
||||||
rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0) = 1
|
rv = webnotes.conn.sql("""select name, recurring_id from `tabSales Invoice` where ifnull(convert_into_recurring_invoice, 0) = 1
|
||||||
and next_date = %s and next_date <= end_date and docstatus=1 order by next_date desc""", nowdate())
|
and next_date = %s and next_date <= ifnull(end_date, '2199-12-31') and docstatus=1""", nowdate())
|
||||||
|
|
||||||
for d in rv:
|
for d in rv:
|
||||||
if not webnotes.conn.sql("""select name from `tabSales Invoice` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
|
if not webnotes.conn.sql("""select name from `tabSales Invoice` where posting_date = %s and recurring_id = %s and docstatus=1""", (nowdate(), d[1])):
|
||||||
prev_rv = get_obj('Sales Invoice', d[0], with_children=1)
|
prev_rv = get_obj('Sales Invoice', d[0], with_children=1)
|
||||||
@ -503,6 +504,8 @@ def create_new_invoice(prev_rv):
|
|||||||
new_rv.doc.posting_date = new_rv.doc.next_date
|
new_rv.doc.posting_date = new_rv.doc.next_date
|
||||||
new_rv.doc.aging_date = new_rv.doc.next_date
|
new_rv.doc.aging_date = new_rv.doc.next_date
|
||||||
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
|
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))
|
||||||
|
new_rv.doc.invoice_period_from_date = get_next_month_date(new_rv.doc.invoice_period_from_date)
|
||||||
|
new_rv.doc.invoice_period_to_date = get_next_month_date(new_rv.doc.invoice_period_to_date)
|
||||||
new_rv.doc.owner = prev_rv.doc.owner
|
new_rv.doc.owner = prev_rv.doc.owner
|
||||||
new_rv.doc.save()
|
new_rv.doc.save()
|
||||||
|
|
||||||
@ -512,6 +515,21 @@ def create_new_invoice(prev_rv):
|
|||||||
|
|
||||||
return new_rv
|
return new_rv
|
||||||
|
|
||||||
|
def get_next_month_date(dt):
|
||||||
|
import datetime
|
||||||
|
m = getdate(dt).month + 1
|
||||||
|
y = getdate(dt).year
|
||||||
|
d = getdate(dt).day
|
||||||
|
if m > 12:
|
||||||
|
m, y = 1, y+1
|
||||||
|
try:
|
||||||
|
next_month_date = datetime.date(y, m, d)
|
||||||
|
except:
|
||||||
|
import calendar
|
||||||
|
last_day = calendar.monthrange(y, m)[1]
|
||||||
|
next_month_date = datetime.date(y, m, last_day)
|
||||||
|
return next_month_date.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
|
||||||
def send_notification(new_rv):
|
def send_notification(new_rv):
|
||||||
"""Notify concerned persons about recurring invoice generation"""
|
"""Notify concerned persons about recurring invoice generation"""
|
||||||
@ -528,7 +546,7 @@ def send_notification(new_rv):
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \
|
''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \
|
||||||
getdate(add_days(add_months(new_rv.doc.posting_date, -1), 1)).strftime("%d-%m-%Y"), getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"),\
|
getdate(new_rv.doc.invoice_period_from_date).strftime("%d-%m-%Y"), getdate(new_rv.doc.invoice_period_to_date).strftime("%d-%m-%Y"),\
|
||||||
getdate(new_rv.doc.due_date).strftime("%d-%m-%Y"))
|
getdate(new_rv.doc.due_date).strftime("%d-%m-%Y"))
|
||||||
|
|
||||||
|
|
||||||
@ -570,5 +588,4 @@ def send_notification(new_rv):
|
|||||||
|
|
||||||
msg = hd + tbl + totals
|
msg = hd + tbl + totals
|
||||||
from webnotes.utils.email_lib import sendmail
|
from webnotes.utils.email_lib import sendmail
|
||||||
sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \
|
sendmail(new_rv.doc.notification_email_address.split(", "), subject=subject, msg = msg)
|
||||||
sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]])
|
|
@ -292,7 +292,7 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
|
|||||||
// Expense Head
|
// Expense Head
|
||||||
// -------------
|
// -------------
|
||||||
cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
|
cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
|
||||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
||||||
}
|
}
|
||||||
cur_frm.cscript.expense_head = function(doc, cdt, cdn){
|
cur_frm.cscript.expense_head = function(doc, cdt, cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
|
@ -390,7 +390,7 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|||||||
// Income Account in Details Table
|
// Income Account in Details Table
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
|
cur_frm.fields_dict.entries.grid.get_field("income_account").get_query = function(doc) {
|
||||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Credit" OR tabAccount.account_type = "Income Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
||||||
}
|
}
|
||||||
|
|
||||||
// warehouse in detail table
|
// warehouse in detail table
|
||||||
|
@ -683,6 +683,8 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
def convert_into_recurring(self):
|
def convert_into_recurring(self):
|
||||||
if self.doc.convert_into_recurring_invoice:
|
if self.doc.convert_into_recurring_invoice:
|
||||||
|
if not self.doc.invoice_period_from_date or not self.doc.invoice_period_to_date:
|
||||||
|
msgprint("Invoice period from date and to date is mandatory for recurring invoice", raise_exception=1)
|
||||||
self.set_next_date()
|
self.set_next_date()
|
||||||
if not self.doc.recurring_id:
|
if not self.doc.recurring_id:
|
||||||
webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
|
webnotes.conn.set(self.doc, 'recurring_id', make_autoname('RECINV/.#####'))
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{
|
{
|
||||||
'creation': '2012-04-13 11:56:18',
|
'creation': '2012-04-13 11:56:18',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-05-14 14:09:43',
|
'modified': '2012-06-04 14:40:59',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -1498,11 +1498,25 @@
|
|||||||
{
|
{
|
||||||
'allow_on_submit': 1,
|
'allow_on_submit': 1,
|
||||||
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
|
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
|
||||||
'description': u'The date on which recurring invoice will be stop',
|
'description': u'Start date of the invoice period',
|
||||||
'doctype': u'DocField',
|
'doctype': u'DocField',
|
||||||
'fieldname': u'end_date',
|
'fieldname': u'invoice_period_from_date',
|
||||||
'fieldtype': u'Date',
|
'fieldtype': u'Date',
|
||||||
'label': u'End Date',
|
'label': u'Invoice Period From Date',
|
||||||
|
'no_copy': 1,
|
||||||
|
'permlevel': 0,
|
||||||
|
'print_hide': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'allow_on_submit': 1,
|
||||||
|
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
|
||||||
|
'description': u'End date of the invoice period',
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'invoice_period_to_date',
|
||||||
|
'fieldtype': u'Date',
|
||||||
|
'label': u'Invoice Period To Date',
|
||||||
'no_copy': 1,
|
'no_copy': 1,
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
'print_hide': 1
|
'print_hide': 1
|
||||||
@ -1559,6 +1573,20 @@
|
|||||||
'print_hide': 1
|
'print_hide': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'allow_on_submit': 1,
|
||||||
|
'depends_on': u'eval:doc.convert_into_recurring_invoice==1',
|
||||||
|
'description': u'The date on which recurring invoice will be stop',
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'end_date',
|
||||||
|
'fieldtype': u'Date',
|
||||||
|
'label': u'End Date',
|
||||||
|
'no_copy': 1,
|
||||||
|
'permlevel': 0,
|
||||||
|
'print_hide': 1
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
'doctype': u'DocField',
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
|
wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
|
||||||
|
wn.require('erpnext/support/doctype/communication/communication.js');
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
|||||||
// make contact, history list body
|
// make contact, history list body
|
||||||
//cur_frm.cscript.make_cl_body();
|
//cur_frm.cscript.make_cl_body();
|
||||||
cur_frm.cscript.make_hl_body();
|
cur_frm.cscript.make_hl_body();
|
||||||
|
cur_frm.cscript.make_communication_body();
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||||
@ -44,7 +46,8 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
|
|||||||
// make lists
|
// make lists
|
||||||
cur_frm.cscript.make_address(doc,dt,dn);
|
cur_frm.cscript.make_address(doc,dt,dn);
|
||||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||||
cur_frm.cscript.make_history(doc,dt,dn);
|
cur_frm.cscript.render_communication_list(doc, cdt, cdn);
|
||||||
|
cur_frm.cscript.make_history(doc,dt,dn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,44 +112,88 @@ cur_frm.cscript.make_contact = function() {
|
|||||||
// Transaction History
|
// Transaction History
|
||||||
|
|
||||||
cur_frm.cscript.make_po_list = function(parent, doc) {
|
cur_frm.cscript.make_po_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Order',
|
var ListView = wn.views.ListView.extend({
|
||||||
[
|
init: function(doclistview) {
|
||||||
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
|
this._super(doclistview);
|
||||||
{fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
|
this.fields = this.fields.concat([
|
||||||
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
|
"`tabPurchase Order`.status",
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
"`tabPurchase Order`.currency",
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
"ifnull(`tabPurchase Order`.grand_total_import, 0) as grand_total_import",
|
||||||
style: 'display: hidden'},
|
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
]);
|
||||||
type: 'Currency', style: 'text-align: right'},
|
},
|
||||||
]);
|
|
||||||
|
prepare_data: function(data) {
|
||||||
|
this._super(data);
|
||||||
|
data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import);
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '20%', content: 'name'},
|
||||||
|
{width: '30%', content: 'status',
|
||||||
|
css: {'text-align': 'right', 'color': '#777'}},
|
||||||
|
{width: '35%', content: 'grand_total_import', css: {'text-align': 'right'}},
|
||||||
|
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript.render_list(doc, 'Purchase Order', parent, ListView);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_pr_list = function(parent, doc) {
|
cur_frm.cscript.make_pr_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Receipt',
|
var ListView = wn.views.ListView.extend({
|
||||||
[
|
init: function(doclistview) {
|
||||||
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
|
this._super(doclistview);
|
||||||
{fieldname: 'status', width: '15%', label: 'Status', type: 'Data'},
|
this.fields = this.fields.concat([
|
||||||
{fieldname: 'per_billed', width: '10%', label: '% Billed',
|
"`tabPurchase Receipt`.status",
|
||||||
type: 'Percentage', style: 'text-align: right'},
|
"`tabPurchase Receipt`.currency",
|
||||||
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
|
"ifnull(`tabPurchase Receipt`.grand_total_import, 0) as grand_total_import",
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
"ifnull(`tabPurchase Receipt`.per_billed, 0) as per_billed",
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
]);
|
||||||
style: 'display: hidden'},
|
},
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
|
||||||
type: 'Currency', style: 'text-align: right'},
|
prepare_data: function(data) {
|
||||||
]);
|
this._super(data);
|
||||||
|
data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import);
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '20%', content: 'name'},
|
||||||
|
{width: '20%', content: 'status',
|
||||||
|
css: {'text-align': 'right', 'color': '#777'}},
|
||||||
|
{width: '35%', content: 'grand_total_import', css: {'text-align': 'right'}},
|
||||||
|
{width: '10%', content: 'per_billed', type: 'bar-graph', label: 'Billed'},
|
||||||
|
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript.render_list(doc, 'Purchase Receipt', parent, ListView);
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_pi_list = function(parent, doc) {
|
cur_frm.cscript.make_pi_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Purchase Invoice',
|
var ListView = wn.views.ListView.extend({
|
||||||
[
|
init: function(doclistview) {
|
||||||
{fieldname: 'name', width: '30%', label: 'Id', type: 'Link'},
|
this._super(doclistview);
|
||||||
{fieldname: 'modified', width: '35%', label: 'Last Modified On',
|
this.fields = this.fields.concat([
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
"`tabPurchase Invoice`.currency",
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
"ifnull(`tabPurchase Invoice`.grand_total_import, 0) as grand_total_import",
|
||||||
style: 'display: hidden'},
|
]);
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
},
|
||||||
type: 'Currency', style: 'text-align: right'},
|
|
||||||
]);
|
prepare_data: function(data) {
|
||||||
|
this._super(data);
|
||||||
|
data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import);
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '30%', content: 'name'},
|
||||||
|
{width: '55%', content: 'grand_total_import', css: {'text-align': 'right'}},
|
||||||
|
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript.render_list(doc, 'Purchase Invoice', parent, ListView);
|
||||||
}
|
}
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-03-27 14:35:52',
|
'creation': '2012-05-15 12:14:41',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-03-27 14:35:52',
|
'modified': '2012-05-31 13:18:29',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -25,7 +25,7 @@
|
|||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'subject': u' ',
|
'subject': u' ',
|
||||||
'tag_fields': u'supplier_type',
|
'tag_fields': u'supplier_type',
|
||||||
'version': 87
|
'version': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
@ -53,6 +53,30 @@
|
|||||||
'name': u'Supplier'
|
'name': u'Supplier'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'amend': 0,
|
||||||
|
'cancel': 0,
|
||||||
|
'create': 0,
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 1,
|
||||||
|
'role': u'Purchase Manager',
|
||||||
|
'submit': 0,
|
||||||
|
'write': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'amend': 0,
|
||||||
|
'cancel': 0,
|
||||||
|
'create': 0,
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': u'Purchase Manager',
|
||||||
|
'submit': 0,
|
||||||
|
'write': 0
|
||||||
|
},
|
||||||
|
|
||||||
# DocPerm
|
# DocPerm
|
||||||
{
|
{
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
@ -72,30 +96,6 @@
|
|||||||
'write': 1
|
'write': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocPerm
|
|
||||||
{
|
|
||||||
'amend': 0,
|
|
||||||
'cancel': 0,
|
|
||||||
'create': 0,
|
|
||||||
'doctype': u'DocPerm',
|
|
||||||
'permlevel': 1,
|
|
||||||
'role': u'Purchase Manager',
|
|
||||||
'submit': 0,
|
|
||||||
'write': 0
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocPerm
|
|
||||||
{
|
|
||||||
'amend': 0,
|
|
||||||
'cancel': 0,
|
|
||||||
'create': 0,
|
|
||||||
'doctype': u'DocPerm',
|
|
||||||
'permlevel': 0,
|
|
||||||
'role': u'Purchase Manager',
|
|
||||||
'submit': 0,
|
|
||||||
'write': 0
|
|
||||||
},
|
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'colour': u'White:FFF',
|
'colour': u'White:FFF',
|
||||||
@ -218,6 +218,24 @@
|
|||||||
'permlevel': 1
|
'permlevel': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'communication_history',
|
||||||
|
'fieldtype': u'Section Break',
|
||||||
|
'label': u'Communication History',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'communication_html',
|
||||||
|
'fieldtype': u'HTML',
|
||||||
|
'label': u'Communication HTML',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'doctype': u'DocField',
|
'doctype': u'DocField',
|
||||||
|
108
erpnext/patches/may_2012/remove_communication_log.py
Normal file
108
erpnext/patches/may_2012/remove_communication_log.py
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
import webnotes.model.sync
|
||||||
|
webnotes.model.sync.sync('support', 'communication')
|
||||||
|
webnotes.conn.commit()
|
||||||
|
webnotes.conn.begin()
|
||||||
|
|
||||||
|
# change doctype property setter and custom fields, and save them
|
||||||
|
move_customizations()
|
||||||
|
|
||||||
|
try:
|
||||||
|
remove_communication_log()
|
||||||
|
except Exception, e:
|
||||||
|
if e.args[0] != 1146:
|
||||||
|
raise e
|
||||||
|
|
||||||
|
def move_customizations():
|
||||||
|
import webnotes.model.doc
|
||||||
|
import webnotes.model.doctype
|
||||||
|
|
||||||
|
res = webnotes.conn.sql("""\
|
||||||
|
delete from `tabProperty Setter`
|
||||||
|
where property='previous_field'
|
||||||
|
and doc_type = 'Communication Log'""")
|
||||||
|
|
||||||
|
res = webnotes.conn.sql("""\
|
||||||
|
select name from `tabCustom Field`
|
||||||
|
where dt='Communication Log'""")
|
||||||
|
for r in res:
|
||||||
|
d = webnotes.model.doc.Document('Custom Field', r[0])
|
||||||
|
d.dt = 'Communication'
|
||||||
|
d.save()
|
||||||
|
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:
|
||||||
|
if r[0] in field_list:
|
||||||
|
webnotes.conn.sql("""\
|
||||||
|
update `tabProperty Setter`
|
||||||
|
set doc_type = 'Communication'
|
||||||
|
where field_name=%s and doc_type='Communication Log'""", r[0])
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
for key in comm_log.keys():
|
||||||
|
if key not in webnotes.model.default_fields:
|
||||||
|
d.fields[key] = comm_log[key]
|
||||||
|
|
||||||
|
parenttype = (comm_log.get('parenttype') or '').lower()
|
||||||
|
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 ''
|
||||||
|
d.sales_person = comm_log.get('follow_up_by')
|
||||||
|
d.communication_date = comm_log.get('date')
|
||||||
|
d.category = 'Miscellaneous'
|
||||||
|
d.action = 'No Action'
|
||||||
|
d.save(ignore_fields=1)
|
||||||
|
|
||||||
|
# delete records with parent type "Customer", "Lead", "Supplier"
|
||||||
|
webnotes.conn.sql("""\
|
||||||
|
delete from `tabCommunication Log`
|
||||||
|
where parenttype in ('Customer', 'Lead', 'Supplier',
|
||||||
|
'Opportunity', 'Quotation')""")
|
||||||
|
|
||||||
|
# if all records deleted, drop table communication log
|
||||||
|
# and delete doctype communication log
|
||||||
|
# if for some reason, records remain, dont drop table and dont delete doctype
|
||||||
|
count = webnotes.conn.sql("select count(*) from `tabCommunication Log`")[0][0]
|
||||||
|
if not count:
|
||||||
|
webnotes.model.delete_doc('DocType', 'Communication Log')
|
||||||
|
webnotes.conn.commit()
|
||||||
|
webnotes.conn.sql("drop table `tabCommunication Log`")
|
||||||
|
webnotes.conn.begin()
|
@ -407,4 +407,9 @@ patch_list = [
|
|||||||
'patch_file': 'remove_euro_currency',
|
'patch_file': 'remove_euro_currency',
|
||||||
'description': 'Remove EURO currency and replace with EUR'
|
'description': 'Remove EURO currency and replace with EUR'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.may_2012',
|
||||||
|
'patch_file': 'remove_communication_log',
|
||||||
|
'description': 'Remove Communication Log and replace it with Communication'
|
||||||
|
},
|
||||||
]
|
]
|
@ -15,6 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
|
wn.require('erpnext/setup/doctype/contact_control/contact_control.js');
|
||||||
|
wn.require('erpnext/support/doctype/communication/communication.js');
|
||||||
|
|
||||||
/* ********************************* onload ********************************************* */
|
/* ********************************* onload ********************************************* */
|
||||||
|
|
||||||
@ -31,6 +32,8 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
|||||||
//cur_frm.cscript.make_sl_body();
|
//cur_frm.cscript.make_sl_body();
|
||||||
|
|
||||||
cur_frm.cscript.load_defaults(doc, dt, dn);
|
cur_frm.cscript.load_defaults(doc, dt, dn);
|
||||||
|
|
||||||
|
cur_frm.cscript.make_communication_body();
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
||||||
@ -62,6 +65,7 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
|
|||||||
cur_frm.cscript.make_address(doc,dt,dn);
|
cur_frm.cscript.make_address(doc,dt,dn);
|
||||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||||
cur_frm.cscript.make_history(doc,dt,dn);
|
cur_frm.cscript.make_history(doc,dt,dn);
|
||||||
|
cur_frm.cscript.render_communication_list(doc, cdt, cdn);
|
||||||
//cur_frm.cscript.make_shipping_address(doc,dt,dn);
|
//cur_frm.cscript.make_shipping_address(doc,dt,dn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,62 +147,84 @@ cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){
|
|||||||
|
|
||||||
|
|
||||||
// Transaction History
|
// Transaction History
|
||||||
// functions called by these functions are defined in contact_control.js
|
// functions called by these functions are defined in communication.js
|
||||||
cur_frm.cscript.make_qtn_list = function(parent, doc) {
|
cur_frm.cscript.make_qtn_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Quotation',
|
cur_frm.cscript.get_common_list_view(parent, doc, 'Quotation');
|
||||||
[
|
|
||||||
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
|
|
||||||
{fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
|
|
||||||
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
|
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
|
||||||
style: 'display: hidden'},
|
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
|
||||||
type: 'Currency', style: 'text-align: right'},
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_so_list = function(parent, doc) {
|
cur_frm.cscript.make_so_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Sales Order',
|
cur_frm.cscript.get_common_list_view(parent, doc, 'Sales Order');
|
||||||
[
|
|
||||||
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
|
|
||||||
{fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
|
|
||||||
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
|
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
|
||||||
style: 'display: hidden'},
|
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
|
||||||
type: 'Currency', style: 'text-align: right'},
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_dn_list = function(parent, doc) {
|
cur_frm.cscript.make_dn_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Delivery Note',
|
cur_frm.cscript.get_common_list_view(parent, doc, 'Delivery Note');
|
||||||
[
|
}
|
||||||
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
|
|
||||||
{fieldname: 'status', width: '25%', label: 'Status', type: 'Data'},
|
cur_frm.cscript.get_common_list_view = function(parent, doc, doctype) {
|
||||||
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
|
var ListView = wn.views.ListView.extend({
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
init: function(doclistview) {
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
this._super(doclistview);
|
||||||
style: 'display: hidden'},
|
this.fields = this.fields.concat([
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
"`tab" + doctype + "`.status",
|
||||||
type: 'Currency', style: 'text-align: right'},
|
"`tab" + doctype + "`.currency",
|
||||||
]);
|
"ifnull(`tab" + doctype + "`.grand_total_export, 0) as grand_total_export",
|
||||||
|
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
prepare_data: function(data) {
|
||||||
|
this._super(data);
|
||||||
|
data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export)
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '25%', content: 'name'},
|
||||||
|
{width: '25%', content: 'status'},
|
||||||
|
{width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}},
|
||||||
|
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript.render_list(doc, doctype, parent, ListView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.make_si_list = function(parent, doc) {
|
cur_frm.cscript.make_si_list = function(parent, doc) {
|
||||||
cur_frm.cscript.render_transaction_history(parent, doc, 'Sales Invoice',
|
var ListView = wn.views.ListView.extend({
|
||||||
[
|
init: function(doclistview) {
|
||||||
{fieldname: 'name', width: '28%', label: 'Id', type: 'Link'},
|
this._super(doclistview);
|
||||||
{fieldname: 'outstanding_amount', width: '25%',
|
this.fields = this.fields.concat([
|
||||||
label: 'Outstanding Amount',
|
"ifnull(`tabSales Invoice`.outstanding_amount, 0) as outstanding_amount",
|
||||||
type: 'Currency', style: 'text-align: right; color: #777'},
|
"`tabSales Invoice`.currency",
|
||||||
{fieldname: 'modified', width: '12%', label: 'Last Modified On',
|
"ifnull(`tabSales Invoice`.conversion_rate, 0) as conversion_rate",
|
||||||
type: 'Date', style: 'text-align: right; color: #777'},
|
"ifnull(`tabSales Invoice`.grand_total_export, 0) as grand_total_export",
|
||||||
{fieldname: 'currency', width: '0%', label: 'Currency',
|
|
||||||
style: 'display: hidden'},
|
]);
|
||||||
{fieldname: 'grand_total', width: '35%', label: 'Grand Total',
|
},
|
||||||
type: 'Currency', style: 'text-align: right'},
|
|
||||||
]);
|
prepare_data: function(data) {
|
||||||
|
this._super(data);
|
||||||
|
if (data.outstanding_amount) {
|
||||||
|
data.outstanding_amount = data.currency + " " +
|
||||||
|
fmt_money(flt(data.outstanding_amount)/flt(data.conversion_rate)) +
|
||||||
|
" [outstanding]";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
data.outstanding_amount = '';
|
||||||
|
}
|
||||||
|
data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export);
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '25%', content: 'name'},
|
||||||
|
{width: '25%', content: 'outstanding_amount',
|
||||||
|
css: {'text-align': 'right', 'color': '#777'}},
|
||||||
|
{width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}},
|
||||||
|
{width: '12%', content:'modified', css: {'text-align': 'right'}}
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
cur_frm.cscript.render_list(doc, 'Sales Invoice', parent, ListView);
|
||||||
}
|
}
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-04-13 11:56:26',
|
'creation': '2012-05-15 12:14:51',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-04-19 17:12:24',
|
'modified': '2012-05-31 11:41:06',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -303,6 +303,24 @@
|
|||||||
'permlevel': 1
|
'permlevel': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'communication_history',
|
||||||
|
'fieldtype': u'Section Break',
|
||||||
|
'label': u'Communication History',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'communication_html',
|
||||||
|
'fieldtype': u'HTML',
|
||||||
|
'label': u'Communication HTML',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'colour': u'White:FFF',
|
'colour': u'White:FFF',
|
||||||
|
@ -8,19 +8,20 @@
|
|||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// Module CRM
|
// Module CRM
|
||||||
|
|
||||||
wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
|
wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
|
||||||
|
wn.require('erpnext/support/doctype/communication/communication.js');
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||||
if(user =='Guest'){
|
if(user =='Guest'){
|
||||||
hide_field(['status', 'naming_series', 'order_lost_reason',
|
hide_field(['status', 'naming_series', 'order_lost_reason',
|
||||||
'customer', 'rating', 'fax', 'website', 'territory',
|
'customer', 'rating', 'fax', 'website', 'territory',
|
||||||
'address_line1', 'address_line2', 'city', 'state',
|
'address_line1', 'address_line2', 'city', 'state',
|
||||||
'country', 'pincode', 'address', 'lead_owner', 'market_segment',
|
'country', 'pincode', 'address', 'lead_owner', 'market_segment',
|
||||||
@ -29,29 +30,33 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
'contact_date_ref', 'to_discuss', 'more_info', 'follow_up',
|
'contact_date_ref', 'to_discuss', 'more_info', 'follow_up',
|
||||||
'communication_history', 'cc_to', 'subject', 'message', 'lead_attachment_detail',
|
'communication_history', 'cc_to', 'subject', 'message', 'lead_attachment_detail',
|
||||||
'Create Customer', 'Create Opportunity', 'transaction_date', 'type', 'source']);
|
'Create Customer', 'Create Opportunity', 'transaction_date', 'type', 'source']);
|
||||||
doc.source = 'Website';
|
doc.source = 'Website';
|
||||||
}
|
}
|
||||||
if(!doc.status) set_multiple(dt,dn,{status:'Open'});
|
if(!doc.status) set_multiple(dt,dn,{status:'Open'});
|
||||||
|
|
||||||
if (!doc.date){
|
if (!doc.date){
|
||||||
doc.date = date.obj_to_str(new Date());
|
doc.date = date.obj_to_str(new Date());
|
||||||
}
|
}
|
||||||
// set naming series
|
// set naming series
|
||||||
if(user=='Guest') doc.naming_series = 'WebLead';
|
if(user=='Guest') doc.naming_series = 'WebLead';
|
||||||
|
|
||||||
cur_frm.add_fetch('customer', 'customer_name', 'company_name');
|
cur_frm.add_fetch('customer', 'customer_name', 'company_name');
|
||||||
|
|
||||||
|
cur_frm.cscript.make_communication_body();
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
// custom buttons
|
// custom buttons
|
||||||
//---------------
|
//---------------
|
||||||
cur_frm.clear_custom_buttons()
|
cur_frm.clear_custom_buttons()
|
||||||
if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
|
if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
|
||||||
if (doc.source != 'Existing Customer') cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
|
if (doc.source != 'Existing Customer') cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
|
||||||
cur_frm.add_custom_button('Create Opportunity', cur_frm.cscript['Create Opportunity']);
|
cur_frm.add_custom_button('Create Opportunity', cur_frm.cscript['Create Opportunity']);
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||||
}
|
}
|
||||||
erpnext.hide_naming_series();
|
erpnext.hide_naming_series();
|
||||||
|
|
||||||
|
if (!doc.__islocal) cur_frm.cscript.render_communication_list(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,82 +64,81 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
// ===========================================================
|
// ===========================================================
|
||||||
// ************ Status ******************
|
// ************ Status ******************
|
||||||
cur_frm.cscript.status = function(doc, cdt, cdn){
|
cur_frm.cscript.status = function(doc, cdt, cdn){
|
||||||
cur_frm.cscript.refresh(doc, cdt, cdn);
|
cur_frm.cscript.refresh(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Trigger in Item Table
|
//Trigger in Item Table
|
||||||
//===================================
|
//===================================
|
||||||
cur_frm.cscript.item_code=function(doc,cdt,cdn){
|
cur_frm.cscript.item_code=function(doc,cdt,cdn){
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.item_code) { get_server_fields('get_item_detail',d.item_code,'lead_item_detail',doc,cdt,cdn,1);}
|
if (d.item_code) { get_server_fields('get_item_detail',d.item_code,'lead_item_detail',doc,cdt,cdn,1);}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create New Customer
|
// Create New Customer
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
cur_frm.cscript['Create Customer'] = function(){
|
cur_frm.cscript['Create Customer'] = function(){
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
|
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'Converted'){
|
if(r.message == 'Converted'){
|
||||||
msgprint("This lead is already converted to customer");
|
msgprint("This lead is already converted to customer");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
n = createLocal("Customer");
|
n = createLocal("Customer");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Customer"][n]]),
|
'docs':compress_doclist([locals["Customer"][n]]),
|
||||||
'from_doctype':'Lead',
|
'from_doctype':'Lead',
|
||||||
'to_doctype':'Customer',
|
'to_doctype':'Customer',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
'from_to_list':"[['Lead', 'Customer']]"
|
'from_to_list':"[['Lead', 'Customer']]"
|
||||||
},
|
},
|
||||||
function(r,rt) {
|
function(r,rt) {
|
||||||
loaddoc("Customer", n);
|
loaddoc("Customer", n);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// send email
|
// send email
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
cur_frm.cscript.send_email = function(doc,cdt,cdn){
|
cur_frm.cscript.send_email = function(doc,cdt,cdn){
|
||||||
if(doc.__islocal != 1){
|
if(doc.__islocal != 1){
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
|
$c_obj(make_doclist(doc.doctype, doc.name),'send_mail','',function(r,rt){});
|
||||||
}else{
|
}else{
|
||||||
msgprint("Please save lead first before sending email")
|
msgprint("Please save lead first before sending email")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create New Opportunity
|
// Create New Opportunity
|
||||||
// ===============================================================
|
// ===============================================================
|
||||||
cur_frm.cscript['Create Opportunity'] = function(){
|
cur_frm.cscript['Create Opportunity'] = function(){
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
|
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist([doc])},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'Converted'){
|
if(r.message == 'Converted'){
|
||||||
msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
|
msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
n = createLocal("Opportunity");
|
n = createLocal("Opportunity");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Opportunity"][n]]),
|
'docs':compress_doclist([locals["Opportunity"][n]]),
|
||||||
'from_doctype':'Lead',
|
'from_doctype':'Lead',
|
||||||
'to_doctype':'Opportunity',
|
'to_doctype':'Opportunity',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
'from_to_list':"[['Lead', 'Opportunity']]"
|
'from_to_list':"[['Lead', 'Opportunity']]"
|
||||||
}
|
}
|
||||||
, function(r,rt) {
|
, function(r,rt) {
|
||||||
loaddoc("Opportunity", n);
|
loaddoc("Opportunity", n);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get query select Territory
|
//get query select Territory
|
||||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-04-02 16:02:08',
|
'creation': '2012-05-15 12:14:52',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-04-30 15:20:50',
|
'modified': '2012-05-30 12:43:03',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -314,13 +314,13 @@
|
|||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'allow_on_submit': 0,
|
'allow_on_submit': 0,
|
||||||
|
'colour': u'White:FFF',
|
||||||
'doctype': u'DocField',
|
'doctype': u'DocField',
|
||||||
'fieldname': u'follow_up',
|
'fieldname': u'communication_html',
|
||||||
'fieldtype': u'Table',
|
'fieldtype': u'HTML',
|
||||||
'label': u'Communication Log',
|
'label': u'Communication HTML',
|
||||||
'oldfieldname': u'follow_up',
|
'oldfieldname': u'follow_up',
|
||||||
'oldfieldtype': u'Table',
|
'oldfieldtype': u'Table',
|
||||||
'options': u'Communication Log',
|
|
||||||
'permlevel': 0
|
'permlevel': 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
|
wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
|
||||||
|
wn.require('erpnext/support/doctype/communication/communication.js');
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
||||||
erpnext.hide_naming_series();
|
erpnext.hide_naming_series();
|
||||||
@ -25,7 +26,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn){
|
|||||||
cur_frm.add_custom_button('Opportunity Lost', cur_frm.cscript['Declare Opportunity Lost']);
|
cur_frm.add_custom_button('Opportunity Lost', cur_frm.cscript['Declare Opportunity Lost']);
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||||
}
|
}
|
||||||
|
if(!doc.__islocal) cur_frm.cscript.render_communication_list(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ONLOAD
|
// ONLOAD
|
||||||
@ -49,6 +50,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
// setup fetch
|
// setup fetch
|
||||||
cur_frm.cscript.set_fetch();
|
cur_frm.cscript.set_fetch();
|
||||||
|
cur_frm.cscript.make_communication_body();
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-04-02 16:02:08',
|
'creation': '2012-05-15 12:14:52',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-04-30 15:34:34',
|
'modified': '2012-05-31 12:42:38',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -282,12 +282,11 @@
|
|||||||
'allow_on_submit': 1,
|
'allow_on_submit': 1,
|
||||||
'colour': u'White:FFF',
|
'colour': u'White:FFF',
|
||||||
'doctype': u'DocField',
|
'doctype': u'DocField',
|
||||||
'fieldname': u'follow_up',
|
'fieldname': u'communication_html',
|
||||||
'fieldtype': u'Table',
|
'fieldtype': u'HTML',
|
||||||
'label': u'Communication Log',
|
'label': u'Communication HTML',
|
||||||
'oldfieldname': u'follow_up',
|
'oldfieldname': u'follow_up',
|
||||||
'oldfieldtype': u'Table',
|
'oldfieldtype': u'Table',
|
||||||
'options': u'Communication Log',
|
|
||||||
'permlevel': 0
|
'permlevel': 0
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ wn.require('erpnext/selling/doctype/sales_common/sales_common.js');
|
|||||||
wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
|
wn.require('erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js');
|
||||||
wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
|
wn.require('erpnext/utilities/doctype/sms_control/sms_control.js');
|
||||||
wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
|
wn.require('erpnext/setup/doctype/notification_control/notification_control.js');
|
||||||
|
wn.require('erpnext/support/doctype/communication/communication.js');
|
||||||
|
|
||||||
// ONLOAD
|
// ONLOAD
|
||||||
// ===================================================================================
|
// ===================================================================================
|
||||||
@ -39,7 +40,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
|
if(!doc.company && sys_defaults.company) set_multiple(cdt,cdn,{company:sys_defaults.company});
|
||||||
if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
|
if(!doc.fiscal_year && sys_defaults.fiscal_year) set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});
|
||||||
|
|
||||||
if(doc.quotation_to) {
|
if(doc.quotation_to) {
|
||||||
if(doc.quotation_to == 'Customer') {
|
if(doc.quotation_to == 'Customer') {
|
||||||
hide_field(['lead', 'lead_name']);
|
hide_field(['lead', 'lead_name']);
|
||||||
@ -48,9 +49,11 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
|
hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cur_frm.cscript.make_communication_body();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
var callback = function(doc, dt, dn) {
|
var callback = function(doc, dt, dn) {
|
||||||
// defined in sales_common.js
|
// defined in sales_common.js
|
||||||
cur_frm.cscript.update_item_details(doc, dt, dn);
|
cur_frm.cscript.update_item_details(doc, dt, dn);
|
||||||
@ -95,6 +98,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
if(doc.customer || doc.lead) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
if(doc.customer || doc.lead) $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(true);
|
||||||
else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false);
|
else $(cur_frm.fields_dict.contact_section.row.wrapper).toggle(false);
|
||||||
|
|
||||||
|
if (!doc.__islocal) cur_frm.cscript.render_communication_list(doc, cdt, cdn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-04-30 18:40:10',
|
'creation': '2012-05-21 11:43:59',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-04-30 20:30:45',
|
'modified': '2012-05-31 11:43:18',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -51,8 +51,7 @@
|
|||||||
'name': '__common__',
|
'name': '__common__',
|
||||||
'parent': u'Quotation',
|
'parent': u'Quotation',
|
||||||
'parentfield': u'permissions',
|
'parentfield': u'permissions',
|
||||||
'parenttype': u'DocType',
|
'parenttype': u'DocType'
|
||||||
'read': 1
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocType, Quotation
|
# DocType, Quotation
|
||||||
@ -61,6 +60,13 @@
|
|||||||
'name': u'Quotation'
|
'name': u'Quotation'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': u'user print'
|
||||||
|
},
|
||||||
|
|
||||||
# DocPerm
|
# DocPerm
|
||||||
{
|
{
|
||||||
'amend': 0,
|
'amend': 0,
|
||||||
@ -68,6 +74,7 @@
|
|||||||
'create': 0,
|
'create': 0,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 1,
|
'permlevel': 1,
|
||||||
|
'read': 1,
|
||||||
'role': u'Sales Manager',
|
'role': u'Sales Manager',
|
||||||
'submit': 0,
|
'submit': 0,
|
||||||
'write': 0
|
'write': 0
|
||||||
@ -80,6 +87,7 @@
|
|||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
|
'read': 1,
|
||||||
'role': u'Sales Manager',
|
'role': u'Sales Manager',
|
||||||
'submit': 1,
|
'submit': 1,
|
||||||
'write': 1
|
'write': 1
|
||||||
@ -92,6 +100,7 @@
|
|||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
|
'read': 1,
|
||||||
'role': u'Sales User',
|
'role': u'Sales User',
|
||||||
'submit': 1,
|
'submit': 1,
|
||||||
'write': 1
|
'write': 1
|
||||||
@ -104,6 +113,7 @@
|
|||||||
'create': 0,
|
'create': 0,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 1,
|
'permlevel': 1,
|
||||||
|
'read': 1,
|
||||||
'role': u'Sales User',
|
'role': u'Sales User',
|
||||||
'submit': 0,
|
'submit': 0,
|
||||||
'write': 0
|
'write': 0
|
||||||
@ -114,6 +124,7 @@
|
|||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'match': u'customer_name',
|
'match': u'customer_name',
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
|
'read': 1,
|
||||||
'role': u'Customer'
|
'role': u'Customer'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -124,6 +135,7 @@
|
|||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
|
'read': 1,
|
||||||
'role': u'Maintenance Manager',
|
'role': u'Maintenance Manager',
|
||||||
'submit': 1,
|
'submit': 1,
|
||||||
'write': 1
|
'write': 1
|
||||||
@ -133,6 +145,7 @@
|
|||||||
{
|
{
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 1,
|
'permlevel': 1,
|
||||||
|
'read': 1,
|
||||||
'role': u'Maintenance Manager'
|
'role': u'Maintenance Manager'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -143,6 +156,7 @@
|
|||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
|
'read': 1,
|
||||||
'role': u'Maintenance User',
|
'role': u'Maintenance User',
|
||||||
'submit': 1,
|
'submit': 1,
|
||||||
'write': 1
|
'write': 1
|
||||||
@ -152,6 +166,7 @@
|
|||||||
{
|
{
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 1,
|
'permlevel': 1,
|
||||||
|
'read': 1,
|
||||||
'role': u'Maintenance User'
|
'role': u'Maintenance User'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1240,12 +1255,11 @@
|
|||||||
'allow_on_submit': 1,
|
'allow_on_submit': 1,
|
||||||
'colour': u'White:FFF',
|
'colour': u'White:FFF',
|
||||||
'doctype': u'DocField',
|
'doctype': u'DocField',
|
||||||
'fieldname': u'follow_up',
|
'fieldname': u'communication_html',
|
||||||
'fieldtype': u'Table',
|
'fieldtype': u'HTML',
|
||||||
'label': u'Communication Log',
|
'label': u'Communication HTML',
|
||||||
'oldfieldname': u'follow_up',
|
'oldfieldname': u'follow_up',
|
||||||
'oldfieldtype': u'Table',
|
'oldfieldtype': u'Table',
|
||||||
'options': u'Communication Log',
|
|
||||||
'permlevel': 0,
|
'permlevel': 0,
|
||||||
'print_hide': 1,
|
'print_hide': 1,
|
||||||
'width': u'40px'
|
'width': u'40px'
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
cur_frm.cscript.make_hl_body = function(){
|
cur_frm.cscript.make_hl_body = function(){
|
||||||
cur_frm.fields_dict['history_html'].wrapper.innerHTML = '';
|
cur_frm.fields_dict['history_html'].wrapper.innerHTML = '';
|
||||||
cur_frm.history_html = $a(cur_frm.fields_dict['history_html'].wrapper,'div');
|
cur_frm.history_html = $a(cur_frm.fields_dict['history_html'].wrapper,'div');
|
||||||
|
$(cur_frm.history_html).css({
|
||||||
|
'min-height': '320px',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// make history
|
// make history
|
||||||
// -------------
|
// -------------
|
||||||
cur_frm.cscript.make_history = function(doc,dt,dn){
|
cur_frm.cscript.make_history = function(doc,dt,dn){
|
||||||
@ -50,42 +52,6 @@ cur_frm.cscript.make_history_list = function(parent,doc){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// run list
|
|
||||||
// ---------
|
|
||||||
cur_frm.cscript.run_list = function(lst,parent,q,q_max,doc,dn,nm){
|
|
||||||
|
|
||||||
parent.innerHTML = '';
|
|
||||||
$dh(parent);
|
|
||||||
|
|
||||||
lst.doc = doc;
|
|
||||||
lst.dn = dn;
|
|
||||||
lst.nm = nm;
|
|
||||||
lst.page_len = 10;
|
|
||||||
|
|
||||||
lst.get_query = function(){
|
|
||||||
this.query = q;
|
|
||||||
this.query_max = q_max;
|
|
||||||
}
|
|
||||||
|
|
||||||
lst.make(parent);
|
|
||||||
lst.run();
|
|
||||||
|
|
||||||
lst.onrun = function(){
|
|
||||||
$ds(parent);
|
|
||||||
if(!this.has_data()){
|
|
||||||
parent.innerHTML = '';
|
|
||||||
var dv = $a(parent,'div','help_box');
|
|
||||||
$a(dv,'span').innerHTML = "No " + this.dn + " found. ";
|
|
||||||
|
|
||||||
var lbl = 'Create the <b>first</b> ' + this.dn + ' for ' + this.doc.name;
|
|
||||||
var sp = $a(dv,'span');
|
|
||||||
sp.nm = this.nm;
|
|
||||||
$(sp).html(lbl).addClass('link_type').click(function(){ newdoc(this.nm); });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// get sates on country trigger
|
// get sates on country trigger
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
cur_frm.cscript.get_states=function(doc,dt,dn){
|
cur_frm.cscript.get_states=function(doc,dt,dn){
|
||||||
@ -111,80 +77,3 @@ if(cur_frm.fields_dict['territory']){
|
|||||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Transaction History related functions
|
|
||||||
cur_frm.cscript.render_transaction_history = function(parent, doc, doctype, args) {
|
|
||||||
$(parent).css({ 'padding-top': '10px' });
|
|
||||||
cur_frm.transaction_list = new wn.ui.Listing({
|
|
||||||
parent: parent,
|
|
||||||
page_length: 10,
|
|
||||||
get_query: function() {
|
|
||||||
return cur_frm.cscript.get_query_transaction_history({
|
|
||||||
parent: doc.doctype.toLowerCase(),
|
|
||||||
parent_name: doc.name,
|
|
||||||
doctype: doctype,
|
|
||||||
fields: (function() {
|
|
||||||
var fields = [];
|
|
||||||
for(var i in args) {
|
|
||||||
fields.push(args[i].fieldname);
|
|
||||||
}
|
|
||||||
return fields.join(", ");
|
|
||||||
})(),
|
|
||||||
});
|
|
||||||
},
|
|
||||||
as_dict: 1,
|
|
||||||
no_result_message: repl('No %(doctype)s created for this %(parent)s',
|
|
||||||
{ doctype: doctype, parent: doc.doctype }),
|
|
||||||
render_row: function(wrapper, data) {
|
|
||||||
render_html = cur_frm.cscript.render_transaction_history_row(data, args, doctype);
|
|
||||||
$(wrapper).html(render_html);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
cur_frm.transaction_list.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.render_transaction_history_row = function(data, args, doctype) {
|
|
||||||
var content = [];
|
|
||||||
var currency = data.currency;
|
|
||||||
for (var a in args) {
|
|
||||||
for (var d in data) {
|
|
||||||
if (args[a].fieldname === d && args[a].fieldname !== 'currency') {
|
|
||||||
if (args[a].type === 'Link') {
|
|
||||||
data[d] = repl('<a href="#!Form/%(doctype)s/%(name)s">\
|
|
||||||
%(name)s</a>', { doctype: doctype, name: data[d]});
|
|
||||||
} else if (args[a].type === 'Currency') {
|
|
||||||
data[d] = currency + " " + fmt_money(data[d]);
|
|
||||||
} else if (args[a].type === 'Percentage') {
|
|
||||||
data[d] = flt(data[d]) + '%';
|
|
||||||
} else if (args[a].type === 'Date') {
|
|
||||||
data[d] = wn.datetime.only_date(data[d]);
|
|
||||||
}
|
|
||||||
if (args[a].style == undefined) {
|
|
||||||
args[a].style = '';
|
|
||||||
}
|
|
||||||
data[d] = repl('\
|
|
||||||
<td width="%(width)s" title="%(title)s" style="%(style)s">\
|
|
||||||
%(content)s</td>',
|
|
||||||
{
|
|
||||||
content: data[d],
|
|
||||||
width: args[a].width,
|
|
||||||
title: args[a].label,
|
|
||||||
style: args[a].style,
|
|
||||||
});
|
|
||||||
content.push(data[d]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
content = content.join("\n");
|
|
||||||
return '<table><tr>' + content + '</tr></table>';
|
|
||||||
}
|
|
||||||
|
|
||||||
cur_frm.cscript.get_query_transaction_history = function(args) {
|
|
||||||
var query = repl("\
|
|
||||||
select %(fields)s from `tab%(doctype)s` \
|
|
||||||
where %(parent)s = '%(parent_name)s' \
|
|
||||||
order by modified desc", args);
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
|
@ -52,7 +52,7 @@ class DocType:
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.doc.lft and self.doc.rgt:
|
if self.doc.lft and self.doc.rgt:
|
||||||
res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name))
|
res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_item_group,self.doc.item_group_name))
|
||||||
if not res:
|
if not res:
|
||||||
msgprint("Please enter proper parent item group.")
|
msgprint("Please enter proper parent item group.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
@ -61,7 +61,7 @@ class DocType:
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.doc.lft and self.doc.rgt:
|
if self.doc.lft and self.doc.rgt:
|
||||||
res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_territory,self.doc.territory_name))
|
res = sql("select name from `tabTerritory` where is_group = 'Yes' and docstatus!= 2 and name ='%s' and name !='%s'"%(self.doc.parent_territory,self.doc.territory_name))
|
||||||
if not res:
|
if not res:
|
||||||
msgprint("Please enter proper parent territory.")
|
msgprint("Please enter proper parent territory.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
0
erpnext/support/doctype/communication/__init__.py
Normal file
0
erpnext/support/doctype/communication/__init__.py
Normal file
92
erpnext/support/doctype/communication/communication.js
Normal file
92
erpnext/support/doctype/communication/communication.js
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
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);
|
||||||
|
data.creation = wn.datetime.str_to_user(data.communication_date);
|
||||||
|
|
||||||
|
data.content = cstr(data.subject) + " | " + cstr(data.content);
|
||||||
|
|
||||||
|
if(data.content && data.content.length > 50) {
|
||||||
|
data.content = '<span title="'+data.content+'">' +
|
||||||
|
data.description.substr(0,50) + '...</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '15%', content: 'name'},
|
||||||
|
{width: '15%', content: 'category'},
|
||||||
|
{width: '55%', content: 'content'},
|
||||||
|
{width: '12%', content:'communication_date',
|
||||||
|
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()] = 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']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var RecordListView = wn.views.RecordListView.extend({
|
||||||
|
default_docstatus: ['0', '1', '2'],
|
||||||
|
default_filters: [
|
||||||
|
[doctype, doc.doctype.toLowerCase(), '=', doc.name],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (make_new_doc) {
|
||||||
|
RecordListView = RecordListView.extend({
|
||||||
|
make_new_doc: make_new_doc,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var record_list_view = new RecordListView(doctype, wrapper, ListView);
|
||||||
|
});
|
||||||
|
}
|
26
erpnext/support/doctype/communication/communication.py
Normal file
26
erpnext/support/doctype/communication/communication.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
import webnotes
|
||||||
|
from webnotes.model.doc import make_autoname
|
||||||
|
|
||||||
|
class DocType():
|
||||||
|
def __init__(self, doc, doclist=[]):
|
||||||
|
self.doc = doc
|
||||||
|
self.doclist = doclist
|
||||||
|
|
||||||
|
def autoname(self):
|
||||||
|
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
377
erpnext/support/doctype/communication/communication.txt
Normal file
377
erpnext/support/doctype/communication/communication.txt
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
# DocType, Communication
|
||||||
|
[
|
||||||
|
|
||||||
|
# These values are common in all dictionaries
|
||||||
|
{
|
||||||
|
'creation': '2012-05-29 16:56:41',
|
||||||
|
'docstatus': 0,
|
||||||
|
'modified': '2012-05-31 16:14:39',
|
||||||
|
'modified_by': u'Administrator',
|
||||||
|
'owner': u'Administrator'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocType
|
||||||
|
{
|
||||||
|
'allow_attach': 1,
|
||||||
|
'description': u'Keep a track of all communications',
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'module': u'Support',
|
||||||
|
'name': '__common__',
|
||||||
|
'version': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': u'Communication',
|
||||||
|
'parentfield': u'fields',
|
||||||
|
'parenttype': u'DocType'
|
||||||
|
},
|
||||||
|
|
||||||
|
# These values are common for all DocPerm
|
||||||
|
{
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'name': '__common__',
|
||||||
|
'parent': u'Communication',
|
||||||
|
'parentfield': u'permissions',
|
||||||
|
'parenttype': u'DocType',
|
||||||
|
'read': 1,
|
||||||
|
'write': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocType, Communication
|
||||||
|
{
|
||||||
|
'doctype': 'DocType',
|
||||||
|
'name': u'Communication'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'create': 1,
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': u'Support Team'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'create': 1,
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': u'Sales Manager'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'create': 1,
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 0,
|
||||||
|
'role': u'Sales User'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 1,
|
||||||
|
'role': u'Sales Manager'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocPerm
|
||||||
|
{
|
||||||
|
'doctype': u'DocPerm',
|
||||||
|
'permlevel': 1,
|
||||||
|
'role': u'Support Manager'
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'basic_info',
|
||||||
|
'fieldtype': u'Section Break',
|
||||||
|
'label': u'Basic Info',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': u'White:FFF',
|
||||||
|
'default': u'COMM-',
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'naming_series',
|
||||||
|
'fieldtype': u'Select',
|
||||||
|
'hidden': 1,
|
||||||
|
'label': u'Naming Series',
|
||||||
|
'options': u'COMM-',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'category',
|
||||||
|
'fieldtype': u'Select',
|
||||||
|
'label': u'Category',
|
||||||
|
'options': u'\nSales\nComplaint\nHelp\nSuggestion\nMiscellaneous',
|
||||||
|
'permlevel': 0,
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'action',
|
||||||
|
'fieldtype': u'Select',
|
||||||
|
'label': u'Action',
|
||||||
|
'options': u'\nCreated Opportunity\nSent Quotation\nCreated Support Ticket\nCreated Customer Issue\nNo Action',
|
||||||
|
'permlevel': 0,
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'column_break2',
|
||||||
|
'fieldtype': u'Column Break',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'subject',
|
||||||
|
'fieldtype': u'Small Text',
|
||||||
|
'label': u'Subject',
|
||||||
|
'permlevel': 0,
|
||||||
|
'reqd': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'section_break1',
|
||||||
|
'fieldtype': u'Section Break',
|
||||||
|
'options': u'simple',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'content',
|
||||||
|
'fieldtype': u'Text Editor',
|
||||||
|
'label': u'Content',
|
||||||
|
'permlevel': 0,
|
||||||
|
'reqd': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'additional_info',
|
||||||
|
'fieldtype': u'Section Break',
|
||||||
|
'label': u'Additional Info',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': u'White:FFF',
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'column_break3',
|
||||||
|
'fieldtype': u'Column Break',
|
||||||
|
'label': u'Communication With / Related To',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'lead',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'hidden': 0,
|
||||||
|
'label': u'Lead',
|
||||||
|
'options': u'Lead',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'contact',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Contact',
|
||||||
|
'options': u'Contact',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'customer',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Customer',
|
||||||
|
'options': u'Customer',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'supplier',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Supplier',
|
||||||
|
'options': u'Supplier',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'opportunity',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Opportunity',
|
||||||
|
'options': u'Opportunity',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'quotation',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Quotation',
|
||||||
|
'options': u'Quotation',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'support_ticket',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Support Ticket',
|
||||||
|
'options': u'Support Ticket',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'column_break1',
|
||||||
|
'fieldtype': u'Column Break',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'communication_medium',
|
||||||
|
'fieldtype': u'Select',
|
||||||
|
'label': u'Communication Medium',
|
||||||
|
'options': u'\nChat\nPhone\nEmail\nSMS\nVisit\nOther',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'phone_no',
|
||||||
|
'fieldtype': u'Data',
|
||||||
|
'label': u'Phone No.',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'email_address',
|
||||||
|
'fieldtype': u'Data',
|
||||||
|
'label': u'Email Address',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'section_break2',
|
||||||
|
'fieldtype': u'Section Break',
|
||||||
|
'options': u'simple',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'column_break4',
|
||||||
|
'fieldtype': u'Column Break',
|
||||||
|
'label': u'Communication Carried Out By',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': u'White:FFF',
|
||||||
|
'default': u'__user',
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'user',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'User',
|
||||||
|
'options': u'Profile',
|
||||||
|
'permlevel': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'sales_person',
|
||||||
|
'fieldtype': u'Link',
|
||||||
|
'label': u'Sales Person',
|
||||||
|
'options': u'Sales Person',
|
||||||
|
'permlevel': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'column_break5',
|
||||||
|
'fieldtype': u'Column Break',
|
||||||
|
'label': u'Communication Carried Out On',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'colour': u'White:FFF',
|
||||||
|
'default': u'Today',
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'communication_date',
|
||||||
|
'fieldtype': u'Date',
|
||||||
|
'label': u'Date',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'file_list',
|
||||||
|
'fieldtype': u'Text',
|
||||||
|
'hidden': 1,
|
||||||
|
'label': u'File List',
|
||||||
|
'no_copy': 1,
|
||||||
|
'permlevel': 0,
|
||||||
|
'print_hide': 1
|
||||||
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': u'DocField',
|
||||||
|
'fieldname': u'_user_tags',
|
||||||
|
'fieldtype': u'Data',
|
||||||
|
'hidden': 1,
|
||||||
|
'label': u'User Tags',
|
||||||
|
'no_copy': 1,
|
||||||
|
'permlevel': 0,
|
||||||
|
'print_hide': 1
|
||||||
|
}
|
||||||
|
]
|
35
erpnext/support/doctype/communication/listview.js
Normal file
35
erpnext/support/doctype/communication/listview.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
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);
|
||||||
|
data.creation = wn.datetime.only_date(data.creation);
|
||||||
|
|
||||||
|
data.content = cstr(data.subject) + " | " + cstr(data.content);
|
||||||
|
|
||||||
|
if(data.content && data.content.length > 50) {
|
||||||
|
data.content = '<span title="'+data.content+'">' +
|
||||||
|
data.content.substr(0,50) + '...</span>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
columns: [
|
||||||
|
{width: '5%', content: 'avatar'},
|
||||||
|
{width: '3%', content: 'docstatus'},
|
||||||
|
{width: '15%', content: 'name'},
|
||||||
|
{width: '15%', content: 'category'},
|
||||||
|
{width: '55%', content: 'content+tags'},
|
||||||
|
{width: '12%', content:'creation',
|
||||||
|
css: {'text-align': 'right', 'color':'#777'}}
|
||||||
|
],
|
||||||
|
});
|
@ -114,7 +114,7 @@ class DocType(TransactionBase):
|
|||||||
""" Add calendar event for Maintenece Schedule in calendar of Allocated person"""
|
""" Add calendar event for Maintenece Schedule in calendar of Allocated person"""
|
||||||
event = Document('Event')
|
event = Document('Event')
|
||||||
event.owner = incharge_email
|
event.owner = incharge_email
|
||||||
event.description = "Item Code:%s and Reference:%s" %(item_code,self.doc.name)
|
event.description = "Reference:%s, Item Code:%s and Customer: %s" %(self.doc.name, item_code, self.doc.customer)
|
||||||
event.event_date = scheduled_date
|
event.event_date = scheduled_date
|
||||||
event.event_hour = '10:00'
|
event.event_hour = '10:00'
|
||||||
event.event_type = 'Private'
|
event.event_type = 'Private'
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
<br>
|
<br>
|
||||||
<h4><a href="#!List/Maintenance Visit">Maintenance Visit</a></h4>
|
<h4><a href="#!List/Maintenance Visit">Maintenance Visit</a></h4>
|
||||||
<p class="help">Visit report for maintenance visit</p>
|
<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>
|
||||||
<div style="width: 48%; float: right;">
|
<div style="width: 48%; float: right;">
|
||||||
<h4><a href="#!List/Serial No">Serial No</a></h4>
|
<h4><a href="#!List/Serial No">Serial No</a></h4>
|
||||||
|
@ -305,9 +305,9 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
|
|||||||
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
||||||
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||||
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
||||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype);},'icon-plus');}
|
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){me.make_new_doc(me.new_doctype);},'icon-plus');}
|
||||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
||||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_new_doc:function(new_doctype){new_doc(new_doctype);},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||||
this.onrun=a0;if(a0&&a0.callback)
|
this.onrun=a0;if(a0&&a0.callback)
|
||||||
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
||||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||||
@ -321,7 +321,7 @@ if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:funct
|
|||||||
* lib/js/wn/ui/filters.js
|
* lib/js/wn/ui/filters.js
|
||||||
*/
|
*/
|
||||||
wn.ui.FilterList=Class.extend({init:function(opts){wn.require('js/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});this.$w.find('.search-btn').bind('click',function(){me.listobj.run();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length)
|
wn.ui.FilterList=Class.extend({init:function(opts){wn.require('js/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});this.$w.find('.search-btn').bind('click',function(){me.listobj.run();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length)
|
||||||
this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').toggle(true);}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
|
this.add_filter();},add_filter:function(fieldname,condition,value){this.push_new_filter(fieldname,condition,value);if(fieldname){this.$w.find('.show_filters').toggle(true);}},push_new_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
|
||||||
values.push(f.get_value());})
|
values.push(f.get_value());})
|
||||||
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
|
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
|
||||||
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
|
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
|
||||||
@ -968,13 +968,13 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype){this.doctype=d
|
|||||||
<div style="clear: both"></div>\
|
<div style="clear: both"></div>\
|
||||||
</div>',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.make_report_button();me.add_delete_option();},make_report_button:function(){var me=this;if(wn.boot.profile.can_get_report.indexOf(this.doctype)!=-1){this.appframe.add_button('Build Report',function(){wn.set_route('Report2',me.doctype);},'icon-th')}},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
|
</div>',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.make_report_button();me.add_delete_option();},make_report_button:function(){var me=this;if(wn.boot.profile.can_get_report.indexOf(this.doctype)!=-1){this.appframe.add_button('Build Report',function(){wn.set_route('Report2',me.doctype);},'icon-th')}},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
|
||||||
else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
|
else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
|
||||||
this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('<div class="well"><p>No %(doctype_label)s found</p>\
|
this.listview.parent=this;this.wrapper=this.$page.find('.wnlist-area');this.page_length=20;this.allow_delete=true;},init_list:function(auto_run){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.wrapper,start:0,page_length:this.page_length,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:this.allow_delete,no_result_message:this.make_no_result(),columns:this.listview.fields});if((auto_run!==false)&&(auto_run!==0))this.run();},make_no_result:function(){return repl('<div class="well"><p>No %(doctype_label)s found</p>\
|
||||||
%(description)s\
|
%(description)s\
|
||||||
<hr>\
|
<hr>\
|
||||||
<p><button class="btn btn-info btn-small"\
|
<p><button class="btn btn-info btn-small"\
|
||||||
onclick="newdoc(\'%(doctype)s\');"\
|
onclick="newdoc(\'%(doctype)s\');"\
|
||||||
>Make a new %(doctype_label)s</button>\
|
>Make a new %(doctype_label)s</button>\
|
||||||
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
|
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[],order_by:this.listview.order_by||undefined,}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
|
||||||
return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
|
return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
|
||||||
me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
|
me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
|
||||||
wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});if(me.listview.stats.length){$('<button class="btn btn-small"><i class="refresh"></i> Refresh</button>').click(function(){me.reload_stats();}).appendTo($('<div class="stat-wrapper">').appendTo(me.$page.find('.layout-side-section')))}}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
|
wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});if(me.listview.stats.length){$('<button class="btn btn-small"><i class="refresh"></i> Refresh</button>').click(function(){me.reload_stats();}).appendTo($('<div class="stat-wrapper">').appendTo(me.$page.find('.layout-side-section')))}}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
|
||||||
@ -1021,7 +1021,7 @@ if(diff==2){data.when='2 days ago'}
|
|||||||
if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}
|
if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}
|
||||||
for(key in data){if(data[key]==null){data[key]='';}}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){if($(parent).html().length>0){$(parent).append('<br />');}
|
for(key in data){if(data[key]==null){data[key]='';}}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){if($(parent).html().length>0){$(parent).append('<br />');}
|
||||||
$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer; line-height: 200%">'
|
$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer; line-height: 200%">'
|
||||||
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}})
|
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}});wn.provide('wn.views.RecordListView');wn.views.RecordListView=wn.views.DocListView.extend({init:function(doctype,wrapper,ListView){this.doctype=doctype;this.wrapper=wrapper;this.listview=new ListView(this);this.listview.parent=this;this.setup();},setup:function(){var me=this;me.page_length=10;$(me.wrapper).empty();me.init_list();},get_args:function(){var args=this._super();$.each((this.default_filters||[]),function(i,f){args.filters.push(f);});args.docstatus=args.docstatus.concat((this.default_docstatus||[]));return args;},});
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/views/formview.js
|
* lib/js/wn/views/formview.js
|
||||||
*/
|
*/
|
||||||
|
@ -192,9 +192,9 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
|
|||||||
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
||||||
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||||
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
||||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype);},'icon-plus');}
|
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){me.make_new_doc(me.new_doctype);},'icon-plus');}
|
||||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
||||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_new_doc:function(new_doctype){new_doc(new_doctype);},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||||
this.onrun=a0;if(a0&&a0.callback)
|
this.onrun=a0;if(a0&&a0.callback)
|
||||||
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
||||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||||
@ -208,7 +208,7 @@ if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:funct
|
|||||||
* lib/js/wn/ui/filters.js
|
* lib/js/wn/ui/filters.js
|
||||||
*/
|
*/
|
||||||
wn.ui.FilterList=Class.extend({init:function(opts){wn.require('js/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});this.$w.find('.search-btn').bind('click',function(){me.listobj.run();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length)
|
wn.ui.FilterList=Class.extend({init:function(opts){wn.require('js/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});this.$w.find('.search-btn').bind('click',function(){me.listobj.run();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length)
|
||||||
this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').toggle(true);}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
|
this.add_filter();},add_filter:function(fieldname,condition,value){this.push_new_filter(fieldname,condition,value);if(fieldname){this.$w.find('.show_filters').toggle(true);}},push_new_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
|
||||||
values.push(f.get_value());})
|
values.push(f.get_value());})
|
||||||
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
|
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
|
||||||
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
|
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user