brotherton-erpnext/public/js/queries.js

61 lines
1.4 KiB
JavaScript
Raw Normal View History

// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
2013-01-11 05:45:27 +00:00
// searches for enabled profiles
wn.provide("erpnext.queries");
$.extend(erpnext.queries, {
profile: function() {
2013-09-03 10:03:56 +00:00
return { query: "core.doctype.profile.profile.profile_query" };
},
2013-01-11 05:45:27 +00:00
lead: function() {
return { query: "controllers.queries.lead_query" };
},
2013-01-11 05:45:27 +00:00
customer: function() {
return { query: "controllers.queries.customer_query" };
},
2013-01-11 05:45:27 +00:00
supplier: function() {
return { query: "controllers.queries.supplier_query" };
},
2013-01-11 05:45:27 +00:00
account: function() {
return { query: "controllers.queries.account_query" };
},
2013-01-11 05:45:27 +00:00
item: function() {
return { query: "controllers.queries.item_query" };
},
bom: function() {
return { query: "controllers.queries.bom" };
},
task: function() {
return { query: "projects.utils.query_task" };
},
customer_filter: function(doc) {
if(!doc.customer) {
wn.throw(wn._("Please specify a") + " " +
wn._(wn.meta.get_label(doc.doctype, "customer", doc.name)));
}
return { filters: { customer: doc.customer } };
},
supplier_filter: function(doc) {
if(!doc.supplier) {
wn.throw(wn._("Please specify a") + " " +
wn._(wn.meta.get_label(doc.doctype, "supplier", doc.name)));
}
return { filters: { supplier: doc.supplier } };
},
not_a_group_filter: function() {
return { filters: { is_group: "No" } };
},
});