brotherton-erpnext/erpnext/public/js/queries.js

69 lines
1.7 KiB
JavaScript
Raw Normal View History

2013-11-20 07:29:58 +00:00
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
2013-01-11 05:45:27 +00:00
// searches for enabled users
2014-02-14 10:17:51 +00:00
frappe.provide("erpnext.queries");
$.extend(erpnext.queries, {
user: function() {
return { query: "frappe.core.doctype.user.user.user_query" };
},
lead: function() {
return { query: "erpnext.controllers.queries.lead_query" };
},
customer: function() {
return { query: "erpnext.controllers.queries.customer_query" };
},
supplier: function() {
return { query: "erpnext.controllers.queries.supplier_query" };
},
account: function() {
return { query: "erpnext.controllers.queries.account_query" };
},
item: function() {
return { query: "erpnext.controllers.queries.item_query" };
},
bom: function() {
return { query: "erpnext.controllers.queries.bom" };
},
task: function() {
return { query: "erpnext.projects.utils.query_task" };
},
customer_filter: function(doc) {
if(!doc.customer) {
2014-04-14 10:55:30 +00:00
frappe.throw(__("Please specify a") + " " +
__(frappe.meta.get_label(doc.doctype, "customer", doc.name)));
}
return { filters: { customer: doc.customer } };
},
supplier_filter: function(doc) {
if(!doc.supplier) {
2014-04-14 10:55:30 +00:00
frappe.throw(__("Please specify a") + " " +
__(frappe.meta.get_label(doc.doctype, "supplier", doc.name)));
}
return { filters: { supplier: doc.supplier } };
},
lead_filter: function(doc) {
if(!doc.lead) {
2014-04-14 10:55:30 +00:00
frappe.throw(__("Please specify a") + " " +
__(frappe.meta.get_label(doc.doctype, "lead", doc.name)));
}
return { filters: { lead: doc.lead } };
},
not_a_group_filter: function() {
return { filters: { is_group: "No" } };
},
});