2013-11-20 07:29:58 +00:00
|
|
|
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
2013-08-05 09:29:54 +00:00
|
|
|
// License: GNU General Public License v3. See license.txt
|
2013-01-11 05:45:27 +00:00
|
|
|
|
|
|
|
// searches for enabled profiles
|
2013-07-18 07:56:27 +00:00
|
|
|
wn.provide("erpnext.queries");
|
|
|
|
$.extend(erpnext.queries, {
|
|
|
|
profile: function() {
|
2013-12-31 12:08:21 +00:00
|
|
|
return { query: "webnotes.core.doctype.profile.profile.profile_query" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
lead: function() {
|
2013-12-13 08:40:14 +00:00
|
|
|
return { query: "erpnext.controllers.queries.lead_query" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
customer: function() {
|
2013-12-13 08:40:14 +00:00
|
|
|
return { query: "erpnext.controllers.queries.customer_query" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
supplier: function() {
|
2013-12-13 08:40:14 +00:00
|
|
|
return { query: "erpnext.controllers.queries.supplier_query" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
account: function() {
|
2013-12-13 08:40:14 +00:00
|
|
|
return { query: "erpnext.controllers.queries.account_query" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
item: function() {
|
2013-12-13 08:40:14 +00:00
|
|
|
return { query: "erpnext.controllers.queries.item_query" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
bom: function() {
|
2013-12-13 08:40:14 +00:00
|
|
|
return { query: "erpnext.controllers.queries.bom" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
task: function() {
|
2014-01-30 08:26:57 +00:00
|
|
|
return { query: "erpnext.projects.utils.query_task" };
|
2013-07-18 07:56:27 +00:00
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
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 } };
|
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
2013-07-29 07:58:37 +00:00
|
|
|
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 } };
|
|
|
|
},
|
2014-01-29 14:43:43 +00:00
|
|
|
|
|
|
|
lead_filter: function(doc) {
|
|
|
|
if(!doc.lead) {
|
|
|
|
wn.throw(wn._("Please specify a") + " " +
|
|
|
|
wn._(wn.meta.get_label(doc.doctype, "lead", doc.name)));
|
|
|
|
}
|
|
|
|
|
|
|
|
return { filters: { lead: doc.lead } };
|
|
|
|
},
|
|
|
|
|
2013-07-18 07:56:27 +00:00
|
|
|
not_a_group_filter: function() {
|
|
|
|
return { filters: { is_group: "No" } };
|
|
|
|
},
|
|
|
|
});
|