mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
commified item_code query
This commit is contained in:
@@ -149,9 +149,13 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
//=======================================
|
||||
cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||
if (doc.enquiry_type == 'Maintenance')
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_service_item, "No")': 'Yes'
|
||||
});
|
||||
else
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_sales_item, "No")': 'Yes'
|
||||
});
|
||||
}
|
||||
|
||||
// Create New Quotation
|
||||
|
||||
@@ -249,21 +249,15 @@ cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
|
||||
|
||||
// ******************** ITEM CODE ********************************
|
||||
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||
if (inList(['Maintenance', 'Service'], doc.order_type))
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description \
|
||||
FROM tabItem WHERE tabItem.is_service_item="Yes" \
|
||||
AND tabItem.docstatus != 2 \
|
||||
AND (ifnull(`tabItem`.`end_of_life`,"") = "" \
|
||||
OR `tabItem`.`end_of_life` > NOW() \
|
||||
OR `tabItem`.`end_of_life`="0000-00-00") \
|
||||
AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
else
|
||||
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem \
|
||||
WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 \
|
||||
AND (ifnull(`tabItem`.`end_of_life`,"") = "" \
|
||||
OR `tabItem`.`end_of_life` > NOW() \
|
||||
OR `tabItem`.`end_of_life`="0000-00-00") \
|
||||
AND tabItem.%(key)s LIKE "%s" LIMIT 50';
|
||||
if (inList(['Maintenance', 'Service'], doc.order_type)) {
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_service_item, "No")': 'Yes'
|
||||
});
|
||||
} else {
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_sales_item, "No")': 'Yes'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user