custom field included in docfield query
This commit is contained in:
parent
d9742a6a58
commit
fec3f783af
@ -130,16 +130,6 @@ cur_frm.fields_dict['indent_no'].get_query = function(doc) {
|
|||||||
return 'SELECT DISTINCT `tabPurchase Request`.`name` FROM `tabPurchase Request` WHERE `tabPurchase Request`.company = "' + doc.company + '" and `tabPurchase Request`.`docstatus` = 1 and `tabPurchase Request`.`status` != "Stopped" and ifnull(`tabPurchase Request`.`per_ordered`,0) < 100 and `tabPurchase Request`.%(key)s LIKE "%s" ORDER BY `tabPurchase Request`.`name` DESC LIMIT 50';
|
return 'SELECT DISTINCT `tabPurchase Request`.`name` FROM `tabPurchase Request` WHERE `tabPurchase Request`.company = "' + doc.company + '" and `tabPurchase Request`.`docstatus` = 1 and `tabPurchase Request`.`status` != "Stopped" and ifnull(`tabPurchase Request`.`per_ordered`,0) < 100 and `tabPurchase Request`.%(key)s LIKE "%s" ORDER BY `tabPurchase Request`.`name` DESC LIMIT 50';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//*********** get approved supplier quotation ********************
|
|
||||||
cur_frm.fields_dict['supplier_qtn'].get_query = function(doc) {
|
|
||||||
var cond='';
|
|
||||||
if(doc.supplier) cond = 'ifnull(`tabSupplier Quotation`.supplier, "") = "'+doc.supplier+'" and';
|
|
||||||
|
|
||||||
return repl('SELECT DISTINCT `tabSupplier Quotation`.`name` FROM `tabSupplier Quotation` WHERE `tabSupplier Quotation`.company = "%(company)s" and`tabSupplier Quotation`.`docstatus` = 1 and `tabSupplier Quotation`.`approval_status` = "Approved" and %(cond)s `tabSupplier Quotation`.%(key)s LIKE "%s" ORDER BY `tabSupplier Quotation`.`name` DESC LIMIT 50', {company:doc.company,cond:cond});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//========================= Get Last Purhase Rate =====================================
|
//========================= Get Last Purhase Rate =====================================
|
||||||
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
|
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
|
||||||
|
|||||||
@ -39,15 +39,12 @@ class DocType:
|
|||||||
|
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
def get_att_list(self):
|
def get_att_list(self):
|
||||||
|
|
||||||
lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
|
lst = [['Attendance','','','Please fill columns which are Mandatory.',' Please do not modify the structure','',''],['','','','','','',''],['[Mandatory]','','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]','[Mandatory]'],['Employee','Employee Name','Attendance Date','Status','Fiscal Year','Company','Naming Series']]
|
||||||
|
|
||||||
dt = self.date_diff_list() # get date list inbetween from date and to date
|
dt = self.date_diff_list() # get date list inbetween from date and to date
|
||||||
|
|
||||||
att_dt = self.get_att_data() # get default attendance data like fiscal yr, company, naming series
|
att_dt = self.get_att_data() # get default attendance data like fiscal yr, company, naming series
|
||||||
|
|
||||||
fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']
|
fy, comp, sr = att_dt['fy'], att_dt['comp'], att_dt['sr']
|
||||||
|
|
||||||
res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2")
|
res = sql("select name, employee_name from `tabEmployee` where status = 'Active' and docstatus !=2")
|
||||||
|
|
||||||
for d in dt:
|
for d in dt:
|
||||||
@ -77,19 +74,18 @@ class DocType:
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
def get_att_data(self):
|
def get_att_data(self):
|
||||||
|
|
||||||
fy = get_defaults()['fiscal_year'] #get default fiscal year
|
fy = get_defaults()['fiscal_year'] #get default fiscal year
|
||||||
|
|
||||||
comp = get_defaults()['company'] #get default company
|
comp = get_defaults()['company'] #get default company
|
||||||
|
|
||||||
#get naming series of attendance
|
#get naming series of attendance
|
||||||
#sr = sql("select series_options from `tabNaming Series Options` where doc_type='Attendance'")
|
import webnotes.model.doctype
|
||||||
sr = sql("select options from `tabDocField` where parent = 'Attendance' and fieldname = 'naming_series'")
|
docfield = webnotes.model.doctype.get('Attendance')
|
||||||
if not sr:
|
series = [d.options for d in docfield if d.doctype == 'DocField' and d.fieldname == 'naming_series']
|
||||||
msgprint("Please create naming series for Attendance.\nGo to Setup--> Manage Series.")
|
if not series:
|
||||||
|
msgprint("Please create naming series for Attendance.\nGo to Setup--> Numbering Series.")
|
||||||
raise Exception
|
raise Exception
|
||||||
else:
|
else:
|
||||||
sr = sr and sr[0][0]
|
sr = series[0][0] or ''
|
||||||
|
|
||||||
return {'fy':fy,'comp':comp,'sr':sr}
|
return {'fy':fy,'comp':comp,'sr':sr}
|
||||||
|
|
||||||
|
|||||||
@ -50,10 +50,6 @@ class DocType:
|
|||||||
chk = chk and chk[0][0] or ''
|
chk = chk and chk[0][0] or ''
|
||||||
return cstr(chk)
|
return cstr(chk)
|
||||||
|
|
||||||
# Gets states belonging cto country selected
|
|
||||||
# =====================================================================
|
|
||||||
#def check_state(self):
|
|
||||||
# return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
|
|
||||||
|
|
||||||
# Get item detail (will be removed later)
|
# Get item detail (will be removed later)
|
||||||
#=======================================
|
#=======================================
|
||||||
@ -71,18 +67,6 @@ class DocType:
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
import string
|
import string
|
||||||
# Get Address
|
|
||||||
# ======================================================================
|
|
||||||
#if (self.doc.address_line1) or (self.doc.address_line2) or (self.doc.city) or (self.doc.state) or (self.doc.country) or (self.doc.pincode):
|
|
||||||
# address =["address_line1", "address_line2", "city", "state", "country", "pincode"]
|
|
||||||
# comp_address=''
|
|
||||||
# for d in address:
|
|
||||||
# if self.doc.fields[d]:
|
|
||||||
# comp_address += self.doc.fields[d] + "\n"
|
|
||||||
# if self.doc.website:
|
|
||||||
# comp_address += "Website : "+ self.doc.website
|
|
||||||
# self.doc.address = comp_address
|
|
||||||
|
|
||||||
if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
|
if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
|
||||||
msgprint("Please Enter Quotation Lost Reason")
|
msgprint("Please Enter Quotation Lost Reason")
|
||||||
raise Exception
|
raise Exception
|
||||||
@ -96,16 +80,6 @@ class DocType:
|
|||||||
msgprint('Please enter valid email id.')
|
msgprint('Please enter valid email id.')
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
if not self.doc.naming_series:
|
|
||||||
if session['user'] == 'Guest':
|
|
||||||
so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
|
|
||||||
#so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
|
|
||||||
if so:
|
|
||||||
sr = so[0][0].split("\n")
|
|
||||||
set(self.doc, 'naming_series', sr[0])
|
|
||||||
else:
|
|
||||||
msgprint("Please specify naming series")
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
# Add to calendar
|
# Add to calendar
|
||||||
@ -119,10 +93,11 @@ class DocType:
|
|||||||
|
|
||||||
if not self.doc.naming_series:
|
if not self.doc.naming_series:
|
||||||
if session['user'] == 'Guest':
|
if session['user'] == 'Guest':
|
||||||
#so = sql("select series_options from `tabNaming Series Options` where doc_type='Lead'")
|
import webnotes.model.doctype
|
||||||
so = sql("select options from `tabDocField` where parent = 'Lead' and fieldname = 'naming_series'")
|
docfield = webnotes.model.doctype.get('Lead')
|
||||||
if so:
|
series = [d.options for d in docfield if d.doctype == 'DocField' and d.fieldname == 'naming_series']
|
||||||
sr = so[0][0].split("\n")
|
if series:
|
||||||
|
sr = series[0].split("\n")
|
||||||
set(self.doc, 'naming_series', sr[0])
|
set(self.doc, 'naming_series', sr[0])
|
||||||
else:
|
else:
|
||||||
msgprint("Please specify naming series")
|
msgprint("Please specify naming series")
|
||||||
@ -136,7 +111,6 @@ class DocType:
|
|||||||
subject = 'Thank you for interest in erpnext'
|
subject = 'Thank you for interest in erpnext'
|
||||||
|
|
||||||
sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
|
sendmail([self.doc.email_id.strip(' ')], sender = sender_email[0][0], subject = subject , parts = [['text/html', self.get_notification_msg()]])
|
||||||
#sendmail(cc_list, sender = sender_email[0][0], subject = subject , parts = [['text/html', message]],attach=attach_list)
|
|
||||||
msgprint("Mail Sent")
|
msgprint("Mail Sent")
|
||||||
|
|
||||||
def get_notification_msg(self):
|
def get_notification_msg(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user