Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
e1ec323ffa
@ -52,3 +52,5 @@ cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
|||||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||||
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict.user.get_query = erpnext.utils.profile_query;
|
@ -64,3 +64,5 @@ cur_frm.cscript.make_salary_structure = function(doc,dt,dn,det){
|
|||||||
st.grade=doc.grade;
|
st.grade=doc.grade;
|
||||||
loaddoc('Salary Structure', st.name);
|
loaddoc('Salary Structure', st.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict.user_id.get_query = erpnext.utils.profile_query;
|
@ -15,5 +15,6 @@
|
|||||||
"app/public/js/themes.js",
|
"app/public/js/themes.js",
|
||||||
"app/public/js/toolbar.js",
|
"app/public/js/toolbar.js",
|
||||||
"app/public/js/feature_setup.js",
|
"app/public/js/feature_setup.js",
|
||||||
|
"app/public/js/utils.js"
|
||||||
],
|
],
|
||||||
}
|
}
|
26
public/js/utils.js
Normal file
26
public/js/utils.js
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/>.
|
||||||
|
|
||||||
|
wn.provide('erpnext.utils');
|
||||||
|
|
||||||
|
// profile related get_query
|
||||||
|
erpnext.utils.profile_query = function() {
|
||||||
|
return "select name, concat_ws(' ', first_name, middle_name, last_name) \
|
||||||
|
from `tabProfile` where ifnull(enabled, 0)=1 and docstatus < 2 and \
|
||||||
|
name not in ('Administrator', 'Guest') and (%(key)s like \"%s\" or \
|
||||||
|
concat_ws(' ', first_name, middle_name, last_name) like \"%%%s\") \
|
||||||
|
limit 50";
|
||||||
|
};
|
@ -43,6 +43,14 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
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.make_communication_body();
|
||||||
|
|
||||||
|
if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) {
|
||||||
|
cur_frm.fields_dict.lead_owner.get_query = erpnext.utils.profile_query;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
|
||||||
|
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh_custom_buttons = function(doc) {
|
cur_frm.cscript.refresh_custom_buttons = function(doc) {
|
||||||
|
@ -49,6 +49,10 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_communication_body();
|
cur_frm.cscript.make_communication_body();
|
||||||
|
|
||||||
|
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
|
||||||
|
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||||
|
@ -50,6 +50,10 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur_frm.cscript.make_communication_body();
|
cur_frm.cscript.make_communication_body();
|
||||||
|
|
||||||
|
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
|
||||||
|
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{
|
{
|
||||||
u'creation': '2012-09-18 11:20:27',
|
u'creation': '2012-09-18 11:20:27',
|
||||||
u'docstatus': 0,
|
u'docstatus': 0,
|
||||||
u'modified': '2012-09-26 13:05:15',
|
u'modified': '2012-09-26 13:05:20',
|
||||||
u'modified_by': u'Administrator',
|
u'modified_by': u'Administrator',
|
||||||
u'owner': u'Administrator'
|
u'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -271,7 +271,7 @@
|
|||||||
'colour': u'White:FFF',
|
'colour': u'White:FFF',
|
||||||
u'doctype': u'DocField',
|
u'doctype': u'DocField',
|
||||||
'fieldname': u'shipping_address_name',
|
'fieldname': u'shipping_address_name',
|
||||||
'fieldtype': u'Data',
|
'fieldtype': u'Link',
|
||||||
'hidden': 1,
|
'hidden': 1,
|
||||||
'in_filter': 1,
|
'in_filter': 1,
|
||||||
'label': u'Shipping Address Name',
|
'label': u'Shipping Address Name',
|
||||||
|
@ -85,12 +85,9 @@ cur_frm.cscript.transaction = function(doc,cdt,cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// System User Trigger
|
cur_frm.fields_dict.system_user.get_query = erpnext.profile_query;
|
||||||
// -------------------
|
|
||||||
cur_frm.fields_dict['system_user'].get_query = function(doc) {
|
|
||||||
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.enabled = 1 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
cur_frm.fields_dict.approving_user.get_query = erpnext.profile_query;
|
||||||
|
|
||||||
// System Role Trigger
|
// System Role Trigger
|
||||||
// -----------------------
|
// -----------------------
|
||||||
@ -98,14 +95,6 @@ cur_frm.fields_dict['system_role'].get_query = function(doc) {
|
|||||||
return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50'
|
return 'SELECT tabRole.name FROM tabRole WHERE tabRole.name not in ("Administrator","Guest","All") AND tabRole.%(key)s LIKE "%s" LIMIT 50'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Approving User Trigger
|
|
||||||
// -----------------------
|
|
||||||
cur_frm.fields_dict['approving_user'].get_query = function(doc) {
|
|
||||||
return 'SELECT tabProfile.name FROM tabProfile WHERE tabProfile.name not in ("Administrator","Guest") AND tabProfile.docstatus != 2 AND tabProfile.enabled = 1 AND tabProfile.%(key)s LIKE "%s" LIMIT 50'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Approving Role Trigger
|
// Approving Role Trigger
|
||||||
// -----------------------
|
// -----------------------
|
||||||
cur_frm.fields_dict['approving_role'].get_query = function(doc) {
|
cur_frm.fields_dict['approving_role'].get_query = function(doc) {
|
||||||
|
@ -510,16 +510,19 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
|
|
||||||
def get_cust_values(self):
|
def get_cust_values(self):
|
||||||
tbl = self.doc.delivery_note_no and 'Delivery Note' or 'Sales Invoice'
|
"""fetches customer details"""
|
||||||
record_name = self.doc.delivery_note_no or self.doc.sales_invoice_no
|
if self.doc.delivery_note_no:
|
||||||
res = sql("select customer,customer_name, customer_address from `tab%s` where name = '%s'" % (tbl, record_name))
|
doctype = "Delivery Note"
|
||||||
ret = {
|
name = self.doc.delivery_note_no
|
||||||
'customer' : res and res[0][0] or '',
|
else:
|
||||||
'customer_name' : res and res[0][1] or '',
|
doctype = "Sales Invoice"
|
||||||
'customer_address' : res and res[0][2] or ''}
|
name = self.doc.sales_invoice_no
|
||||||
|
|
||||||
return ret
|
result = webnotes.conn.sql("""select customer, customer_name,
|
||||||
|
address_display as customer_address
|
||||||
|
from `tab%s` where name=%s""" % (doctype, "%s"), (name,), as_dict=1)
|
||||||
|
|
||||||
|
return result and result[0] or {}
|
||||||
|
|
||||||
def get_cust_addr(self):
|
def get_cust_addr(self):
|
||||||
res = sql("select customer_name from `tabCustomer` where name = '%s'"%self.doc.customer)
|
res = sql("select customer_name from `tabCustomer` where name = '%s'"%self.doc.customer)
|
||||||
@ -530,16 +533,13 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_supp_values(self):
|
def get_supp_values(self):
|
||||||
res = sql("select supplier,supplier_name,supplier_address from `tabPurchase Receipt` where name = '%s'"%self.doc.purchase_receipt_no)
|
result = webnotes.conn.sql("""select supplier, supplier_name,
|
||||||
ret = {
|
address_display as supplier_address
|
||||||
'supplier' : res and res[0][0] or '',
|
from `tabPurchase Receipt` where name=%s""", (self.doc.purchase_receipt_no,),
|
||||||
'supplier_name' :res and res[0][1] or '',
|
as_dict=1)
|
||||||
'supplier_address' : res and res[0][2] or ''}
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
return result and result[0] or {}
|
||||||
|
|
||||||
def get_supp_addr(self):
|
def get_supp_addr(self):
|
||||||
res = sql("select supplier_name,address from `tabSupplier` where name = '%s'"%self.doc.supplier)
|
res = sql("select supplier_name,address from `tabSupplier` where name = '%s'"%self.doc.supplier)
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
cur_frm.cscript.onload = function(doc) {
|
||||||
|
cur_frm.fields_dict.user.get_query = function() {
|
||||||
|
return "select name, concat_ws(' ', first_name, middle_name, last_name) \
|
||||||
|
from `tabProfile` where ifnull(enabled, 0)=1 and docstatus < 2 and \
|
||||||
|
(%(key)s like \"%s\" or \
|
||||||
|
concat_ws(' ', first_name, middle_name, last_name) like \"%%%s\") \
|
||||||
|
limit 50";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
var field_list = ['lead', 'customer', 'supplier', 'contact', 'opportunity',
|
var field_list = ['lead', 'customer', 'supplier', 'contact', 'opportunity',
|
||||||
|
@ -188,3 +188,5 @@ EmailMessage = function(parent, args, list, idx) {
|
|||||||
}
|
}
|
||||||
this.make();
|
this.make();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.fields_dict.allocated_to.get_query = erpnext.profile_query;
|
Loading…
x
Reference in New Issue
Block a user