change project get_query to include projects with status other than Completed and Cancelled

This commit is contained in:
Anand Doshi 2012-10-29 14:26:38 +05:30
parent bdaada1080
commit 548eb7b1c3
10 changed files with 31 additions and 10 deletions

View File

@ -394,7 +394,9 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
// ***************** Get project name *****************
cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}

View File

@ -376,7 +376,10 @@ cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" \
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}
//Territory

View File

@ -99,7 +99,9 @@ cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
}
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['indent_no'].get_query = function(doc) {

View File

@ -77,7 +77,8 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query =
function(doc, cdt, cdn) {
return "select `tabProject`.name from `tabProject` \
where `tabProject`.status = \"Open\" and `tabProject`.name like \"%s\" \
where `tabProject`.status not in (\"Completed\", \"Cancelled\") \
and `tabProject`.name like \"%s\" \
order by `tabProject`.name ASC LIMIT 50";
}

View File

@ -145,7 +145,9 @@ cur_frm.fields_dict['item'].get_query = function(doc) {
}
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {

View File

@ -104,7 +104,9 @@ cur_frm.fields_dict['production_item'].get_query = function(doc) {
}
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['bom_no'].get_query = function(doc) {

View File

@ -17,7 +17,9 @@
cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
var cond='';
if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` \
WHERE %(cond)s `tabProject`.`name` LIKE "%s" \
ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
}

View File

@ -168,7 +168,9 @@ cur_frm.cscript.new_contact = function(){
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}
//---- get customer details ----------------------------

View File

@ -150,7 +150,10 @@ cur_frm.fields_dict['delivery_note_details'].grid.get_field('batch_no').get_quer
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" \
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}

View File

@ -128,7 +128,9 @@ cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
// ***************** Get project name *****************
cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}